I'm trying to implement a parser in Jison. The parser has support for both JSON objects: { a: 1 }
and blocks: if (true) { statement(); }
.
My grammar looks like:
block:
: '{' '}'
| '{' statementList '}'
;
objectExpression:
: '{' '}'
| '{' properties '}'
;
There's a {}
rule in both block
and objectExpression
because I need to support both empty objects and empty blocks.
It works, but it outputs lots of warnings such as:
Conflict in grammar: multiple actions possible when lookahead token is ; in state 52
- reduce by rule: objectExpression -> { }
- reduce by rule: block -> { }
How can I fix or suppress these warnings?