From 3061a4ee2c4f9938b2d88ebe0481d821a546921b Mon Sep 17 00:00:00 2001 From: Waiel Al Date: Tue, 25 Sep 2018 20:39:39 +0200 Subject: [PATCH] Fixed some parsing errors --- jass.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/jass.php b/jass.php index 9d335be..1e9b201 100644 --- a/jass.php +++ b/jass.php @@ -643,6 +643,7 @@ protected function ifthenelse(JASSLexer $lexer) { 'condition' => $expr, 'statements' => $statements, ); + $statements = array(); if ($next == 'endif') { break; } elseif ($next == 'elseif') { @@ -821,7 +822,14 @@ protected function expr(JASSLexer $lexer) { while ($lexer->match(self::LP_OPS)) { $op = $lexer->next(); $result[] = $op; - $result[] = $this->term($lexer); + + if ($lexer->match(self::UNARY_OPS)) { + $op = $lexer->next(); + $term = $this->term($lexer); + $result[] = array($op, $term); + } else { + $result[] = $this->term($lexer); + } } if (count($result) == 1) { return $result[0]; @@ -1033,4 +1041,4 @@ protected function id(JASSLexer $lexer) { } return false; } -} \ No newline at end of file +}