Package gnu.xquery.lang
Class XQParser
java.lang.Object
java.io.Reader
gnu.text.Lexer
gnu.xquery.lang.XQParser
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Readable
A class to read xquery forms.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String[]
static final CastableAs
static final QuoteExp
static final InstanceOf
static QuoteExp
static QuoteExp
static Expression
static final Convert
static boolean
static boolean
Fields inherited from class gnu.text.Lexer
nesting, port, tentative, tokenBuffer, tokenBufferLength
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
appendNamedEntity
(String name) static Expression
booleanValue
(Expression exp) Coerce the value of an expresison to a boolean value.void
void
void
void
void
getDelimited
(String delimiter) Scan until a given delimiter.void
handleOption
(Symbol name, String value) static Expression
makeFunctionExp
(String className, String name) static Expression
makeFunctionExp
(String className, String fieldName, String name) void
mark()
Start tentative parsing.boolean
void
maybeSetLine
(Declaration decl, int line, int column) void
maybeSetLine
(Expression exp, int line, int column) void
maybeSetLine
(Expression exp, int startLine, int startColumn, int endLine, int endColumn) protected Symbol
namespaceResolve
(String name, boolean function) parse
(Compilation comp) Parse an expression.parseFLWRExpression
(boolean isFor) parseFLWRInner
(boolean isFor) Parse a let- or a for-expression.parseFunctionDefinition
(int declLine, int declColumn) parseNamedNodeType
(boolean attribute) Parse: ["as" SequenceType]parseQuantifiedExpr
(boolean isEvery) Parse a some- or an every-expression.Parse a Variable.void
reset()
Stop tentative parsing.void
setInteractive
(boolean v) void
setStaticBaseUri
(String uri) syntaxError
(String message) syntaxError
(String message, String code) Handle syntax errors (at rewrite time).Methods inherited from class gnu.text.Lexer
checkErrors, checkNext, clearErrors, close, eofError, error, error, fatal, getColumnNumber, getErrors, getLineNumber, getMessages, getName, getPort, isInteractive, isTentative, peek, popNesting, pushNesting, read, read, readCodePoint, readDelimited, readDigits, readDigitsInBuffer, readIntDigits, readOptionalExponent, readUnicodeChar, seenErrors, setMessages, setTentative, skip, skip_quick, tokenBufferAppend, tokenBufferString, unread, unread, unread_quick
Methods inherited from class java.io.Reader
mark, markSupported, nullReader, read, read, ready, skip, transferTo
-
Field Details
-
warnOldVersion
public static boolean warnOldVersion -
warnHidePreviousDeclaration
public static boolean warnHidePreviousDeclaration -
instanceOf
-
castableAs
-
treatAs
-
functionNamespacePath
-
makeChildAxisStep
-
makeDescendantAxisStep
-
makeText
-
getExternalFunction
-
axisNames
-
-
Constructor Details
-
XQParser
-
-
Method Details
-
setStaticBaseUri
-
getStaticBaseUri
-
resolveAgainstBaseUri
-
mark
Description copied from class:Lexer
Start tentative parsing. Must be followed by a reset.- Overrides:
mark
in classLexer
- Throws:
IOException
-
reset
Description copied from class:Lexer
Stop tentative parsing. Return to position where we called mark.- Overrides:
reset
in classLexer
- Throws:
IOException
-
getDelimited
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:
IOException
SyntaxException
-
appendNamedEntity
-
setInteractive
public void setInteractive(boolean v) - Overrides:
setInteractive
in classLexer
-
parseNamedNodeType
- Throws:
IOException
SyntaxException
-
parseOptionalTypeDeclaration
Parse: ["as" SequenceType]- Throws:
IOException
SyntaxException
-
parseDataType
- Throws:
IOException
SyntaxException
-
parseMaybeKindTest
- Throws:
IOException
SyntaxException
-
parseItemType
- Throws:
IOException
SyntaxException
-
booleanValue
Coerce the value of an expresison to a boolean value. -
parseIfExpr
- Throws:
IOException
SyntaxException
-
match
-
parseVariable
Parse a Variable.- Throws:
IOException
SyntaxException
-
parseVariableDeclaration
- Throws:
IOException
SyntaxException
-
parseFLWRExpression
- Throws:
IOException
SyntaxException
-
parseFLWRInner
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:
IOException
SyntaxException
-
parseQuantifiedExpr
Parse a some- or an every-expression. Assume the 'some'/'every'-token has been seen, and we've read '$'.- Throws:
IOException
SyntaxException
-
parseFunctionDefinition
public Expression parseFunctionDefinition(int declLine, int declColumn) throws IOException, SyntaxException - Throws:
IOException
SyntaxException
-
readObject
- Throws:
IOException
SyntaxException
-
namespaceResolve
-
parse
Parse an expression. Return null on EOF.- Throws:
IOException
SyntaxException
-
handleOption
-
makeFunctionExp
-
makeFunctionExp
-
error
-
error
-
declError
- Throws:
IOException
SyntaxException
-
syntaxError
Handle syntax errors (at rewrite time).- Parameters:
message
- an error message to print out- Returns:
- an ErrorExp
- Throws:
IOException
SyntaxException
-
syntaxError
- Throws:
IOException
SyntaxException
-
eofError
- Overrides:
eofError
in classLexer
- Throws:
SyntaxException
-
fatal
- Throws:
SyntaxException
-
maybeSetLine
-
maybeSetLine
public void maybeSetLine(Expression exp, int startLine, int startColumn, int endLine, int endColumn) -
maybeSetLine
-