Add support for parsing scientific notation (e.g., 2.55e2, -2.55e-2) in the readNumber function of wren_compiler.c. The implementation handles optional negative exponents, validates that exponent digits follow 'e'/'E', and emits a lex error for unterminated scientific notation. Also adds comprehensive test cases covering valid scientific literals, missing exponents, floating exponents, missing fractional parts, and multiple exponents.
10 lines
255 B
Plaintext
10 lines
255 B
Plaintext
var x = 2.55e2
|
|
|
|
IO.print(x) // expect: 255
|
|
IO.print(x + 1) // expect: 256
|
|
IO.print(x == 255) // expect: true
|
|
IO.print(2.55e-2 is Num) // expect: true
|
|
IO.print(x is Num) // expect: true
|
|
IO.print(-2.55e2) // expect: -255
|
|
IO.print(-25500e-2) // expect: -255
|