All Classes and Interfaces
Class
Description
This abstract base class is provided so performance-critical applications can
use virtual- instead of interface-dispatch when calling comparator methods.
Find token and rule refs plus refs to them in actions;
side-effect: update Alternatives
Any ALT (which can be child of ALT_REWRITE node)
An outermost alternative for a rule.
A StructDecl to handle a -> label on alt
This class represents profiling event information for an ambiguity.
This implementation of
ANTLRToolListener
reports messages to the
Log
instance provided by Maven.Parses ANTLR 4 grammar files
*.g4
and transforms them into Java
source files.How to emit recognition errors.
The interface for defining strategies to deal with syntax errors encountered
during a parse by ANTLR-generated parsers.
Deprecated.
Deprecated.
as of 4.7 Please use
CharStreams
interface.Read in an ANTLR grammar and build an AST.
The definitive ANTLR v3 grammar to parse ANTLR v4 grammars.
Defines behavior of object able to handle error messages from ANTLR including
both tool errors like "can't write file" and grammar ambiguity warnings.
Set
implementation with closed hashing (open addressing).A tuple: (ATN state, predicted alt, syntactic, semantic context).
The reason that we need this is because we don't want the hash map to use
the standard hash code and equals.
A pair of states pointing to the left/right (start and end) states of a
state submachine.
An ATN walker that knows how to dump them to serialized strings.
The following images show the relation of states and
ATNState.transitions
for various grammar constructs.Represents the type of recognizer an ATN applies to.
A simple visitor that walks everywhere it can go starting from s,
without going into an infinite cycle.
TODO: make all transitions sets? no, should remove set edges
Track the names of attributes defined in arg lists, return values,
scope blocks etc...
Trigger checks for various kinds of attribute expressions.
Track the attributes within retval, arg lists etc...
Grammars, rules, and alternatives all have symbols visible to
actions.
This implementation of
ANTLRErrorStrategy
responds to syntax errors
by immediately canceling the parse operation with a
ParseCancellationException
.Provides an empty default implementation of
ANTLRErrorListener
.Font metrics.
No side-effects except for setting options into the appropriate node.
Terminal node of a simple
(a|b|c)
block.The start of a regular
(...)
block.This implementation of
TokenStream
loads tokens from a
TokenSource
on-demand, and places the tokens in a buffer to provide
access to any previous token by index.Given a grammar file, show the dependencies on .tokens etc...
A source of characters for an ANTLR lexer.
This class represents the primary interface for creating
CharStream
s
from a variety of sources as of 4.7.The class hierarchy underneath SrcOp is pretty deep but makes sense that,
for example LL1StarBlock is a kind of LL1Loop which is a kind of Choice.
Contains Rewrite block (usually as last op)
The code associated with the outermost alternative of a rule.
General controller for code gen.
Filter list of SrcOps and return; default is pass-through filter
Alternative to
ANTLRInputStream
which treats the input
as a series of Unicode code points, instead of a series of UTF-16
code units.Utility class to create
AtomTransition
, RangeTransition
,
and SetTransition
appropriately based on the range of the input.This default implementation of
TokenFactory
creates
CommonToken
objects.This class extends
BufferedTokenStream
with functionality to filter
token streams to tokens on a particular channel (tokens where
Token.getChannel()
returns a particular value).public XContext X() { }
public List<XContext> X() { }
public XContext X(int i) { }
This class represents profiling event information for a context sensitivity.
public Token X() { }
public List<Token> X() { }
public Token X(int i) { }
This is the base class for gathering detailed information about prediction
events which occur during parsing.
This class contains profiling gathered for a particular decision.
This is the default implementation of
ANTLRErrorStrategy
used for
error reporting and recovery in ANTLR parsers.Create output objects for elements *within* rule functions except
buildOutputModel() which builds outer/root model object and any
objects such as RuleFunction that surround elements in rule
functions.
A DFA walker that knows how to dump them to serialized strings.
A DFA state represents a set of possible ATN configurations.
Map a predicate to a predicted alternative.
This implementation of
ANTLRErrorListener
can be used to identify
certain potential correctness and performance problems in grammars.The DOT (part of graphviz) generation aspect.
Sometimes we need to map a key to a value but key is two pieces of data.
This interface provides an abstract concept of object equality independent of
Object.equals(java.lang.Object)
(object equality) and the ==
operator
(reference equality).This class represents profiling event information for a syntax error
identified during prediction.
Represents a token that was consumed during resynchronization
rather than during a valid match operation.
Abstracts away the definition of Message severity and the text that should
display to represent that severity if there is no StringTemplate available
to do it.
A complex enumeration of all the error messages that the tool can issue.
Utility class to parse escapes like:
\\n
\\uABCD
\\u{10ABCD}
\\p{Foo}
\\P{Bar}
\\p{Baz=Blech}
\\P{Baz=Blech}
A semantic predicate failed during validation.
A limited map (many unsupported operations) that lets me use
varying hashCode/equals.
Count how many of each key we have; not thread safe
A node representing erroneous token range in token stream
A simple visitor, based upon the classic double dispatch method,
for walking GrammarAST trees resulting from parsing ANTLR grammars.
An
InterpreterRuleContext
that knows which alternative
for a rule was matched.A heavier weight
ParserInterpreter
that creates parse trees
that track alternative numbers for subtree roots.We want to stop and track the first error but we cannot bail out like
BailErrorStrategy
as consume() constructs trees.A problem with the symbols and/or meaning of a grammar such as rule
redefinition.
A problem with the syntax of your antlr grammar such as
"The '{' came as a complete surprise to me at this point in your program"
A CommonToken that can also track it's original location,
derived from options on the element ref like BEGIN<line=34,...>.
Handle left-recursion and block-set transforms
The definitive ANTLR v3 tree grammar to walk/visit ANTLR v4 grammars.
A generic graph with edges; Each node as a single Object payload.
Display help information on antlr4-maven-plugin.
Call
Call
mvn antlr4:help -Ddetail=true -Dgoal=<goal-name>
to display parameter details.This signifies any kind of mismatched input exceptions such as
when the current input does not match the expected token.
This class extends
ParserRuleContext
by allowing the value of
InterpreterRuleContext.getRuleIndex()
to be explicitly set for the context.An immutable inclusive interval a..b
This class implements the
IntSet
backed by a sorted array of
non-overlapping intervals.A generic set of integers.
A simple stream of symbols whose values are represented as integers.
An iterative (read: non-recursive) pre-order and post-order tree walker that
doesn't use the thread stack but heap-based stacks.
All the rule elements we can label like tokens, rules, sets, wildcard.
the various kinds of labels.
Using a tree walker on the rules, determine if a rule is directly left-recursive and if it follows
our pattern.
Remove left-recursive rule refs, add precedence args to recursive rule refs.
Find left-recursive rules
A lexer is recognizer that draws input symbols from a character stream.
Represents a single action which can be executed following the successful
match of a lexer rule.
Represents an executor for a sequence of lexer actions which traversed during
the matching operation of a lexer rule (token).
Represents the serialization type of a
LexerAction
."dup" of ParserInterpreter
When we hit an accept state in either the DFA or the ATN, we
have to notify the character stream to start buffering characters
via
IntStream.mark()
and record the current state.Implements the
channel
lexer action by calling
Lexer.setChannel(int)
with the assigned channel.Executes a custom lexer action by calling
Recognizer.action(org.antlr.v4.runtime.RuleContext, int, int)
with the
rule and action indexes assigned to the custom action.This implementation of
LexerAction
is used for tracking input offsets
for position-dependent actions within a LexerActionExecutor
.Implements the
mode
lexer action by calling Lexer.mode(int)
with
the assigned mode.Implements the
more
lexer action by calling Lexer.more()
.Implements the
popMode
lexer action by calling Lexer.popMode()
.Implements the
pushMode
lexer action by calling
Lexer.pushMode(int)
with the assigned mode.Implements the
skip
lexer action by calling Lexer.skip()
.Implements the
type
lexer action by calling Lexer.setType(int)
with the assigned type.A model object representing a parse tree listener file.
Provides an implementation of
TokenSource
as a wrapper around a list
of Token
objects.(A | B | C)
An optional block is just an alternative block where the last alternative
is epsilon.
(A B C)?
This class represents profiling event information for tracking the lookahead
depth required in order to make a prediction.
Mark the end of a * or + loop.
Indicate field of OutputModelObject is an element to be walked by
OutputModelWalker.
Deprecated.
THIS IS HERE FOR BACKWARD COMPATIBILITY WITH 4.5 ONLY.
Indicates that the parser could not decide which of two or more paths
to take based upon the remaining input.
This default implementation of
EqualityComparator
uses object equality
for comparisons by calling Object.hashCode()
and Object.equals(java.lang.Object)
.I need the get-element-i functionality so I'm subclassing
LinkedHashMap.
A HashMap that remembers the order that the elements were added.
This receives events from SourceGenTriggers.g and asks factory to do work.
Convert an output model tree to template hierarchy by walking
the output model.
This exception is thrown to cancel a parsing operation.
This class provides access to specific and aggregate statistics gathered
during profiling of a parser.
This is all the parsing support code essentially; most of it is error recovery stuff.
ATN construction routines triggered by ATNBuilder.g.
The embodiment of the adaptive LL(*), ALL(*), parsing strategy.
A parser simulator that mimics what ANTLR's generated
parser code does.
A rule invocation record for parsing.
An interface to access the tree of
RuleContext
objects created
during a parse that makes the data structure look like a simple parse tree.This interface describes the minimal core of methods triggered
by
ParseTreeWalker
.Represents the result of matching a
ParseTree
against a tree pattern.A pattern like
<ID> = <expr>;
converted to a ParseTree
by
ParseTreePatternMatcher.compile(String, int)
.A tree pattern matching mechanism for ANTLR
ParseTree
s.Associate a property with a parse tree node.
This interface defines the basic notion of a parse tree visitor.
Start of
(A|B|...)+
loop.Decision state for
A+
and (A|B)+
.This class represents profiling event information for semantic predicate
evaluations which occur during prediction.
TODO: this is old comment:
A tree of semantic predicates from the grammar AST if label==SEMPRED.
Used to cache
PredictionContext
objects.This enumeration defines the prediction modes available in ANTLR 4 along with
utility methods for analyzing configuration sets for conflicts and/or
ambiguities.
This implementation of
ANTLRErrorListener
dispatches all calls to a
collection of delegate listeners.The root of the ANTLR exception hierarchy.
Used to throw us out of deeply nested element back to end of a rule's
alt list.
A rule context is a record of a single rule invocation.
A handy class for use with
options {contextSuperClass=org.antlr.v4.runtime.RuleContextWithAltNum;}
that provides a backing field / impl for the outer alternative number
matched for an internal parse tree node.
Tag indicated AST node is a rule element like token or rule ref.
The last node in the ATN for a rule, unless that rule is the start symbol.
A
Token
object representing an entire subtree matched by a parser
rule; e.g., <expr>
.This class provides access to the current version of the ANTLR 4 runtime
library as compile-time and runtime constants, along with methods for
checking for matching version numbers and notifying listeners in the case
where a version mismatch is detected.
Parse args, return values, locals
A tree structure used to record the semantic context in which
an ATN configuration is valid.
A semantic context which is true whenever none of the contained contexts
is false.
This is the base class for semantic context "operators", which operate on
a collection of semantic context "operands".
A semantic context which is true whenever at least one of the contained
contexts is true.
Do as much semantic checking as we can and fill in grammar
with rules, actions, and token definitions.
A transition containing a set of values.
The block that begins a closure loop.
This object models the structure holding all of the parameters,
return values, local variables, and labels associated with a rule.
Check for symbol problems; no side-effects.
Collects (create) rules, terminals, strings, actions, scopes etc...
A tree that knows about an interval in a token stream
is some kind of syntax tree.
Run a lexer/parser combo, optionally printing tree string or generating
postscript file.
Deprecated.
A token has properties: text, type, line, character position in the line
(so we can ignore tabs), token channel, index, and source from which
we obtained this token.
x=ID or implicit _tID label
The default mechanism for creating tokens.
A source of tokens must provide a sequence of tokens via
TokenSource.nextToken()
and also must reveal it's source of characters; CommonToken
's text is
computed from a CharStream
; it only store indices into the char
stream.The Tokens rule start state linking to each lexer rule start state
Useful for rewriting out a buffered input token stream after doing some
augmentation or other manipulations on it.
A
Token
object representing a token of a particular type; e.g.,
<ID>
.Override error handling for use with ANTLR tool itself; leaves
nothing in grammar associated with Tool so others can use in IDEs, ...
A generic message from the tool such as "file not found" type errors; there
is no reason to create a special object for each error unlike the grammar
errors, which may be rather complex.
An ATN transition between any two ATN states.
The basic notion of a tree has a parent, a payload, and a list of children.
Adaptor ANTLR trees to
TreeForTreeLayout
.A set of utility routines useful for all kinds of ANTLR trees.
Do not buffer up the entire char stream.
Code-generated utility class mapping Unicode properties to Unicode code point ranges.
StringTemplate controller used to generate parameters to feed
to
unicodedata.st
to code-generate UnicodeData.java
,
used by the tool for Unicode property escapes like \\p\{Lu\}
.Utility class to escape Unicode code points using various
languages' syntaxes.
Look for errors and deadcode stuff
This interface provides information about the vocabulary used by a
recognizer.
This class provides a default implementation of the
Vocabulary
interface.Represent a subset of XPath XML path syntax for use in identifying nodes in
parse trees.
Either
ID
at start of path or ...//ID
in middle of path.
CharStreams
interface.