diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2022-07-13 02:44:41 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2022-07-13 02:44:41 -0400 |
commit | 42a014c98797c7c4d78bfc3c2494a6ef0ce4e6be (patch) | |
tree | bb9e6310d2d973882f05011a3b0e82db34f13a37 /src/tparse/tree-statement.go | |
parent | 81300fda909b260ff62ae1af9157cf0d097a47c0 (diff) |
[AST] Fix an issue with parsing lists of values
Diffstat (limited to 'src/tparse/tree-statement.go')
-rw-r--r-- | src/tparse/tree-statement.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/tparse/tree-statement.go b/src/tparse/tree-statement.go index 6a5b6e3..5c6d912 100644 --- a/src/tparse/tree-statement.go +++ b/src/tparse/tree-statement.go @@ -193,7 +193,13 @@ func keywordStatement(tokens *[]Token, tok, max int) (Node, int) { out.Sub = append(out.Sub, tmp) tok++ if (*tokens)[tok].Data == "(" { - tmp, tok = parseValueList(tokens, tok + 1, max) + mx := findClosing(tokens, tok) + + if mx < 0 { + errOut("Failed to find closing paren when parsing a struct def", (*tokens)[tok]) + } + + tmp, tok = parseValueList(tokens, tok + 1, mx) out.Sub = append(out.Sub, tmp) tok++ } |