Парсинг выражений со скобками

This commit is contained in:
Victor 2015-04-16 20:50:14 +03:00
parent 3f5f8bca46
commit e728a91ff5

View File

@ -535,6 +535,11 @@ public final class Parser {
if (match(current, TokenType.WORD)) { if (match(current, TokenType.WORD)) {
return new VariableExpression(current.getText()); return new VariableExpression(current.getText());
} }
if (match(current, TokenType.LPAREN)) {
Expression expr = expression();
match(TokenType.RPAREN);
return expr;
}
throw new RuntimeException(); throw new RuntimeException();
} }