Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrEOF = errors.New("end of file")
ErrEOF is returned when the lexer reaches the end of file.
View Source
var ErrUnterminatedString = errors.New("unterminated string literal")
ErrUnterminatedString is returned when an open-quote does not have a matching close.
Functions ¶
This section is empty.
Types ¶
type ErrUnrecognizedToken ¶
type ErrUnrecognizedToken struct {
// contains filtered or unexported fields
}
ErrUnrecognizedToken is returned when a character or sequence of characters cannot be recognized as a valid token.
func (ErrUnrecognizedToken) Error ¶
func (err ErrUnrecognizedToken) Error() string
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
Lexer performs lexical analysis of LISP.
func New ¶
New initializes the lexer with the given source. Source can contain any UTF-8 characters.
type TokenType ¶
type TokenType string
TokenType represents the type of the extracted token
const ( // LPAREN represents the left-parenthesis character LPAREN TokenType = "LPAREN" // RPAREN represents the right-parenthesis character RPAREN TokenType = "RPAREN" // LVECT represents the left-brace character LVECT TokenType = "LVECT" // RVECT represents the right-brace character RVECT TokenType = "RVECT" // LDICT represents the left curly brace LDICT TokenType = "LDICT" // KEYWORD represents a keyword KEYWORD TokenType = "KEYWORD" // RDICT represents the right curly brace RDICT TokenType = "RDICT" // STRING represents a double-quoted string STRING TokenType = "STRING" // NUMBER represents int, float, hex, complex etc. NUMBER TokenType = "NUMBER" // WHITESPACE represents a space, tab or newline WHITESPACE TokenType = "WHITESPACE" // NEWLINE represents a new-line or return-line-feed character. NEWLINE TokenType = "NEWLINE" // COMMENT represents a ";" based comment COMMENT TokenType = "COMMENT" // SYMBOL represents any identifier SYMBOL TokenType = "SYMBOL" // QUOTE represents the single quote QUOTE TokenType = "QUOTE" )
Click to show internal directories.
Click to hide internal directories.