summaryrefslogtreecommitdiff
path: root/src/tparse/tree-value.go
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2022-06-26 01:18:27 -0400
committerKyle Gunger <kgunger12@gmail.com>2022-06-26 01:18:27 -0400
commit289c1fe3dd2f29e2511b6bb376582f8791179a9b (patch)
tree67c7c2e272f7564e873c8092c9333aa3a5e16c2d /src/tparse/tree-value.go
parent6416973e373a3c61aa2b44591799385c5b1b0092 (diff)
[AST] Parentheticals
+ Add support for parentheticals + Add uint as a valid type for the evaluator
Diffstat (limited to 'src/tparse/tree-value.go')
-rw-r--r--src/tparse/tree-value.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/tparse/tree-value.go b/src/tparse/tree-value.go
index 7ae346c..35e94d2 100644
--- a/src/tparse/tree-value.go
+++ b/src/tparse/tree-value.go
@@ -115,6 +115,11 @@ func parseUnaryOps(tokens *[]Token, tok, max int) (Node) {
(*vnode).Data.Data = "comp"
val = true
comp = true
+ case "(": //Typecast or paren statement
+ mx := findClosing(tokens, tok)
+ (*vnode) = parseBinaryOp(tokens, tok + 1, mx)
+ tok = mx
+ val = true
default:
errOut("Unexpected delimiter when parsing value", t)
}
@@ -210,7 +215,7 @@ func parseBinaryOp(tokens *[]Token, tok, max int) (Node) {
}
if curl < 0 || brak < 0 || parn < 0 {
- if curl > 0 || brak > 0 || parn > 0 {
+ if curl > 0 || brak > 0 || parn > 0 || tok < max - 1 {
errOut("Un-matched closing delimiter when parsing a type.", t)
}
}
@@ -303,7 +308,7 @@ func parseValue(tokens *[]Token, tok, max int) (Node, int) {
if block > 1 {
continue
} else if block == 1 {
- errOut("Error: redefinition of a block from a block as a value is not permitted.", t)
+ errOut("Error: redefinition of a block from a value block is not permitted.", t)
}
if curl > 0 || brak > 0 || parn > 0 {
errOut("Delimeter pairs not closed before end of value", t)