本文整理了Java中org.antlr.runtime.IntStream.index()
方法的一些代码示例,展示了IntStream.index()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IntStream.index()
方法的具体详情如下:
包路径:org.antlr.runtime.IntStream
类名称:IntStream
方法名:index
[英]Return the current input symbol index 0..n where n indicates the last symbol has been read. The index is the symbol about to be read not the most recently read symbol.
[中]返回当前输入符号索引0。。n其中n表示已读取最后一个符号。索引是即将读取的符号,而不是最近读取的符号。
代码示例来源:origin: apache/hive
int LA29_5 = input.LA(1);
int index29_5 = input.index();
input.rewind();
s = -1;
代码示例来源:origin: apache/drill
int LA28_5 = input.LA(1);
int index28_5 = input.index();
input.rewind();
s = -1;
代码示例来源:origin: antlr/antlr3
/** Record whether or not this rule parsed the input at this position
* successfully. Use a standard java hashtable for now.
*/
public void memoize(IntStream input,
int ruleIndex,
int ruleStartIndex)
{
int stopTokenIndex = state.failed?MEMO_RULE_FAILED:input.index()-1;
if ( state.ruleMemo==null ) {
System.err.println("!!!!!!!!! memo array is null for "+ getGrammarFileName());
}
if ( ruleIndex >= state.ruleMemo.length ) {
System.err.println("!!!!!!!!! memo size is "+state.ruleMemo.length+", but rule index is "+ruleIndex);
}
if ( state.ruleMemo[ruleIndex]!=null ) {
state.ruleMemo[ruleIndex].put(ruleStartIndex, stopTokenIndex);
}
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/** Record whether or not this rule parsed the input at this position
* successfully. Use a standard java hashtable for now.
*/
public void memoize(IntStream input,
int ruleIndex,
int ruleStartIndex)
{
int stopTokenIndex = state.failed?MEMO_RULE_FAILED:input.index()-1;
if ( state.ruleMemo==null ) {
System.err.println("!!!!!!!!! memo array is null for "+ getGrammarFileName());
}
if ( ruleIndex >= state.ruleMemo.length ) {
System.err.println("!!!!!!!!! memo size is "+state.ruleMemo.length+", but rule index is "+ruleIndex);
}
if ( state.ruleMemo[ruleIndex]!=null ) {
state.ruleMemo[ruleIndex].put(ruleStartIndex, stopTokenIndex);
}
}
代码示例来源:origin: antlr/antlr3
/** Record whether or not this rule parsed the input at this position
* successfully. Use a standard java hashtable for now.
*/
public void memoize(IntStream input,
int ruleIndex,
int ruleStartIndex)
{
int stopTokenIndex = state.failed?MEMO_RULE_FAILED:input.index()-1;
if ( state.ruleMemo==null ) {
System.err.println("!!!!!!!!! memo array is null for "+ getGrammarFileName());
}
if ( ruleIndex >= state.ruleMemo.length ) {
System.err.println("!!!!!!!!! memo size is "+state.ruleMemo.length+", but rule index is "+ruleIndex);
}
if ( state.ruleMemo[ruleIndex]!=null ) {
state.ruleMemo[ruleIndex].put(ruleStartIndex, stopTokenIndex);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr-runtime
/** Record whether or not this rule parsed the input at this position
* successfully. Use a standard java hashtable for now.
*/
public void memoize(IntStream input,
int ruleIndex,
int ruleStartIndex)
{
int stopTokenIndex = state.failed?MEMO_RULE_FAILED:input.index()-1;
if ( state.ruleMemo==null ) {
System.err.println("!!!!!!!!! memo array is null for "+ getGrammarFileName());
}
if ( ruleIndex >= state.ruleMemo.length ) {
System.err.println("!!!!!!!!! memo size is "+state.ruleMemo.length+", but rule index is "+ruleIndex);
}
if ( state.ruleMemo[ruleIndex]!=null ) {
state.ruleMemo[ruleIndex].put(ruleStartIndex, stopTokenIndex);
}
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/** Record whether or not this rule parsed the input at this position
* successfully. Use a standard java hashtable for now.
*/
public void memoize(IntStream input,
int ruleIndex,
int ruleStartIndex)
{
int stopTokenIndex = state.failed?MEMO_RULE_FAILED:input.index()-1;
if ( state.ruleMemo==null ) {
System.err.println("!!!!!!!!! memo array is null for "+ getGrammarFileName());
}
if ( ruleIndex >= state.ruleMemo.length ) {
System.err.println("!!!!!!!!! memo size is "+state.ruleMemo.length+", but rule index is "+ruleIndex);
}
if ( state.ruleMemo[ruleIndex]!=null ) {
state.ruleMemo[ruleIndex].put(ruleStartIndex, stopTokenIndex);
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
/** Record whether or not this rule parsed the input at this position
* successfully. Use a standard java hashtable for now.
*/
public void memoize(IntStream input,
int ruleIndex,
int ruleStartIndex)
{
int stopTokenIndex = state.failed?MEMO_RULE_FAILED:input.index()-1;
if ( state.ruleMemo==null ) {
System.err.println("!!!!!!!!! memo array is null for "+ getGrammarFileName());
}
if ( ruleIndex >= state.ruleMemo.length ) {
System.err.println("!!!!!!!!! memo size is "+state.ruleMemo.length+", but rule index is "+ruleIndex);
}
if ( state.ruleMemo[ruleIndex]!=null ) {
state.ruleMemo[ruleIndex].put(
new Integer(ruleStartIndex), new Integer(stopTokenIndex)
);
}
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/** Recover from an error found on the input stream. This is
* for NoViableAlt and mismatched symbol exceptions. If you enable
* single token insertion and deletion, this will usually not
* handle mismatched symbol exceptions but there could be a mismatched
* token that the match() routine could not recover from.
*/
public void recover(IntStream input, RecognitionException re) {
if ( state.lastErrorIndex==input.index() ) {
// uh oh, another error at same token index; must be a case
// where LT(1) is in the recovery token set so nothing is
// consumed; consume a single token so at least to prevent
// an infinite loop; this is a failsafe.
input.consume();
}
state.lastErrorIndex = input.index();
BitSet followSet = computeErrorRecoverySet();
beginResync();
consumeUntil(input, followSet);
endResync();
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
/** Recover from an error found on the input stream. This is
* for NoViableAlt and mismatched symbol exceptions. If you enable
* single token insertion and deletion, this will usually not
* handle mismatched symbol exceptions but there could be a mismatched
* token that the match() routine could not recover from.
*/
public void recover(IntStream input, RecognitionException re) {
if ( state.lastErrorIndex==input.index() ) {
// uh oh, another error at same token index; must be a case
// where LT(1) is in the recovery token set so nothing is
// consumed; consume a single token so at least to prevent
// an infinite loop; this is a failsafe.
input.consume();
}
state.lastErrorIndex = input.index();
BitSet followSet = computeErrorRecoverySet();
beginResync();
consumeUntil(input, followSet);
endResync();
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/** Recover from an error found on the input stream. This is
* for NoViableAlt and mismatched symbol exceptions. If you enable
* single token insertion and deletion, this will usually not
* handle mismatched symbol exceptions but there could be a mismatched
* token that the match() routine could not recover from.
*/
public void recover(IntStream input, RecognitionException re) {
if ( state.lastErrorIndex==input.index() ) {
// uh oh, another error at same token index; must be a case
// where LT(1) is in the recovery token set so nothing is
// consumed; consume a single token so at least to prevent
// an infinite loop; this is a failsafe.
input.consume();
}
state.lastErrorIndex = input.index();
BitSet followSet = computeErrorRecoverySet();
beginResync();
consumeUntil(input, followSet);
endResync();
}
代码示例来源:origin: antlr/antlr3
/** Recover from an error found on the input stream. This is
* for NoViableAlt and mismatched symbol exceptions. If you enable
* single token insertion and deletion, this will usually not
* handle mismatched symbol exceptions but there could be a mismatched
* token that the match() routine could not recover from.
*/
public void recover(IntStream input, RecognitionException re) {
if ( state.lastErrorIndex==input.index() ) {
// uh oh, another error at same token index; must be a case
// where LT(1) is in the recovery token set so nothing is
// consumed; consume a single token so at least to prevent
// an infinite loop; this is a failsafe.
input.consume();
}
state.lastErrorIndex = input.index();
BitSet followSet = computeErrorRecoverySet();
beginResync();
consumeUntil(input, followSet);
endResync();
}
代码示例来源:origin: antlr/antlr3
/** Recover from an error found on the input stream. This is
* for NoViableAlt and mismatched symbol exceptions. If you enable
* single token insertion and deletion, this will usually not
* handle mismatched symbol exceptions but there could be a mismatched
* token that the match() routine could not recover from.
*/
public void recover(IntStream input, RecognitionException re) {
if ( state.lastErrorIndex==input.index() ) {
// uh oh, another error at same token index; must be a case
// where LT(1) is in the recovery token set so nothing is
// consumed; consume a single token so at least to prevent
// an infinite loop; this is a failsafe.
input.consume();
}
state.lastErrorIndex = input.index();
BitSet followSet = computeErrorRecoverySet();
beginResync();
consumeUntil(input, followSet);
endResync();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr-runtime
/** Recover from an error found on the input stream. This is
* for NoViableAlt and mismatched symbol exceptions. If you enable
* single token insertion and deletion, this will usually not
* handle mismatched symbol exceptions but there could be a mismatched
* token that the match() routine could not recover from.
*/
public void recover(IntStream input, RecognitionException re) {
if ( state.lastErrorIndex==input.index() ) {
// uh oh, another error at same token index; must be a case
// where LT(1) is in the recovery token set so nothing is
// consumed; consume a single token so at least to prevent
// an infinite loop; this is a failsafe.
input.consume();
}
state.lastErrorIndex = input.index();
BitSet followSet = computeErrorRecoverySet();
beginResync();
consumeUntil(input, followSet);
endResync();
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
public RecognitionException(IntStream input) {
this.input = input;
this.index = input.index();
if ( input instanceof TokenStream ) {
this.token = ((TokenStream)input).LT(1);
this.line = token.getLine();
this.charPositionInLine = token.getCharPositionInLine();
}
if ( input instanceof TreeNodeStream ) {
extractInformationFromTreeNodeStream(input);
}
else if ( input instanceof CharStream ) {
this.c = input.LA(1);
this.line = ((CharStream)input).getLine();
this.charPositionInLine = ((CharStream)input).getCharPositionInLine();
}
else {
this.c = input.LA(1);
}
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
public RecognitionException(IntStream input) {
this.input = input;
this.index = input.index();
if ( input instanceof TokenStream ) {
this.token = ((TokenStream)input).LT(1);
this.line = token.getLine();
this.charPositionInLine = token.getCharPositionInLine();
}
if ( input instanceof TreeNodeStream ) {
extractInformationFromTreeNodeStream(input);
}
else if ( input instanceof CharStream ) {
this.c = input.LA(1);
this.line = ((CharStream)input).getLine();
this.charPositionInLine = ((CharStream)input).getCharPositionInLine();
}
else {
this.c = input.LA(1);
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
public RecognitionException(IntStream input) {
this.input = input;
this.index = input.index();
if ( input instanceof TokenStream ) {
this.token = ((TokenStream)input).LT(1);
this.line = token.getLine();
this.charPositionInLine = token.getCharPositionInLine();
}
if ( input instanceof TreeNodeStream ) {
extractInformationFromTreeNodeStream(input);
}
else if ( input instanceof CharStream ) {
this.c = input.LA(1);
this.line = ((CharStream)input).getLine();
this.charPositionInLine = ((CharStream)input).getCharPositionInLine();
}
else {
this.c = input.LA(1);
}
}
代码示例来源:origin: antlr/antlr3
public RecognitionException(IntStream input) {
this.input = input;
this.index = input.index();
if ( input instanceof TokenStream ) {
this.token = ((TokenStream)input).LT(1);
this.line = token.getLine();
this.charPositionInLine = token.getCharPositionInLine();
}
if ( input instanceof TreeNodeStream ) {
extractInformationFromTreeNodeStream(input);
}
else if ( input instanceof CharStream ) {
this.c = input.LA(1);
this.line = ((CharStream)input).getLine();
this.charPositionInLine = ((CharStream)input).getCharPositionInLine();
}
else {
this.c = input.LA(1);
}
}
代码示例来源:origin: antlr/antlr3
public RecognitionException(IntStream input) {
this.input = input;
this.index = input.index();
if ( input instanceof TokenStream ) {
this.token = ((TokenStream)input).LT(1);
this.line = token.getLine();
this.charPositionInLine = token.getCharPositionInLine();
}
if ( input instanceof TreeNodeStream ) {
extractInformationFromTreeNodeStream(input);
}
else if ( input instanceof CharStream ) {
this.c = input.LA(1);
this.line = ((CharStream)input).getLine();
this.charPositionInLine = ((CharStream)input).getCharPositionInLine();
}
else {
this.c = input.LA(1);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr-runtime
public RecognitionException(IntStream input) {
this.input = input;
this.index = input.index();
if ( input instanceof TokenStream ) {
this.token = ((TokenStream)input).LT(1);
this.line = token.getLine();
this.charPositionInLine = token.getCharPositionInLine();
}
if ( input instanceof TreeNodeStream ) {
extractInformationFromTreeNodeStream(input);
}
else if ( input instanceof CharStream ) {
this.c = input.LA(1);
this.line = ((CharStream)input).getLine();
this.charPositionInLine = ((CharStream)input).getCharPositionInLine();
}
else {
this.c = input.LA(1);
}
}
内容来源于网络,如有侵权,请联系作者删除!