summaryrefslogtreecommitdiff
path: root/tnslc
diff options
context:
space:
mode:
Diffstat (limited to 'tnslc')
-rw-r--r--tnslc/simple.tnsl36
-rw-r--r--tnslc/tnslc.tnsl11
2 files changed, 20 insertions, 27 deletions
diff --git a/tnslc/simple.tnsl b/tnslc/simple.tnsl
index 1d9bd30..6ac7f31 100644
--- a/tnslc/simple.tnsl
+++ b/tnslc/simple.tnsl
@@ -1,32 +1,14 @@
-/; module mod
- uint a = 2, b = 4
- {}uint8 str = "Hello", c = "#"
- {}int arr_i = {2, 3, 4, 5}
-
- struct test {
- int i, j,
- bool k,
- uint8 m
- }
-;/
-
-mod.test tv = {
- 1, 2, false, 0
-}
-
-mod.test sv = {
- 4, 5, true, 6
+struct Test {
+ int i
}
-/; main [int]
- ~uint8 i = ~mod.str{0}
- bool b = i` > i`
- /; loop (i` < 81)
- i` = i` + 2
- /; if (i` == 80)
- i` = i` + 5
- ;/
+/; method Test
+ /; whatever [int]
+ return self.i
;/
- return i`
;/
+
+/; main [int]
+ return 0
+;/ \ No newline at end of file
diff --git a/tnslc/tnslc.tnsl b/tnslc/tnslc.tnsl
index 1054d7b..ecc9e61 100644
--- a/tnslc/tnslc.tnsl
+++ b/tnslc/tnslc.tnsl
@@ -1633,6 +1633,7 @@
/; parse_param_list (~{}Token tok, ~int cur, ~Module current) [{}Variable]
;{}Variable out = {}
+
;int max = find_closing(tok, cur)
;Type t = NO_TYPE
/; loop (cur` = next_non_nl(tok, cur` + 1); cur` < max) [cur` = next_non_nl(tok, cur` + 1)]
@@ -2554,6 +2555,16 @@
;int max = find_closing(tok, cur)
;bool m = false, returned = false
;Type ret = NO_TYPE
+
+ /; if (len (current`.name) > 2)
+ /; if (current`.name{0} == '_' && current`.name{1} == '#')
+ ;{}{}uint8 split = string_split(current`.name, '#')
+ ;Type st = current`.find_type( {split{1}} )`
+ ;st.ptr_chain = {PTYPE.REFERENCE}
+ ;root.vars.append({"self", st, 0, 0})
+ ;/
+ ;/
+
/; loop (cur`++; cur` < max && !m) [cur`++]
/; if (tok`{cur`}.type_is(TOKEN.DEFWORD))
;root.name = tok`{cur`}.data