congo-cc / congo-parser-generator

The CongoCC Parser Generator, the Next Generation of JavaCC 21, which in turn was the next generation of JavaCC
https://discuss.congocc.org/
Other
36 stars 11 forks source link

Tree building annotations on parenthesized expansions throw NPE #69

Closed adMartem closed 7 months ago

adMartem commented 10 months ago

I think maybe this commit broke definite node handling for ExpansionWithParentheses. I've been trying to figure out why

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "org.congocc.core.Grammar.getAppSettings()" because the return value of "org.congocc.core.Expansion.getGrammar()" is null
     [java]     at org.congocc.core.Expansion.setTreeNodeBehavior(Expansion.java:66)
     [java]     at org.congocc.parser.CongoCCParser.ExpansionUnit(CongoCCParser.java:13543)
     [java]     at org.congocc.parser.CongoCCParser.ExpansionSequence(CongoCCParser.java:12932) ...

happens when I do

Array :
    <OPEN_BRACKET>
    [
      Value (<COMMA> Value)*! #Xyzzy
    ]
    <CLOSE_BRACKET>
;

that. I'm pretty sure it has worked in the past, but in any case I suspect it shouldn't result in a NPE. Unfortunately I've not dove into the node hook stuff enough (or at all) to know what is going on with that "temporary kludge".