summaryrefslogtreecommitdiff
path: root/src/tparse/tree-list.go
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2021-05-03 15:00:59 -0400
committerKyle Gunger <kgunger12@gmail.com>2021-05-03 15:00:59 -0400
commite1eeadf0d53ca3088d7e0e1dd5521878a11ebde7 (patch)
tree1e5798057a04e63bcfb558de2a428bb717f96c38 /src/tparse/tree-list.go
parentc625ed1cfe7f7ea4ab2a75a8a0a6a6772f86431c (diff)
tokenizer bug fix
Diffstat (limited to 'src/tparse/tree-list.go')
-rw-r--r--src/tparse/tree-list.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/tparse/tree-list.go b/src/tparse/tree-list.go
index 843ca9b..059ef0b 100644
--- a/src/tparse/tree-list.go
+++ b/src/tparse/tree-list.go
@@ -58,6 +58,36 @@ func parseValueList(tokens *[]Token, tok, max int) (Node, int) {
return out, tok
}
+// Parse list of parameters
+func parseParamList(tokens *[]Token, tok, max int) (Node, int) {
+ out := Node{}
+ out.Data = Token{Type: 10, Data: "param"}
+ var tmp Node
+
+ c := getClosing((*tokens)[tok].Data)
+
+ tok++
+
+ for ; tok < max; tok++ {
+ t := (*tokens)[tok]
+
+ switch t.Data {
+ case c:
+ return out, tok
+ case ",":
+ tok++
+ default:
+ errOut("Error: unexpected token when parsing a list of values", t)
+ }
+
+ tmp, tok = parseValue(tokens, tok, max)
+ out.Sub = append(out.Sub, tmp)
+ }
+
+ return out, tok
+}
+
+// Parse a list of types
func parseTypeList(tokens *[]Token, tok, max int) (Node, int) {
out := Node{}
out.Data = Token{Type: 10, Data: "type"}