summaryrefslogtreecommitdiff
path: root/tnslc/parse
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2024-10-08 05:50:22 -0400
committerKyle Gunger <kgunger12@gmail.com>2024-10-08 05:50:22 -0400
commitb57b275c5c6aea194535587a80785fa56b4d6e71 (patch)
treee2aafb0817278ecfd7d976473057022d60ef843c /tnslc/parse
parentf74a9e454576d3523b15775356103ecb000bf014 (diff)
[tnslc] get vector.tnsl to compile
Diffstat (limited to 'tnslc/parse')
-rw-r--r--tnslc/parse/ast.tnsl17
1 files changed, 12 insertions, 5 deletions
diff --git a/tnslc/parse/ast.tnsl b/tnslc/parse/ast.tnsl
index 0e18a4f..8e7ff3c 100644
--- a/tnslc/parse/ast.tnsl
+++ b/tnslc/parse/ast.tnsl
@@ -1024,7 +1024,7 @@ int errors_shown = 0
# function blocks
/; _ast_flow (~utils.File fin, ~Node mod, ~Token first)
- uint16 block_type = NTYPE_IF_BLOCK
+ int block_type = NTYPE_IF_BLOCK
/; if (_advance_check(fin, first, "else\0") == true)
/; if (_advance_check(fin, first, "if\0") == true)
block_type = NTYPE_ELIF_BLOCK
@@ -1042,7 +1042,7 @@ int errors_shown = 0
Node out
out.init(block_type, utils.strcpy("\0"))
- /; if (block_type != NTYPE_ELSE_BLOCK && first`.eq("(\0") == true)
+ /; if (block_type !== NTYPE_ELSE_BLOCK && first`.eq("(\0") == true)
_ast_list_stmt(fin, ~out, first)
;/
@@ -1522,13 +1522,16 @@ int errors_shown = 0
cur = _mhf_up_to_value(cur)
+ bool did_binop = false
+
/; loop (bool run = true; run == true && first`._type !== TTYPE_ERR)
- /; if (first`.eq(")\0") || first`.eq(",\0"))
+ /; if (first`.eq(")\0") == true || first`.eq(",\0") == true)
run = false
;; else if (first`.eq(".\0") == true)
- _ast_print_err(fin, first, "Unexpected token within function call. Expected binary operator then value, ',', or ')'.\0")
+ _ast_print_err(fin, first, "Unexpected token within function call (1). Expected binary operator then value, ',', or ')'.\0")
return NULL
;; else if (first`._type == TTYPE_AUG && _op_bin(first) == true)
+ did_binop = true
Node bin
bin.init(NTYPE_BIN_OP, first`.data)
@@ -1562,12 +1565,16 @@ int errors_shown = 0
;/
;; else
- _ast_print_err(fin, first, "Unexpected token within function call. Expected binary operator then value, ',', or ')'.\0")
+ _ast_print_err(fin, first, "Unexpected token within function call (2). Expected binary operator then value, ',', or ')'.\0")
return NULL
;/
;/
cur = cur`.parent
+ /; if (did_binop == true)
+ cur = cur`.parent
+ ;/
+
/; if (_advance_check(fin, first, ")\0"))
/; if (cur`.eq("(\0") == true)
cur = _mhf_up_to_value(cur)