Package gnu.xquery.lang
Class XQuery
java.lang.Object
gnu.expr.Language
gnu.xquery.lang.XQuery
- Direct Known Subclasses:
XSLT
The XQuery language.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Pseudo-namespace "prefix" for the default element namespace.static final String
Pseudo-namespace "prefix" for the default function namespace.static final Namespace[]
static Environment
Environment of pre-defined non-standard Qexo/Kawa functions.static QuoteExp
static final ConstantFunction0
static final XQuery
static final String
static final Namespace
static final String
static final int
Special parser flag used byevalToFocusProc
.static final String
static final Namespace
static final String
static final String
static QuoteExp
static final ConstantFunction0
static final int
static final String
static final Environment
static final String
static final Namespace
Fields inherited from class gnu.expr.Language
current, environ, FUNCTION_NAMESPACE, global, NAMESPACE_PREFIX_NAMESPACE, PARSE_CURRENT_NAMES, PARSE_EMIT_MAIN, PARSE_EXPLICIT, PARSE_FOR_APPLET, PARSE_FOR_EVAL, PARSE_FOR_LINT, PARSE_FOR_SERVLET, PARSE_IMMEDIATE, PARSE_INTERACTIVE_MODULE, PARSE_ONE_LINE, PARSE_PROLOG, requirePedantic, userEnv, VALUE_NAMESPACE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapplyWithFocus
(Procedure proc, Object values) Call a procedure with each item in a sequence as the context item.applyWithFocus
(Procedure proc, Object item, int position, int size) Call a procedure with a given focus (context).void
applyWithFocus
(Procedure proc, Object item, int position, int size, Consumer out) Call a procedure with a given focus (context).void
applyWithFocus
(Procedure proc, Object values, Consumer out) Call a procedure with each item in a sequence as the context item.void
applyWithFocus$X
(Procedure proc, Object values, CallContext ctx) Call a procedure with each item in a sequence as the context item.static char
static Numeric
void
Enter a value into the current environment.protected void
define_method
(String name, String cname, String mname) void
eval_with_focus$X
(String expr, Object item, int position, int size, CallContext ctx) Evaluate an expression with a given focus (context).void
eval_with_focus$X
(String expr, Object values, CallContext ctx) Evaluate an expression with a given focus (context).evalToFocusProc
(Reader in, SourceMessages messages) Parse an XQuery expression from aReader
that is the body of a procedure.evalToFocusProc
(String expr) Parse an XQuery expression that is the body of a procedure.void
evalWithFocus
(Reader in, SourceMessages messages, Object item, int position, int size, Consumer out) Evaluate an expression with a given focus (context).void
evalWithFocus
(Reader in, SourceMessages messages, Object values, Consumer out) Evaluate an expression with each item in a sequence as the context item.evalWithFocus
(String expr, Object values) Evaluate an expression with each item in a sequence as the context item.evalWithFocus
(String expr, Object item, int position, int size) Evaluate an expression with a given focus (context).formatType
(Type type) getCompilation
(Lexer lexer, SourceMessages messages, NameLookup lexical) static Object
getExternal
(Symbol name, Object type) static XQuery
getLexer
(gnu.kawa.io.InPort inp, SourceMessages messages) getName()
int
getNamespaceOf
(Declaration decl) Return the namespace (e.g value or function) of a Declaration.getOutputConsumer
(Writer out) getStandardType
(String name) getTypeFor
(Class clas) getTypeFor
(String name) boolean
hasNamespace
(Declaration decl, int namespace) True if a Declaration is in the specified namespace.boolean
True if functions are in a separate name space from variable.boolean
Test if a value is considered "true" in this language.static String
makeClassName
(String source) static String
static int
namespaceForFunctions
(int argCount) boolean
parse
(Compilation tr, int options) static void
The compiler insert calls to this method for applications and applets.void
resolve
(Compilation comp) Perform any need post-processing after we've read all the modules to be compiled.Methods inherited from class gnu.expr.Language
asType, booleanObject, booleanValue, coerceFromObject, coerceToObject, declFromField, decodeType, defAliasStFld, defineFunction, defineFunction, defProcStFld, defProcStFld, defProcStFld, defProcStFldAs, detect, detect, detect, encodeType, eval, eval, eval, eval, eval, eval, eval, eval, eval, getCompilation, getCompilation, getCompilationClass, getDefaultLanguage, getEnvironment, getEnvPropertyFor, getEnvPropertyFor, getExtensions, getFormat, getInstance, getInstance, getInstanceFromFilenameExtension, getLangEnvironment, getLangTypeFor, getLanguages, getNamedType, getNewEnvironment, getTypeFor, getTypeFor, getTypeFor, isValidJavaName, loadClass, lookup, lookupBuiltin, mangleName, noValue, parse, parse, parse, parse, registerLanguage, restoreCurrent, runAsApplication, setCurrentLanguage, setDefaults, setSaveCurrent, unionType
-
Field Details
-
XQUERY_FUNCTION_NAMESPACE
- See Also:
-
KAWA_FUNCTION_NAMESPACE
- See Also:
-
QEXO_FUNCTION_NAMESPACE
- See Also:
-
LOCAL_NAMESPACE
- See Also:
-
SCHEMA_NAMESPACE
- See Also:
-
SCHEMA_INSTANCE_NAMESPACE
- See Also:
-
XHTML_NAMESPACE
- See Also:
-
xqueryFunctionNamespace
-
kawaFunctionNamespace
-
qexoFunctionNamespace
-
defaultFunctionNamespacePath
-
DEFAULT_ELEMENT_PREFIX
Pseudo-namespace "prefix" for the default element namespace. -
DEFAULT_FUNCTION_PREFIX
Pseudo-namespace "prefix" for the default function namespace.- See Also:
-
PARSE_WITH_FOCUS
public static final int PARSE_WITH_FOCUSSpecial parser flag used byevalToFocusProc
.- See Also:
-
VARIADIC_FUNCTION_NAMESPACE
public static final int VARIADIC_FUNCTION_NAMESPACE- See Also:
-
extensionsEnvEnv
Environment of pre-defined non-standard Qexo/Kawa functions. -
xqEnvironment
-
instance
-
falseExp
-
trueExp
-
falseFunction
-
trueFunction
-
-
Constructor Details
-
XQuery
public XQuery()
-
-
Method Details
-
hasSeparateFunctionNamespace
public boolean hasSeparateFunctionNamespace()Description copied from class:Language
True if functions are in a separate name space from variable. Is true for e.g. Common Lisp, Emacs Lisp; false for Scheme.- Overrides:
hasSeparateFunctionNamespace
in classLanguage
-
asNumber
-
asChar
-
isTrue
Description copied from class:Language
Test if a value is considered "true" in this language. Throws an exception if value can't be used in a boolean context. Use booleanValue to catch that exception. -
getLexer
-
getCompilation
-
parse
- Specified by:
parse
in classLanguage
- Throws:
IOException
SyntaxException
-
resolve
Description copied from class:Language
Perform any need post-processing after we've read all the modules to be compiled. Using a separate pass allows compiling mutually recursive modules. -
namespaceForFunctions
public static int namespaceForFunctions(int argCount) -
getNamespaceOf
Description copied from class:Language
Return the namespace (e.g value or function) of a Declaration. Return a bitmask of all the namespaces "covered" by the Declaration. Note this isn't a namespace in the XML sense; if a Declaration has a specific namespace URI, then that is part of its symbol. This namespace bitmap is a separate dimension, for the use of languages that have separate namespaces for different kinds of declarations, such as variables and functions.- Overrides:
getNamespaceOf
in classLanguage
-
hasNamespace
Description copied from class:Language
True if a Declaration is in the specified namespace.- Overrides:
hasNamespace
in classLanguage
- Parameters:
namespace
- normally a bitmask as returned by getNamespaceOf.
-
getSymbol
-
define
Description copied from class:Language
Enter a value into the current environment. -
define_method
-
getName
-
applyWithFocus
public void applyWithFocus(Procedure proc, Object item, int position, int size, Consumer out) throws Throwable Call a procedure with a given focus (context).- Parameters:
proc
- a 3-operandProcedure
as returned byevalToFocusProc
item
- the context item, passed as the first argument toproc
position
- the context position, passed as the second argumentsize
- the context size, passed as the second argumentout
- where to send the result ofproc
- Throws:
Throwable
-
applyWithFocus
Call a procedure with a given focus (context).- Parameters:
proc
- a 3-operandProcedure
as returned byevalToFocusProc
item
- the context item, passed as the first argument toproc
position
- the context position, passed as the second argumentsize
- the context size, passed as the second argument- Returns:
- the result of applying
proc
- Throws:
Throwable
-
applyWithFocus
Call a procedure with each item in a sequence as the context item.- Parameters:
proc
- a 3-operandProcedure
as returned byevalToFocusProc
values
- a sequence. Theproc
is called once for each item, with the item as the first argument, a 1-based index as the second argument, and the sequence size as the third argument.out
- where to send the result ofproc
- Throws:
Throwable
-
applyWithFocus
Call a procedure with each item in a sequence as the context item.- Parameters:
proc
- a 3-operandProcedure
as returned byevalToFocusProc
values
- a sequence. Theproc
is called once for each item, with the item as the first argument, a 1-based index as the second argument, and the sequence size as the third argument.- Returns:
- the result of applying
proc
- Throws:
Throwable
-
applyWithFocus$X
Call a procedure with each item in a sequence as the context item.- Parameters:
proc
- a 3-operandProcedure
as returned byevalToFocusProc
values
- a sequence. Theproc
is called once for each item, with the item as the first argument, a 1-based index as the second argument, and the sequence size as the third argument.ctx
- theCallContext
. The$X
in the method name tells Kawa that this argument is implicit when invoked from XQuery.- Throws:
Throwable
-
evalToFocusProc
Parse an XQuery expression that is the body of a procedure. Helper method used byevalWithFocus
methods.- Parameters:
expr
- an XQuery expression (query) to evaluate- Returns:
- a 3-operand Procedure whose arguments become the context item, position, and size.
- Throws:
Throwable
-
evalToFocusProc
Parse an XQuery expression from aReader
that is the body of a procedure. Helper method used byevalWithFocus
methods.- Parameters:
in
- where we read the expression frommessages
- where to write syntax errors- Returns:
- a 3-operand Procedure whose arguments become the context item, position, and size.
- Throws:
Throwable
-
evalWithFocus
public void evalWithFocus(Reader in, SourceMessages messages, Object values, Consumer out) throws Throwable Evaluate an expression with each item in a sequence as the context item.- Parameters:
in
- where we read the expression frommessages
- where to write syntax errorsvalues
- becomes the context sequence while evaluatingexpr
.out
- where to send the result of the expression- Throws:
Throwable
-
evalWithFocus
Evaluate an expression with each item in a sequence as the context item.- Parameters:
expr
- an XQuery expression (query) to evaluatevalues
- becomes the context sequence while evaluating the expression- Returns:
- the result of evaluating the expression
- Throws:
Throwable
-
evalWithFocus
Evaluate an expression with a given focus (context).- Parameters:
expr
- an XQuery expression (query) to evaluateitem
- becomes the context item while evaluatingexpr
.position
- becomes the context positionsize
- becomes the context size- Returns:
- the result of evaluating
expr
- Throws:
Throwable
-
evalWithFocus
public void evalWithFocus(Reader in, SourceMessages messages, Object item, int position, int size, Consumer out) throws Throwable Evaluate an expression with a given focus (context).- Parameters:
in
- where we read the expression frommessages
- where to write syntax errorsitem
- becomes the context item while evaluating the expressionposition
- becomes the context positionsize
- becomes the context sizeout
- where to send the result of the expression- Throws:
Throwable
-
eval_with_focus$X
Evaluate an expression with a given focus (context). Similar toevalWithFocus(String, Object, Consumer)
. The "$X" in the method name tells the Kawa compiler that the CallContext argument is implicit, so it can be invoked from XQuery code thus:XQuery:eval-with-focus($xquery, "expr", $sequence)
- Throws:
Throwable
-
eval_with_focus$X
public void eval_with_focus$X(String expr, Object item, int position, int size, CallContext ctx) throws Throwable Evaluate an expression with a given focus (context). Similar toevalWithFocus(String, Object, int, int, Consumer)
. The "$X" in the method name tells the Kawa compiler that the CallContext argument is implicit, so it can be invoked from XQuery code thus:XQuery:eval-with-focus($xquery, "expr", $item, $pos, $size)
- Throws:
Throwable
-
getInstance
-
registerEnvironment
public static void registerEnvironment()The compiler insert calls to this method for applications and applets. -
getOutputConsumer
- Overrides:
getOutputConsumer
in classLanguage
-
getStandardType
-
getTypeFor
- Overrides:
getTypeFor
in classLanguage
-
formatType
- Overrides:
formatType
in classLanguage
-
getTypeFor
- Overrides:
getTypeFor
in classLanguage
-
getPrimaryPrompt
- Overrides:
getPrimaryPrompt
in classLanguage
-
getSecondaryPrompt
- Overrides:
getSecondaryPrompt
in classLanguage
-
mangle
-
makeClassName
-
getExternal
-