summaryrefslogtreecommitdiff
path: root/tnslc/compile
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2022-12-12 13:04:40 -0500
committerKyle Gunger <kgunger12@gmail.com>2022-12-12 13:04:40 -0500
commitb343dcdcb4e6b9297257dc066885aa530b8a04c1 (patch)
treed77ab78f4935f477ee3945ef610658b25d2ba2d9 /tnslc/compile
parent069eb0fc2edf1f40fd1fff6584e430c111471859 (diff)
Fix path completion
Diffstat (limited to 'tnslc/compile')
-rw-r--r--tnslc/compile/compile.tnsl33
1 files changed, 26 insertions, 7 deletions
diff --git a/tnslc/compile/compile.tnsl b/tnslc/compile/compile.tnsl
index aefcbfe..677cf55 100644
--- a/tnslc/compile/compile.tnsl
+++ b/tnslc/compile/compile.tnsl
@@ -32,13 +32,26 @@
}
/; method VType
- /; get_sub_type({}charp name) [{}charp]
+ /; get_sub_type({}charp name) [VType]
/; loop (int i = 0; i < len (self.sub_types)) [i = i + 2]
/; if (string_equate(~name, ~(self.sub_types{i + 1})))
- ;return (self.sub_types{i})
+ ;return vtype_by_name(self.sub_types{i})
;/
;/
- ;return ""
+ ;return NT
+ ;/
+
+ /; 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})))
+ ;return out
+ ;; else
+ ;VType tmp = vtype_by_name(self.sub_types{i})
+ ;out = out + tmp.size
+ ;/
+ ;/
+ ;return -1
;/
;/
@@ -56,7 +69,7 @@
/; method VTrack
# returns true if the value is allocated to the stack
- /; add_track({}charp name, VType _type) [bool]
+ /; add_track({}charp name, VType _type) [int]
;bool to_stack = is_struct(_type)
;int count = 0
@@ -72,7 +85,13 @@
;self.sym_names.append(name)
;self.sym_types.append(_type)
- ;self.on_stack.append()
+ ;self.on_stack.append(to_stack)
+
+ /; if (count > 7)
+ ;return -1
+ ;/
+
+ ;return count
;/
# Returns true if the variable is being tracked
@@ -514,8 +533,8 @@
;cur`++
/; loop (data`{cur`}.token_type == TOKEN_TYPE.DEFWORD)
- ;tab`.sym_types.append(def_t)
- ;tab`.sym_names.append(data`{cur`}.data`)
+ ;int stack = tab`.add_track()
+
/; if (token_is(cur, data, ","))
;cur`++
;; else if (token_is(cur, data, "="))