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 +}