Package | Description |
---|---|
org.antlr.v4.runtime | |
org.antlr.v4.runtime.tree |
Modifier and Type | Interface and Description |
---|---|
interface |
TokenFactory<Symbol extends Token>
The default mechanism for creating tokens.
|
class |
UnbufferedTokenStream<T extends Token> |
Modifier and Type | Interface and Description |
---|---|
interface |
WritableToken |
Modifier and Type | Class and Description |
---|---|
class |
CommonToken |
Modifier and Type | Field and Description |
---|---|
Token |
Lexer._token
The goal of all lexer rules/methods is to create a token object.
|
protected Token |
UnbufferedTokenStream.lastToken
This is the
LT(-1) token for the current position. |
protected Token |
UnbufferedTokenStream.lastTokenBufferStart
|
Token |
ParserRuleContext.start
For debugging/tracing purposes, we want to track all of the nodes in
the ATN traversed by the parser for a particular rule.
|
Token |
ParserRuleContext.stop
For debugging/tracing purposes, we want to track all of the nodes in
the ATN traversed by the parser for a particular rule.
|
protected Token[] |
UnbufferedTokenStream.tokens
A moving window buffer of the data being scanned.
|
Modifier and Type | Field and Description |
---|---|
protected List<Token> |
BufferedTokenStream.tokens
Record every single token pulled from the source so we can reproduce
chunks of it later.
|
Modifier and Type | Method and Description |
---|---|
Token |
Parser.consume()
Consume the current symbol and return it.
|
Token |
Lexer.emit()
The standard method called to automatically emit a token at the
outermost lexical rule.
|
Token |
Lexer.emitEOF() |
Token |
UnbufferedTokenStream.get(int i) |
Token |
TokenStream.get(int index)
Gets the
Token at the specified index in the stream. |
Token |
BufferedTokenStream.get(int i) |
Token |
Parser.getCurrentToken()
Match needs to return the current input symbol, which gets put
into the label for the associated token ref; e.g., x=ID.
|
protected Token |
DefaultErrorStrategy.getMissingSymbol(Parser recognizer)
Conjure up a missing token during error recovery.
|
Token |
RecognitionException.getOffendingToken() |
Token |
ParserRuleContext.getStart() |
Token |
NoViableAltException.getStartToken() |
Token |
ParserRuleContext.getStop() |
Token |
Lexer.getToken()
Override if emitting multiple tokens.
|
protected Token |
CommonTokenStream.LB(int k) |
protected Token |
BufferedTokenStream.LB(int k) |
Token |
UnbufferedTokenStream.LT(int i) |
Token |
TokenStream.LT(int k)
|
Token |
CommonTokenStream.LT(int k) |
Token |
BufferedTokenStream.LT(int k) |
Token |
Parser.match(int ttype)
Match current input symbol against ttype.
|
Token |
Parser.matchWildcard() |
Token |
TokenSource.nextToken()
Return a Token object from your input stream (usually a CharStream).
|
Token |
Lexer.nextToken()
Return a token from this source; i.e., match a token on the char
stream.
|
Token |
DefaultErrorStrategy.recoverInline(Parser recognizer)
Attempt to recover from a single missing or extra token.
|
Token |
BailErrorStrategy.recoverInline(Parser recognizer)
Make sure we don't attempt to recover inline; if the parser
successfully recovers, it won't throw an exception.
|
Token |
ANTLRErrorStrategy.recoverInline(Parser recognizer)
When matching elements within alternative, use this method
to recover.
|
Token |
DefaultErrorStrategy.singleTokenDeletion(Parser recognizer) |
Modifier and Type | Method and Description |
---|---|
protected List<Token> |
BufferedTokenStream.filterForChannel(int from,
int to,
int channel) |
List<Token> |
BufferedTokenStream.get(int start,
int stop)
Get all tokens from start..stop inclusively
|
List<? extends Token> |
Lexer.getAllTokens()
Return a list of all Token objects in input char stream.
|
List<Token> |
BufferedTokenStream.getHiddenTokensToLeft(int tokenIndex)
Collect all hidden tokens (any off-default channel) to the left of
the current token up until we see a token on DEFAULT_TOKEN_CHANNEL.
|
List<Token> |
BufferedTokenStream.getHiddenTokensToLeft(int tokenIndex,
int channel)
Collect all tokens on specified channel to the left of
the current token up until we see a token on DEFAULT_TOKEN_CHANNEL.
|
List<Token> |
BufferedTokenStream.getHiddenTokensToRight(int tokenIndex)
Collect all hidden tokens (any off-default channel) to the right of
the current token up until we see a token on DEFAULT_TOKEN_CHANNEL
of EOF.
|
List<Token> |
BufferedTokenStream.getHiddenTokensToRight(int tokenIndex,
int channel)
Collect all tokens on specified channel to the right of
the current token up until we see a token on DEFAULT_TOKEN_CHANNEL or
EOF.
|
TokenFactory<? extends Token> |
Lexer.getTokenFactory() |
List<Token> |
BufferedTokenStream.getTokens() |
List<Token> |
BufferedTokenStream.getTokens(int start,
int stop) |
List<Token> |
BufferedTokenStream.getTokens(int start,
int stop,
int ttype) |
List<Token> |
BufferedTokenStream.getTokens(int start,
int stop,
Set<Integer> types)
Given a start and stop index, return a List of all tokens in
the token type BitSet.
|
Modifier and Type | Method and Description |
---|---|
protected void |
UnbufferedTokenStream.add(Token t) |
TerminalNode |
ParserRuleContext.addChild(Token matchedToken) |
ErrorNode |
ParserRuleContext.addErrorNode(Token badToken) |
void |
TokenStreamRewriter.delete(String programName,
Token from,
Token to) |
void |
TokenStreamRewriter.delete(Token indexT) |
void |
TokenStreamRewriter.delete(Token from,
Token to) |
void |
Lexer.emit(Token token)
By default does not support multiple emits per nextToken invocation
for efficiency reasons.
|
protected String |
DefaultErrorStrategy.getSymbolText(Token symbol) |
protected int |
DefaultErrorStrategy.getSymbolType(Token symbol) |
String |
UnbufferedTokenStream.getText(Token start,
Token stop) |
String |
TokenStream.getText(Token start,
Token stop)
Return the text of all tokens in this stream between
start and
stop (inclusive). |
String |
BufferedTokenStream.getText(Token start,
Token stop) |
String |
Recognizer.getTokenErrorDisplay(Token t)
How should a token be displayed in an error message? The default
is to display just the text, but during development you might
want to have a lot of information spit out.
|
String |
DefaultErrorStrategy.getTokenErrorDisplay(Token t)
How should a token be displayed in an error message? The default
is to display just the text, but during development you might
want to have a lot of information spit out.
|
void |
TokenStreamRewriter.insertAfter(String programName,
Token t,
Object text) |
void |
TokenStreamRewriter.insertAfter(Token t,
Object text) |
void |
TokenStreamRewriter.insertBefore(String programName,
Token t,
Object text) |
void |
TokenStreamRewriter.insertBefore(Token t,
Object text) |
void |
Parser.notifyErrorListeners(Token offendingToken,
String msg,
RecognitionException e) |
void |
TokenStreamRewriter.replace(String programName,
Token from,
Token to,
Object text) |
void |
TokenStreamRewriter.replace(Token indexT,
Object text) |
void |
TokenStreamRewriter.replace(Token from,
Token to,
Object text) |
protected void |
RecognitionException.setOffendingToken(Token offendingToken) |
void |
Lexer.setToken(Token _token) |
Modifier and Type | Method and Description |
---|---|
List<String> |
Parser.toStrings(List<? extends Token> tokens)
A convenience method for use most often with template rewrites.
|
Constructor and Description |
---|
CommonToken(Token oldToken) |
NoViableAltException(Parser recognizer,
TokenStream input,
Token startToken,
Token offendingToken,
ATNConfigSet deadEndConfigs,
ParserRuleContext ctx) |
Modifier and Type | Field and Description |
---|---|
Token |
TerminalNodeImpl.symbol |
Modifier and Type | Method and Description |
---|---|
Token |
TerminalNodeImpl.getPayload() |
Token |
TerminalNodeImpl.getSymbol() |
Token |
TerminalNode.getSymbol() |
Constructor and Description |
---|
ErrorNodeImpl(Token token) |
TerminalNodeImpl(Token symbol) |
Copyright © 1992-2013 ANTLR. All Rights Reserved.