![]() reworked the Integer and Float stuff to be two different tokens so that I could use the Integer token in the section parser rule.removed the StatementEnd lexer rule since I skiped the NewLine tokens.set the NewLine token to -> skip (This is a bit more presumptive on my part, but not skipping NewLine will require modifying more parse rule to specify where all NewLine is a valid token.).Having lexer rules like 'Body ' Integer will give you a single token with both the body keyword and the integer, that you'd then have to pull apart later (it also forces there to be only a single space between 'Body' and the integer). changed SectionName lexer rule to section parser rule (with labeled alternatives. ![]() Removed the target language (It's generally better to specify the target language on the antlr command line so that the grammar remains language agnostic (it's also essential if you want to use the TestRig/grun utility to test things out, since you'll need the Java target)).To get it to parse correctly, I took the liberty of modifying several things in your grammar: I removed the target language option from the grammar and was able to run the grun command against your sample input. By specifying python as the target language in the grammar, you didn't generate the *.java classes that the TestRig class (used by the grun alias) needed to execute. The immediate issue for why grun is giving you this issue is that you specified your target language in the grammar file (looks like I need to retract that comment about it not being anything in your grammar). I cloned your repo to take a closer look at your issue. ![]() TestRig takes the grammarName AND a startRule as parameters, and expects your input to come from stdin. If you’ve placed your generated Parser in a package, you may need to take the package name into account, but the main thing is that the generated (and compiled) class is in your classpath.Īlso. This error message is an indication that TestRig (that the grun alias uses), can’t find the Parser (or Lexer) class in your classpath. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |