Package eu.bandm.tools.tpath.parser2
Class Parser<D>
java.lang.Object
eu.bandm.tools.tpath.parser2.Parser<D>
- Type Parameters:
D
- Document type identifier
Parser for tpath expressions, based on
bandm Lexic
and Ramus-runtime
.
The syntax implemented here does differ slightly from the proposal
in [XPath 1.0]
and is as follows:
abbreviatedStep ::= selfStep | parentStep separator ::= slash | doubleSlash abbreviatedAxisSpecifier ::= @ | [emptyString] explicitAxisSpecifier ::= ("ancestor" | "ancestorOrSelf" | ...), "::" axisSpecifier ::= explicitAxisSpecifier | abbreviatedAxisSpecifier nodeTest ::= nameTest | testComment| testText | testNode | testPI | testNodeUri | testElement explicitStep ::= axisSpecifier, nodetest, predicate* step ::= explicitStep | abbreviatedStep relativeStep ::= separator, step f_relativeLocationPath ::= step, relativeStep* relativeLocationPath ::= f_relativeLocationPath absoluteLocationPath ::= separator, f_relativeLocationPath locationPath ::= absoluteLocationPath | relativeLocationPath ( abbreviatedRelativeLocationPath and abbreviatedAbsoluteLocationPath are already realized by allowing everywhere the separator "//".)
-
Field Summary
Modifier and TypeFieldDescriptionLexer rule for the outer level of AVT.(package private) final CheckedList
<TPath.Expr> protected Function
<Location<D>, Location<XMLDocumentIdentifier>> final Expression
<D, TokenType, TPath.Expr> final Expression
<D, TokenType, TPath.Literal> Parsing rule for the longest sequence of characters up to the first single-standing opening brace. -
Constructor Summary
ConstructorDescriptionParser()
Instances are only needed to set the type parameter <D> = document identifier. -
Method Summary
Modifier and TypeMethodDescriptionattributeValueTemplate
(LookaheadTokenMultiplexer<Boolean, D, TokenType, int[]> mux) Parsing rule for an XSLT "Attribute Value Template".bracedExpr
(LookaheadTokenMultiplexer<Boolean, D, TokenType, int[]> mux) Parsing rule for a tpath expression embedded in an XSLT AVT.protected Location
<XMLDocumentIdentifier> encodeLocation
(Location<D> loc) protected String
Remove the leading and trailing quotes from a »literal«.protected Location
<XMLDocumentIdentifier> getLocation
(Reducer.Context<D> context) multiplexedTokenSource
(Reader reader, D sourceIndication) Return a multiplexer between the tpath lexer and the (very simple) xslt "attribute value template" outer lexer.parse
(Reader reader, MessageReceiver<SimpleMessage<D>> msg, D sourceIndication) Service Access Point for converting a complete text (ended with EOF) into a tpath expression.parse_AVT
(Reader reader, MessageReceiver<SimpleMessage<D>> msg, D sourceIndication) Parse an "xslt attribute value template".parse_embed
(LookaheadTokenMultiplexer<Boolean, D, TokenType, int[]> mux) Parsing rule for a segment (verbatim or embedded) of an XSLT "Attribute Value Template".<R> R
parse_nonterminal
(Expression<D, TokenType, R> nonterminal, LookaheadTokenSource<D, TokenType, int[]> tokenSource, MessageReceiver<SimpleMessage<D>> msg) <R> R
parse_nonterminal
(Expression<D, TokenType, R> nonterminal, Reader reader, MessageReceiver<SimpleMessage<D>> msg, D sourceIndication) Service Access Point for parsing a particular non-terminal.void
setLocation
(Function<Location<D>, Location<XMLDocumentIdentifier>> encodeLocation) LookaheadTokenSource
<D, TokenType, int[]> tokenSource
(Reader reader, D sourceIndication) protected Expression
<D, TokenType, String> unparsedLiteralText
(TokenType... types)
-
Field Details
-
encodeLocation
-
AVT_prefix
Lexer rule for the outer level of AVT. Accepts all up to the first non-doubled opening brace. -
emptyTests
-
expr
-
non_braced
Parsing rule for the longest sequence of characters up to the first single-standing opening brace.
-
-
Constructor Details
-
Parser
public Parser()Instances are only needed to set the type parameter <D> = document identifier.
-
-
Method Details
-
setLocation
-
parse_nonterminal
@Opt public <R> R parse_nonterminal(Expression<D, TokenType, R> nonterminal, Reader reader, MessageReceiver<SimpleMessage<D>> msg, D sourceIndication) Service Access Point for parsing a particular non-terminal. -
parse_nonterminal
@Opt public <R> R parse_nonterminal(Expression<D, TokenType, R> nonterminal, LookaheadTokenSource<D, TokenType, int[]> tokenSource, MessageReceiver<SimpleMessage<D>> msg) -
parse
@Opt public TPath.Expr parse(Reader reader, MessageReceiver<SimpleMessage<D>> msg, D sourceIndication) Service Access Point for converting a complete text (ended with EOF) into a tpath expression. -
encodeLocation
-
tokenSource
-
getLocation
-
unparsedLiteralText
-
extract
Remove the leading and trailing quotes from a »literal«. -
bracedExpr
public Expression<D,TokenType, bracedExprTPath.FunctionCall> (LookaheadTokenMultiplexer<Boolean, D, TokenType, int[]> mux) Parsing rule for a tpath expression embedded in an XSLT AVT. The parser consumes the BRACKET_OPEN and then switches the Multiplexer to use the (more complex) tpath lexer for the embedded expression and the closing brace.- Parameters:
mux
- additional access to the the token source multiplexer employed as token source, for switching it from the parsing rule.
-
parse_embed
public Expression<D,TokenType, parse_embedTPath.Expr> (LookaheadTokenMultiplexer<Boolean, D, TokenType, int[]> mux) Parsing rule for a segment (verbatim or embedded) of an XSLT "Attribute Value Template".- Parameters:
mux
- additional access to the the token source multiplexer employed as token source, for switching it from the parsing rule.
-
attributeValueTemplate
public Expression<D,TokenType, attributeValueTemplateTPath.Expr> (LookaheadTokenMultiplexer<Boolean, D, TokenType, int[]> mux) Parsing rule for an XSLT "Attribute Value Template".- Parameters:
mux
- additional access to the the token source multiplexer employed as token source, for switching it from the parsing rule.
-
multiplexedTokenSource
public LookaheadTokenMultiplexer<Boolean,D, multiplexedTokenSourceTokenType, int[]> (Reader reader, D sourceIndication) Return a multiplexer between the tpath lexer and the (very simple) xslt "attribute value template" outer lexer. Its initial state is the outer lexer. -
parse_AVT
@Opt public TPath.Expr parse_AVT(Reader reader, MessageReceiver<SimpleMessage<D>> msg, D sourceIndication) Parse an "xslt attribute value template". See XSLT 1.1, section 7.6.2.- Returns:
- an expression from the tpath model that combines (via function call) the constant text regions with the embedded xpath expressions.
-