aboutsummaryrefslogtreecommitdiff
path: root/lib/Parser/ParserExpression.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Parser/ParserExpression.cc')
-rw-r--r--lib/Parser/ParserExpression.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Parser/ParserExpression.cc b/lib/Parser/ParserExpression.cc
index 3e2665f..d32c407 100644
--- a/lib/Parser/ParserExpression.cc
+++ b/lib/Parser/ParserExpression.cc
@@ -5,6 +5,7 @@
using namespace cps;
int Parser::GetTokPrecedence() {
+ if (atCaseBoundary()) return -1;
if (BinopPrecedence.find(CurTok) == BinopPrecedence.end()) return -1;
int TokPrec = BinopPrecedence[CurTok];
if (TokPrec <= 0) return -1;
@@ -28,7 +29,7 @@ std::unique_ptr<ExprAST> Parser::ParseIdentifierExpr() {
int Line = Lex.getLine();
getNextToken();
- if (CurTok == '(') {
+ if (CurTok == '(' && !atCaseBoundary()) {
getNextToken();
auto Args = ParseExprList(')', true);
if (!Args) return nullptr;
@@ -54,6 +55,7 @@ std::unique_ptr<ExprAST> Parser::ParseIdentifierExpr() {
// Postfix accessor chain after an identifier: '[' exprs ']' | '.' IDENT | '^'
bool Parser::ParseDesignatorSuffix(std::vector<DesignatorAccess> &Out) {
while (true) {
+ if (atCaseBoundary()) return true;
if (CurTok == '[') {
getNextToken();
auto Indices = ParseExprList(']', false);