/**
* Computes the set of conflicting or ambiguous alternatives from a
* configuration set, if that information was not already provided by the
* parser.
*
* @param reportedAlts The set of conflicting or ambiguous alternatives, as
* reported by the parser.
* @param configs The conflicting or ambiguous configuration set.
* @return Returns {@code reportedAlts} if it is not {@code null}, otherwise
* returns the set of alternatives represented in {@code configs}.
*/
@NotNull
protected BitSet getConflictingAlts(@Nullable BitSet reportedAlts, @NotNull ATNConfigSet configs) {
if (reportedAlts != null) {
return reportedAlts;
}
BitSet result = new BitSet();
for (ATNConfig config : configs) {
result.set(config.alt);
}
return result;
}
java类org.antlr.v4.runtime.misc.Nullable的实例源码
DiagnosticErrorListener.java 文件源码
项目:Scratch-ApuC
阅读 23
收藏 0
点赞 0
评论 0
RootView.java 文件源码
项目:sres
阅读 30
收藏 0
点赞 0
评论 0
public RootView(@NotNull String name, @Nullable String subclass,
@NotNull java.util.Set<Attribute> attributes, @NotNull List<Child> children) {
view = new View(name, attributes, children);
this.subclass = subclass;
this.bindClass = findBindClass();
if (this.bindClass == null) {
verifyNoBindings(view);
}
}
ATNConfig.java 文件源码
项目:Scratch-ApuC
阅读 23
收藏 0
点赞 0
评论 0
public ATNConfig(@NotNull ATNState state,
int alt,
@Nullable PredictionContext context,
@NotNull SemanticContext semanticContext)
{
this.state = state;
this.alt = alt;
this.context = context;
this.semanticContext = semanticContext;
}
ATNConfig.java 文件源码
项目:Scratch-ApuC
阅读 22
收藏 0
点赞 0
评论 0
public String toString(@Nullable Recognizer<?, ?> recog, boolean showAlt) {
StringBuilder buf = new StringBuilder();
// if ( state.ruleIndex>=0 ) {
// if ( recog!=null ) buf.append(recog.getRuleNames()[state.ruleIndex]+":");
// else buf.append(state.ruleIndex+":");
// }
buf.append('(');
buf.append(state);
if ( showAlt ) {
buf.append(",");
buf.append(alt);
}
if ( context!=null ) {
buf.append(",[");
buf.append(context.toString());
buf.append("]");
}
if ( semanticContext!=null && semanticContext != SemanticContext.NONE ) {
buf.append(",");
buf.append(semanticContext);
}
if ( reachesIntoOuterContext>0 ) {
buf.append(",up=").append(reachesIntoOuterContext);
}
buf.append(')');
return buf.toString();
}
ParserATNSimulator.java 文件源码
项目:Scratch-ApuC
阅读 27
收藏 0
点赞 0
评论 0
public ParserATNSimulator(@Nullable Parser parser, @NotNull ATN atn,
@NotNull DFA[] decisionToDFA,
@NotNull PredictionContextCache sharedContextCache)
{
super(atn, sharedContextCache);
this.parser = parser;
this.decisionToDFA = decisionToDFA;
// DOTGenerator dot = new DOTGenerator(null);
// System.out.println(dot.getDOT(atn.rules.get(0), parser.getRuleNames()));
// System.out.println(dot.getDOT(atn.rules.get(1), parser.getRuleNames()));
}
ParserATNSimulator.java 文件源码
项目:Scratch-ApuC
阅读 32
收藏 0
点赞 0
评论 0
@Nullable
protected ATNState getReachableTarget(@NotNull Transition trans, int ttype) {
if (trans.matches(ttype, 0, atn.maxTokenType)) {
return trans.target;
}
return null;
}
Parser.java 文件源码
项目:Scratch-ApuC
阅读 20
收藏 0
点赞 0
评论 0
public void notifyErrorListeners(@NotNull Token offendingToken, @NotNull String msg,
@Nullable RecognitionException e)
{
_syntaxErrors++;
int line = -1;
int charPositionInLine = -1;
line = offendingToken.getLine();
charPositionInLine = offendingToken.getCharPositionInLine();
ANTLRErrorListener listener = getErrorListenerDispatch();
listener.syntaxError(this, offendingToken, line, charPositionInLine, msg, e);
}
ParserATNSimulator.java 文件源码
项目:Scratch-ApuC
阅读 25
收藏 0
点赞 0
评论 0
/** If context sensitive parsing, we know it's ambiguity not conflict */
protected void reportAmbiguity(@NotNull DFA dfa, DFAState D, int startIndex, int stopIndex,
boolean exact,
@Nullable BitSet ambigAlts,
@NotNull ATNConfigSet configs)
{
if ( debug || retry_debug ) {
Interval interval = Interval.of(startIndex, stopIndex);
System.out.println("reportAmbiguity "+
ambigAlts+":"+configs+
", input="+parser.getTokenStream().getText(interval));
}
if ( parser!=null ) parser.getErrorListenerDispatch().reportAmbiguity(parser, dfa, startIndex, stopIndex,
exact, ambigAlts, configs);
}
ATNDeserializer.java 文件源码
项目:Scratch-ApuC
阅读 28
收藏 0
点赞 0
评论 0
public ATNDeserializer(@Nullable ATNDeserializationOptions deserializationOptions) {
if (deserializationOptions == null) {
deserializationOptions = ATNDeserializationOptions.getDefaultOptions();
}
this.deserializationOptions = deserializationOptions;
}
ProfilingATNSimulator.java 文件源码
项目:Scratch-ApuC
阅读 20
收藏 0
点赞 0
评论 0
@Override
protected void reportAttemptingFullContext(@NotNull DFA dfa, @Nullable BitSet conflictingAlts, @NotNull ATNConfigSet configs, int startIndex, int stopIndex) {
if ( conflictingAlts!=null ) {
conflictingAltResolvedBySLL = conflictingAlts.nextSetBit(0);
}
else {
conflictingAltResolvedBySLL = configs.getAlts().nextSetBit(0);
}
decisions[currentDecision].LL_Fallback++;
super.reportAttemptingFullContext(dfa, conflictingAlts, configs, startIndex, stopIndex);
}