commit 406889154e7971cfc6e9beefa382e8389ac542f5
parent 4cfb7f07f8cb88ca0a00bfd6d5a3c1e196a4b873
Author: weetat <wtenison@protonmail.com>
Date: Tue, 25 Feb 2025 19:36:48 +0000
Added '\t' to lexer symbols check.
Diffstat:
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/src/fmd/lexer.go b/src/fmd/lexer.go
@@ -11,14 +11,15 @@ https://www.youtube.com/watch?v=HxaD_trXwRE */
type tokenType int
const (
- TokenLiteral tokenType = iota // (letters, numbers, symbols)+
- TokenKeyword // (valid keywords)
- TokenSpace // " "
- TokenNewline // \n
- TokenEscape // \
- TokenColon // :
- TokenLBrace // {
- TokenRBrace // }
+ TokenLiteral tokenType = iota // 0. (letters, numbers, symbols)+
+ TokenKeyword // 1. (valid keywords)
+ TokenSpace // 2. " "
+ TokenNewline // 3. \n
+ TokenTab // 4. \t
+ TokenEscape // 5. \
+ TokenColon // 6. :
+ TokenLBrace // 7. {
+ TokenRBrace // 8. }
)
type token struct {
@@ -51,6 +52,9 @@ func (l *lexer) Exec() []token {
case _currentSymbol == '\n':
l.tokens = append(l.tokens, token{TokenNewline, "\n"})
l.pos++
+ case _currentSymbol == '\t':
+ l.tokens = append(l.tokens, token{TokenTab, "\t"})
+ l.pos++
case _currentSymbol == ':':
l.tokens = append(l.tokens, token{TokenColon, ":"})
l.pos++