## org.exist.xquery.parser
Class DeclScanner

    java.lang.Object
      antlr.Parser
          antlr.LLkParser
              org.exist.xquery.parser.DeclScanner

All Implemented Interfaces:
  DeclScannerTokenTypes

public class DeclScanner
extends antlr.LLkParser
implements DeclScannerTokenTypes

Try to read the XQuery declaration. The purpose of this class is to determine the content encoding of an XQuery. It just reads until it finds an XQuery declaration and throws an XPathException afterwards. It also throws a RecognitionException if something else than a comment, a pragma or an XQuery declaration is found. The declared encoding can then be retrieved from getEncoding().

Field Summary
`static java.lang.String[]` `_tokenNames`

Fields inherited from interface org.exist.xquery.parser.DeclScannerTokenTypes

`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
`DeclScanner(antlr.ParserSharedInputState state)`
`DeclScanner(antlr.TokenBuffer tokenBuf)`
`DeclScanner(antlr.TokenStream lexer)`

Method Summary
`java.lang.String` `getEncoding()`
`void` `versionDecl()`

Methods inherited from class antlr.LLkParser
`consume, LA, LT, traceIn, traceOut`

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`

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

Constructor Detail

### DeclScanner

    public DeclScanner(antlr.TokenBuffer tokenBuf)

### DeclScanner

    public DeclScanner(antlr.TokenStream lexer)

### DeclScanner

    public DeclScanner(antlr.ParserSharedInputState state)

Method Detail

### getEncoding

    public java.lang.String getEncoding()

### versionDecl

    public final void versionDecl()
                           throws antlr.RecognitionException,
                                  antlr.TokenStreamException,
                                  XPathException

  Throws:
    `antlr.RecognitionException`
    `antlr.TokenStreamException`
    `XPathException`

Copyright (C) Wolfgang Meier. All rights reserved.