net.sf.saxon.pattern
Class PatternParser

java.lang.Object
  extended by net.sf.saxon.expr.ExpressionParser
      extended by net.sf.saxon.pattern.PatternParser

public class PatternParser
extends ExpressionParser

Parser for XSLT patterns. This is created by overriding selected parts of the standard ExpressionParser.


Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.saxon.expr.ExpressionParser
ExpressionParser.FLWORClause, ExpressionParser.ForClause, ExpressionParser.TemporaryContainer
 
Field Summary
 
Fields inherited from class net.sf.saxon.expr.ExpressionParser
allowXPath30Syntax, compileWithTracing, defaultContainer, env, language, languageVersion, nameChecker, rangeVariables, scanOnly, SEQUENCE_TYPE, t, XPATH, XQUERY, XSLT_PATTERN
 
Constructor Summary
PatternParser()
           
 
Method Summary
 Expression makeTracer(int startOffset, Expression exp, int construct, StructuredQName qName)
          If tracing, wrap an expression in a trace instruction
protected  Expression parseBasicStep(boolean firstInPattern)
          Parse a basic step expression (without the predicates)
 Expression parseExpression()
          Parse a top-level Expression: ExprSingle ( ',' ExprSingle )*
protected  Expression parseFunctionArgument()
          Parse an argument to a function call.
protected  Expression parseFunctionCall()
          Parse a function call.
 Pattern parsePattern(String pattern, StaticContext env)
          Parse a string representing an XSLT pattern
protected  Expression parsePredicate()
          Parse the expression within a predicate.
protected  Expression parseUnionExpression()
          Parse a UnionExpr:
IntersectExceptExpr ( "|" | "union" IntersectExceptExpr )*
 
Methods inherited from class net.sf.saxon.expr.ExpressionParser
atStartOfRelativePath, currentTokenDisplay, declareRangeVariable, disallowedAtStartOfRelativePath, expect, findRangeVariable, getDefaultContainer, getLanguage, getNameChecker, getRangeVariables, getStaticContext, getTokenizer, grumble, grumble, grumble, grumble, isCompileWithTracing, isKeyword, isNamespaceTestAllowed, makeCurriedFunction, makeLocalNameTest, makeNameCode, makeNameCodeSilently, makeNamespaceTest, makeNameTest, makeStringLiteral, makeStructuredQName, nextToken, normalizeEQName, parse, parseConstructor, parseDynamicFunctionCall, parseExprSingle, parseExtensionExpression, parseForExpression, parseFunctionItemType, parseInlineFunction, parseItemType, parseLiteralFunctionItem, parseNodeTest, parseNumericLiteral, parseParenthesizedItemType, parsePathExpression, parseRelativePath, parseRemainingPath, parseSequenceType, parseSequenceType, parseStepExpression, parseStringLiteral, parseSwitchExpression, parseTryCatchExpression, parseTypeswitchExpression, parseValidateExpression, parseVariableReference, resolveFunctionName, setCompileWithTracing, setDefaultContainer, setLanguage, setLocation, setLocation, setRangeVariables, setRangeVariableStack, setScanOnly, undeclareRangeVariable, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PatternParser

public PatternParser()
Method Detail

parsePattern

public Pattern parsePattern(String pattern,
                            StaticContext env)
                     throws XPathException
Parse a string representing an XSLT pattern

Parameters:
pattern - the pattern expressed as a String
env - the static context for the pattern
Returns:
a Pattern object representing the result of parsing
Throws:
XPathException - if the pattern contains a syntax error

parseExpression

public Expression parseExpression()
                           throws XPathException
Description copied from class: ExpressionParser
Parse a top-level Expression: ExprSingle ( ',' ExprSingle )*

Overrides:
parseExpression in class ExpressionParser
Returns:
the Expression object that results from parsing
Throws:
XPathException - if the expression contains a syntax error

parseUnionExpression

protected Expression parseUnionExpression()
                                   throws XPathException
Description copied from class: ExpressionParser
Parse a UnionExpr:
IntersectExceptExpr ( "|" | "union" IntersectExceptExpr )*

Overrides:
parseUnionExpression in class ExpressionParser
Returns:
the resulting subexpression
Throws:
XPathException - if any error is encountered

parseBasicStep

protected Expression parseBasicStep(boolean firstInPattern)
                             throws XPathException
Parse a basic step expression (without the predicates)

Overrides:
parseBasicStep in class ExpressionParser
Parameters:
firstInPattern - true only if we are parsing the first step in a RelativePathPattern in the XSLT Pattern syntax
Returns:
the resulting subexpression
Throws:
XPathException - if any error is encountered

parsePredicate

protected Expression parsePredicate()
                             throws XPathException
Description copied from class: ExpressionParser
Parse the expression within a predicate. A separate method so it can be overridden

Overrides:
parsePredicate in class ExpressionParser
Throws:
XPathException

parseFunctionCall

protected Expression parseFunctionCall()
                                throws XPathException
Description copied from class: ExpressionParser
Parse a function call. function-name '(' ( Expression (',' Expression )* )? ')'

Overrides:
parseFunctionCall in class ExpressionParser
Returns:
the resulting subexpression
Throws:
XPathException - if any error is encountered

parseFunctionArgument

protected Expression parseFunctionArgument()
                                    throws XPathException
Description copied from class: ExpressionParser
Parse an argument to a function call. Separate method so it can be overridden. With higher-order-function syntax in XPath 3.0/XQuery 3.0, this returns null if the pseudo-argument "?" is found.

Overrides:
parseFunctionArgument in class ExpressionParser
Throws:
XPathException

makeTracer

public Expression makeTracer(int startOffset,
                             Expression exp,
                             int construct,
                             StructuredQName qName)
Description copied from class: ExpressionParser
If tracing, wrap an expression in a trace instruction

Overrides:
makeTracer in class ExpressionParser
Parameters:
startOffset - the position of the expression in the soruce
exp - the expression to be wrapped
construct - integer constant identifying the kind of construct
qName - the name of the construct (if applicable)
Returns:
the expression that does the tracing


Copyright (c) 2004-2010 Saxonica Limited. All rights reserved.