Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInsufficient = errors.New("insufficient input")
ErrInsufficient represents an error which is raised when the given input is insufficient for a term.
View Source
var Spacing = [tokenKindLen][tokenKindLen]bool{ TokenVariable: { TokenVariable: true, TokenInteger: true, TokenFloat: true, TokenIdent: true, }, TokenIdent: { TokenVariable: true, TokenInteger: true, TokenFloat: true, TokenIdent: true, }, TokenGraphic: { TokenGraphic: true, TokenSign: true, }, TokenComma: { TokenVariable: true, TokenFloat: true, TokenInteger: true, TokenIdent: true, TokenQuotedIdent: true, TokenGraphic: true, TokenComma: true, TokenPeriod: true, TokenBar: true, TokenParenL: true, TokenParenR: true, TokenBracketL: true, TokenBracketR: true, TokenBraceL: true, TokenBraceR: true, TokenSign: true, }, TokenSign: { TokenGraphic: true, }, }
Spacing describes which token kinds require spaces between them.
Functions ¶
func IsExtendedGraphic ¶
IsExtendedGraphic checks if the rune is a graphic token, comma, or semicolon.
Types ¶
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
Lexer turns bytes into tokens.
type TokenKind ¶
type TokenKind byte
TokenKind is a type of Token.
const ( // TokenEOS represents an end of token stream. TokenEOS TokenKind = iota // TokenVariable represents a variable token. TokenVariable // TokenFloat represents a floating-point token. TokenFloat // TokenInteger represents an integer token. TokenInteger // TokenIdent represents an identifier token. TokenIdent // TokenQuotedIdent represents a quoted identifier token. TokenQuotedIdent // TokenGraphic represents a graphical token. TokenGraphic // TokenComma represents a comma. TokenComma // TokenPeriod represents a period. TokenPeriod // TokenBar represents a bar. TokenBar // TokenParenL represents an open parenthesis. TokenParenL // TokenParenR represents a close parenthesis. TokenParenR // TokenBracketL represents an open bracket. TokenBracketL // TokenBracketR represents a close bracket. TokenBracketR // TokenBraceL represents an open brace. TokenBraceL // TokenBraceR represents a close brace. TokenBraceR // TokenSign represents a plus/minus. TokenSign // TokenDoubleQuoted represents a double-quoted string. TokenDoubleQuoted )
type UnexpectedRuneError ¶
type UnexpectedRuneError struct {
// contains filtered or unexported fields
}
UnexpectedRuneError represents an error which is raised when the given input contains an unexpected rune.
func (UnexpectedRuneError) Error ¶
func (e UnexpectedRuneError) Error() string
Click to show internal directories.
Click to hide internal directories.