public final Operator operator() throws RecognitionException { Operator op = null; Token t=null; try { // org/apache/hadoop/hive/metastore/parser/Filter.g:170:4: (t= ( LESSTHAN | LESSTHANOREQUALTO | GREATERTHAN | GREATERTHANOREQUALTO | KW_LIKE | EQUAL | NOTEQUAL ) ) // org/apache/hadoop/hive/metastore/parser/Filter.g:171:4: t= ( LESSTHAN | LESSTHANOREQUALTO | GREATERTHAN | GREATERTHANOREQUALTO | KW_LIKE | EQUAL | NOTEQUAL ) { t=input.LT(1); if ( (input.LA(1) >= EQUAL && input.LA(1) <= GREATERTHANOREQUALTO)||input.LA(1)==KW_LIKE||(input.LA(1) >= LESSTHAN && input.LA(1) <= LESSTHANOREQUALTO)||input.LA(1)==NOTEQUAL ) { input.consume(); state.errorRecovery=false; } else { MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } op = Operator.fromString(t.getText().toUpperCase()); } } catch (RecognitionException e){ throw e; } finally { // do for sure before leaving } return op; } // $ANTLR end "operator"
private String getQueryStringFromAst(ASTNode ast) { StringBuilder sb = new StringBuilder(); int startIdx = ast.getTokenStartIndex(); int endIdx = ast.getTokenStopIndex(); boolean queryNeedsQuotes = true; if (conf.getVar(ConfVars.HIVE_QUOTEDID_SUPPORT).equals("none")) { queryNeedsQuotes = false; } for (int idx = startIdx; idx <= endIdx; idx++) { Token curTok = ctx.getTokenRewriteStream().get(idx); if (curTok.getType() == Token.EOF) { continue; } else if (queryNeedsQuotes && curTok.getType() == HiveLexer.Identifier) { // The Tokens have no distinction between Identifiers and QuotedIdentifiers. // Ugly solution is just to surround all identifiers with quotes. sb.append('`'); // Re-escape any backtick (`) characters in the identifier. sb.append(curTok.getText().replaceAll("`", "``")); sb.append('`'); } else { sb.append(curTok.getText()); } } return sb.toString(); }
public final String sSigAttr() throws RecognitionException { String sig = null; Token a=null; try { // com/googlecode/d2j/jasmin/Jasmin.g:985:29: ( ( '.signature_attr' | '.signature' ) a= STRING ) // com/googlecode/d2j/jasmin/Jasmin.g:985:31: ( '.signature_attr' | '.signature' ) a= STRING { if ( (input.LA(1) >= 137 && input.LA(1) <= 138) ) { input.consume(); state.errorRecovery=false; } else { MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } a=(Token)match(input,STRING,FOLLOW_STRING_in_sSigAttr2503); sig =unEscapeString((a!=null?a.getText():null)); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving } return sig; } // $ANTLR end "sSigAttr"
public final CpQueryFilterParser.select_subject_return select_subject() throws RecognitionException { CpQueryFilterParser.select_subject_return retval = new CpQueryFilterParser.select_subject_return(); retval.start = input.LT(1); Object root_0 = null; Token ID77=null; Object ID77_tree=null; try { // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:350:3: ( ID ) // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:350:5: ID { root_0 = (Object)adaptor.nil(); ID77=(Token)match(input,ID,FOLLOW_ID_in_select_subject1609); ID77_tree = (Object)adaptor.create(ID77); adaptor.addChild(root_0, ID77_tree); parsedQuery.addSelect((ID77!=null?ID77.getText():null)); } retval.stop = input.LT(-1); retval.tree = (Object)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } finally { // do for sure before leaving } return retval; } // $ANTLR end "select_subject"
constantV = FilterLexer.ExtractDate(constant.getText()); constants.add(constantV); constant=(Token)match(input,DateLiteral,FOLLOW_DateLiteral_in_inExpression967); constantV = FilterLexer.ExtractDate(constant.getText()); constants.add(constantV); constantV = TrimQuotes(constant.getText()); constants.add(constantV); constant=(Token)match(input,StringLiteral,FOLLOW_StringLiteral_in_inExpression1136); constantV = TrimQuotes(constant.getText()); constants.add(constantV); constantV = Long.parseLong(constant.getText()); constants.add(constantV); constantV = Long.parseLong(constant.getText()); constants.add(constantV); Object value = constants.get(i); LeafNode leaf = new LeafNode(); leaf.keyName = key.getText(); leaf.value = value; leaf.operator = isPositive ? Operator.EQUALS : Operator.NOTEQUALS2;
public final smaliParser.insn_format10x_odex_return insn_format10x_odex() throws RecognitionException { smaliParser.insn_format10x_odex_return retval = new smaliParser.insn_format10x_odex_return(); retval.start = input.LT(1); adaptor.addChild(root_0, INSTRUCTION_FORMAT10x_ODEX324_tree); throwOdexedInstructionException(input, (INSTRUCTION_FORMAT10x_ODEX324!=null?INSTRUCTION_FORMAT10x_ODEX324.getText():null)); retval.stop = input.LT(-1); retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); reportError(re); recover(input,re); retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
a=(Token)match(input,STRING,FOLLOW_STRING_in_sAnnotationElementSoot2861); b=(Token)match(input,INT,FOLLOW_INT_in_sAnnotationElementSoot2865); retval.nn =unEscapeString((a!=null?a.getText():null)); retval.v =0!=parseInt((b!=null?b.getText():null)); a=(Token)match(input,STRING,FOLLOW_STRING_in_sAnnotationElementSoot2903); b=(Token)match(input,INT,FOLLOW_INT_in_sAnnotationElementSoot2907); retval.nn =unEscapeString((a!=null?a.getText():null)); retval.v =(short)parseInt((b!=null?b.getText():null)); a=(Token)match(input,STRING,FOLLOW_STRING_in_sAnnotationElementSoot2943); b=(Token)match(input,INT,FOLLOW_INT_in_sAnnotationElementSoot2947); retval.nn =unEscapeString((a!=null?a.getText():null)); retval.v =(byte)parseInt((b!=null?b.getText():null)); a=(Token)match(input,STRING,FOLLOW_STRING_in_sAnnotationElementSoot2984); b=(Token)match(input,INT,FOLLOW_INT_in_sAnnotationElementSoot2988); retval.nn =unEscapeString((a!=null?a.getText():null)); retval.v =(char)parseInt((b!=null?b.getText():null)); a=(Token)match(input,STRING,FOLLOW_STRING_in_sAnnotationElementSoot3025); b=(Token)match(input,INT,FOLLOW_INT_in_sAnnotationElementSoot3029); retval.nn =unEscapeString((a!=null?a.getText():null)); retval.v =parseInt((b!=null?b.getText():null)); retval.nn =unEscapeString((a!=null?a.getText():null)); retval.v =parseLong((b!=null?b.getText():null)); a=(Token)match(input,STRING,FOLLOW_STRING_in_sAnnotationElementSoot3105); b=(Token)match(input,INT,FOLLOW_INT_in_sAnnotationElementSoot3109); retval.nn =unEscapeString((a!=null?a.getText():null)); retval.v =parseFloat((b!=null?b.getText():null)); retval.nn =unEscapeString((a!=null?a.getText():null)); retval.v =parseDouble((b!=null?b.getText():null)); a=(Token)match(input,STRING,FOLLOW_STRING_in_sAnnotationElementSoot3183);
int LA9_0 = input.LA(1); if ( (LA9_0==KW_NOT) ) { alt9=1; switch ( input.LA(1) ) { case DateLiteral: default: NoViableAltException nvae = new NoViableAltException("", 10, 0, input); throw nvae; leftV = FilterLexer.ExtractDate(left.getText()); rightV = FilterLexer.ExtractDate(right.getText()); leftV = TrimQuotes(left.getText()); rightV = TrimQuotes(right.getText()); leftV = Long.parseLong(left.getText()); rightV = Long.parseLong(right.getText()); leftNode.keyName = rightNode.keyName = key.getText(); leftNode.value = leftV; rightNode.value = rightV;
public String getTokenErrorDisplay(Token t) { if (!verboseErrors) { String s = t.getText(); if ( s==null ) { if ( t.getType()==Token.EOF ) { s = "<EOF>"; s = "<"+tokenNames[t.getType()]+">"; channelStr=",channel="+t.getChannel(); String txt = t.getText(); if ( txt!=null ) { txt = txt.replaceAll("\n","\\\\n"); txt = "<no text>"; return "[@"+t.getTokenIndex()+","+ct.getStartIndex()+":"+ct.getStopIndex()+"='"+txt+"',<"+tokenNames[t.getType()]+">"+channelStr+","+t.getLine()+":"+t.getCharPositionInLine()+"]";
int LA121_0 = input.LA(1); if ( (LA121_0==NUMBER) ) { alt121=1; int LA122_0 = input.LA(1); if ( ((LA122_0 >= ROW && LA122_0 <= ROWS)) ) { alt122=1; if ( (input.LA(1) >= ROW && input.LA(1) <= ROWS) ) { input.consume(); state.errorRecovery=false; state.failed=false; state._fsp--; if (state.failed) return ret; if ( state.backtracking==0 ) {ret = factory.fetch(c,true, a == null ? 1 : Integer.parseInt( a.getText() )); }
public final ProtoParser.signed_constant_return signed_constant(Proto proto, HasFields message, Field field, String key, boolean checkDefault) throws RecognitionException { ProtoParser.signed_constant_return retval = new ProtoParser.signed_constant_return(); retval.start = input.LT(1); if ( state.backtracking==0 ) { MINUS119_tree = (Object)adaptor.create(MINUS119); adaptor.addChild(root_0, MINUS119_tree); if ( state.backtracking==0 ) { ID120_tree = (Object)adaptor.create(ID120); adaptor.addChild(root_0, ID120_tree); throw new IllegalStateException("a field can only have a single default value"); String refName = (ID120!=null?ID120.getText():null); if(field instanceof Field.Float) { if("inf".equals(refName)) { retval.stop = input.LT(-1); retval.tree = (Object)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); reportError(re); recover(input,re); retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);
if(!"e".contains((xid!=null?xid.getText():null))){ throw new RecognitionException(input);} c=(Token)match(input,OBJECT_TYPE,FOLLOW_OBJECT_TYPE_in_sAnnotationElement3455); match(input,148,FOLLOW_148_in_sAnnotationElement3457); _t.visit((a!=null?input.toString(a.start,a.stop):null),new String[]{(c!=null?c.getText():null),(b!=null?input.toString(b.start,b.stop):null)}); b2=(Token)match(input,OBJECT_TYPE,FOLLOW_OBJECT_TYPE_in_sAnnotationElement3482); match(input,148,FOLLOW_148_in_sAnnotationElement3484); currentAnnotationVisitor=new AnnotationNode((b2!=null?b2.getText():null)); pushFollow(FOLLOW_sSubannotation_in_sAnnotationElement3488); sSubannotation(); if(!"c".contains((xid!=null?xid.getText():null))){ throw new RecognitionException(input);} match(input,148,FOLLOW_148_in_sAnnotationElement3512); pushFollow(FOLLOW_sClassDesc_in_sAnnotationElement3516); if(!"s".contains((xid!=null?xid.getText():null))){ throw new RecognitionException(input);} match(input,148,FOLLOW_148_in_sAnnotationElement3539); b3=(Token)match(input,STRING,FOLLOW_STRING_in_sAnnotationElement3543); currentAnnotationVisitor.visit((a!=null?input.toString(a.start,a.stop):null),unEscapeString((b3!=null?b3.getText():null))); match(input,148,FOLLOW_148_in_sAnnotationElement3568); b4=(Token)match(input,INT,FOLLOW_INT_in_sAnnotationElement3572); currentAnnotationVisitor.visit((a!=null?input.toString(a.start,a.stop):null),(byte)parseInt((b4!=null?b4.getText():null))); match(input,148,FOLLOW_148_in_sAnnotationElement3593); b5=(Token)match(input,INT,FOLLOW_INT_in_sAnnotationElement3597); currentAnnotationVisitor.visit((a!=null?input.toString(a.start,a.stop):null),0!=parseInt((b5!=null?b5.getText():null)));
int LA12_0 = input.LA(1); if ( (LA12_0==ANNOTATION_VISIBLITY) ) { alt12=1; new NoViableAltException("", 12, 0, input); throw nvae; state._fsp--; currentAnnotationVisitor= currentAv.visitAnnotation(aInternalOrDesc,!(b!=null?b.getText():null).contains("invisible")); state._fsp--; currentAnnotationVisitor=currentAv.visitParameterAnnotation(parseInt((c!=null?c.getText():null)),(a!=null?input.toString(a.start,a.stop):null),!(b!=null?b.getText():null).contains("invisible")); while (true) { int alt13=2; int LA13_0 = input.LA(1); if ( ((LA13_0 >= AND && LA13_0 <= ANNOTATION_VISIBLITY)||LA13_0==AT||LA13_0==DEFAULT||LA13_0==FROM||(LA13_0 >= HIGH && LA13_0 <= INNER)||(LA13_0 >= INVOKEDYNAMIC && LA13_0 <= LDC)||LA13_0==LOCALS||(LA13_0 >= LOOKUPSWITCH && LA13_0 <= METHOD_ANNOTATION_VISIBLITY)||LA13_0==MULTIANEWARRAY||(LA13_0 >= OP0 && LA13_0 <= OUTTER)||LA13_0==STACK||(LA13_0 >= TABLESWITCH && LA13_0 <= WLONG)||(LA13_0 >= WSHORT && LA13_0 <= XTYPE)) ) { alt13=1;
public final CpQueryFilterParser.select_assign_return select_assign() throws RecognitionException { CpQueryFilterParser.select_assign_return retval = new CpQueryFilterParser.select_assign_return(); retval.start = input.LT(1); adaptor.addChild(root_0, target_tree); adaptor.addChild(root_0, char_literal78_tree); adaptor.addChild(root_0, source_tree); parsedQuery.addSelect((target!=null?target.getText():null), (source!=null?source.getText():null)); retval.stop = input.LT(-1); retval.tree = (Object)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
int LA61_0 = input.LA(1); if ( (LA61_0==LOOKUPSWITCH) ) { alt61=1; int LA61_2 = input.LA(2); if ( (LA61_2==INT) ) { int LA61_3 = input.LA(3); if ( (LA61_3==147) ) { alt61=2; try { for (int nvaeConsume = 0; nvaeConsume < 3 - 1; nvaeConsume++) { input.consume(); new NoViableAltException("", 61, 3, input); throw nvae; } finally { new NoViableAltException("", 61, 0, input); throw nvae; state._fsp--; keys.add(parseInt((c!=null?c.getText():null))); labels.add(getLabel((z!=null?input.toString(z.start,z.stop):null))); line((a!=null?a.getLine():0)); mn.visitTableSwitchInsn(parseInt((c!=null?c.getText():null)),parseInt((c!=null?c.getText():null))+labels.size()-1,defaultLabel,labels.toArray(new Label[labels.size()])); line((a!=null?a.getLine():0)); mn.visitTableSwitchInsn(parseInt((c!=null?c.getText():null)),parseInt((c!=null?c.getText():null))+labels.size()-1,defaultLabel,labels.toArray(new Label[labels.size()]));
switch ( input.LA(1) ) { case AND: case ANNOTATION_VISIBLITY: default: NoViableAltException nvae = new NoViableAltException("", 37, 0, input); throw nvae; name =unEscapeString((b!=null?b.getText():null)); name =unEscapeString((c!=null?c.getText():null));
private static List<TokenLocation> buildApexDocTokenLocations(String source) { ANTLRStringStream stream = new ANTLRStringStream(source); ApexLexer lexer = new ApexLexer(stream); ArrayList<TokenLocation> tokenLocations = new ArrayList<>(); int startIndex = 0; Token token = lexer.nextToken(); int endIndex = lexer.getCharIndex(); while (token.getType() != Token.EOF) { if (token.getType() == ApexLexer.BLOCK_COMMENT) { // Filter only block comments starting with "/**" if (token.getText().startsWith("/**")) { tokenLocations.add(new TokenLocation(startIndex, token.getText())); } } // TODO : Check other non-doc comments and tokens of type ApexLexer.EOL_COMMENT for "NOPMD" suppressions startIndex = endIndex; token = lexer.nextToken(); endIndex = lexer.getCharIndex(); } return tokenLocations; }