Add TOKEN_QUESTION token type and implement conditional() parsing function in wren_compiler.c to support the ternary conditional operator (condition ? then : else). Register fn_toString native in wren_core.c to return "<fn>" string for function objects. Include comprehensive test suite covering precedence, short-circuit evaluation, and error cases for missing tokens.
3 lines
107 B
Plaintext
3 lines
107 B
Plaintext
true ? IO.print("ok") : IO.print("no") // expect: ok
|
|
false ? IO.print("no") : IO.print("ok") // expect: ok
|