Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to create parboiled parser

Tags:

java

parboiled

I have created a parser class for the parboiled framework according to this simple example:

package my.package;

import org.parboiled.BaseParser;
import org.parboiled.annotations.BuildParseTree;

@BuildParseTree
public class QueryParser extends BaseParser<Object> {
    //some rules
}

If I try to create parser as shown in the example

QueryParser parser = Parboiled.createParser(QueryParser.class);

I get an exception at that line:

java.lang.ClassCastException: my.package.QueryParser$$parboiled cannot be cast to org.parboiled.BaseParser
    at org.parboiled.Parboiled.createParser(Parboiled.java:56)
    ...

I'm really not doing anything special that is not done in the example. The only difference is that the parser and and the class calling it are in different projects but I can't imagine why this should matter. The dependencies between the projects (which are Eclipse plugin projects) should be alright.

Can anyone tell what I'm doing wrong or where the mistake could be?

like image 660
André Stannek Avatar asked Jun 10 '26 01:06

André Stannek


1 Answers

It actually seems to have something to do with the run configurations. I moved all the parboiled relevant code to one project and it works. I think I'll keep it this way because it is better encapsulation anyway.

like image 117
André Stannek Avatar answered Jun 11 '26 16:06

André Stannek