In java compiler JCTree.java the JCVariableDecl is defined as the following: However, I am not sure how nameexpr can be useful here. In what situation nameexpr field is not null? I have read the BNF of Java 8 and JavacParser.java it seems that we need to construct a case to make pn.hasTag(Tag.IDENT) && ((JCIdent)pn).name != names._this to be false. Answer
Tag: abstract-syntax-tree
ANTLR AST visitor that returns different data types
I finished converting the ANTLR CST into an AST and created a specific Visitor<T> interface that allows me to visit all my AST nodes, but the main issue i’m having is that some visits should return different data types, and i’m not sure how to go about this. For example, for simple arithmetics operations i want to return a double
Can Antlr ignore some of the keyword?
I’m new to Antlr but I’m trying to change some of the Grammar from my existing project. The example of the grammar looks like this The grammar is supposed to parse something like this a=10 AND s=1 AND s=2 or ((a=9 AND s=1) AND s=2). The question is is it possible to ignore anything that’s not s={ANYTHING}. So from the