feat: replace block syntax with fn keyword for function literals across compiler and tests

Rename `block` parsing rule to `fn` by adding TOKEN_FN token and function prefix rule, removing the old block prefix from TOKEN_LEFT_BRACE. Update compiler.c to replace `block()` with `function()` and add fn equality primitives (fn_eqeq, fn_bangeq) in primitives.c. Migrate test files: rename block_call.wren to fn_call.wren, block_syntax.wren to fn_syntax.wren, and replace `{ ... }` with `fn { ... }` or `fn expr` syntax. Remove obsolete bool_equality.wren test.
This commit is contained in:
Bob Nystrom
2013-11-06 15:47:47 +00:00
parent cae70590d8
commit 46977dceea
9 changed files with 98 additions and 63 deletions
+2 -6
View File
@@ -1,6 +1,2 @@
io.write(1 + 2)
io.write(3 - 1)
io.write(10 / 3)
io.write(20 * 30)
io.write("abc" + "def")
io.write(1 + "string")
if (false) io.write("bad2")
if (false) io.write("bad")