aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2013-03-14 23:06:59 +0100
committerDrahflow <drahflow@gmx.de>2013-03-14 23:06:59 +0100
commit2bd86cd07103e1386ab2816f680954ff21f3043f (patch)
tree33d803d6c679dc6c9495eb822d95c4090726dad8
parente7c4a3ef952011f7db572e1fe7eea58448e76f13 (diff)
Added "quoted" function
-rw-r--r--compiler/elymasGlobal.ey20
-rw-r--r--examples/working-compiler/grammar-pre.test4
2 files changed, 24 insertions, 0 deletions
diff --git a/compiler/elymasGlobal.ey b/compiler/elymasGlobal.ey
index 77015a0..06a2b4c 100644
--- a/compiler/elymasGlobal.ey
+++ b/compiler/elymasGlobal.ey
@@ -835,6 +835,26 @@
/rbx :pushqReg
:retn
] /eydie defv
+
+ # determine current quoting mode
+ # 0 <- an integer giving the current quoting level
+ [[
+ /rbx :popqReg
+
+ # allocate result int
+ 16 /rdi :movqImmReg
+ ::internalAllocate /rax :movqImmReg
+ /rax :callqReg
+ # and push to stack
+ /rax :pushqReg
+
+ ::currentQuoted /rcx :movqImmReg
+ /rcx /rcx :movqMemReg
+ /rcx 8 /rax :movqRegMemDisp8
+
+ /rbx :pushqReg
+ :retn
+ ]] /eyquoted defv
> _ ==globalFunctions { defv }' ::allocateOffsetStruct
<
diff --git a/examples/working-compiler/grammar-pre.test b/examples/working-compiler/grammar-pre.test
new file mode 100644
index 0000000..6c9c8ca
--- /dev/null
+++ b/examples/working-compiler/grammar-pre.test
@@ -0,0 +1,4 @@
+[ "(" ")" "[" "]" "-" "|" ] { _ { streq }_ "'" -102 cat deff }' each
+
+"[" '[ dump
+"x" '[ dump