feat: add conditional operator and fn toString to wren compiler and core

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.
This commit is contained in:
Bob Nystrom
2014-02-15 19:36:01 +00:00
parent d335116799
commit 73b92ca7f3
12 changed files with 106 additions and 0 deletions
+2
View File
@@ -57,3 +57,5 @@ An `||` ("logical or") expression is reversed. If the left-hand argument is trut
:::wren
io.write(false || 1) // 1
io.write(1 || 2) // 1
**TODO: Conditional operator.**