Skip to content

Is it somehow possible to use this javacc jar to parse a jjt and jj file  #221

@wumpz

Description

@wumpz

I want to construct some tests depending on the tokens used in a specific rule of my grammar.

void myrule() : {} {
<K_MYKEYWORD1>
| <K_MYKEYWORD2>
}

So I have a jjt file and need to transform this in a jj file and then parse this and get the AST - node tree, to traverse it.

My first attempt was this:

var parser = new JJTreeParser(
                Files.newInputStream(Paths.get("src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt"))
) {
    public ASTGrammar getRoot() {
        return (ASTGrammar)jjtree.rootNode());
    }
};
parser.javacc_input();

new JavaCodeGenerator().visit(parser.getRoot(), io);

But I have to fight method and class visibility issues:

IO is only package private, ASTGrammer.generate is package private as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions