diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2021-10-29 23:12:42 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2021-10-29 23:12:42 -0400 |
commit | 6af4308f464e3821baca41a5bc5b4938481504b4 (patch) | |
tree | f13eac68640fea9142ed17e3a71d0afdda43753c /src/tparse/tree-list.go | |
parent | a7b7ecec0cafe6399151669860b3c0d521a31828 (diff) |
[AST] General bugfixes
We have emerged into the testing phase of the AST.
Very basic statements seem to parse here, but not much else.
Diffstat (limited to 'src/tparse/tree-list.go')
-rw-r--r-- | src/tparse/tree-list.go | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/tparse/tree-list.go b/src/tparse/tree-list.go index 059ef0b..0a98e8c 100644 --- a/src/tparse/tree-list.go +++ b/src/tparse/tree-list.go @@ -31,21 +31,22 @@ func getClosing(start string) string { // Parse a list of values func parseValueList(tokens *[]Token, tok, max int) (Node, int) { - out := Node{} - out.Data = Token{Type: 10, Data: "value"} + out := Node{Data: Token{Type: 10, Data: "list"}, IsBlock: false} var tmp Node - c := getClosing((*tokens)[tok].Data) + tmp, tok = parseValue(tokens, tok, max) + out.Sub = append(out.Sub, tmp) + + for ; tok < max; { - tok++ - - for ; tok < max; tok++ { t := (*tokens)[tok] - - switch t.Data { - case c: - return out, tok - case ",": + + switch t.Type { + case LINESEP: + fallthrough + case DELIMIT: + return out, tok + 1 + case INLNSEP: tok++ default: errOut("Error: unexpected token when parsing a list of values", t) |