aboutsummaryrefslogtreecommitdiff
path: root/lib/utils2.nom
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2017-11-01 16:49:11 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2017-11-01 16:49:11 -0700
commitf1a2c936de700ddf1c7ccb650be9598db40c13d4 (patch)
tree237ac9a52295f0c5dbc0dbb5624e0c2e5940f263 /lib/utils2.nom
parentcbd876673a4accc23aca16c015c20b819a2685b5 (diff)
Fixed some codegen stuff, optimized "say" for the common case of string
literals.
Diffstat (limited to 'lib/utils2.nom')
-rw-r--r--lib/utils2.nom10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/utils2.nom b/lib/utils2.nom
new file mode 100644
index 0000000..2562471
--- /dev/null
+++ b/lib/utils2.nom
@@ -0,0 +1,10 @@
+require "lib/metaprogramming.nom"
+require "lib/utils.nom"
+require "lib/control_flow.nom"
+require "lib/operators.nom"
+
+compile [say %str] to:
+ if ((%str's "type") == "String"):
+ "nomsu:writeln(\(%str as lua))"
+ ..else:
+ "nomsu:writeln(nomsu:stringify(\(%str as lua)))"