BK-SCOSS / sctokenizer

A Source Code Tokenizer
MIT License
14 stars 5 forks source link

':' is tokenized as an OPERATOR rather than a CONSTANT #15

Open Derek-Jones opened 1 month ago

Derek-Jones commented 1 month ago

The character constant ':' is tokenized as an OPERATOR rather than a CONSTANT. The same incorrect behavior also occurs for the string literal ":"

x == '(' && y == ':' && z == ":" :

(x, TokenType.IDENTIFIER, (1, 1))
(==, TokenType.OPERATOR, (1, 3))
(', TokenType.SPECIAL_SYMBOL, (1, 6))
((, TokenType.CONSTANT, (1, 7))
(', TokenType.SPECIAL_SYMBOL, (1, 8))
(&&, TokenType.OPERATOR, (1, 10))
(y, TokenType.IDENTIFIER, (1, 13))
(==, TokenType.OPERATOR, (1, 15))
(', TokenType.SPECIAL_SYMBOL, (1, 18))
(:, TokenType.OPERATOR, (1, 19))
(', TokenType.SPECIAL_SYMBOL, (1, 20))
(&&, TokenType.OPERATOR, (1, 22))
(z, TokenType.IDENTIFIER, (1, 25))
(==, TokenType.OPERATOR, (1, 27))
(", TokenType.SPECIAL_SYMBOL, (1, 30))
(:, TokenType.OPERATOR, (1, 31))
(", TokenType.SPECIAL_SYMBOL, (1, 32))
(:, TokenType.OPERATOR, (1, 34))
Dec1mo commented 1 month ago

Thanks for informing us this bug, Derek. Unfortunately, we no longer maintain this repository. But we do welcome contributions, so you might make a PR to fix this error. Cheers!

ngocbh commented 3 weeks ago

@tranvien98 do you wanna take a look at this? I'm gonna release a new version soon. Hopefully we can get it fixed as well.