public abstract class AbstractParser extends Object
AbstractParser
supports syntactic analysis of a tokens
produced by an AbstractLexer
to create a corresponding CST, that
may in turn be exploited by an AbstractAnalyzer
to create an
AST.
Derived classes should extend the abstract support for AST from CST from
tokens from text parsing and analysis to support the AST and CST classes
appropriate to a particular language.Constructor and Description |
---|
AbstractParser(AbstractLexer lexer) |
AbstractParser(BasicEnvironment environment) |
Modifier and Type | Method and Description |
---|---|
String |
computeInputString(int left,
int right)
Returns a single line string representation of the input chars for the
given range.
|
int |
getDefaultRepairCount() |
BasicEnvironment |
getEnvironment() |
abstract DerivedPrsStream |
getIPrsStream() |
AbstractLexer |
getLexer() |
abstract ParseTable |
getParseTable() |
abstract int |
numTokenKinds() |
abstract String[] |
orderedTerminalSymbols() |
abstract CSTNode |
parser()
Runs the parser with the current
lex and parse streams |
abstract CSTNode |
parser(Monitor monitor)
Runs the parser with the current
lex and parse streams
using the given Monitor |
abstract CSTNode |
parser(Monitor monitor,
int error_repair_count)
Runs the parser with the current
lex and parse streams
using the given Monitor and error_repair_count (useful for a backtracking parser) |
CSTNode |
parseTokensToCST()
Deprecated.
clients should invoke
parser() |
abstract void |
reset(ILexStream lexStream)
Resets the parser's
lexStream |
void |
resetLexStream(LexStream lexStream)
Deprecated.
To set/reset the lex stream use
reset(ILexStream) |
void |
setDefaultRepairCount(int defaultRepairCount)
Sets the number of repairs to be performed by a parser capable of
performing repairs (the BacktrackingParser) unless overridden on the
specific parser invocation method.
|
void |
setLexStream(AbstractLexer lexer)
Deprecated.
To set/reset the lex stream use
reset(ILexStream) |
public AbstractParser(BasicEnvironment environment)
public AbstractParser(AbstractLexer lexer)
public String computeInputString(int left, int right)
left
- left most char indexright
- right most char indexpublic BasicEnvironment getEnvironment()
public int getDefaultRepairCount()
public AbstractLexer getLexer()
@Deprecated public CSTNode parseTokensToCST()
parser()
@Deprecated public void resetLexStream(LexStream lexStream)
reset(ILexStream)
lexStream
- public void setDefaultRepairCount(int defaultRepairCount)
defaultRepairCount
- the default repair count@Deprecated public void setLexStream(AbstractLexer lexer)
reset(ILexStream)
lexer
- public abstract String[] orderedTerminalSymbols()
public abstract int numTokenKinds()
public abstract DerivedPrsStream getIPrsStream()
parseStream
public abstract void reset(ILexStream lexStream)
lexStream
lexStream
- public abstract CSTNode parser()
lex
and parse
streamsCSTNode
which results from the parsing processpublic abstract CSTNode parser(Monitor monitor)
lex
and parse
streams
using the given Monitor
CSTNode
which results from the parsing processpublic abstract CSTNode parser(Monitor monitor, int error_repair_count)
lex
and parse
streams
using the given Monitor
and error_repair_count (useful for a backtracking parser)CSTNode
which results from the parsing processpublic abstract ParseTable getParseTable()
ParseTable
used by the parserCopyright © 2005, 2018 IBM Corporation and others. All Rights Reserved.