NewScanner returns a new *Scanner by reading through the synopsis.
(synopsis string)
| 32 | |
| 33 | // NewScanner returns a new *Scanner by reading through the synopsis. |
| 34 | func NewScanner(synopsis string) *Scanner { |
| 35 | scanner := &Scanner{ |
| 36 | source: []rune(strings.ReplaceAll(synopsis, "\r", "")), |
| 37 | tokens: nil, |
| 38 | sourceIdx: -1, |
| 39 | isFinished: false, |
| 40 | savedErr: nil, |
| 41 | } |
| 42 | _, _ = scanner.Process() |
| 43 | return scanner |
| 44 | } |
| 45 | |
| 46 | // Next returns the next rune while advancing the scanner. Returns false if there are no more runes. |
| 47 | func (scanner *Scanner) Next() (rune, bool) { |
no test coverage detected