Run executes the given StateFn on the lexer and returns the lexer.
(f StateFn)
| 194 | |
| 195 | // Run executes the given StateFn on the lexer and returns the lexer. |
| 196 | func (l *Lexer) Run(f StateFn) *Lexer { |
| 197 | for state := f; state != nil; { |
| 198 | // The following statement is useful for debugging. |
| 199 | // fmt.Printf("Func: %v\n", runtime.FuncForPC(reflect.ValueOf(state).Pointer()).Name()) |
| 200 | state = state(l) |
| 201 | } |
| 202 | return l |
| 203 | } |
| 204 | |
| 205 | // Errorf returns the error state function. |
| 206 | func (l *Lexer) Errorf(format string, args ...interface{}) StateFn { |