net.sf.saxon.expr

Class Token

public abstract class Token extends Object

This class holds static constants and methods defining the lexical tokens used in XPath and XQuery, and associated keywords.
Field Summary
static intAND
Operator "and"
static intASSIGN
":=" symbol (XQuery only)
static intAT
At token, "@"
static intATTRIBUTE_QNAME
composite token <'attribute' QNAME> (XQuery only)
static intAXIS
Token representing the name of an axis and the following "::" symbol
static intCASE
Keyword "case"
static intCASTABLE_AS
operator "castable as"
static intCAST_AS
operator "cast as"
static intCOLONCOLON
"::" symbol
static intCOLONSTAR
":*" symbol
static intCOMMA
Comma token
static HashMapdoubleKeywords
Lookup table for composite (two-keyword) tokens
static intDECLARE_BASEURI
"declare base-uri"
static intDECLARE_BOUNDARY_SPACE
"declare boundary-space"
static intDECLARE_CONSTRUCTION
"declare construction"
static intDECLARE_COPY_NAMESPACES
"declare copy-namespaces"
static intDECLARE_DEFAULT
"declare default"
static intDECLARE_FUNCTION
"define function"
static intDECLARE_NAMESPACE
"declare namespace"
static intDECLARE_OPTION
"declare option"
static intDECLARE_ORDERING
"declare xmlspace"
static intDECLARE_VARIABLE
"define variable"
static intDEFAULT
Keyword "default"
static intDIV
Operator "div"
static intDOLLAR
"$" symbol
static intDOT
"." symbol
static intDOTDOT
".." symbol
static intELEMENT_QNAME
composite token <'element' QNAME> (XQuery only)
static intELSE
Keyword "else"
static intEOF
Pseudo-token representing the end of the expression
static intEQUALS
Equals token ("=")
static intEVERY
Keyword "every"
static intEXCEPT
Operator "except"
static intFEQ
operator "eq"
static intFGE
operator "ge"
static intFGT
operator "gt"
static intFLE
opeartor "le"
static intFLT
operator "lt"
static intFNE
operator "ne"
static intFOLLOWS
Operator ">>"
static intFOR
"for" keyword
static intFUNCTION
Token representing the name of a function and the following "(" symbol
static intGE
Operator ">="
static intGT
Operator ">"
static intIDIV
operator "idiv"
static intIF
Keyword "if"
static intIMPORT_MODULE
"import module"
static intIMPORT_SCHEMA
"import schema"
static intIN
Keyword "in"
static intINSTANCE_OF
operator "instance of"
static intINTERSECT
Operator "intersect"
static intIS
Operator "is"
static intKEYWORD_CURLY
composite token: (XQuery only)
static intLAST_OPERATOR
Constant identifying the token number of the last token to be classified as an operator
static intLCURLY
"{" symbol (XQuery only)
static intLE
Operator "<="
static intLET
"let" keyword (XQuery only)
static intLPAR
Left parenthesis
static intLSQB
Left square bracket
static intLT
Operator "<"
static intMINUS
Binary minus operator
static intMOD
Operator "mod"
static intMODULE_NAMESPACE
"module namespace"
static intMULT
Multiply operator, "*" when used in an operator context
static intNAME
Name token (a QName, in general)
static intNE
Operator not-equals.
static intNEGATE
Unary minus sign
static intNODEKIND
Node kind, e.g.
static intNUMBER
Numeric literal
static intOR
Operator "or"
static intPI_QNAME
composite token <'pi' QNAME> (XQuery only)
static intPLUS
Operator "+"
static intPRAGMA
A token representing an XQuery pragma.
static intPRECEDES
Operator "<<"
static intPREFIX
"prefix:*" token
static intQMARK
Question mark symbol.
static intRCURLY
"}" symbol (XQuery only)
static intRETURN
Keyword "return"
static intRPAR
Right parenthesis
static intRSQB
Right square bracket
static intSATISFIES
Keyword "satisfies"
static intSEMICOLON
semicolon separator
static intSLASH
Forwards "/"
static intSLSL
Double forwards slash, "//"
static intSOME
Keyword "some"
static intSTAR
"*" symbol when used as a wildcard
static intSTRING_LITERAL
String literal
static intSUFFIX
"*:" token
static String[]tokens
The following strings are used to represent tokens in error messages
static intTAG
"<" at the start of a tag (XQuery only).
static intTHEN
Ketword "then"
static intTO
Operator "to"
static intTREAT_AS
operator "treat as"
static intTYPESWITCH
Keyword "typeswitch"
static intUNION
"union" or "|" token
static intUNKNOWN
Pseudo-token representing the start of the expression
static intVALIDATE
Various compound symbols supporting XQuery validation expression
static intVALIDATE_LAX
static intVALIDATE_STRICT
static intWHERE
Keyword "where"
static intXQUERY_VERSION
"xquery version"
Method Summary
static intinverse(int operator)
Return the inverse of a relational operator, so that "a op b" can be rewritten as "b inverse(op) a"
static booleanisOrderedOperator(int operator)
static intnegate(int operator)
Return the negation of a relational operator, so that "a op b" can be rewritten as not(b op' a)

Field Detail

AND

public static final int AND
Operator "and"

ASSIGN

public static final int ASSIGN
":=" symbol (XQuery only)

AT

public static final int AT
At token, "@"

ATTRIBUTE_QNAME

public static final int ATTRIBUTE_QNAME
composite token <'attribute' QNAME> (XQuery only)

AXIS

public static final int AXIS
Token representing the name of an axis and the following "::" symbol

CASE

public static final int CASE
Keyword "case"

CASTABLE_AS

public static final int CASTABLE_AS
operator "castable as"

CAST_AS

public static final int CAST_AS
operator "cast as"

COLONCOLON

public static final int COLONCOLON
"::" symbol

COLONSTAR

public static final int COLONSTAR
":*" symbol

COMMA

public static final int COMMA
Comma token

doubleKeywords

public static HashMap doubleKeywords
Lookup table for composite (two-keyword) tokens

DECLARE_BASEURI

public static final int DECLARE_BASEURI
"declare base-uri"

DECLARE_BOUNDARY_SPACE

public static final int DECLARE_BOUNDARY_SPACE
"declare boundary-space"

DECLARE_CONSTRUCTION

public static final int DECLARE_CONSTRUCTION
"declare construction"

DECLARE_COPY_NAMESPACES

public static final int DECLARE_COPY_NAMESPACES
"declare copy-namespaces"

DECLARE_DEFAULT

public static final int DECLARE_DEFAULT
"declare default"

DECLARE_FUNCTION

public static final int DECLARE_FUNCTION
"define function"

DECLARE_NAMESPACE

public static final int DECLARE_NAMESPACE
"declare namespace"

DECLARE_OPTION

public static final int DECLARE_OPTION
"declare option"

DECLARE_ORDERING

public static final int DECLARE_ORDERING
"declare xmlspace"

DECLARE_VARIABLE

public static final int DECLARE_VARIABLE
"define variable"

DEFAULT

public static final int DEFAULT
Keyword "default"

DIV

public static final int DIV
Operator "div"

DOLLAR

public static final int DOLLAR
"$" symbol

DOT

public static final int DOT
"." symbol

DOTDOT

public static final int DOTDOT
".." symbol

ELEMENT_QNAME

public static final int ELEMENT_QNAME
composite token <'element' QNAME> (XQuery only)

ELSE

public static final int ELSE
Keyword "else"

EOF

public static final int EOF
Pseudo-token representing the end of the expression

EQUALS

public static final int EQUALS
Equals token ("=")

EVERY

public static final int EVERY
Keyword "every"

EXCEPT

public static final int EXCEPT
Operator "except"

FEQ

public static final int FEQ
operator "eq"

FGE

public static final int FGE
operator "ge"

FGT

public static final int FGT
operator "gt"

FLE

public static final int FLE
opeartor "le"

FLT

public static final int FLT
operator "lt"

FNE

public static final int FNE
operator "ne"

FOLLOWS

public static final int FOLLOWS
Operator ">>"

FOR

public static final int FOR
"for" keyword

FUNCTION

public static final int FUNCTION
Token representing the name of a function and the following "(" symbol

GE

public static final int GE
Operator ">="

GT

public static final int GT
Operator ">"

IDIV

public static final int IDIV
operator "idiv"

IF

public static final int IF
Keyword "if"

IMPORT_MODULE

public static final int IMPORT_MODULE
"import module"

IMPORT_SCHEMA

public static final int IMPORT_SCHEMA
"import schema"

IN

public static final int IN
Keyword "in"

INSTANCE_OF

public static final int INSTANCE_OF
operator "instance of"

INTERSECT

public static final int INTERSECT
Operator "intersect"

IS

public static final int IS
Operator "is"

KEYWORD_CURLY

public static final int KEYWORD_CURLY
composite token: (XQuery only)

LAST_OPERATOR

static int LAST_OPERATOR
Constant identifying the token number of the last token to be classified as an operator

LCURLY

public static final int LCURLY
"{" symbol (XQuery only)

LE

public static final int LE
Operator "<="

LET

public static final int LET
"let" keyword (XQuery only)

LPAR

public static final int LPAR
Left parenthesis

LSQB

public static final int LSQB
Left square bracket

LT

public static final int LT
Operator "<"

MINUS

public static final int MINUS
Binary minus operator

MOD

public static final int MOD
Operator "mod"

MODULE_NAMESPACE

public static final int MODULE_NAMESPACE
"module namespace"

MULT

public static final int MULT
Multiply operator, "*" when used in an operator context

NAME

public static final int NAME
Name token (a QName, in general)

NE

public static final int NE
Operator not-equals. That is, "!="

NEGATE

public static final int NEGATE
Unary minus sign

NODEKIND

public static final int NODEKIND
Node kind, e.g. "node()" or "comment()"

NUMBER

public static final int NUMBER
Numeric literal

OR

public static final int OR
Operator "or"

PI_QNAME

public static final int PI_QNAME
composite token <'pi' QNAME> (XQuery only)

PLUS

public static final int PLUS
Operator "+"

PRAGMA

public static final int PRAGMA
A token representing an XQuery pragma. This construct "(# .... #)" is regarded as a single token, for the QueryParser to sort out.

PRECEDES

public static final int PRECEDES
Operator "<<"

PREFIX

public static final int PREFIX
"prefix:*" token

QMARK

public static final int QMARK
Question mark symbol. That is, "?"

RCURLY

public static final int RCURLY
"}" symbol (XQuery only)

RETURN

public static final int RETURN
Keyword "return"

RPAR

public static final int RPAR
Right parenthesis

RSQB

public static final int RSQB
Right square bracket

SATISFIES

public static final int SATISFIES
Keyword "satisfies"

SEMICOLON

public static final int SEMICOLON
semicolon separator

SLASH

public static final int SLASH
Forwards "/"

SLSL

public static final int SLSL
Double forwards slash, "//"

SOME

public static final int SOME
Keyword "some"

STAR

public static final int STAR
"*" symbol when used as a wildcard

STRING_LITERAL

public static final int STRING_LITERAL
String literal

SUFFIX

public static final int SUFFIX
"*:" token

tokens

public static String[] tokens
The following strings are used to represent tokens in error messages

TAG

public static final int TAG
"<" at the start of a tag (XQuery only). The pseudo-XML syntax that follows is read character-by-character by the XQuery parser

THEN

public static final int THEN
Ketword "then"

TO

public static final int TO
Operator "to"

TREAT_AS

public static final int TREAT_AS
operator "treat as"

TYPESWITCH

public static final int TYPESWITCH
Keyword "typeswitch"

UNION

public static final int UNION
"union" or "|" token

UNKNOWN

public static final int UNKNOWN
Pseudo-token representing the start of the expression

VALIDATE

public static final int VALIDATE
Various compound symbols supporting XQuery validation expression

VALIDATE_LAX

public static final int VALIDATE_LAX

VALIDATE_STRICT

public static final int VALIDATE_STRICT

WHERE

public static final int WHERE
Keyword "where"

XQUERY_VERSION

public static final int XQUERY_VERSION
"xquery version"

Method Detail

inverse

public static final int inverse(int operator)
Return the inverse of a relational operator, so that "a op b" can be rewritten as "b inverse(op) a"

isOrderedOperator

public static boolean isOrderedOperator(int operator)

negate

public static final int negate(int operator)
Return the negation of a relational operator, so that "a op b" can be rewritten as not(b op' a)