Strumenta / antlr-kotlin

Support for Kotlin as a target for ANTLR 4
Apache License 2.0
221 stars 47 forks source link

Name conflict in predicate #172

Closed piacenti closed 6 months ago

piacenti commented 6 months ago

The most recent version improved several things. However, it seems that If I have a predicate or action that references a token it can have issues in JS image

I'm currently solving this by appending an underscore for the local variable created that is referenced from the predicate/action

lppedd commented 6 months ago

Thanks! Will have a look soon. It's strange tho because I did test this exact scenario, and in JS I did not have conflicts reported.

piacenti commented 6 months ago

Not sure if this makes any difference but the grammar has something like this in the rule TYPE type=type_XYZ So there is both a TYPE token and a type label to simplify navigation to one of many different type configurations. The $TYPE token is referenced in the predicate

lppedd commented 6 months ago

I'm not sure if we can have something that works in all platforms to be honest.

lppedd commented 6 months ago

If you have time, some kind of reproducer would help, I can't seem to get the same result.

lppedd commented 6 months ago

Nevermind, reproduced!