aboutsummaryrefslogtreecommitdiff
path: root/core/metaprogramming.nom
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-07-15 19:41:22 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-07-15 19:43:28 -0700
commitbe06fc096aa28358914bd6a76b4ea380a04b8873 (patch)
tree1f6c300bc8fbeb6cd84008124fca1e43f5513616 /core/metaprogramming.nom
parent8a44869c4a548692a19afe5258e2540f7d351c8a (diff)
Major changes to how versioning and parsing work. This should be a
better path going forward to handling upgrades. Old syntax files will stick around for compatibility purposes. Old syntax can be parsed into valid syntax trees via the old syntax (.peg) files, and then old syntax trees should be valid and can be upgraded via the normal code path. This change has lots of improvements to Nomsu codegen too.
Diffstat (limited to 'core/metaprogramming.nom')
-rw-r--r--core/metaprogramming.nom5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom
index d445737..2be7132 100644
--- a/core/metaprogramming.nom
+++ b/core/metaprogramming.nom
@@ -1,3 +1,4 @@
+#!/usr/bin/env nomsu -V1
#
This File contains actions for making actions and compile-time actions and some helper
functions to make that easier.
@@ -186,6 +187,8 @@ compile [remove free vars %vars from %code] to
compile [%lua <-write %code, to %lua write %code] to: Lua "\(%lua as lua expr):append(\(%code as lua expr));"
+compile [to %lua write %code joined by %glue] to: Lua "\(%lua as lua expr):concat_append(\(%code as lua expr), \(%glue as lua expr));"
+
compile [quote %s] to
Lua value ".."
repr(\(%s as lua expr))
@@ -212,7 +215,7 @@ compile [compile %block, compiled %block, %block compiled] to
# Return statement is wrapped in a do..end block because Lua is unhappy if you
put code after a return statement, unless you wrap it in a block.
compile [return] to: Lua "do return; end"
-compile [return %return_value] to: Lua "do return \(%return_value as lua expr); end"
+compile [return %return_value] to: Lua "do return \(%return_value as lua expr) end"
# Literals
compile [yes] to: Lua value "true"