Greater than and Less Than
This commit is contained in:
@@ -84,9 +84,21 @@ func (l *Lexer) NextToken() token.Token {
|
||||
case '*':
|
||||
tok = newToken(token.ASTERISK, l.ch)
|
||||
case '<':
|
||||
tok = newToken(token.LT, l.ch)
|
||||
if l.peekChar() == '=' {
|
||||
l.readChar()
|
||||
tok = newToken(token.LTE, l.ch)
|
||||
tok.Literal = "<="
|
||||
} else {
|
||||
tok = newToken(token.LT, l.ch)
|
||||
}
|
||||
case '>':
|
||||
tok = newToken(token.GT, l.ch)
|
||||
if l.peekChar() == '=' {
|
||||
l.readChar()
|
||||
tok = newToken(token.GTE, l.ch)
|
||||
tok.Literal = ">="
|
||||
} else {
|
||||
tok = newToken(token.GT, l.ch)
|
||||
}
|
||||
case ';':
|
||||
tok = newToken(token.SEMICOLON, l.ch)
|
||||
case ',':
|
||||
|
||||
Reference in New Issue
Block a user