Add exponentiation operator '**' in lexer

This commit is contained in:
Petar Kapriš 2025-01-22 19:12:43 +01:00
parent 225a2b13ea
commit 6403c4578c

View file

@ -23,9 +23,10 @@ const (
MINUS
PLUS
SEMICOLON
STAR
// One or two character tokens.
STAR
STAR_STAR
BANG
BANG_EQUAL
EQUAL
@ -156,6 +157,11 @@ func (l *Lexer) scanToken() {
case ';':
l.addSimpleToken(SEMICOLON)
case '*':
if l.match('*') {
l.addSimpleToken(STAR_STAR)
} else {
l.addSimpleToken(STAR)
}
l.addSimpleToken(STAR)
case '!':
if l.match('=') {