antlr / grammars-v4

Grammars written for ANTLR v4; expectation that the grammars are free of actions.
MIT License
10.14k stars 3.7k forks source link

error generate lexer and parser in java8 grammars #2406

Open Lson-L opened 2 years ago

Lson-L commented 2 years ago

I copy lexer and parser in https://github.com/antlr/grammars-v4/tree/master/java/java8 to my idea,but idea tip some error in parser, my antlr4 plugin version is 1.16.

a
kaby76 commented 2 years ago

This is not an error in the grammar. trgen generates a working parser for targets Java and CSharp. The problem is an error in setting up the IDE: if you look way, way up at the top of the screenshot, options { tokenVocab=Java8Lexer; } has an error. The IDE (Antlr4 generator) cannot find the Java8Lexer.g4 grammar. That's why it says below in the tip that you are trying to define a string literal in a parser grammar.