antlr4 icon indicating copy to clipboard operation
antlr4 copied to clipboard

A dedicated bug under CPP, where assignment expressions are treated as variables

Open cxasm opened this issue 11 months ago • 1 comments

{ ning zs_1 = 1; ning bl_3 = (zs_1 and (1>2)); }

Image

If it is under Java, zs_1 and (1>2) in the following figure will be well handled.

But if it's cpp, “zs_1and” will be treated as a variable.

Suspect that CPP is dealing with some malfunctions in this area.

antlr4 version is 4.13.2 。

cxasm avatar Jan 22 '25 08:01 cxasm

What is the grammar? ~~Is it the CPP14 grammar from grammars-v4? https://github.com/antlr/grammars-v4/tree/83cb847a0a6d278b166eb3cb48f032533d0c8060/cpp ? That grammar does not use a symbol table.~~ It's not the cpp14 grammar because there's no block, statement, or defvar. We need a grammar, not just an input string.

kaby76 avatar Jan 22 '25 11:01 kaby76