coli-saar / alto

Alto, the Algebraic Language Toolkit
Other
17 stars 2 forks source link

Error handling with duplicate tree families #45

Closed alexanderkoller closed 4 years ago

alexanderkoller commented 5 years ago

When a tulipac grammar contains the same tree family name twice, Alto throws an incomprehensible error.

Reading grammar from simpleG.tag ...
Exception in thread "main" java.lang.NullPointerException
    at de.up.ling.irtg.codec.TulipacInputCodec.buildWordByItself(TulipacInputCodec.java:170)
    at de.up.ling.irtg.codec.TulipacInputCodec.buildGrmr(TulipacInputCodec.java:79)
    at de.up.ling.irtg.codec.TulipacInputCodec.parseFile(TulipacInputCodec.java:62)
    at de.up.ling.irtg.codec.TulipacInputCodec.read(TulipacInputCodec.java:51)
    at de.up.ling.irtg.codec.TulipacInputCodec.read(TulipacInputCodec.java:43)
    at de.up.ling.irtg.script.TulipacParser.reloadGrammar(TulipacParser.java:60)
    at de.up.ling.irtg.script.TulipacParser.main(TulipacParser.java:181)
alexanderkoller commented 4 years ago

I couldn't reproduce this issue with duplicate family names; in that case, the last declaration for the same name wins. But the exception occurred when the family name was undefined. We now throw a clearer exception when this happens.