Files
wren/test/grammar.wren
Bob Nystrom b979272305 Clean up text handling a bit:
- Rename IO.write -> IO.print.
- Make IO.write not print a newline.
- Support \u Unicode escapes in strings.
2014-01-05 12:27:12 -08:00

32 lines
769 B
Plaintext

// * has higher precedence than +.
IO.print(2 + 3 * 4) // expect: 14
// * has higher precedence than -.
IO.print(20 - 3 * 4) // expect: 8
// / has higher precedence than +.
IO.print(2 + 6 / 3) // expect: 4
// / has higher precedence than -.
IO.print(2 - 6 / 3) // expect: 0
// < has higher precedence than ==.
IO.print(false == 2 < 1) // expect: true
// > has higher precedence than ==.
IO.print(false == 1 > 2) // expect: true
// <= has higher precedence than ==.
IO.print(false == 2 <= 1) // expect: true
// >= has higher precedence than ==.
IO.print(false == 1 >= 2) // expect: true
// Unary - has lower precedence than ..
IO.print(-"abc".count) // expect: -3
// TODO: %, associativity.
// Using () for grouping.
IO.print((2 * (6 - (2 + 2)))) // expect: 4