diff options
Diffstat (limited to 'core/metaprogramming.nom')
| -rw-r--r-- | core/metaprogramming.nom | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom index 6dea00f..180614b 100644 --- a/core/metaprogramming.nom +++ b/core/metaprogramming.nom @@ -210,13 +210,11 @@ test: [$1, $2] = [1, 2] swap $1 and $2 assume (($1 == 2) and ($2 == 1)) or barf - .."'parse % as %' failed on 'swap % and %'" - + "'parse % as %' failed on 'swap % and %'" [$tmp, $tmp2] = [1, 2] - swap $tmp and $tmp2 assume (($tmp == 2) and ($tmp2 == 1)) or barf - .."'parse % as %' variable mangling failed." + "'parse % as %' variable mangling failed." ($actions all parse as $body) compiles to: lua> (" @@ -310,7 +308,12 @@ externally ($ is $kind syntax tree) means ($tree with $t -> $replacement) compiles to (" \($tree as lua expr):map(function(\($t as lua expr)) - \(=lua "\$replacement.type == 'Block' and \($replacement as lua) or 'return '..\($replacement as lua expr)") + \( + =lua (" + \$replacement.type == 'Block' and \($replacement as lua) or 'return '..\ + ..\($replacement as lua expr) + ") + ) end) ") @@ -360,7 +363,13 @@ externally (match $tree with $patt) means: ") test: - assume ((quote "one\n\"two\"") == "\"one\\n\\\"two\\\"\"") + assume + ( + quote (" + one + "two" + ") + ) == "\"one\\n\\\"two\\\"\"" (quote $s) compiles to "tostring(\($s as lua expr)):as_lua()" test: @@ -400,7 +409,7 @@ test: assume (run \(return \(\(5) + \(5)))) == 10 (run $nomsu_code) compiles to "run_1_in(\($nomsu_code as lua expr), _ENV)" [compile $block, compiled $block, $block compiled] all compile to -.."compile(\($block as lua))" + "compile(\($block as lua))" test: (foo) means: @@ -443,4 +452,6 @@ test: ") externally (Nomsu version) means: - return "\(Nomsu syntax version).\(core version).\(Nomsu compiler version).\(lib version)" + return (" + \(Nomsu syntax version).\(core version).\(Nomsu compiler version).\(lib version) + ") |
