Skip to content

Commit 79d35e3

Browse files
committed
Fixed bug: PR_CLOSE after group expression
1 parent 3bb8277 commit 79d35e3

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

source/calcool/expression.d

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ private:
2626
static foreach (i; trigonometry ~ other) {
2727
funcs[i] = mixin("&" ~ i);
2828
}
29+
funcs["abs"] = &abs!real;
2930
}
3031

3132
public:

source/calcool/parser.d

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ public:
6464
Expression parseGroupExpression() {
6565
auto inside = parseExpression(Precedence.START);
6666
expect(TokenType.PR_CLOSE);
67+
if (input.length > 0 && input.front().type == TokenType.PR_CLOSE) {
68+
input.length = 0;
69+
throw new ParseException("Syntax error");
70+
}
6771
return inside;
6872
}
6973

0 commit comments

Comments
 (0)