Tokens with a dash beginning are positioned correctly

This commit is contained in:
Sasha Koshka 2022-09-03 12:58:06 -04:00
parent 645456bb48
commit 7714c08846

View File

@ -372,11 +372,11 @@ func (lexer *LexingOperation) tokenizeSymbolBeginning () (err error) {
}
func (lexer *LexingOperation) tokenizeDashBeginning () (err error) {
token := lexer.newToken()
err = lexer.nextRune()
if err != nil { return }
if lexer.char == '-' {
token := lexer.newToken()
token.kind = TokenKindDecrement
token.location.SetWidth(2)
@ -390,7 +390,6 @@ func (lexer *LexingOperation) tokenizeDashBeginning () (err error) {
}
lexer.addToken(token)
} else if lexer.char == '>' {
token := lexer.newToken()
token.kind = TokenKindReturnDirection
token.location.SetWidth(2)
@ -401,7 +400,6 @@ func (lexer *LexingOperation) tokenizeDashBeginning () (err error) {
} else if lexer.char >= '0' && lexer.char <= '9' {
lexer.tokenizeNumberBeginning(true)
} else {
token := lexer.newToken()
token.kind = TokenKindMinus
lexer.addToken(token)
}