/** * Gets the label associated with the rule tag. * * @return The name of the label associated with the rule tag, or * {@code null} if this is an unlabeled rule tag. */ @Nullable public final String getLabel() { return label; }
/** * Get the node at which we first detected a mismatch. * * @return the node at which we first detected a mismatch, or {@code null} * if the match was successful. */ @Nullable public ParseTree getMismatchedNode() { return mismatchedNode; }
/** * Gets the {@link RuleContext} at the time this exception was thrown. * * <p>If the context is not available, this method returns {@code null}.</p> * * @return The {@link RuleContext} at the time this exception was thrown. * If the context is not available, this method returns {@code null}. */ @Nullable public RuleContext getContext() { return ctx; }
/** For testing; builds trees, does sem anal */ public Grammar(String fileName, String grammarText, @Nullable ANTLRToolListener listener) throws org.antlr.runtime.RecognitionException { this(fileName, grammarText, null, listener); }
/** * Return a new {@link IntSet} object containing all elements that are * present in both the current set and the specified set {@code a}. * * @param a The set to intersect with the current set. A {@code null} * argument is treated as though it were an empty set. * @return A new {@link IntSet} instance containing the intersection of the * current set and {@code a}. The value {@code null} may be returned in * place of an empty result set. */ @Nullable IntSet and(@Nullable IntSet a);
public RecognitionException(@Nullable Lexer lexer, CharStream input) { this.recognizer = lexer; this.input = input; this.ctx = null; }
/** * @deprecated Use {@link #toString(Vocabulary)} instead. */ @Deprecated public String toString(@Nullable String[] tokenNames) { if ( s0.get()==null ) return ""; DFASerializer serializer = new DFASerializer(this,tokenNames); return serializer.toString(); }
/** Return the set of keys that collide from * {@code this} and {@code other}. */ @NotNull public Set<String> intersection(@Nullable AttributeDict other) { if ( other==null || other.size()==0 || size()==0 ) { return Collections.emptySet(); } Set<String> result = new HashSet<String>(attributes.keySet()); result.retainAll(other.attributes.keySet()); return result; }
@Nullable public STGroup getTemplates() { Target target = getTarget(); if (target == null) { return null; } return target.getTemplates(); }
public String toString(@NotNull Vocabulary vocabulary, @Nullable String[] ruleNames) { if (s0.get() == null) { return ""; } DFASerializer serializer = new DFASerializer(this, vocabulary, ruleNames, atnStartState.atn); return serializer.toString(); }
/** Print out a whole tree in LISP form. {@link #getNodeText} is used on the * node payloads to get the text for the nodes. Detect * parse trees and extract data appropriately. */ public static String toStringTree(@NotNull Tree t, @Nullable Parser recog) { String[] ruleNames = recog != null ? recog.getRuleNames() : null; List<String> ruleNamesList = ruleNames != null ? Arrays.asList(ruleNames) : null; return toStringTree(t, ruleNamesList); }
protected ActionATNConfig(LexerActionExecutor lexerActionExecutor, @NotNull ATNConfig c, @NotNull ATNState state, @Nullable PredictionContext context, boolean passedThroughNonGreedyDecision) { super(c, state, context); if (c.getSemanticContext() != SemanticContext.NONE) { throw new UnsupportedOperationException(); } this.lexerActionExecutor = lexerActionExecutor; this.passedThroughNonGreedyDecision = passedThroughNonGreedyDecision; }
public ActionSemanticContextATNConfig(LexerActionExecutor lexerActionExecutor, @NotNull SemanticContext semanticContext, @NotNull ATNConfig c, @NotNull ATNState state, @Nullable PredictionContext context, boolean passedThroughNonGreedyDecision) { super(semanticContext, c, state, context); this.lexerActionExecutor = lexerActionExecutor; this.passedThroughNonGreedyDecision = passedThroughNonGreedyDecision; }
@Override public void reportAmbiguity(@NotNull Parser recognizer, @NotNull DFA dfa, int startIndex, int stopIndex, boolean exact, @Nullable BitSet ambigAlts, @NotNull ATNConfigSet configs) { }
@Override public void syntaxError(@NotNull Recognizer<?, ?> recognizer, @Nullable Object offendingSymbol, int line, int charPositionInLine, @NotNull String msg, @Nullable RecognitionException e) { if (offendingSymbol instanceof Token) { Token startToken = (Token) offendingSymbol; SyntaxError error = new SyntaxError(new EditPosition(line, charPositionInLine, startToken.getStartIndex(), startToken.getStopIndex() - startToken.getStartIndex() + 1), msg); errors.add(error); } else { errors.add(new SyntaxError(new EditPosition(line, charPositionInLine, -1, 0), msg)); } }