com.jclark.xsl.expr
Class ExprParser

java.lang.Object
  extended by com.jclark.xsl.expr.ExprTokenizer
      extended by com.jclark.xsl.expr.ExprParser
All Implemented Interfaces:
NamespaceConstants

public class ExprParser
extends ExprTokenizer
implements NamespaceConstants

XPAth expression parser / compiler extends the lexer ExprTokenizer


Field Summary
 
Fields inherited from class com.jclark.xsl.expr.ExprTokenizer
currentToken, currentTokenValue, TOK_AND, TOK_AT, TOK_AXIS, TOK_CNAME_LPAR, TOK_COMMA, TOK_COMMENT_LPAR, TOK_DIV, TOK_DOT, TOK_DOT_DOT, TOK_EOF, TOK_EQUALS, TOK_FUNCTION_LPAR, TOK_GT, TOK_GTE, TOK_LITERAL, TOK_LPAR, TOK_LSQB, TOK_LT, TOK_LTE, TOK_MINUS, TOK_MOD, TOK_MULTIPLY, TOK_NAME_COLON_STAR, TOK_NODE_LPAR, TOK_NOT_EQUALS, TOK_NUMBER, TOK_OR, TOK_PLUS, TOK_PROCESSING_INSTRUCTION_LPAR, TOK_QNAME, TOK_RPAR, TOK_RSQB, TOK_SLASH, TOK_SLASH_SLASH, TOK_STAR, TOK_TEXT_LPAR, TOK_VARIABLE_REF, TOK_VBAR
 
Fields inherited from interface com.jclark.xsl.om.NamespaceConstants
EXSL_COMMON_NAMESPACE, EXSL_DATE_NAMESPACE, EXSL_DYNAMIC_NAMESPACE, EXSL_FUNCTIONS_NAMESPACE, EXSL_MATH_NAMESPACE, EXSL_REGEXP_NAMESPACE, EXSL_SETS_NAMESPACE, EXSL_STRINGS_NAMESPACE, XFYXT_NAMESPACE, XSL_NAMESPACE, XT_NAMESPACE
 
Method Summary
(package private) static boolean functionAvailable(Name name, ExprContext context)
           
static NodeSetExpr getChildrenExpr()
           
(package private)  ConvertibleExpr makeRelationalExpr(Relation rel, ConvertibleExpr e1, ConvertibleExpr e2)
          A ConvertibleExpr allows for the casting of one type to another for the purpose of making a comparison
static BooleanExpr parseBooleanExpr(Node node, java.lang.String expr, VariableSet locals)
          parse an XPath expression which is to be used in a context in which a Boolean is expected
static NodeSetExpr parseNodeSetExpr(Node node, java.lang.String expr, VariableSet locals)
          parse an XPath expression which is to be used in a context in which a NodeSet is expected i.e.
static NumberExpr parseNumberExpr(Node node, java.lang.String expr, VariableSet locals)
          parse an XPath expression which is to be used in a context in which a Number is expected
static TopLevelPattern parsePattern(Node node, java.lang.String pattern)
          parse an XPath match Pattern
static TopLevelPattern parsePattern(Node node, java.lang.String pattern, VariableSet locals)
          parse an XPath match pattern (with some variables!?!?)
static StringExpr parseStringExpr(Node node, java.lang.String expr, VariableSet locals)
          parse an XPath expression which is to be used in a context in which a String is expected
static StringExpr parseValueExpr(Node node, java.lang.String value, VariableSet locals)
          parse an XSLT attribute value template (which may include XPath expression(s) enclosed in curlybraces "{" "}")
static VariantExpr parseVariantExpr(Node node, java.lang.String expr, VariableSet locals)
          parse an XPath expression which is to be used in a context in which a Variant (xsl:variable, xsl:param) is expected
 
Methods inherited from class com.jclark.xsl.expr.ExprTokenizer
next
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parseValueExpr

public static StringExpr parseValueExpr(Node node,
                                        java.lang.String value,
                                        VariableSet locals)
                                 throws XSLException
parse an XSLT attribute value template (which may include XPath expression(s) enclosed in curlybraces "{" "}")

Throws:
XSLException

getChildrenExpr

public static NodeSetExpr getChildrenExpr()

parsePattern

public static TopLevelPattern parsePattern(Node node,
                                           java.lang.String pattern)
                                    throws XSLException
parse an XPath match Pattern

Throws:
XSLException

parsePattern

public static TopLevelPattern parsePattern(Node node,
                                           java.lang.String pattern,
                                           VariableSet locals)
                                    throws XSLException
parse an XPath match pattern (with some variables!?!?)

Parameters:
node - represents the node in the stylesheet with the expression we're parsing. Used for plugging the location in any Exception we might throw xsl:number allows variables in the "count" and "from" attributes
Throws:
XSLException

parseNodeSetExpr

public static NodeSetExpr parseNodeSetExpr(Node node,
                                           java.lang.String expr,
                                           VariableSet locals)
                                    throws XSLException
parse an XPath expression which is to be used in a context in which a NodeSet is expected i.e. for the "select" attribute of an "xsl:apply-templates"

Throws:
XSLException

parseStringExpr

public static StringExpr parseStringExpr(Node node,
                                         java.lang.String expr,
                                         VariableSet locals)
                                  throws XSLException
parse an XPath expression which is to be used in a context in which a String is expected

Throws:
XSLException

parseNumberExpr

public static NumberExpr parseNumberExpr(Node node,
                                         java.lang.String expr,
                                         VariableSet locals)
                                  throws XSLException
parse an XPath expression which is to be used in a context in which a Number is expected

Throws:
XSLException

parseBooleanExpr

public static BooleanExpr parseBooleanExpr(Node node,
                                           java.lang.String expr,
                                           VariableSet locals)
                                    throws XSLException
parse an XPath expression which is to be used in a context in which a Boolean is expected

Throws:
XSLException

parseVariantExpr

public static VariantExpr parseVariantExpr(Node node,
                                           java.lang.String expr,
                                           VariableSet locals)
                                    throws XSLException
parse an XPath expression which is to be used in a context in which a Variant (xsl:variable, xsl:param) is expected

Throws:
XSLException

makeRelationalExpr

ConvertibleExpr makeRelationalExpr(Relation rel,
                                   ConvertibleExpr e1,
                                   ConvertibleExpr e2)
                             throws ParseException
A ConvertibleExpr allows for the casting of one type to another for the purpose of making a comparison

Throws:
ParseException

functionAvailable

static boolean functionAvailable(Name name,
                                 ExprContext context)
                          throws XSLException
Throws:
XSLException