Custom Language Development - GeneratedParserUtilBase?

I'm following the tutorial here: http://confluence.jetbrains.com/display/IntelliJIDEA/Grammar+and+Parser

However, when I copy the GeneratedParserUtilBase class, it won't compile.  There are several methods that are not found:

builder_.rawTokenIndex();
last.getStartIndex()
latestDoneMarker.getEndIndex()

I'm using IDEA Ultimate 12.

Is this class necessary anymore?  I'm able to generate the parser without it.

CORRECTION: I can generate the parser, but it contains a referece to this class.  So, I guess I need to know how to get GeneratedParserUtilBase to compile.

2 comments
Comment actions Permalink

I think I've solved the problem.....

The SimpleParser generated had the following import statement:

import static com.simpleplugin.parser.GeneratedParserUtilBase.*;

I found the following on page https://github.com/JetBrains/Grammar-Kit:

There's no need to keep a copy of GeneratedParserUtilBase in a project, it is included in IntelliJ Platform since version 12.1.


So I changed the generated import statment in SimpleParser to:

import static com.intellij.lang.parser.GeneratedParserUtilBase.*;

And everything compiles.

Is there anyway to force Grammar-Kit to generate the correct import statement?

0
Comment actions Permalink

Doh!  I figured it out again......

The example bnf file contained:

stubParserClass="com.simpleplugin.parser.GeneratedParserUtilBase"


Change it to:

stubParserClass="com.intellij.lang.parser.GeneratedParserUtilBase"


And the parser generates successfully and compiles cleanly.
0

Please sign in to leave a comment.