summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKyle Gunger <corechg@gmail.com>2020-11-17 16:17:24 -0500
committerKyle Gunger <corechg@gmail.com>2020-11-17 16:17:24 -0500
commit02aac12bd9c6f329135234b9a9446008d8f6dfa5 (patch)
tree88e79dd24ebb0bd3cc16419f1d3c1779c213639d /src
parenta0435f61add1daa2cb645d05aafc694044e5efa8 (diff)
Parse list/value list fixes
Diffstat (limited to 'src')
-rw-r--r--src/tparse/tree.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/tparse/tree.go b/src/tparse/tree.go
index ced25d7..61e9be7 100644
--- a/src/tparse/tree.go
+++ b/src/tparse/tree.go
@@ -29,27 +29,25 @@ func errOut(message string, token Token) {
// Parse a list of values
func parseValueList(tokens *[]Token, tok, max int) (Node, int) {
out := Node{}
- out.Data = Token{Type: 9, Data: "list"}
-
- currentType := Node{}
- currentType.Data = Token{Data: "undefined"}
+ out.Data = Token{Type: 10, Data: "list"}
+ var tmp Node
tok++
for ; tok < max; tok++ {
- var tmp Node
- tmp, tok = parseValue(tokens, tok, max)
- makeParent(&out, tmp)
-
t := (*tokens)[tok]
switch t.Data {
case ")", "]", "}":
return out, tok
case ",":
+ tok++
default:
- errOut("Error: unexpected token when parsing list, expected ',' or end of list", t)
+ errOut("Error: unexpected token when parsing a list of types", t)
}
+
+ tmp, tok = parseValue(tokens, tok, max)
+ out.Sub = append(out.Sub, tmp)
}
return out, tok
@@ -111,9 +109,11 @@ func parseDefList(tokens *[]Token, tok, max int) (Node, int) {
func parseTypeList(tokens *[]Token, tok, max int) (Node, int) {
out := Node{}
- out.Data = Token{Type: 10, Data: "list"}
+ out.Data = Token{Type: 9, Data: "list"}
var tmp Node
+ tok++
+
for ; tok < max; tok++ {
t := (*tokens)[tok]