Package eu.bandm.tools.xantlr.runtime
Class X_LLkParser
java.lang.Object
antlr.Parser
antlr.LLkParser
eu.bandm.tools.xantlr.runtime.X_LLkParser
- Direct Known Subclasses:
D2dParser
,JavaParser
,UModParser
public class X_LLkParser
extends antlr.LLkParser
Base class for all parsers generated by xantlr,
see user doc.
Such a new base class is needed (1) to perform the event generation,
which is the purpose of the xantlr tool,
and (2) to re-implement the antlr error handling routines, for to
pipe the antlr errors and warnings into the metatools
(1) is done as follows: the xantlr transformations add semantic actions (as described in the user doc) to the parser code which call the event genrating runtime routines in that
(Currently this object is always a
(2) is achieved by re-implementing the methods
Before starting any parser process, the user has to configure this class corretly with the targets of these both data channeld, ie. by calling
(Plese note that the parser has to be linked to a lexer using
message
system.(1) is done as follows: the xantlr transformations add semantic actions (as described in the user doc) to the parser code which call the event genrating runtime routines in that
EventGenerator
object
which is stored in event
. (Currently this object is always a
SAXEventGenerator
, but this is not
necessarily so.)
(2) is achieved by re-implementing the methods
reportError(String)
,
reportWarning(String)
, etc., which are called by standard antlr
behaviour, and here create Message
objects.
Before starting any parser process, the user has to configure this class corretly with the targets of these both data channeld, ie. by calling
setEventGenerator(EventGenerator)
and
setMessageReceiver(MessageReceiver)
.
After creation of the X_LLKParser, the field event
contains
a new EventFilter
, which is a clsss which discards all events!
This is probably not what you want.
(Plese note that the parser has to be linked to a lexer using
HistoryToken
. See there for an example.)-
Field Summary
Modifier and TypeFieldDescriptionprotected EventGenerator<NamespaceName,
XMLDocumentIdentifier> protected MessageReceiver<? super SimpleMessage<XMLDocumentIdentifier>>
Fields inherited from class antlr.Parser
astFactory, inputState, returnAST, tokenNames, tokenTypeToASTClassMap, traceDepth
-
Constructor Summary
ConstructorDescriptionX_LLkParser
(antlr.ParserSharedInputState lexer, int k) X_LLkParser
(antlr.TokenBuffer lexer, int k) X_LLkParser
(antlr.TokenStream lexer, int k) -
Method Summary
Modifier and TypeMethodDescriptionvoid
reportError
(antlr.RecognitionException e) void
void
void
void
setFilename
(String filename) Deprecated.void
setMessageReceiver
(MessageReceiver<? super SimpleMessage<XMLDocumentIdentifier>> mr) Methods inherited from class antlr.LLkParser
consume, LA, LT, traceIn, traceOut
Methods inherited from class antlr.Parser
addMessageListener, addParserListener, addParserMatchListener, addParserTokenListener, addSemanticPredicateListener, addSyntacticPredicateListener, addTraceListener, consumeUntil, consumeUntil, defaultDebuggingSetup, getAST, getASTFactory, getFilename, getInputState, getTokenName, getTokenNames, getTokenTypeToASTClassMap, isDebugMode, mark, match, match, matchNot, panic, removeMessageListener, removeParserListener, removeParserMatchListener, removeParserTokenListener, removeSemanticPredicateListener, removeSyntacticPredicateListener, removeTraceListener, rewind, setASTFactory, setASTNodeClass, setASTNodeType, setDebugMode, setIgnoreInvalidDebugCalls, setInputState, setTokenBuffer, traceIndent
-
Field Details
-
event
-
messageReceiver
-
-
Constructor Details
-
X_LLkParser
public X_LLkParser(antlr.TokenStream lexer, int k) -
X_LLkParser
public X_LLkParser(antlr.TokenBuffer lexer, int k)
-
-
Method Details
-
setEventGenerator
-
getEventGenerator
-
setMessageReceiver
-
reportError
- Overrides:
reportError
in classantlr.Parser
-
reportWarning
- Overrides:
reportWarning
in classantlr.Parser
-
reportError
public void reportError(antlr.RecognitionException e) - Overrides:
reportError
in classantlr.Parser
-
getLocation
-
setFilename
Deprecated.ignored bygetLocation()
mechanism.- Overrides:
setFilename
in classantlr.Parser
-
getLocation()
mechanism.