本文整理匯總了Java中org.antlr.v4.runtime.misc.Interval.INVALID屬性的典型用法代碼示例。如果您正苦於以下問題:Java Interval.INVALID屬性的具體用法?Java Interval.INVALID怎麽用?Java Interval.INVALID使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.antlr.v4.runtime.misc.Interval
的用法示例。
在下文中一共展示了Interval.INVALID屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getSourceInterval
public static Interval getSourceInterval(@NonNull ParseTree context) {
Parameters.notNull("context", context);
if (context instanceof TerminalNode) {
TerminalNode terminalNode = (TerminalNode)context;
Token token = terminalNode.getSymbol();
return new Interval(token.getStartIndex(), token.getStopIndex());
} else if (context instanceof RuleNode) {
RuleNode ruleNode = (RuleNode)context;
RuleContext ruleContext = ruleNode.getRuleContext();
if (ruleContext instanceof ParserRuleContext) {
return getSourceInterval((ParserRuleContext)ruleContext);
} else {
Token startSymbol = getStartSymbol(context);
Token stopSymbol = getStopSymbol(context);
if (startSymbol == null || stopSymbol == null) {
return Interval.INVALID;
}
return new Interval(startSymbol.getStartIndex(), stopSymbol.getStopIndex());
}
} else {
return Interval.INVALID;
}
}
示例2: getStateToGrammarRegion
/** Given an ATN state number, return the token index range within the grammar from which that ATN state was derived. */
public Interval getStateToGrammarRegion(int atnStateNumber) {
if ( stateToGrammarRegionMap==null ) {
stateToGrammarRegionMap = getStateToGrammarRegionMap(ast, null); // map all nodes with non-null atn state ptr
}
if ( stateToGrammarRegionMap==null ) return Interval.INVALID;
return stateToGrammarRegionMap.get(atnStateNumber);
}
示例3: getSourceInterval
@Override
public Interval getSourceInterval() {
if ( symbol ==null ) return Interval.INVALID;
int tokenIndex = symbol.getTokenIndex();
return new Interval(tokenIndex, tokenIndex);
}
示例4: getSourceInterval
@Override
public Interval getSourceInterval() {
if ( start==null || stop==null ) return Interval.INVALID;
return Interval.of(start.getTokenIndex(), stop.getTokenIndex());
}
示例5: getSourceInterval
@Override
public Interval getSourceInterval() {
return Interval.INVALID;
}