gnu.xquery.lang

Class XQParser


public class XQParser
extends Lexer

A class to read xquery forms.

Field Summary

static String[]
axisNames
Namespace[]
functionNamespacePath
static InstanceOf
instanceOf
static boolean
warnOldVersion

Fields inherited from class gnu.text.Lexer

interactive, nesting, port, tokenBuffer, tokenBufferLength

Constructor Summary

XQParser(InPort port, SourceMessages messages, XQuery interp)

Method Summary

void
appendNamedEntity(String name)
static Expression
booleanValue(Expression exp)
Coerce the value of an expresison to a boolean value.
Expression
declError(String message)
void
error(char severity, String message)
void
getDelimited(String delimiter)
Scan until a given delimiter.
static boolean
isNamePart(char ch)
static boolean
isNameStart(char ch)
static Expression
makeFunctionExp(String className, String name)
static Expression
makeFunctionExp(String className, String fieldName, String name)
void
mark()
boolean
match(String word)
Expression
parse(Compilation comp)
Parse an expression.
Expression
parseDataType()
Type
parseElementType()
Expression
parseFLWRExpression(boolean isFor)
Expression
parseFLWRInner(boolean isFor)
Parse a let- or a for-expression.
Expression
parseFunctionDefinition(int declLine, int declColumn)
Expression
parseIfExpr()
Type
parseItemType()
Expression
parseOptionalTypeDeclaration()
Parse: ["as" SequenceType]
Expression
parseQuantifiedExpr(boolean isEvery)
Parse a some- or an every-expression.
Object
parseVariable()
Parse a Variable.
Declaration
parseVariableDeclaration()
Object
readObject()
void
reset()
void
setInteractive(boolean v)
void
setType(Declaration decl, Expression type)
static Expression
stringValue(Expression exp)
Coerce the value of an expresison to a string value.
Expression
syntaxError(String message)
Handle syntax errors (at rewrite time).

Methods inherited from class gnu.text.Lexer

checkErrors, checkNext, clearErrors, close, eofError, eofError, error, error, error, fatal, getColumnNumber, getErrors, getLineNumber, getMessages, getName, getPort, isInteractive, mark, peek, popNesting, pushNesting, read, read, readDigitsInBuffer, readOptionalExponent, reset, seenErrors, setInteractive, setMessages, skip, skip_quick, tokenBufferAppend, unread, unread, unread_quick

Field Details

axisNames

public static final String[] axisNames

functionNamespacePath

public Namespace[] functionNamespacePath

instanceOf

public static final InstanceOf instanceOf

warnOldVersion

public static boolean warnOldVersion

Constructor Details

XQParser

public XQParser(InPort port,
                SourceMessages messages,
                XQuery interp)

Method Details

appendNamedEntity

public void appendNamedEntity(String name)

booleanValue

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

declError

public Expression declError(String message)
            throws java.io.IOException,
                   SyntaxException

error

public void error(char severity,
                  String message)
Overrides:
error in interface Lexer

getDelimited

public void getDelimited(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.

isNamePart

public static boolean isNamePart(char ch)

isNameStart

public static boolean isNameStart(char ch)

makeFunctionExp

public static Expression makeFunctionExp(String className,
                                         String name)

makeFunctionExp

public static Expression makeFunctionExp(String className,
                                         String fieldName,
                                         String name)

mark

public void mark()
            throws java.io.IOException
Overrides:
mark in interface Lexer

match

public boolean match(String word)

parse

public Expression parse(Compilation comp)
            throws java.io.IOException,
                   SyntaxException
Parse an expression. Return null on EOF.

parseDataType

public Expression parseDataType()
            throws java.io.IOException,
                   SyntaxException

parseElementType

public Type parseElementType()
            throws java.io.IOException,
                   SyntaxException

parseFLWRExpression

public Expression parseFLWRExpression(boolean isFor)
            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 top parsing, and return a result as if we instead saw a 'return make-tuple($x, ...)'. The 'order by' clause will get parser by the outer-mot 'for' or 'let'.

parseFunctionDefinition

public Expression parseFunctionDefinition(int declLine,
                                          int declColumn)
            throws java.io.IOException,
                   SyntaxException

parseIfExpr

public Expression parseIfExpr()
            throws java.io.IOException,
                   SyntaxException

parseItemType

public Type parseItemType()
            throws java.io.IOException,
                   SyntaxException

parseOptionalTypeDeclaration

public Expression parseOptionalTypeDeclaration()
            throws java.io.IOException,
                   SyntaxException
Parse: ["as" SequenceType]

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 '$'.

parseVariable

public Object parseVariable()
            throws java.io.IOException,
                   SyntaxException
Parse a Variable.

parseVariableDeclaration

public Declaration parseVariableDeclaration()
            throws java.io.IOException,
                   SyntaxException

readObject

public Object readObject()
            throws java.io.IOException,
                   SyntaxException

reset

public void reset()
            throws java.io.IOException
Overrides:
reset in interface Lexer

setInteractive

public void setInteractive(boolean v)
Overrides:
setInteractive in interface Lexer

setType

public void setType(Declaration decl,
                    Expression type)

stringValue

public static Expression stringValue(Expression exp)
Coerce the value of an expresison to a string value.

syntaxError

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