Skip to content

Commit

Permalink
Fixes declarationStatement issue
Browse files Browse the repository at this point in the history
It was not parsing the following correctly:

int f()
{
    MyClass *test= new MyClass;
    test->foo();
}

MyClass *test was being interpreted as an expression (multiplicativeExpression) instead of a declarationStatement.
  • Loading branch information
kstallard committed May 8, 2021
1 parent 8422542 commit 570ad60
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cpp/CPP14Parser.g4
Expand Up @@ -225,15 +225,15 @@ constantExpression: conditionalExpression;

statement:
labeledStatement
| declarationStatement
| attributeSpecifierSeq? (
expressionStatement
| compoundStatement
| selectionStatement
| iterationStatement
| jumpStatement
| tryBlock
)
| declarationStatement;
);

labeledStatement:
attributeSpecifierSeq? (
Expand Down

0 comments on commit 570ad60

Please sign in to comment.