From 3a9dbb4b5491a6ae813e4632bf17a5b5f00e8e0c Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Sat, 9 Apr 2022 20:39:33 -0400 Subject: [PARSE] Hotfix for array indexing --- src/tparse/tree-value.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/tparse') diff --git a/src/tparse/tree-value.go b/src/tparse/tree-value.go index 1c7e99c..25982ff 100644 --- a/src/tparse/tree-value.go +++ b/src/tparse/tree-value.go @@ -213,6 +213,10 @@ func parseBinaryOp(tokens *[]Token, tok, max int) (Node) { } } else if t.Type == AUGMENT { order, prs := ORDER[t.Data] + if prs == false || curl > 0 || brak > 0 || parn > 0 { + continue + } + if t.Data == "-" { _, prs := ORDER[(*tokens)[tok - 1].Data] if prs || (*tokens)[tok - 1].Data == "return" { @@ -220,9 +224,7 @@ func parseBinaryOp(tokens *[]Token, tok, max int) (Node) { } else if order > highOrder { high, highOrder = tok, order } - } else if prs == false || curl > 0 || brak > 0 || parn > 0 { - continue - } else if order > highOrder { + } else if order > highOrder { high, highOrder = tok, order } // TODO: Add in case for the "is" operator @@ -544,4 +546,4 @@ func isTypeThenValue(tokens *[]Token, tok, max int) (bool) { } return stage == 2 -} \ No newline at end of file +} -- cgit v1.2.3