Class XQParser

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.lang.Readable

    public class XQParser
    extends Lexer
    A class to read xquery forms.
    • Field Detail

      • warnOldVersion

        public static boolean warnOldVersion
      • warnHidePreviousDeclaration

        public static boolean warnHidePreviousDeclaration
      • instanceOf

        public static final InstanceOf instanceOf
      • castableAs

        public static final CastableAs castableAs
      • treatAs

        public static final Convert treatAs
      • functionNamespacePath

        public Namespace[] functionNamespacePath
      • makeChildAxisStep

        public static QuoteExp makeChildAxisStep
      • makeDescendantAxisStep

        public static QuoteExp makeDescendantAxisStep
      • getExternalFunction

        public static final QuoteExp getExternalFunction
      • axisNames

        public static final java.lang.String[] axisNames
    • Constructor Detail

    • Method Detail

      • setStaticBaseUri

        public void setStaticBaseUri​(java.lang.String uri)
      • getStaticBaseUri

        public java.lang.String getStaticBaseUri()
      • resolveAgainstBaseUri

        public java.lang.String resolveAgainstBaseUri​(java.lang.String uri)
      • mark

        public void mark()
                  throws java.io.IOException
        Description copied from class: Lexer
        Start tentative parsing. Must be followed by a reset.
        Overrides:
        mark in class Lexer
        Throws:
        java.io.IOException
      • reset

        public void reset()
                   throws java.io.IOException
        Description copied from class: Lexer
        Stop tentative parsing. Return to position where we called mark.
        Overrides:
        reset in class Lexer
        Throws:
        java.io.IOException
      • getDelimited

        public void getDelimited​(java.lang.String delimiter)
                          throws java.io.IOException,
                                 SyntaxException
        Scan until a given delimiter. On success, text upto the delimiter is in then tokenBuffer (with tokenBufferLength marking its length); the delimiter is not included.
        Throws:
        java.io.IOException
        SyntaxException
      • appendNamedEntity

        public void appendNamedEntity​(java.lang.String name)
      • setInteractive

        public void setInteractive​(boolean v)
        Overrides:
        setInteractive in class Lexer
      • booleanValue

        public static Expression booleanValue​(Expression exp)
        Coerce the value of an expresison to a boolean value.
      • match

        public boolean match​(java.lang.String word)
      • parseVariable

        public java.lang.Object parseVariable()
                                       throws java.io.IOException,
                                              SyntaxException
        Parse a Variable.
        Throws:
        java.io.IOException
        SyntaxException
      • parseFLWRInner

        public Expression parseFLWRInner​(boolean isFor)
                                  throws java.io.IOException,
                                         SyntaxException
        Parse a let- or a for-expression. Assume the 'let'/'for'-token has been seen, and we've read '$'. If we see the 'order' keyword of an 'order by' clause then we stop parsing, and return a result as if we instead saw a 'return make-tuple($x, ...)'. The 'order by' clause will get parsed by the outer-most 'for' or 'let'.
        Throws:
        java.io.IOException
        SyntaxException
      • parseQuantifiedExpr

        public Expression parseQuantifiedExpr​(boolean isEvery)
                                       throws java.io.IOException,
                                              SyntaxException
        Parse a some- or an every-expression. Assume the 'some'/'every'-token has been seen, and we've read '$'.
        Throws:
        java.io.IOException
        SyntaxException
      • namespaceResolve

        protected Symbol namespaceResolve​(java.lang.String name,
                                          boolean function)
      • handleOption

        public void handleOption​(Symbol name,
                                 java.lang.String value)
      • makeFunctionExp

        public static Expression makeFunctionExp​(java.lang.String className,
                                                 java.lang.String name)
      • makeFunctionExp

        public static Expression makeFunctionExp​(java.lang.String className,
                                                 java.lang.String fieldName,
                                                 java.lang.String name)
      • error

        public void error​(char severity,
                          java.lang.String message,
                          java.lang.String code)
      • error

        public void error​(char severity,
                          java.lang.String message)
        Overrides:
        error in class Lexer
      • syntaxError

        public Expression syntaxError​(java.lang.String message,
                                      java.lang.String code)
                               throws java.io.IOException,
                                      SyntaxException
        Handle syntax errors (at rewrite time).
        Parameters:
        message - an error message to print out
        Returns:
        an ErrorExp
        Throws:
        java.io.IOException
        SyntaxException
      • maybeSetLine

        public void maybeSetLine​(Expression exp,
                                 int line,
                                 int column)
      • maybeSetLine

        public void maybeSetLine​(Expression exp,
                                 int startLine,
                                 int startColumn,
                                 int endLine,
                                 int endColumn)
      • maybeSetLine

        public void maybeSetLine​(Declaration decl,
                                 int line,
                                 int column)