Skip to content

Commit

Permalink
fix: add an error message when a combined grammar has no implicit lex…
Browse files Browse the repository at this point in the history
…er grammar (fixes #687)
  • Loading branch information
bjansen committed Mar 9, 2024
1 parent 85cc999 commit 1668e58
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,9 @@ public static Grammar[] loadGrammars(VirtualFile grammarFile, Project project) {
case ANTLRParser.COMBINED :
lg = g.getImplicitLexer();
if ( lg==null ) {
String msg = "No implicit lexer grammar found in combined grammar " + g.name
+ ". Did you mean to declare a `parser grammar` instead?\n";
console.print(msg, ConsoleViewContentType.ERROR_OUTPUT);
lg = BAD_LEXER_GRAMMAR;
}
ANTLRv4PluginController.LOG.info("loadGrammars combined: "+lg.name+", "+g.name);
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ For really big files and slow grammars, there is an appreciable delay when displ
<change-notes><![CDATA[
<ul>
<li>Fixed syntax highlighting in 2024.1 EAP (<a href="https://github.com/antlr/intellij-plugin-v4/issues/691">#691</a>)</li>
<li>Explain when a grammar might lack the `parser` keyword (<a href="https://github.com/antlr/intellij-plugin-v4/issues/687">#687</a>)</li>
</ul>
See the complete list of <a href="https://github.com/antlr/intellij-plugin-v4/issues?q=milestone%3A1.23.1fix+is%3Aclosed">fixed issues</a>.
]]>
Expand Down

0 comments on commit 1668e58

Please sign in to comment.