diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2021-10-31 00:41:36 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2021-10-31 00:41:36 -0400 |
commit | c0a3940eb07abf13123c7190a5fa8a613bba9db0 (patch) | |
tree | aa0829d37956302ff6529074cb88779e0c4b5b3c /src/tparse | |
parent | a3e0d8d47b47a5b3ec4cb0f40a7411091af900a6 (diff) |
[AST] more fixes, slight restructure
+ changes for composite values
+ more void type fixes
Diffstat (limited to 'src/tparse')
-rw-r--r-- | src/tparse/tree-value.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/tparse/tree-value.go b/src/tparse/tree-value.go index abb785b..ac91873 100644 --- a/src/tparse/tree-value.go +++ b/src/tparse/tree-value.go @@ -102,11 +102,12 @@ func parseUnaryOps(tokens *[]Token, tok, max int) (Node) { case DELIMIT: switch t.Data { - case "{", "(": // Array or struct evaluation, parenthetical value + case "{": // Array or struct evaluation, parenthetical value if vnode != &out { errOut("Composite values may not use unary operators.", out.Data) } - (*vnode), tok = parseValueList(tokens, tok + 1, max) + (*vnode) = Node{Token{10, "comp", 0, 0}, false, []Node{Node{}}} + (*vnode).Sub[0], tok = parseValueList(tokens, tok + 1, max) val = true comp = true default: @@ -320,12 +321,12 @@ func parseTypeParams(tokens *[]Token, tok, max int) (Node, int) { out := Node{Data: (*tokens)[tok], IsBlock: false} tok++ - for ; tok < max; tok++ { + for ; tok < max; tok++{ t := (*tokens)[tok] tmp := Node{IsBlock: false} switch t.Type { case DELIMIT: - if tok < max-1 { + if tok < max { if t.Data == "(" { tmp, tok = parseTypeList(tokens, tok + 1, max) tmp.Data.Data = "()" @@ -339,7 +340,7 @@ func parseTypeParams(tokens *[]Token, tok, max int) (Node, int) { } else { errOut("Error: unexpected delimeter when parsing type", t) } - } else if tok >= max-1 { + } else { errOut("Error: unexpected end of file when parsing type", t) } |