本文整理了Java中org.antlr.runtime.IntStream.seek()
方法的一些代码示例,展示了IntStream.seek()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IntStream.seek()
方法的具体详情如下:
包路径:org.antlr.runtime.IntStream
类名称:IntStream
方法名:seek
[英]Set the input cursor to the position indicated by index. This is normally used to seek ahead in the input stream. No buffering is required to do this unless you know your stream will use seek to move backwards such as when backtracking. This is different from rewind in its multi-directional requirement and in that its argument is strictly an input cursor (index). For char streams, seeking forward must update the stream state such as line number. For seeking backwards, you will be presumably backtracking using the mark/rewind mechanism that restores state and so this method does not need to update state when seeking backwards. Currently, this method is only used for efficient backtracking using memoization, but in the future it may be used for incremental parsing. The index is 0..n-1. A seek to position i means that LA(1) will return the ith symbol. So, seeking to 0 means LA(1) will return the first element in the stream.
[中]将输入光标设置到索引指示的位置。这通常用于在输入流中向前搜索。除非您知道您的流将使用seek向后移动(例如在回溯时),否则不需要缓冲来执行此操作。这与倒带的多向性要求不同,它的参数严格来说是一个输入游标(索引)。对于字符流,向前搜索必须更新流状态,如行号。对于向后搜索,您可能正在使用标记/倒带机制进行回溯,该机制恢复状态,因此此方法在向后搜索时不需要更新状态。目前,该方法仅用于使用记忆的有效回溯,但在将来它可能用于增量解析。索引是0。。n-1。A对位置i的搜索意味着LA(1)将返回第i个符号。因此,寻求0意味着LA(1)将返回流中的第一个元素。
代码示例来源:origin: apache/hive
else if ( (true) ) {s = 6;}
input.seek(index29_5);
if ( s>=0 ) return s;
break;
代码示例来源:origin: apache/drill
else if ( (true) ) {s = 6;}
input.seek(index28_5);
if ( s>=0 ) return s;
break;
代码示例来源:origin: antlr/antlr3
/** Has this rule already parsed input at the current index in the
* input stream? Return the stop token index or MEMO_RULE_UNKNOWN.
* If we attempted but failed to parse properly before, return
* MEMO_RULE_FAILED.
*
* This method has a side-effect: if we have seen this input for
* this rule and successfully parsed before, then seek ahead to
* 1 past the stop token matched for this rule last time.
*/
public boolean alreadyParsedRule(IntStream input, int ruleIndex) {
int stopIndex = getRuleMemoization(ruleIndex, input.index());
if ( stopIndex==MEMO_RULE_UNKNOWN ) {
return false;
}
if ( stopIndex==MEMO_RULE_FAILED ) {
//System.out.println("rule "+ruleIndex+" will never succeed");
state.failed=true;
}
else {
//System.out.println("seen rule "+ruleIndex+" before; skipping ahead to @"+(stopIndex+1)+" failed="+state.failed);
input.seek(stopIndex+1); // jump to one past stop token
}
return true;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
/** Has this rule already parsed input at the current index in the
* input stream? Return the stop token index or MEMO_RULE_UNKNOWN.
* If we attempted but failed to parse properly before, return
* MEMO_RULE_FAILED.
*
* This method has a side-effect: if we have seen this input for
* this rule and successfully parsed before, then seek ahead to
* 1 past the stop token matched for this rule last time.
*/
public boolean alreadyParsedRule(IntStream input, int ruleIndex) {
int stopIndex = getRuleMemoization(ruleIndex, input.index());
if ( stopIndex==MEMO_RULE_UNKNOWN ) {
return false;
}
if ( stopIndex==MEMO_RULE_FAILED ) {
//System.out.println("rule "+ruleIndex+" will never succeed");
state.failed=true;
}
else {
//System.out.println("seen rule "+ruleIndex+" before; skipping ahead to @"+(stopIndex+1)+" failed="+state.failed);
input.seek(stopIndex+1); // jump to one past stop token
}
return true;
}
代码示例来源:origin: antlr/antlr3
/** Has this rule already parsed input at the current index in the
* input stream? Return the stop token index or MEMO_RULE_UNKNOWN.
* If we attempted but failed to parse properly before, return
* MEMO_RULE_FAILED.
*
* This method has a side-effect: if we have seen this input for
* this rule and successfully parsed before, then seek ahead to
* 1 past the stop token matched for this rule last time.
*/
public boolean alreadyParsedRule(IntStream input, int ruleIndex) {
int stopIndex = getRuleMemoization(ruleIndex, input.index());
if ( stopIndex==MEMO_RULE_UNKNOWN ) {
return false;
}
if ( stopIndex==MEMO_RULE_FAILED ) {
//System.out.println("rule "+ruleIndex+" will never succeed");
state.failed=true;
}
else {
//System.out.println("seen rule "+ruleIndex+" before; skipping ahead to @"+(stopIndex+1)+" failed="+state.failed);
input.seek(stopIndex+1); // jump to one past stop token
}
return true;
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/** Has this rule already parsed input at the current index in the
* input stream? Return the stop token index or MEMO_RULE_UNKNOWN.
* If we attempted but failed to parse properly before, return
* MEMO_RULE_FAILED.
*
* This method has a side-effect: if we have seen this input for
* this rule and successfully parsed before, then seek ahead to
* 1 past the stop token matched for this rule last time.
*/
public boolean alreadyParsedRule(IntStream input, int ruleIndex) {
int stopIndex = getRuleMemoization(ruleIndex, input.index());
if ( stopIndex==MEMO_RULE_UNKNOWN ) {
return false;
}
if ( stopIndex==MEMO_RULE_FAILED ) {
//System.out.println("rule "+ruleIndex+" will never succeed");
state.failed=true;
}
else {
//System.out.println("seen rule "+ruleIndex+" before; skipping ahead to @"+(stopIndex+1)+" failed="+state.failed);
input.seek(stopIndex+1); // jump to one past stop token
}
return true;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr-runtime
/** Has this rule already parsed input at the current index in the
* input stream? Return the stop token index or MEMO_RULE_UNKNOWN.
* If we attempted but failed to parse properly before, return
* MEMO_RULE_FAILED.
*
* This method has a side-effect: if we have seen this input for
* this rule and successfully parsed before, then seek ahead to
* 1 past the stop token matched for this rule last time.
*/
public boolean alreadyParsedRule(IntStream input, int ruleIndex) {
int stopIndex = getRuleMemoization(ruleIndex, input.index());
if ( stopIndex==MEMO_RULE_UNKNOWN ) {
return false;
}
if ( stopIndex==MEMO_RULE_FAILED ) {
//System.out.println("rule "+ruleIndex+" will never succeed");
state.failed=true;
}
else {
//System.out.println("seen rule "+ruleIndex+" before; skipping ahead to @"+(stopIndex+1)+" failed="+state.failed);
input.seek(stopIndex+1); // jump to one past stop token
}
return true;
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/** Has this rule already parsed input at the current index in the
* input stream? Return the stop token index or MEMO_RULE_UNKNOWN.
* If we attempted but failed to parse properly before, return
* MEMO_RULE_FAILED.
*
* This method has a side-effect: if we have seen this input for
* this rule and successfully parsed before, then seek ahead to
* 1 past the stop token matched for this rule last time.
*/
public boolean alreadyParsedRule(IntStream input, int ruleIndex) {
int stopIndex = getRuleMemoization(ruleIndex, input.index());
if ( stopIndex==MEMO_RULE_UNKNOWN ) {
return false;
}
if ( stopIndex==MEMO_RULE_FAILED ) {
//System.out.println("rule "+ruleIndex+" will never succeed");
state.failed=true;
}
else {
//System.out.println("seen rule "+ruleIndex+" before; skipping ahead to @"+(stopIndex+1)+" failed="+state.failed);
input.seek(stopIndex+1); // jump to one past stop token
}
return true;
}
代码示例来源:origin: org.databene/databene-formats
input.seek(index3_0);
if ( s>=0 ) return s;
break;
代码示例来源:origin: org.databene/databene-webdecs
input.seek(index3_0);
if ( s>=0 ) return s;
break;
代码示例来源:origin: com.github.sommeri/less4j
input.seek(index201_21);
if ( s>=0 ) return s;
break;
input.seek(index201_22);
if ( s>=0 ) return s;
break;
input.seek(index201_29);
if ( s>=0 ) return s;
break;
input.seek(index201_11);
if ( s>=0 ) return s;
break;
代码示例来源:origin: com.github.sommeri/less4j
input.seek(index213_75);
if ( s>=0 ) return s;
break;
input.seek(index213_76);
if ( s>=0 ) return s;
break;
input.seek(index213_84);
if ( s>=0 ) return s;
break;
input.seek(index213_64);
if ( s>=0 ) return s;
break;
代码示例来源:origin: com.github.sommeri/less4j
input.seek(index221_33);
if ( s>=0 ) return s;
break;
input.seek(index221_53);
if ( s>=0 ) return s;
break;
input.seek(index221_44);
if ( s>=0 ) return s;
break;
input.seek(index221_45);
if ( s>=0 ) return s;
break;
代码示例来源:origin: com.tunnelvisionlabs/antlr4
else s = 38;
input.seek(index35_2);
if ( s>=0 ) return s;
break;
代码示例来源:origin: io.virtdata/virtdata-lib-realer
else s = 38;
input.seek(index35_2);
if ( s>=0 ) return s;
break;
代码示例来源:origin: org.antlr/antlr4
else s = 38;
input.seek(index35_2);
if ( s>=0 ) return s;
break;
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
else s = 38;
input.seek(index34_2);
if ( s>=0 ) return s;
break;
代码示例来源:origin: uk.co.nichesolutions/antlr4
else s = 38;
input.seek(index34_2);
if ( s>=0 ) return s;
break;
代码示例来源:origin: com.facebook.presto.hive/hive-apache
input.seek(index21_5);
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
input.seek(index28_2);
if ( s>=0 ) return s;
break;
input.seek(index28_23);
if ( s>=0 ) return s;
break;
内容来源于网络,如有侵权,请联系作者删除!