public final void annotationExpression() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST annotationExpression_AST = null; conditionalExpression(); astFactory.addASTChild(currentAST, returnAST); if ( inputState.guessing==0 ) { annotationExpression_AST = (AST)currentAST.root; annotationExpression_AST = (AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(EXPR,"EXPR")).add(annotationExpression_AST)); currentAST.root = annotationExpression_AST; currentAST.child = annotationExpression_AST!=null &&annotationExpression_AST.getFirstChild()!=null ? annotationExpression_AST.getFirstChild() : annotationExpression_AST; currentAST.advanceChildToEnd(); } annotationExpression_AST = (AST)currentAST.root; returnAST = annotationExpression_AST; }
public GeneratedJavaRecognizer(ParserSharedInputState state) { super(state,2); tokenNames = _tokenNames; buildTokenTypeASTClassMap(); astFactory = new ASTFactory(getTokenTypeToASTClassMap()); }
public final void resource_assign() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST resource_assign_AST = null; AST tmp178_AST = null; tmp178_AST = astFactory.create(LT(1)); astFactory.makeASTRoot(currentAST, tmp178_AST); match(ASSIGN); expression(); astFactory.addASTChild(currentAST, returnAST); resource_assign_AST = (AST)currentAST.root; returnAST = resource_assign_AST; }
/** * Creates artificial tree root. * @return artificial tree root. */ private static DetailAST createArtificialTreeRoot() { final ASTFactory factory = new ASTFactory(); factory.setASTNodeClass(DetailAST.class.getName()); return (DetailAST) factory.create(TokenTypes.EOF, "ROOT"); }
@Override public void processMemberOf(Token n, AST p, ASTPair currentAST) { // convert MEMBER OF to the equivalent IN ELEMENTS structure... AST inNode = n == null ? astFactory.create( IN, "in" ) : astFactory.create( NOT_IN, "not in" ); astFactory.makeASTRoot( currentAST, inNode ); AST inListNode = astFactory.create( IN_LIST, "inList" ); inNode.addChild( inListNode ); AST elementsNode = astFactory.create( ELEMENTS, "elements" ); inListNode.addChild( elementsNode ); elementsNode.addChild( p ); }
public final void lambdaBody() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST lambdaBody_AST = null; { if ((_tokenSet_12.member(LA(1))) && (_tokenSet_69.member(LA(2)))) { expression(); astFactory.addASTChild(currentAST, returnAST); } else if ((_tokenSet_36.member(LA(1))) && (_tokenSet_69.member(LA(2)))) { statement(); astFactory.addASTChild(currentAST, returnAST); } else { throw new NoViableAltException(LT(1), getFilename()); } } lambdaBody_AST = (AST)currentAST.root; returnAST = lambdaBody_AST; }
lc_AST = astFactory.create(lc); astFactory.makeASTRoot(currentAST, lc_AST); match(LCURLY); if ( inputState.guessing==0 ) { lc_AST.setType(SLIST); if ((_tokenSet_36.member(LA(1)))) { statement(); astFactory.addASTChild(currentAST, returnAST); tmp87_AST = astFactory.create(LT(1)); astFactory.addASTChild(currentAST, tmp87_AST); match(RCURLY); compoundStatement_AST = (AST)currentAST.root;
public final void catchParameterDeclaration() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST catchParameterDeclaration_AST = null; AST pm_AST = null; AST mct_AST = null; Token id = null; AST id_AST = null; parameterModifier(); pm_AST = (AST)returnAST; multiCatchTypes(); mct_AST = (AST)returnAST; id = LT(1); id_AST = astFactory.create(id); match(IDENT); if ( inputState.guessing==0 ) { catchParameterDeclaration_AST = (AST)currentAST.root; catchParameterDeclaration_AST = (AST)astFactory.make( (new ASTArray(4)).add(astFactory.create(PARAMETER_DEF,"PARAMETER_DEF")).add(pm_AST).add((AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(TYPE,"TYPE")).add(mct_AST))).add(id_AST)); currentAST.root = catchParameterDeclaration_AST; currentAST.child = catchParameterDeclaration_AST!=null &&catchParameterDeclaration_AST.getFirstChild()!=null ? catchParameterDeclaration_AST.getFirstChild() : catchParameterDeclaration_AST; currentAST.advanceChildToEnd(); } returnAST = catchParameterDeclaration_AST; }
if (((_t.getType()==WEIRD_IDENT||_t.getType()==IDENT))&&( isOrderExpressionResultVariableRef( _t ) )) { resultVariableRef(_t); _t = _retTree; astFactory.addASTChild(currentAST, returnAST); orderExpr_AST = (AST)currentAST.root; else if ((_tokenSet_0.member(_t.getType()))) { expr(_t, null ); _t = _retTree; astFactory.addASTChild(currentAST, returnAST); orderExpr_AST = (AST)currentAST.root;
private SortSpecification createSortSpecification( AST ident, CollationSpecification collationSpecification, OrderingSpecification orderingSpecification) { AST sortSpecification = getASTFactory().create( SORT_SPEC, "{{sort specification}}" ); AST sortKey = getASTFactory().create( SORT_KEY, "{{sort key}}" ); AST newIdent = getASTFactory().create( ident.getType(), ident.getText() ); sortKey.setFirstChild( newIdent ); sortSpecification.setFirstChild( sortKey ); if ( collationSpecification != null ) { sortSpecification.addChild( collationSpecification ); } if ( orderingSpecification != null ) { sortSpecification.addChild( orderingSpecification ); } return (SortSpecification) sortSpecification; }
public final void selectStatement(AST _t) throws RecognitionException { AST selectStatement_AST_in = (_t == ASTNULL) ? null : (AST)_t; returnAST = null; ASTPair currentAST = new ASTPair(); AST selectStatement_AST = null; try { // for error handling query(_t); _t = _retTree; astFactory.addASTChild(currentAST, returnAST); selectStatement_AST = (AST)currentAST.root; } catch (RecognitionException ex) { reportError(ex); if (_t!=null) {_t = _t.getNextSibling();} } returnAST = selectStatement_AST; _retTree = _t; }
public final void numericInteger(AST _t) throws RecognitionException { AST numericInteger_AST_in = (_t == ASTNULL) ? null : (AST)_t; returnAST = null; ASTPair currentAST = new ASTPair(); AST numericInteger_AST = null; try { // for error handling AST tmp91_AST = null; AST tmp91_AST_in = null; tmp91_AST = astFactory.create((AST)_t); tmp91_AST_in = (AST)_t; astFactory.addASTChild(currentAST, tmp91_AST); match(_t,NUM_INT); _t = _t.getNextSibling(); numericInteger_AST = (AST)currentAST.root; } catch (RecognitionException ex) { reportError(ex); if (_t!=null) {_t = _t.getNextSibling();} } returnAST = numericInteger_AST; _retTree = _t; }
@Override public final AST getWhereClause() { if ( whereClause == null ) { whereClause = locateWhereClause(); // If there is no WHERE node, make one. if ( whereClause == null ) { getLog().debug( "getWhereClause() : Creating a new WHERE clause..." ); whereClause = getWalker().getASTFactory().create( HqlSqlTokenTypes.WHERE, "WHERE" ); // inject the WHERE after the parent AST parent = ASTUtil.findTypeInChildren( this, getWhereClauseParentTokenType() ); whereClause.setNextSibling( parent.getNextSibling() ); parent.setNextSibling( whereClause ); } } return whereClause; }
@Override protected AST generateNamedParameter(AST delimiterNode, AST nameNode) throws SemanticException { if ( getSessionFactoryHelper().isStrictJPAQLComplianceEnabled() && positionalParameters != null ) { throw new SemanticException( "Cannot mix positional and named parameters: " + queryTranslatorImpl.getQueryString() ); } final String name = nameNode.getText(); trackNamedParameterPositions( name ); // create the node initially with the param name so that it shows // appropriately in the "original text" attribute final ParameterNode parameter = (ParameterNode) astFactory.create( NAMED_PARAM, name ); parameter.setText( "?" ); final NamedParameterSpecification paramSpec = new NamedParameterSpecification( delimiterNode.getLine(), delimiterNode.getColumn(), name ); parameter.setHqlParameterSpecification( paramSpec ); parameterSpecs.add( paramSpec ); return parameter; }
@Override protected AST quotedIdentifier(AST ident) { /* * Semantic action used during recognition of quoted identifiers (quoted column names) */ final String columnName = context.getDialect().quote( '`' + ident.getText() + '`' ); columnReferences.add( columnName ); final String marker = '{' + columnName + '}'; return getASTFactory().create( OrderByTemplateTokenTypes.IDENT, marker ); }
public final void stringLiteral() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST stringLiteral_AST = null; org.apache.geode.cache.query.internal.parse.ASTLiteral tmp179_AST = null; tmp179_AST = (org.apache.geode.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"org.apache.geode.cache.query.internal.parse.ASTLiteral"); astFactory.addASTChild(currentAST, tmp179_AST); match(StringLiteral); stringLiteral_AST = (AST)currentAST.root; returnAST = stringLiteral_AST; }
public final void expr() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST expr_AST = null; castExpr(); astFactory.addASTChild(currentAST, returnAST); expr_AST = (AST)currentAST.root; returnAST = expr_AST; }
AST variableDefinitions_AST = null; variableDeclarator((AST) getASTFactory().dupTree(mods), (AST) getASTFactory().dupList(t)); astFactory.addASTChild(currentAST, returnAST); if ((LA(1)==COMMA)) { AST tmp35_AST = null; tmp35_AST = astFactory.create(LT(1)); astFactory.addASTChild(currentAST, tmp35_AST); match(COMMA); variableDeclarator((AST) getASTFactory().dupTree(mods), (AST) getASTFactory().dupList(t)); astFactory.addASTChild(currentAST, returnAST);
private Node create(int tokenType, String text) { return (Node) hqlSqlWalker.getASTFactory().create( tokenType, text ); }