Skip to content
Discussion options

You must be logged in to vote

You're writing a grammar that is not following the standards to avoid all sorts of beginner issues. Here's what you should do.

  • You define a split grammar, but don't declare 'parser grammar' in the parser grammar. You then get two .tokens that are different, assuming you run the Antlr tool on both .g4. It should be parser grammar MarkdownRuleParser;.
  • You should be using the tokenVocab options, not import. Follow the standard pattern for split grammars. Replace import MarkdownLexer;with options { tokenVocab = MarkdownLexer; }.
  • If you are using a split grammar, you have to define lexer rules for every string literal used in the parser grammar. Add to the lexer grammar before the first lexer…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@kurt-steiner
Comment options

@kurt-steiner
Comment options

Answer selected by kurt-steiner
Comment options

You must be logged in to vote
1 reply
@kurt-steiner
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants