Class QueryParser

java.lang.Object
org.basex.util.InputParser
org.basex.query.QueryParser
Direct Known Subclasses:
QuerySuggest

public class QueryParser extends InputParser
Parser for XQuery expressions.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Field Details

    • modules

      public final TokenSet modules
      Modules loaded by the current file.
    • namespaces

      public final TokenMap namespaces
      Namespaces.
    • qc

      public final QueryContext qc
      Query context.
    • sc

      public final StaticContext sc
      Static context.
  • Constructor Details

    • QueryParser

      public QueryParser(String query, String uri, QueryContext qctx, StaticContext sctx)
      Constructor.
      Parameters:
      query - query string
      uri - base URI (can be null; only passed on if not bound to static context yet)
      qctx - query context
      sctx - static context (can be null)
  • Method Details

    • parseMain

      public final MainModule parseMain() throws QueryException
      Parses a main module. Parses the "MainModule" rule. Parses the "Setter" rule. Parses the "QueryBody (= Expr)" rule.
      Returns:
      resulting root expression
      Throws:
      QueryException - query exception
    • parseLibrary

      public final LibraryModule parseLibrary(boolean check) throws QueryException
      Parses a library module. Parses the "ModuleDecl" rule.
      Parameters:
      check - check functions and variables
      Returns:
      name of the module
      Throws:
      QueryException - query exception
    • module

      public final void module(String path, String uri, InputInfo ii) throws QueryException
      Parses the specified module, checking function and variable references at the end.
      Parameters:
      path - file path
      uri - base URI of module
      ii - input info
      Throws:
      QueryException - query exception
    • error

      public QueryException error(QueryError error, InputInfo ii, Object... arg)
      Creates the specified error.
      Parameters:
      error - error to be thrown
      ii - input info
      arg - error arguments
      Returns:
      error