當前位置: 首頁>>代碼示例>>Java>>正文


Java TokenStream.seek方法代碼示例

本文整理匯總了Java中org.antlr.runtime.TokenStream.seek方法的典型用法代碼示例。如果您正苦於以下問題:Java TokenStream.seek方法的具體用法?Java TokenStream.seek怎麽用?Java TokenStream.seek使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.antlr.runtime.TokenStream的用法示例。


在下文中一共展示了TokenStream.seek方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: specialStateTransition

import org.antlr.runtime.TokenStream; //導入方法依賴的package包/類
public int specialStateTransition(int s, IntStream _input) throws NoViableAltException {
    TokenStream input = (TokenStream)_input;
	int _s = s;
    switch ( s ) {
            case 0 : 
                int LA14_3 = input.LA(1);

                 
                int index14_3 = input.index();
                input.rewind();
                s = -1;
                if ( (synpred9_InternalJavaJRExpression()) ) {s = 19;}

                else if ( (true) ) {s = 4;}

                 
                input.seek(index14_3);
                if ( s>=0 ) return s;
                break;
    }
    if (state.backtracking>0) {state.failed=true; return -1;}
    NoViableAltException nvae =
        new NoViableAltException(getDescription(), 14, _s, input);
    error(nvae);
    throw nvae;
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:27,代碼來源:InternalJavaJRExpressionParser.java

示例2: specialStateTransition

import org.antlr.runtime.TokenStream; //導入方法依賴的package包/類
public int specialStateTransition(int s, IntStream _input) throws NoViableAltException {
    TokenStream input = (TokenStream)_input;
	int _s = s;
    switch ( s ) {
            case 0 : 
                int LA6_3 = input.LA(1);

                 
                int index6_3 = input.index();
                input.rewind();
                s = -1;
                if ( (synpred10_InternalJavaJRExpression()) ) {s = 19;}

                else if ( (true) ) {s = 4;}

                 
                input.seek(index6_3);
                if ( s>=0 ) return s;
                break;
    }
    if (state.backtracking>0) {state.failed=true; return -1;}
    NoViableAltException nvae =
        new NoViableAltException(getDescription(), 6, _s, input);
    error(nvae);
    throw nvae;
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:27,代碼來源:InternalJavaJRExpressionParser.java

示例3: promoteEOL

import org.antlr.runtime.TokenStream; //導入方法依賴的package包/類
/**
 * <p>
 * Promotes EOL which may lead to an automatically inserted semicolon. This is probably the most important method
 * for automatic semicolon insertion, as it is only possible to insert a semicolon in case of line breaks (even if
 * they are hidden in a multi-line comment!).
 * </p>
 */
public static void promoteEOL(Callback callback) {
	RecognizerSharedState state = callback.getState();
	TokenStream input = callback.getInput();
	// Don't promote EOL if there was a syntax error at EOF
	if (state.lastErrorIndex == input.size()) {
		return;
	}
	// Get current token and its type (the possibly offending token).
	Token prev = input.LT(-1);
	Token next = input.LT(1);
	int la = next.getType();

	// Promoting an EOL means switching it from off channel to on channel.
	// A ML_COMMENT gets promoted when it contains an EOL.
	for (int idx = prev == null ? 0 : prev.getTokenIndex() + 1, max = la == Token.EOF ? input.size()
			: next.getTokenIndex(); idx < max; idx++) {
		Token lt = input.get(idx);
		if (lt.getChannel() == Token.DEFAULT_CHANNEL) {
			// On channel token found: stop scanning (previously promoted)
			break;
		} else if (isSemicolonEquivalent(lt)) {
			// We found our EOL: promote the token to on channel, position the input on it and reset the rule
			// start.
			lt.setChannel(Token.DEFAULT_CHANNEL);
			input.seek(idx);
			break;
		}
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:37,代碼來源:SemicolonInjectionHelper.java

示例4: specialStateTransition

import org.antlr.runtime.TokenStream; //導入方法依賴的package包/類
public int specialStateTransition(int s, IntStream _input) throws NoViableAltException {
    TokenStream input = (TokenStream)_input;
	int _s = s;
    switch ( s ) {
            case 0 : 
                int LA57_0 = input.LA(1);

                 
                int index57_0 = input.index();
                input.rewind();
                s = -1;
                if ( (LA57_0==EOF||LA57_0==BOOLEAN_LITERAL||LA57_0==STRING_LITERAL||LA57_0==NULL||LA57_0==CONTAIN||LA57_0==THAN||(LA57_0>=OR && LA57_0<=AND)||(LA57_0>=VAR && LA57_0<=FOR)||(LA57_0>=TRY && LA57_0<=SCRIPTCLOSE)||(LA57_0>=PLUS && LA57_0<=MINUSMINUS)||LA57_0==NOTOP||(LA57_0>=SEMICOLON && LA57_0<=LEFTBRACKET)||(LA57_0>=LEFTPAREN && LA57_0<=IDENTIFIER)||LA57_0==INTEGER_LITERAL||(LA57_0>=FLOATING_POINT_LITERAL && LA57_0<=138)||LA57_0==144) ) {s = 1;}

                else if ( (LA57_0==DOES) ) {s = 2;}

                else if ( (LA57_0==GREATER) ) {s = 3;}

                else if ( (LA57_0==LESS) ) {s = 4;}

                else if ( (LA57_0==NOT) ) {s = 5;}

                else if ( (LA57_0==IN) && ((!scriptMode))) {s = 6;}

                else if ( ((LA57_0>=EQUALSOP && LA57_0<=COLON)||LA57_0==QUESTIONMARK||LA57_0==RIGHTBRACKET) ) {s = 7;}

                else if ( (LA57_0==LT) ) {s = 8;}

                else if ( (LA57_0==CONTAINS||(LA57_0>=IS && LA57_0<=LTE)||(LA57_0>=LE && LA57_0<=NEQ)||LA57_0==EQUALSEQUALSOP||(LA57_0>=139 && LA57_0<=143)) ) {s = 9;}

                 
                input.seek(index57_0);
                if ( s>=0 ) return s;
                break;
    }
    if (state.backtracking>0) {state.failed=true; return -1;}
    NoViableAltException nvae =
        new NoViableAltException(getDescription(), 57, _s, input);
    error(nvae);
    throw nvae;
}
 
開發者ID:OpenBD,項目名稱:openbd-core,代碼行數:41,代碼來源:CFMLParser.java

示例5: specialStateTransition

import org.antlr.runtime.TokenStream; //導入方法依賴的package包/類
public int specialStateTransition(int s, IntStream _input) throws NoViableAltException {
    TokenStream input = (TokenStream)_input;
	int _s = s;
    switch ( s ) {
            case 0 : 
                int LA8_2 = input.LA(1);

                 
                int index8_2 = input.index();
                input.rewind();
                s = -1;
                if ( (((!address.isStreetTypePrefix() || ("C".equals(address.getStreetType()) && address.getStreetNumberSuffix() == null)) && addressDatabase.containsStreetType(input.LT(1).getText()))) ) {s = 7;}

                else if ( ((hasStreetNameStarted && Address.isStreetDirection(input.LT(1).getText()))) ) {s = 8;}

                else if ( (((!hasStreetNameStarted) && address.getStreetType() == null)) ) {s = 10;}

                else if ( (true) ) {s = 5;}

                 
                input.seek(index8_2);
                if ( s>=0 ) return s;
                break;
            case 1 : 
                int LA8_3 = input.LA(1);

                 
                int index8_3 = input.index();
                input.rewind();
                s = -1;
                if ( (((!hasStreetNameStarted) && address.getStreetType() == null)) ) {s = 10;}

                else if ( (true) ) {s = 5;}

                 
                input.seek(index8_3);
                if ( s>=0 ) return s;
                break;
            case 2 : 
                int LA8_4 = input.LA(1);

                 
                int index8_4 = input.index();
                input.rewind();
                s = -1;
                if ( ((hasStreetNameStarted)) ) {s = 11;}

                else if ( (true) ) {s = 5;}

                 
                input.seek(index8_4);
                if ( s>=0 ) return s;
                break;
            case 3 : 
                int LA8_1 = input.LA(1);

                 
                int index8_1 = input.index();
                input.rewind();
                s = -1;
                if ( (LA8_1==NUMBER) && ((Address.isSuiteType(input.LT(1).getText())))) {s = 6;}

                else if ( (((!address.isStreetTypePrefix() || ("C".equals(address.getStreetType()) && address.getStreetNumberSuffix() == null)) && addressDatabase.containsStreetType(input.LT(1).getText()))) ) {s = 7;}

                else if ( ((hasStreetNameStarted && Address.isStreetDirection(input.LT(1).getText()))) ) {s = 8;}

                else if ( ((((hasStreetNameStarted && startsUrbanNotRural)&&(Address.isRuralRoute(input.LT(1).getText() + " " + input.LT(2).getText() + " " + input.LT(3).getText())))||((hasStreetNameStarted && startsUrbanNotRural)&&(Address.isRuralRoute(input.LT(1).getText() + " " + input.LT(2).getText())))||((hasStreetNameStarted && startsUrbanNotRural)&&(Address.isRuralRoute(input.LT(1).getText()))))) ) {s = 9;}

                else if ( (true) ) {s = 5;}

                 
                input.seek(index8_1);
                if ( s>=0 ) return s;
                break;
    }
    NoViableAltException nvae =
        new NoViableAltException(getDescription(), 8, _s, input);
    error(nvae);
    throw nvae;
}
 
開發者ID:SQLPower,項目名稱:power-matchmaker,代碼行數:81,代碼來源:AddressParser.java


注:本文中的org.antlr.runtime.TokenStream.seek方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。