Files
wren/test/number/hex_literals.wren
T
Gavin Schulz b2c6dfce8d feat: add hexadecimal literal support to lexer and compiler
Add TOKEN_HEXADECIMAL token type and isHexDigit helper function to lexer.
Modify readNumber to detect 'x' prefix after '0' and lex hex digits.
Implement emitNumericConstant for hex values in compiler.
Add test file test/number/hex_literals.wren verifying basic hex parsing,
arithmetic, type checks, and negative hex literals.
2015-01-25 06:07:23 +00:00

8 lines
211 B
Plaintext

var x = 0xFF
IO.print(x) // expect: 255
IO.print(x + 1) // expect: 256
IO.print(x == 255) // expect: true
IO.print(0x09 is Num) // expect: true
IO.print(x is Num) // expect: true
IO.print(-0xFF) // expect: -255