Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExpandedLexer ¶ added in v0.3.0
type ExpandedLexer struct {
// contains filtered or unexported fields
}
ExpandedLexer tokenizes .glyphx source code (human-readable expanded syntax) It recognizes keywords like "route", "let", "return" and converts them to the same token types as their symbol equivalents (@, $, >).
func NewExpandedLexer ¶ added in v0.3.0
func NewExpandedLexer(input string) *ExpandedLexer
NewExpandedLexer creates a new ExpandedLexer for .glyphx files
func (*ExpandedLexer) Tokenize ¶ added in v0.3.0
func (l *ExpandedLexer) Tokenize() ([]Token, error)
Tokenize returns all tokens from the expanded syntax input
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
Lexer tokenizes GLYPH source code
type ParseError ¶
ParseError represents a parsing error with context
func (*ParseError) Error ¶
func (e *ParseError) Error() string
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser converts tokens to AST
func NewParserWithSource ¶
NewParserWithSource creates a new Parser with source code for better error messages
func (*Parser) ParseExpression ¶ added in v0.4.0
ParseExpression parses a single expression from the token stream. This is used by the REPL and other tools that need to parse expressions directly.
type TokenType ¶
type TokenType int
TokenType represents the type of token
const ( // Special tokens ILLEGAL TokenType = iota EOF NEWLINE // Symbols AT // @ COLON // : DOLLAR // $ PLUS // + MINUS // - STAR // * SLASH // / PERCENT // % GREATER // > GREATER_EQ // >= LESS // < LESS_EQ // <= BANG // ! NOT_EQ // != EQ_EQ // == QUESTION // ? TILDE // ~ AMPERSAND // & AND // && OR // || // Delimiters LPAREN // ( RPAREN // ) LBRACE // { RBRACE // } LBRACKET // [ RBRACKET // ] COMMA // , DOT // . ARROW // -> PIPE // | PIPE_OP // |> EQUALS // = // Literals IDENT // identifier or path STRING // "string" INTEGER // 123 FLOAT // 123.45 TRUE // true FALSE // false NULL // null WHILE // while // Keywords SWITCH // switch CASE // case DEFAULT // default FOR // for IN // in MACRO // macro QUOTE // quote MATCH // match WHEN // when (for guards in match) FATARROW // => DOTDOTDOT // ... ASYNC // async AWAIT // await IMPORT // import FROM // from AS // as MODULE // module CONST // const TEST // test ASSERT // assert BREAK // break CONTINUE // continue )