summaryrefslogtreecommitdiff
path: root/lexer
diff options
context:
space:
mode:
authorMichael Tews <git@tews.dev>2024-06-19 05:30:04 +0200
committerMichael Tews <michael@tews.dev>2026-04-12 11:11:01 +0200
commit5cc4864ae2c10aa27e9a1d10fe0478f2048f930c (patch)
treec6194c0ffc0e263d1989f9d48222c0bd3e6657fc /lexer
parent5c3c7deb46ec17051906142ac37a096345a60a8a (diff)
feat(lexer): added tokens and updated NextToken() with the tokens
adds =,+,-,!,*,/ tokens
Diffstat (limited to 'lexer')
-rw-r--r--lexer/lexer.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/lexer/lexer.go b/lexer/lexer.go
index 92722f6..cdd2901 100644
--- a/lexer/lexer.go
+++ b/lexer/lexer.go
@@ -37,6 +37,18 @@ func (l *Lexer) NextToken() token.Token {
tok = newToken(token.COMMA, l.ch)
case '+':
tok = newToken(token.PLUS, l.ch)
+ case '-':
+ tok = newToken(token.MINUS, l.ch)
+ case '!':
+ tok = newToken(token.BANG, l.ch)
+ case '*':
+ tok = newToken(token.ASTERISK, l.ch)
+ case '/':
+ tok = newToken(token.SLASH, l.ch)
+ case '<':
+ tok = newToken(token.LT, l.ch)
+ case '>':
+ tok = newToken(token.GT, l.ch)
case 0:
tok.Literal = ""
tok.Type = token.EOF