1

I'm new to antlr4 and I was trying to create the Postgres parser for which I was using the grammar files and. I followed the below steps. Please note all the files are used from master branch: https://github.com/antlr/grammars-v4/tree/613f1ab0ae39fcb69b7775811a4591dd9886cb10/sql/postgresql/Java

  1. copied the grammer files .g4 files in to folder "src/main/antlr4/com/rr/sqlparser/grammar".
  2. copied the LexerDispatchingErrorListener.java, ParserDispatchingErrorListener.java, PostgreSQLLexerBase.java, PostgreSQLParserBase.java in the package "src/main/java/com/rr/sqlparser/grammar"
  3. executed the command 'mvn clean compile' and the compiled happened successfully.
  4. marked the "target/generated-sources/antlr4" as resources root and generated sources root and also it was added as the sources in Project module.
  5. After the above steps are done I'm still getting the error in imy IntelliJ in my PostgreSQLParserBase.java that Cannot resolve symbol 'PostgreSQLParser'. Is this because of the larger size of PostgreSQLparser.java as mentioned by one of the contributor in the comments ?

Please help or guide me as in what's the step that I'm missing or is this a issue in code files ? The generated target files

PostgreSQLParserBase.java

My folder structure

2 Answers 2

2

In IntelliJ I see the same error that the base parser cannot be compiled. When I open PostgreSQLParser I see this:

enter image description here

But the lexer has no such issues:

enter image description here

When I select Build and then Build Project from IntelliJ, all goes well. SO it seems to just be an issue that the generated parser is large.

EDIT

W.r.t. the error "The file size ... exceeds ...", look here: File size exceeds configured limit (2560000), code insight features not available

Sign up to request clarification or add additional context in comments.

2 Comments

Hi @Bart so this means that my process is right. It's just that generated file PostgreSQLparser is large so that why Intellij is not able to read it ?
"so this means that my process is right" that seems to be the case (test yourself by building/compiling). "so that why Intellij is not able to read it" ¯\_(ツ)_/¯ I've nog done any Java development in years.
0

So basically this issue seems to be the size of the intellisense of the IDE which I configured in the vmoptions cofig file.
Use
-Didea.max.intellisense.filesize=5000
it incerased the limit to 5 MB and solves the problem.
Thanks for the suggestion and pointing it out at the first place.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.