SQLite User Forum

Lemon get lost with a comment /*/=*/
Login

Lemon get lost with a comment /*/=*/

(1) By Domingo (mingodad) on 2022-04-07 13:08:05 [source]

Testing a grammar converted from other parser generator tool I ended up commenting something inside a rule and discovered that lemon can't handle this particular comment:
====
prog ::= stmt /*=*/ .
prog ::= stmt2 /*/=*/.
stmt ::= .
stmt2 ::= .
====

Lemon output:
====
../lemon gram.y 
gram.y:2: Illegal character on RHS of rule: "=".
====

But with this grammar (notice add a space here "/* /=*/"):
====
prog ::= stmt /*=*/ .
prog ::= stmt2 /* /=*/.
stmt ::= .
stmt2 ::= .
====

Lemon output:
====
../lemon gram.y 
gram.y:4: This rule can not be reduced.

1 parsing conflicts.
====