Documentation
¶
Overview ¶
Package lexer implements a lexical analyzer used by the Elk interpreter.
Lexer expects a slice of bytes containing Elk source code analyses it and returns a stream of tokens/tokens.
Tokens are returned on demand.
Index ¶
- func Colorize(source string) string
- func ColorizeEmbellishedText(source string) string
- func Lex(source string) []*token.Token
- func LexValue(source string) *value.ArrayList
- type Colorizer
- type Lexer
- func (*Lexer) Class() *value.Class
- func (l *Lexer) Copy() value.Reference
- func (*Lexer) DirectClass() *value.Class
- func (l *Lexer) Error() string
- func (l *Lexer) Inspect() string
- func (l *Lexer) InstanceVariables() *value.InstanceVariables
- func (l *Lexer) Next() *token.Token
- func (l *Lexer) SingletonClass() *value.Class
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ColorizeEmbellishedText ¶
Lex the given string and construct a new one colouring every token. Used for text with bits of Elk code in backticks like "foo `1 + 2` bar"
Types ¶
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
Holds the current state of the lexing process.
func NewWithMode ¶
Same as New but lets you specify the path to the source code file.
func NewWithName ¶
Same as New but lets you specify the path to the source code file.
func (*Lexer) DirectClass ¶
func (*Lexer) InstanceVariables ¶
func (l *Lexer) InstanceVariables() *value.InstanceVariables
func (*Lexer) SingletonClass ¶
Click to show internal directories.
Click to hide internal directories.