Documentation ¶
Overview ¶
Just a random lexer.
Index ¶
Constants ¶
View Source
const ( NoMatch = Error("No match was found in the list") Eof = Error("End of input") ErrInvalidUtf8String = Error("Input string isn't a valid UTF-8 sequence") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
Hold the information to perform the lexical scanning of a given input
func NewLexerFromFile ¶
Create a new lexer loading it's contents from the given file file contents MUST BE valid UTF-8 strings.
func (*Lexer) Next ¶
Try to find a match for the current input and move the cursor, if the returned token is < 0, the input is consumed and the lexer tries to advance again.
If not match is found, return's an error. Later the function IsEof can be used to check if the error represent the end of input.
type Rule ¶
type Rule struct {
// contains filtered or unexported fields
}
Represent a rule for the lexer
Click to show internal directories.
Click to hide internal directories.