basic records support
All checks were successful
/ test (push) Successful in 50s

This commit is contained in:
Neemek 2026-08-17 17:08:24 +02:00
parent db3a3e29eb
commit 42fa039daf
11 changed files with 522 additions and 138 deletions

View file

@ -7,7 +7,7 @@ import (
)
type Token struct {
Type TokenKind
Kind TokenKind
Start Pos
End Pos
Line Pos
@ -19,7 +19,7 @@ func (t Token) Bounds() (Pos, Pos) {
}
func (t Token) String() string {
return fmt.Sprintf("token %s, '%s' %d -> %d, line %d", t.Type.String(), t.Lexeme, t.Start, t.End, t.Line)
return fmt.Sprintf("token %s, '%s' %d -> %d, line %d", t.Kind.String(), t.Lexeme, t.Start, t.End, t.Line)
}
type TokenKind uint64
@ -415,7 +415,7 @@ func (l *Lexer) NextToken() (Token, error) {
func NewToken(t TokenKind, start Pos, end Pos, line Pos, lexeme string) Token {
return Token{
Type: t,
Kind: t,
Start: start,
End: end,
Line: line,
@ -430,7 +430,7 @@ func (l *Lexer) Tokenize() ([]Token, error) {
for ; err == nil; tok, err = l.NextToken() {
tokens = append(tokens, tok)
if tok.Type == TokenEOF {
if tok.Kind == TokenEOF {
break
}
}