Hi all, I haven't boiled this down to a smaller reproducible test case yet, but someone may know the answer based on the description so here goes.
Antlr 3.1.1 with Java target. A large combined grammar was being de- composed into separate grammars to facilitate testing and re-use. The grammar was working, but a bit unwieldy. It's (roughly) structured as driver lexer grammar - imports 4 lexers that have been factored out standalone (one which imports another lexer) driver parser grammar - imports several grammars On top of that I have an extra parser grammar that imports the driver parser (mainly to define some test rules with EOF in them to deal with gUnit). This all builds and compiles nicely (warnings about overriding tokenVocab, etc. notwithstanding). When I run some very simple gUnit tests (like testing that a particular keyword matches a rule), I get very interesting behavior. gUnit reports that all tests fail, so anything that I had expected to pass reports as an error. If I have gUnit generate jUnit tests, the exact opposite occurs; all tests are reported OK, even blatantly incorrect tests. After a bit of digging through the generated code, the problem seems to stem from a null pointer exception in mTokens() in the top level grammar. None of the delegators have been initialized. They are declared properly, so everything compiles, when the top level mTokens() calls into the delegators, they are null. If you look down one level, those delegators are actually initialized properly, so I'm guessing that composite grammars were only ever tested one layer deep. So, am I barking up the wrong tree here by re-factoring so much? Or headed in the right direction, but just an early adopter? :-) Thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---
