summaryrefslogtreecommitdiff
path: root/tnslc/compile/compile.tnsl
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2022-09-20 00:40:13 -0400
committerKyle Gunger <kgunger12@gmail.com>2022-09-20 00:40:13 -0400
commitb0fb30d09c592d93db5d1cc403dcd6744d083d78 (patch)
treec14df5e2c674e4350d8f768b272cab74a518259d /tnslc/compile/compile.tnsl
parentbe9813b1062c1f9b2c0d13a76d56c41ba984c1db (diff)
Add ability to splice own asm code in
Diffstat (limited to 'tnslc/compile/compile.tnsl')
-rw-r--r--tnslc/compile/compile.tnsl16
1 files changed, 11 insertions, 5 deletions
diff --git a/tnslc/compile/compile.tnsl b/tnslc/compile/compile.tnsl
index d7e9416..3820812 100644
--- a/tnslc/compile/compile.tnsl
+++ b/tnslc/compile/compile.tnsl
@@ -22,10 +22,8 @@
/; compile_block (~int cur, ~{}Token data, ~{}charp hsec, csec, dsec)
- ;hsec`.append('b')
-
;cur`++
-
+
/; loop (cur` < len data`) [cur`++]
/; if (string_equate(data`{cur`}.data`, ";/") || string_equate(data`{cur`}.data`, ";;"))
;break
@@ -33,6 +31,9 @@
;bool ch = true
/; loop (ch)
;compile_block(cur, data, hsec, csec, dsec)
+ /; if (cur` !< len data`)
+ ;break
+ ;/
;ch = string_equate(data`{cur`}.data`, ";;")
;/
;; else if (string_equate(data`{cur`}.data`, ";"))
@@ -42,8 +43,13 @@
;/
/; compile_statement (~int cur, ~{}Token data, ~{}charp hsec, csec, dsec)
- ;csec`.append('c')
- ;dsec`.append('d')
+ ;cur`++
+ /; if (cur` < len data`)
+ /; if (string_equate(data`{cur`}.data`, "asm"))
+ ;{}charp raw_asm = unquote_string(data`{cur` + 1}.data`)
+ ;add_strings(csec, ~raw_asm)
+ ;/
+ ;/
;/
/; do_compile ({}charp file, ~{}Token data)