Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
ANTLR Runtime Source Code
ANTLR is a powerful parser generator for multiple programming languages including Java.
ANTLR contains 2 major modules:
ANTLR Runtime Source Code files are provided in the distribution packge (antlr4-4.10.1.zip). You can download them at ANTLR Website.
You can also browse the source code below:
✍: FYIcenter
⏎ org/antlr/v4/runtime/ANTLRErrorStrategy.java
/* * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. * Use of this file is governed by the BSD 3-clause license that * can be found in the LICENSE.txt file in the project root. */ package org.antlr.v4.runtime; import org.antlr.v4.runtime.tree.ErrorNode; /** * The interface for defining strategies to deal with syntax errors encountered * during a parse by ANTLR-generated parsers. We distinguish between three * different kinds of errors: * * <ul> * <li>The parser could not figure out which path to take in the ATN (none of * the available alternatives could possibly match)</li> * <li>The current input does not match what we were looking for</li> * <li>A predicate evaluated to false</li> * </ul> * * Implementations of this interface report syntax errors by calling * {@link Parser#notifyErrorListeners}. * * <p>TODO: what to do about lexers</p> */ public interface ANTLRErrorStrategy { /** * Reset the error handler state for the specified {@code recognizer}. * @param recognizer the parser instance */ void reset(Parser recognizer); /** * This method is called when an unexpected symbol is encountered during an * inline match operation, such as {@link Parser#match}. If the error * strategy successfully recovers from the match failure, this method * returns the {@link Token} instance which should be treated as the * successful result of the match. * * <p>This method handles the consumption of any tokens - the caller should * <b>not</b> call {@link Parser#consume} after a successful recovery.</p> * * <p>Note that the calling code will not report an error if this method * returns successfully. The error strategy implementation is responsible * for calling {@link Parser#notifyErrorListeners} as appropriate.</p> * * @param recognizer the parser instance * @throws RecognitionException if the error strategy was not able to * recover from the unexpected input symbol */ Token recoverInline(Parser recognizer) throws RecognitionException; /** * This method is called to recover from exception {@code e}. This method is * called after {@link #reportError} by the default exception handler * generated for a rule method. * * @see #reportError * * @param recognizer the parser instance * @param e the recognition exception to recover from * @throws RecognitionException if the error strategy could not recover from * the recognition exception */ void recover(Parser recognizer, RecognitionException e) throws RecognitionException; /** * This method provides the error handler with an opportunity to handle * syntactic or semantic errors in the input stream before they result in a * {@link RecognitionException}. * * <p>The generated code currently contains calls to {@link #sync} after * entering the decision state of a closure block ({@code (...)*} or * {@code (...)+}).</p> * * <p>For an implementation based on Jim Idle's "magic sync" mechanism, see * {@link DefaultErrorStrategy#sync}.</p> * * @see DefaultErrorStrategy#sync * * @param recognizer the parser instance * @throws RecognitionException if an error is detected by the error * strategy but cannot be automatically recovered at the current state in * the parsing process */ void sync(Parser recognizer) throws RecognitionException; /** * Tests whether or not {@code recognizer} is in the process of recovering * from an error. In error recovery mode, {@link Parser#consume} adds * symbols to the parse tree by calling * {@link Parser#createErrorNode(ParserRuleContext, Token)} then * {@link ParserRuleContext#addErrorNode(ErrorNode)} instead of * {@link Parser#createTerminalNode(ParserRuleContext, Token)}. * * @param recognizer the parser instance * @return {@code true} if the parser is currently recovering from a parse * error, otherwise {@code false} */ boolean inErrorRecoveryMode(Parser recognizer); /** * This method is called by when the parser successfully matches an input * symbol. * * @param recognizer the parser instance */ void reportMatch(Parser recognizer); /** * Report any kind of {@link RecognitionException}. This method is called by * the default exception handler generated for a rule method. * * @param recognizer the parser instance * @param e the recognition exception to report */ void reportError(Parser recognizer, RecognitionException e); }
⏎ org/antlr/v4/runtime/ANTLRErrorStrategy.java
Or download all of them as a single archive file:
File name: antlr-runtime-4.10.1-sources.jar File size: 308953 bytes Release date: 2022-04-15 Download
⇐ What Is ANTLR Parser Generator
2018-10-21, 30974👍, 0💬
Popular Posts:
Apache Commons Codec library provides implementations of common encoders and decoders such as Base64...
jlGui is a music player for the Java platform. It is based on Java Sound 1.0 (i.e. JDK 1.3+). It sup...
JDK 11 jdk.jshell.jmod is the JMOD file for JDK 11 JShell tool, which can be invoked by the "jshell"...
iText is an ideal library for developers looking to enhance web- and other applications with dynamic...
What Is HttpComponents httpclient-4.2.2.jar? HttpComponents httpclient-4.2.2.jar is the JAR file for...