(name, input string)
| 72 | } |
| 73 | |
| 74 | func lex(name, input string) (*lexer, chan item) { |
| 75 | l := &lexer{ |
| 76 | name: name, |
| 77 | input: input, |
| 78 | items: make(chan item), |
| 79 | } |
| 80 | go l.run() // Concurrently run state machine. |
| 81 | return l, l.items |
| 82 | } |
| 83 | |
| 84 | // emit passes an item back to the client. |
| 85 | func (l *lexer) emit(t itemType) { |