summaryrefslogtreecommitdiff
path: root/tnslc/compile
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2022-12-12 16:25:02 -0500
committerKyle Gunger <kgunger12@gmail.com>2022-12-12 16:25:02 -0500
commitecf3e4075141163459200a2b2d05bd8b866c371d (patch)
treea36a0ba031087fb3c4913aa4115b5c2fba225cef /tnslc/compile
parentb343dcdcb4e6b9297257dc066885aa530b8a04c1 (diff)
Module include syntax
Diffstat (limited to 'tnslc/compile')
-rw-r--r--tnslc/compile/compile.tnsl18
1 files changed, 14 insertions, 4 deletions
diff --git a/tnslc/compile/compile.tnsl b/tnslc/compile/compile.tnsl
index 677cf55..c884cca 100644
--- a/tnslc/compile/compile.tnsl
+++ b/tnslc/compile/compile.tnsl
@@ -43,11 +43,11 @@
/; get_offset({}charp name) [int]
;int out = 0
- /; loop (int i = 0; i < len (self.sub_types)) [i = i + 2]
- /; if (string_equate(~name, ~(self.sub_types{i + 1})))
+ /; loop (int i = 0; i < len (self.on_stack)) [i++]
+ /; if (string_equate(~name, ~(self.sub_types{i*2 + 1})))
;return out
- ;; else
- ;VType tmp = vtype_by_name(self.sub_types{i})
+ ;; else if (self.on_stack{i})
+ ;VType tmp = vtype_by_name(self.sub_types{i*2})
;out = out + tmp.size
;/
;/
@@ -621,6 +621,16 @@
;/
/; compile_include (Path file_path, ~VTrack global, ~{}charp hsec, csec, dsec)
+ # Autocomplete in the case of module syntax
+ ;bool d = file_path.extension_is("tnsl")
+ /; if (!d)
+ ;file_path.dirs.append(file_path.file)
+ ;{}charp ftmp = file_path.file
+ ;{}charp tmp = ".tnsl"
+ ;add_strings(~ftmp, ~tmp)
+ ;file_path.file = ftmp
+ ;/
+
;tnsl.io.print("[TNSLC:INCLUDE] ")
;tnsl.io.println(file_path.full_path())