org.exist.xquery.parser
Class XQueryParser
java.lang.Object
antlr.Parser
antlr.LLkParser
org.exist.xquery.parser.XQueryParser
- All Implemented Interfaces:
- XQueryTokenTypes
public class XQueryParser
- extends LLkParser
- implements XQueryTokenTypes
eXist parses an XQuery expression in (currently) 4 phases:
1) lexical analysis in XQueryLexer
2) syntax analysis and construction of an intermediate AST (abstract
syntax tree) in XQueryParser
3) analysis of the intermediate AST, and construction of the executable XQuery
expression tree from the intermediate AST in XQueryTreeParser
4) static analysis of the final expression tree
The grammar in XQuery.g corresponds to phase 2. It generates an
intermediate AST which will then be parsed a second time by
XQueryTree.g.
ANTLR provides a special syntax for tree parsers. Every
action returns an AST node and the # references these nodes.
#[VARIABLE_BINDING, varName] constructs a new AST node of type
VARIABLE_BINDING, which is prepended to the default AST generated by
the production.
ANTLR's meta language for tree construction is described in the ANTLR reference manual:
http://www.antlr.org/doc/index.html .
| Fields inherited from interface org.exist.xquery.parser.XQueryTokenTypes |
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, GROUP_BY, 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_group, 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 |
| Methods inherited from class antlr.Parser |
addMessageListener, addParserListener, addParserMatchListener, addParserTokenListener, addSemanticPredicateListener, addSyntacticPredicateListener, addTraceListener, consumeUntil, consumeUntil, getAST, getASTFactory, getFilename, getInputState, getTokenName, getTokenNames, getTokenTypeToASTClassMap, isDebugMode, mark, match, match, matchNot, panic, removeMessageListener, removeParserListener, removeParserMatchListener, removeParserTokenListener, removeSemanticPredicateListener, removeSyntacticPredicateListener, removeTraceListener, reportError, reportError, reportWarning, rewind, setASTFactory, setASTNodeClass, setASTNodeType, setDebugMode, setFilename, setIgnoreInvalidDebugCalls, setInputState, setTokenBuffer, traceIndent |
_tokenNames
public static final String[] _tokenNames
_tokenSet_0
public static final BitSet _tokenSet_0
_tokenSet_1
public static final BitSet _tokenSet_1
_tokenSet_2
public static final BitSet _tokenSet_2
_tokenSet_3
public static final BitSet _tokenSet_3
_tokenSet_4
public static final BitSet _tokenSet_4
_tokenSet_5
public static final BitSet _tokenSet_5
_tokenSet_6
public static final BitSet _tokenSet_6
_tokenSet_7
public static final BitSet _tokenSet_7
_tokenSet_8
public static final BitSet _tokenSet_8
_tokenSet_9
public static final BitSet _tokenSet_9
_tokenSet_10
public static final BitSet _tokenSet_10
_tokenSet_11
public static final BitSet _tokenSet_11
_tokenSet_12
public static final BitSet _tokenSet_12
_tokenSet_13
public static final BitSet _tokenSet_13
_tokenSet_14
public static final BitSet _tokenSet_14
_tokenSet_15
public static final BitSet _tokenSet_15
_tokenSet_16
public static final BitSet _tokenSet_16
XQueryParser
public XQueryParser(XQueryLexer lexer)
XQueryParser
public XQueryParser(TokenBuffer tokenBuf)
XQueryParser
public XQueryParser(TokenStream lexer)
XQueryParser
public XQueryParser(ParserSharedInputState state)
foundErrors
public boolean foundErrors()
getErrorMessage
public String getErrorMessage()
imaginaryTokenDefinitions
public final void imaginaryTokenDefinitions()
throws RecognitionException,
TokenStreamException
- Throws:
RecognitionException
TokenStreamException
xpointer
public final void xpointer()
throws RecognitionException,
TokenStreamException,
XPathException
- Throws:
RecognitionException
TokenStreamException
XPathException
expr
public final void expr()
throws RecognitionException,
TokenStreamException,
XPathException
- Throws:
RecognitionException
TokenStreamException
XPathException
xpath
public final void xpath()
throws RecognitionException,
TokenStreamException,
XPathException
- top-rule
- Throws:
RecognitionException
TokenStreamException
XPathException
module
public final void module()
throws RecognitionException,
TokenStreamException,
XPathException
- Throws:
RecognitionException
TokenStreamException
XPathException
versionDecl
public final void versionDecl()
throws RecognitionException,
TokenStreamException,
XPathException
- Throws:
RecognitionException
TokenStreamException
XPathException
libraryModule
public final void libraryModule()
throws RecognitionException,
TokenStreamException,
XPathException
- Throws:
RecognitionException
TokenStreamException
XPathException
mainModule
public final void mainModule()
throws RecognitionException,
TokenStreamException,
XPathException
- Throws:
RecognitionException
TokenStreamException
XPathException
prolog
public final void prolog()
throws RecognitionException,
TokenStreamException,
XPathException
- Throws:
RecognitionException
TokenStreamException
XPathException
queryBody
public final void queryBody()
throws RecognitionException,
TokenStreamException,
XPathException
- Throws:
RecognitionException
TokenStreamException
XPathException
moduleDecl
public final void moduleDecl()
throws RecognitionException,
TokenStreamException,
XPathException
- Throws:
RecognitionException
TokenStreamException
XPathException
importDecl
public final void importDecl()
throws RecognitionException,
TokenStreamException,
XPathException
- Throws:
RecognitionException
TokenStreamException
XPathException
setter
public final void setter()
throws RecognitionException,
TokenStreamException
- Throws:
RecognitionException
TokenStreamException
namespaceDecl
public final void namespaceDecl()
throws RecognitionException,
TokenStreamException
- Throws:
RecognitionException
TokenStreamException
optionDecl
public final void optionDecl()
throws RecognitionException,
TokenStreamException
- Throws:
RecognitionException
TokenStreamException
functionDecl
public final void functionDecl()
throws RecognitionException,
TokenStreamException,
XPathException
- Throws:
RecognitionException
TokenStreamException
XPathException
varDecl
public final void varDecl()
throws RecognitionException,
TokenStreamException,
XPathException
- Throws:
RecognitionException
TokenStreamException
XPathException
moduleImport
public final void moduleImport()
throws RecognitionException,
TokenStreamException
- Throws:
RecognitionException
TokenStreamException
schemaImport
public final void schemaImport()
throws RecognitionException,
TokenStreamException
- Throws:
RecognitionException
TokenStreamException
preserveMode
public final void preserveMode()
throws RecognitionException,
TokenStreamException