-
Currently the lexer returns SyntaxError for i64::MIN literal I added it to
The lexer parses an integer literal to i64 at minijinja/minijinja/src/compiler/lexer.rs Line 255 in 27413fb However the negative sign and 9223372036854775808 are tokenized separately, so 9223372036854775808 overflows since 9223372036854775808 > i64::MAX (= 9223372036854775807). I think it would be nice for the lexer to handle a negative integer literal and handle i64::MIN literal, or document the current behavior that the available integer literal is between i64::MIN + 1 and i64::MAX. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I wanted to fix up some of those edge cases for a while but I was too lazy. The correct thing to do would be for the lexer to have to tokens: a I will fix this. |
Beta Was this translation helpful? Give feedback.
I wanted to fix up some of those edge cases for a while but I was too lazy. The correct thing to do would be for the lexer to have to tokens: a
u64
for integers and au128
for large integers. Thenneg
(which is currently invoked for all negative integers) gets a special case for170141183460469231731687303715884105728
which is the largest possible positive integer that can still be negated. Independently of that, it's a bit ridiculous that the compiler emits opcodes for negations of numbers to begin with. It should really compile-42
into just a constant rather thanNeg
+LoadConst
.I will fix this.