summaryrefslogtreecommitdiff
path: root/tnslc/parse
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2024-08-03 03:27:48 -0400
committerKyle Gunger <kgunger12@gmail.com>2024-08-03 03:27:48 -0400
commitb00a5a1123c920a4fc2737fee68347f6285d9ffd (patch)
tree5544c1687e19759e8999a32fbb3e02ddfe8bec61 /tnslc/parse
parent7793ee1739ccb239819c6664c89727697be4bf97 (diff)
Other type helper funcs
Diffstat (limited to 'tnslc/parse')
-rw-r--r--tnslc/parse/ast.tnsl34
1 files changed, 34 insertions, 0 deletions
diff --git a/tnslc/parse/ast.tnsl b/tnslc/parse/ast.tnsl
index 3cdf269..60676d4 100644
--- a/tnslc/parse/ast.tnsl
+++ b/tnslc/parse/ast.tnsl
@@ -135,10 +135,39 @@ struct Node {
;/
/; _type_helper_func (~utils.File fin, ~Node mod, ~Token first)
+ /; if (first`.eq("(\0") == true)
+ _ast_list_type(fin, mod, first)
+ ;/
+ /; if (first.eq("[\0") == true)
+ _ast_list_type(fin, mod, first)
+ ;/
;/
/; _type_helper_usertype (~utils.File fin, ~Node mod, ~Token first)
+
+ /; loop (bool run = true; run == true && first`._type !== TTYPE_ERR)
+ /; if (first`._type == TTYPE_USRWD)
+ Node utp
+ utp.init(NTYPE_ID, first`.data)
+ first` = produce_next_token(fin, first`)
+
+ /; if (first`._type !== TTYPE_AUG || first`.eq(".\0") == false)
+ run = false
+ ;; else
+ Token tmp = produce_next_token(fin, first`)
+ first`.end()
+ first` = tmp
+ ;/
+ ;; else
+ _ast_print_err(first, "Expected identifier in fully qualified type chain\0")
+ run = false
+ ;/
+ ;/
+
+ /; if (first`._type == TTYPE_DELIM && first`.eq("(\0") == true)
+ _ast_list_type(fin, mod, first)
+ ;/
;/
/; _ast_type (~utils.File fin, ~Node mod, ~Token first)
@@ -151,6 +180,11 @@ struct Node {
# Check to see if this is a function pointer type
/; if (first`.eq("void\0") && typ.sub.count == 0)
+ Node ktp
+ ktp.init(NTYPE_ID, first`.data)
+ typ.sub.push(~ktp)
+ first` = produce_next_token(fin, first`)
+
_type_helper_func(fin, ~typ, first)
mod`.sub.push(~typ)
return