org.exist.xquery.parser
Class XQueryTreeParser

java.lang.Object
  extended byantlr.TreeParser
      extended byorg.exist.xquery.parser.XQueryTreeParser
All Implemented Interfaces:
XQueryTreeParserTokenTypes

public class XQueryTreeParser
extends antlr.TreeParser
implements XQueryTreeParserTokenTypes

The tree parser: walks the AST created by XQueryParser and generates an internal representation of the query in the form of XQuery expression objects.


Field Summary
static java.lang.String[] _tokenNames
           
static antlr.collections.impl.BitSet _tokenSet_0
           
static antlr.collections.impl.BitSet _tokenSet_1
           
static antlr.collections.impl.BitSet _tokenSet_2
           
 
Fields inherited from class antlr.TreeParser
ASTNULL
 
Fields inherited from interface org.exist.xquery.parser.XQueryTreeParserTokenTypes
ABSOLUTE_DSLASH, ABSOLUTE_SLASH, AFTER, ANDEQ, APOS, APOS_ATTRIBUTE_CONTENT, AT, ATOMIC_TYPE, ATTRIBUTE, ATTRIBUTE_CONTENT, ATTRIBUTE_TEST, BASECHAR, BEFORE, CHAR, CHAR_REF, COLON, COMBINING_CHAR, COMMA, COMP_ATTR_CONSTRUCTOR, COMP_COMMENT_CONSTRUCTOR, COMP_DOC_CONSTRUCTOR, COMP_ELEM_CONSTRUCTOR, COMP_NS_CONSTRUCTOR, COMP_PI_CONSTRUCTOR, COMP_TEXT_CONSTRUCTOR, DECIMAL_LITERAL, DEF_COLLATION_DECL, DEF_FUNCTION_NS_DECL, DEF_NAMESPACE_DECL, DIGIT, DIGITS, DOLLAR, DOUBLE_LITERAL, DSLASH, ELEMENT, ELEMENT_CONTENT, END_TAG_START, EOF, EQ, ESCAPE_APOS, ESCAPE_QUOT, EXPR_COMMENT, EXTENDER, FLWOR, FUNCTION, FUNCTION_DECL, GLOBAL_VAR, GT, GTEQ, HEX_DIGITS, IDEOGRAPHIC, INTEGER_LITERAL, LCURLY, LETTER, LITERAL_ancestor, LITERAL_and, LITERAL_as, LITERAL_ascending, LITERAL_at, LITERAL_attribute, LITERAL_by, LITERAL_case, LITERAL_cast, LITERAL_castable, LITERAL_child, LITERAL_collation, LITERAL_collection, LITERAL_comment, LITERAL_construction, LITERAL_declare, LITERAL_default, LITERAL_delete, LITERAL_descendant, LITERAL_descending, LITERAL_div, LITERAL_document, LITERAL_element, LITERAL_else, LITERAL_empty, LITERAL_encoding, LITERAL_eq, LITERAL_every, LITERAL_except, LITERAL_external, LITERAL_following, LITERAL_for, LITERAL_function, LITERAL_ge, LITERAL_greatest, LITERAL_gt, LITERAL_idiv, LITERAL_if, LITERAL_import, LITERAL_in, LITERAL_inherit, LITERAL_insert, LITERAL_instance, LITERAL_intersect, LITERAL_into, LITERAL_is, LITERAL_isnot, LITERAL_item, LITERAL_le, LITERAL_least, LITERAL_let, LITERAL_lt, LITERAL_mod, LITERAL_module, LITERAL_namespace, LITERAL_ne, LITERAL_node, LITERAL_of, LITERAL_option, LITERAL_or, LITERAL_order, LITERAL_ordered, LITERAL_ordering, LITERAL_parent, LITERAL_preceding, LITERAL_preserve, LITERAL_rename, LITERAL_replace, LITERAL_return, LITERAL_satisfies, LITERAL_schema, LITERAL_self, LITERAL_some, LITERAL_strip, LITERAL_text, LITERAL_then, LITERAL_to, LITERAL_treat, LITERAL_typeswitch, LITERAL_union, LITERAL_unordered, LITERAL_update, LITERAL_validate, LITERAL_value, LITERAL_variable, LITERAL_version, LITERAL_where, LITERAL_with, LITERAL_xpointer, LITERAL_xquery, LPAREN, LPPAREN, LT, LTEQ, MINUS, MODULE, MODULE_DECL, MODULE_IMPORT, NAMESPACE_DECL, NCNAME, NEQ, NEXT_TOKEN, NMCHAR, NMSTART, NULL_TREE_LOOKAHEAD, OPTION, ORDER_BY, OREQ, PARENT, PARENTHESIZED, PLUS, POSITIONAL_VAR, PRAGMA, PRAGMA_END, PRAGMA_START, PREDEFINED_ENTITY_REF, PREDICATE, PREFIX_WILDCARD, PROLOG, QNAME, QUESTION, QUOT, QUOT_ATTRIBUTE_CONTENT, RCURLY, RPAREN, RPPAREN, S, SCHEMA_IMPORT, SELF, SEMICOLON, SLASH, STAR, STRING_LITERAL, TEXT, UNARY_MINUS, UNARY_PLUS, UNION, VARIABLE_BINDING, VARIABLE_REF, VERSION_DECL, WILDCARD, WS, XML_CDATA, XML_CDATA_END, XML_CDATA_START, XML_COMMENT, XML_COMMENT_END, XML_PI, XML_PI_END, XML_PI_START, XPOINTER, XPOINTER_ID
 
Constructor Summary
XQueryTreeParser()
           
XQueryTreeParser(XQueryContext context)
           
 
Method Summary
 Expression constructor(antlr.collections.AST _t, PathExpr path)
           
 Expression expr(antlr.collections.AST _t, PathExpr path)
          Process a top-level expression like FLWOR, conditionals, comparisons etc.
 Expression extensionExpr(antlr.collections.AST _t, PathExpr path)
           
 int forwardAxis(antlr.collections.AST _t)
           
 boolean foundErrors()
           
 Expression fulltextComp(antlr.collections.AST _t, PathExpr path)
           
 Expression functionCall(antlr.collections.AST _t, PathExpr path)
           
 void functionDecl(antlr.collections.AST _t, PathExpr path)
          Parse a declared function.
 Expression generalComp(antlr.collections.AST _t, PathExpr path)
           
 java.lang.String getErrorMessage()
           
 java.lang.Exception getLastException()
           
 ExternalModule getModule()
           
 void importDecl(antlr.collections.AST _t, PathExpr path)
           
 Expression literalExpr(antlr.collections.AST _t, PathExpr path)
           
 void module(antlr.collections.AST _t, PathExpr path)
           
 Expression nodeComp(antlr.collections.AST _t, PathExpr path)
           
 Expression numericExpr(antlr.collections.AST _t, PathExpr path)
           
 void param(antlr.collections.AST _t, java.util.List vars)
          Single function param.
 void paramList(antlr.collections.AST _t, java.util.List vars)
          Parse params in function declaration.
 Expression pathExpr(antlr.collections.AST _t, PathExpr path)
           
 void predicate(antlr.collections.AST _t, LocationStep step)
           
 Expression predicates(antlr.collections.AST _t, Expression expression)
           
 Expression primaryExpr(antlr.collections.AST _t, PathExpr path)
          Process a primary expression like function calls, variable references, value constructors etc.
 void prolog(antlr.collections.AST _t, PathExpr path)
          Process the XQuery prolog.
 void sequenceType(antlr.collections.AST _t, SequenceType type)
          A sequence type declaration.
 Expression typeCastExpr(antlr.collections.AST _t, PathExpr path)
           
 Expression updateExpr(antlr.collections.AST _t, PathExpr path)
           
 Expression valueComp(antlr.collections.AST _t, PathExpr path)
           
 void xpath(antlr.collections.AST _t, PathExpr path)
           
 void xpointer(antlr.collections.AST _t, PathExpr path)
           
 
Methods inherited from class antlr.TreeParser
getAST, getASTFactory, getTokenName, getTokenNames, match, panic, reportError, reportError, reportWarning, setASTFactory, setASTNodeClass, setASTNodeType, traceIn, traceIndent, traceOut
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_tokenNames

public static final java.lang.String[] _tokenNames

_tokenSet_0

public static final antlr.collections.impl.BitSet _tokenSet_0

_tokenSet_1

public static final antlr.collections.impl.BitSet _tokenSet_1

_tokenSet_2

public static final antlr.collections.impl.BitSet _tokenSet_2
Constructor Detail

XQueryTreeParser

public XQueryTreeParser(XQueryContext context)

XQueryTreeParser

public XQueryTreeParser()
Method Detail

getModule

public ExternalModule getModule()

foundErrors

public boolean foundErrors()

getErrorMessage

public java.lang.String getErrorMessage()

getLastException

public java.lang.Exception getLastException()

xpointer

public final void xpointer(antlr.collections.AST _t,
                           PathExpr path)
                    throws antlr.RecognitionException,
                           XPathException
Throws:
antlr.RecognitionException
XPathException

expr

public final Expression expr(antlr.collections.AST _t,
                             PathExpr path)
                      throws antlr.RecognitionException,
                             PermissionDeniedException,
                             EXistException,
                             XPathException
Process a top-level expression like FLWOR, conditionals, comparisons etc.

Throws:
antlr.RecognitionException
PermissionDeniedException
EXistException
XPathException

xpath

public final void xpath(antlr.collections.AST _t,
                        PathExpr path)
                 throws antlr.RecognitionException,
                        XPathException
Throws:
antlr.RecognitionException
XPathException

module

public final void module(antlr.collections.AST _t,
                         PathExpr path)
                  throws antlr.RecognitionException,
                         PermissionDeniedException,
                         EXistException,
                         XPathException
Throws:
antlr.RecognitionException
PermissionDeniedException
EXistException
XPathException

prolog

public final void prolog(antlr.collections.AST _t,
                         PathExpr path)
                  throws antlr.RecognitionException,
                         PermissionDeniedException,
                         EXistException,
                         XPathException
Process the XQuery prolog.

Throws:
antlr.RecognitionException
PermissionDeniedException
EXistException
XPathException

sequenceType

public final void sequenceType(antlr.collections.AST _t,
                               SequenceType type)
                        throws antlr.RecognitionException,
                               XPathException
A sequence type declaration.

Throws:
antlr.RecognitionException
XPathException

functionDecl

public final void functionDecl(antlr.collections.AST _t,
                               PathExpr path)
                        throws antlr.RecognitionException,
                               PermissionDeniedException,
                               EXistException,
                               XPathException
Parse a declared function.

Throws:
antlr.RecognitionException
PermissionDeniedException
EXistException
XPathException

importDecl

public final void importDecl(antlr.collections.AST _t,
                             PathExpr path)
                      throws antlr.RecognitionException,
                             PermissionDeniedException,
                             EXistException,
                             XPathException
Throws:
antlr.RecognitionException
PermissionDeniedException
EXistException
XPathException

paramList

public final void paramList(antlr.collections.AST _t,
                            java.util.List vars)
                     throws antlr.RecognitionException,
                            XPathException
Parse params in function declaration.

Throws:
antlr.RecognitionException
XPathException

param

public final void param(antlr.collections.AST _t,
                        java.util.List vars)
                 throws antlr.RecognitionException,
                        XPathException
Single function param.

Throws:
antlr.RecognitionException
XPathException

typeCastExpr

public final Expression typeCastExpr(antlr.collections.AST _t,
                                     PathExpr path)
                              throws antlr.RecognitionException,
                                     PermissionDeniedException,
                                     EXistException,
                                     XPathException
Throws:
antlr.RecognitionException
PermissionDeniedException
EXistException
XPathException

generalComp

public final Expression generalComp(antlr.collections.AST _t,
                                    PathExpr path)
                             throws antlr.RecognitionException,
                                    PermissionDeniedException,
                                    EXistException,
                                    XPathException
Throws:
antlr.RecognitionException
PermissionDeniedException
EXistException
XPathException

valueComp

public final Expression valueComp(antlr.collections.AST _t,
                                  PathExpr path)
                           throws antlr.RecognitionException,
                                  PermissionDeniedException,
                                  EXistException,
                                  XPathException
Throws:
antlr.RecognitionException
PermissionDeniedException
EXistException
XPathException

nodeComp

public final Expression nodeComp(antlr.collections.AST _t,
                                 PathExpr path)
                          throws antlr.RecognitionException,
                                 PermissionDeniedException,
                                 EXistException,
                                 XPathException
Throws:
antlr.RecognitionException
PermissionDeniedException
EXistException
XPathException

fulltextComp

public final Expression fulltextComp(antlr.collections.AST _t,
                                     PathExpr path)
                              throws antlr.RecognitionException,
                                     PermissionDeniedException,
                                     EXistException,
                                     XPathException
Throws:
antlr.RecognitionException
PermissionDeniedException
EXistException
XPathException

primaryExpr

public final Expression primaryExpr(antlr.collections.AST _t,
                                    PathExpr path)
                             throws antlr.RecognitionException,
                                    PermissionDeniedException,
                                    EXistException,
                                    XPathException
Process a primary expression like function calls, variable references, value constructors etc.

Throws:
antlr.RecognitionException
PermissionDeniedException
EXistException
XPathException

pathExpr

public final Expression pathExpr(antlr.collections.AST _t,
                                 PathExpr path)
                          throws antlr.RecognitionException,
                                 PermissionDeniedException,
                                 EXistException,
                                 XPathException
Throws:
antlr.RecognitionException
PermissionDeniedException
EXistException
XPathException

extensionExpr

public final Expression extensionExpr(antlr.collections.AST _t,
                                      PathExpr path)
                               throws antlr.RecognitionException,
                                      XPathException,
                                      PermissionDeniedException,
                                      EXistException
Throws:
antlr.RecognitionException
XPathException
PermissionDeniedException
EXistException

numericExpr

public final Expression numericExpr(antlr.collections.AST _t,
                                    PathExpr path)
                             throws antlr.RecognitionException,
                                    PermissionDeniedException,
                                    EXistException,
                                    XPathException
Throws:
antlr.RecognitionException
PermissionDeniedException
EXistException
XPathException

updateExpr

public final Expression updateExpr(antlr.collections.AST _t,
                                   PathExpr path)
                            throws antlr.RecognitionException,
                                   XPathException,
                                   PermissionDeniedException,
                                   EXistException
Throws:
antlr.RecognitionException
XPathException
PermissionDeniedException
EXistException

constructor

public final Expression constructor(antlr.collections.AST _t,
                                    PathExpr path)
                             throws antlr.RecognitionException,
                                    PermissionDeniedException,
                                    EXistException,
                                    XPathException
Throws:
antlr.RecognitionException
PermissionDeniedException
EXistException
XPathException

predicates

public final Expression predicates(antlr.collections.AST _t,
                                   Expression expression)
                            throws antlr.RecognitionException,
                                   PermissionDeniedException,
                                   EXistException,
                                   XPathException
Throws:
antlr.RecognitionException
PermissionDeniedException
EXistException
XPathException

literalExpr

public final Expression literalExpr(antlr.collections.AST _t,
                                    PathExpr path)
                             throws antlr.RecognitionException,
                                    XPathException
Throws:
antlr.RecognitionException
XPathException

functionCall

public final Expression functionCall(antlr.collections.AST _t,
                                     PathExpr path)
                              throws antlr.RecognitionException,
                                     PermissionDeniedException,
                                     EXistException,
                                     XPathException
Throws:
antlr.RecognitionException
PermissionDeniedException
EXistException
XPathException

forwardAxis

public final int forwardAxis(antlr.collections.AST _t)
                      throws antlr.RecognitionException,
                             PermissionDeniedException,
                             EXistException
Throws:
antlr.RecognitionException
PermissionDeniedException
EXistException

predicate

public final void predicate(antlr.collections.AST _t,
                            LocationStep step)
                     throws antlr.RecognitionException,
                            PermissionDeniedException,
                            EXistException,
                            XPathException
Throws:
antlr.RecognitionException
PermissionDeniedException
EXistException
XPathException


Copyright (C) Wolfgang Meier. All rights reserved.