Documentation
¶
Index ¶
- Constants
- type Lexer
- func (lx *Lexer) Position() parser.Cursor
- func (lx *Lexer) Read() (*parser.Token, error)
- func (lx *Lexer) ReadExact(expectation []rune, kind parser.FragmentKind) (token *parser.Token, matched bool, err error)
- func (lx *Lexer) ReadUntil(fn func(parser.Cursor) uint, kind parser.FragmentKind) (token *parser.Token, err error)
- func (lx *Lexer) Set(cursor parser.Cursor)
Constants ¶
View Source
const ( // FrSpace represents a space fragment kind FrSpace parser.FragmentKind // FrWord represents a word fragment kind FrWord // FrSign represents a special character fragment kind FrSign )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
Lexer represents a basic lexer tokenizing source code into 3 basic categories: spaces (whitespaces, tabs, line-breaks), signs (any ASCII special character) and words (any other character)
func NewLexer ¶
func NewLexer(src *parser.SourceFile) *Lexer
NewLexer creates a new basic-latin lexer instance
func (*Lexer) ReadExact ¶
func (lx *Lexer) ReadExact( expectation []rune, kind parser.FragmentKind, ) ( token *parser.Token, matched bool, err error, )
ReadExact tries to read an exact string and returns false if str couldn't have been matched
Click to show internal directories.
Click to hide internal directories.