diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2024-08-03 03:27:48 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2024-08-03 03:27:48 -0400 |
commit | b00a5a1123c920a4fc2737fee68347f6285d9ffd (patch) | |
tree | 5544c1687e19759e8999a32fbb3e02ddfe8bec61 /tnslc | |
parent | 7793ee1739ccb239819c6664c89727697be4bf97 (diff) |
Other type helper funcs
Diffstat (limited to 'tnslc')
-rw-r--r-- | tnslc/parse/ast.tnsl | 34 | ||||
-rwxr-xr-x | tnslc/run.sh | 5 |
2 files changed, 39 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 diff --git a/tnslc/run.sh b/tnslc/run.sh new file mode 100755 index 0000000..8010ab6 --- /dev/null +++ b/tnslc/run.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +DIR_L=$(pwd) + +$DIR_L/out/tnslc $1 |