I am presently getting...
error(56): AqlCommentTest.g4:12:4: reference to undefined rule: htmlCommentDeclaration
error(56): AqlCommentTest.g4:13:4: reference to undefined rule: mdCommentDeclaration
The import for the lexer grammar does seem to be loading. The following files present the problem.
AqlCommentTest.g4
grammar AqlCommentTest;
import AqlLexerRules;
import AqlComment;
program: commentDeclaration+;
commentDeclaration:
htmlCommentDeclaration #Comment_HTML
| mdCommentDeclaration #Comment_MD
;
AqlComment.g4
grammar AqlComment;
import AqlLexerRules;
htmlCommentDeclaration: 'html' '{' '(*' STRING '*)' '}';
mdCommentDeclaration: 'md' '{' '(*' STRING '*)' '}';
AqlLexerRules.g4
lexer grammar AqlLexerRules;
STRING : '"' [a-z]? '"' ;
The errors can be stopped by removing the 'import AqlLexerRules;' from the 'AqlCommentTest.g4' file.
Why does this "fix" the problem?
How can I check to see if and how an antlr4 import statement is actually applied?