Documentation ¶
Index ¶
Constants ¶
const ( EOFRune rune = -1 EmptyToken TokenType = 0 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type L ¶
func (*L) Emit ¶
Emit will receive a token type and push a new token with the current analyzed value into the tokens channel.
func (*L) Ignore ¶
func (l *L) Ignore()
Ignore clears the rewind stack and then sets the current beginning position to the current position in the source which effectively ignores the section of the source being analyzed.
func (*L) Next ¶
Next pulls the next rune from the Lexer and returns it, moving the position forward in the source.
func (*L) NextToken ¶
NextToken returns the next token from the lexer and a value to denote whether or not the token is finished.
func (*L) Peek ¶
Peek performs a Next operation immediately followed by a Rewind returning the peeked rune.
func (*L) Rewind ¶
func (l *L) Rewind()
Rewind will take the last rune read (if any) and rewind back. Rewinds can occur more than once per call to Next but you can never rewind past the last point a token was emitted.