net.sf.saxon.expr

Class Token


public abstract class Token
extends java.lang.Object

This class holds static constants and methods defining the lexical tokens used in XPath and XQuery, and associated keywords.

Field Summary

static int
AND
Operator "and"
static int
ASSIGN
":=" symbol (XQuery only)
static int
AT
At token, "@"
static int
ATTRIBUTE_QNAME
composite token <'attribute' QNAME> (XQuery only)
static int
AXIS
Token representing the name of an axis and the following "::" symbol
static int
CASE
Keyword "case"
static int
CASTABLE_AS
operator "castable as"
static int
CAST_AS
operator "cast as"
static int
COLONCOLON
"::" symbol
static int
COLONSTAR
":*" symbol
static int
COMMA
Comma token
static int
DECLARE_BASEURI
"declare base-uri"
static int
DECLARE_BOUNDARY_SPACE
"declare boundary-space"
static int
DECLARE_CONSTRUCTION
"declare construction"
static int
DECLARE_COPY_NAMESPACES
"declare copy-namespaces"
static int
DECLARE_DEFAULT
"declare default"
static int
DECLARE_FUNCTION
"define function"
static int
DECLARE_NAMESPACE
"declare namespace"
static int
DECLARE_OPTION
"declare option"
static int
DECLARE_ORDERING
"declare xmlspace"
static int
DECLARE_VARIABLE
"define variable"
static int
DEFAULT
Keyword "default"
static int
DIV
Operator "div"
static int
DOLLAR
"$" symbol
static int
DOT
"." symbol
static int
DOTDOT
".." symbol
static int
ELEMENT_QNAME
composite token <'element' QNAME> (XQuery only)
static int
ELSE
Keyword "else"
static int
EOF
Pseudo-token representing the end of the expression
static int
EQUALS
Equals token ("=")
static int
EVERY
Keyword "every"
static int
EXCEPT
Operator "except"
static int
FEQ
operator "eq"
static int
FGE
operator "ge"
static int
FGT
operator "gt"
static int
FLE
opeartor "le"
static int
FLT
operator "lt"
static int
FNE
operator "ne"
static int
FOLLOWS
Operator ">>"
static int
FOR
"for" keyword
static int
FUNCTION
Token representing the name of a function and the following "(" symbol
static int
GE
Operator ">="
static int
GT
Operator ">"
static int
IDIV
operator "idiv"
static int
IF
Keyword "if"
static int
IMPORT_MODULE
"import module"
static int
IMPORT_SCHEMA
"import schema"
static int
IN
Keyword "in"
static int
INSTANCE_OF
operator "instance of"
static int
INTERSECT
Operator "intersect"
static int
IS
Operator "is"
static int
KEYWORD_CURLY
composite token: (XQuery only)
static int
LCURLY
"{" symbol (XQuery only)
static int
LE
Operator "<="
static int
LET
"let" keyword (XQuery only)
static int
LPAR
Left parenthesis
static int
LSQB
Left square bracket
static int
LT
Operator "<"
static int
MINUS
Binary minus operator
static int
MOD
Operator "mod"
static int
MODULE_NAMESPACE
"module namespace"
static int
MULT
Multiply operator, "*" when used in an operator context
static int
NAME
Name token (a QName, in general)
static int
NE
Operator not-equals.
static int
NEGATE
Unary minus sign
static int
NODEKIND
Node kind, e.g.
static int
NUMBER
Numeric literal
static int
OR
Operator "or"
static int
PI_QNAME
composite token <'pi' QNAME> (XQuery only)
static int
PLUS
Operator "+"
static int
PRAGMA
A token representing an XQuery pragma.
static int
PRECEDES
Operator "<<"
static int
PREFIX
"prefix:*" token
static int
QMARK
Question mark symbol.
static int
RCURLY
"}" symbol (XQuery only)
static int
RETURN
Keyword "return"
static int
RPAR
Right parenthesis
static int
RSQB
Right square bracket
static int
SATISFIES
Keyword "satisfies"
static int
SEMICOLON
semicolon separator
static int
SLASH
Forwards "/"
static int
SLSL
Double forwards slash, "//"
static int
SOME
Keyword "some"
static int
STAR
"*" symbol when used as a wildcard
static int
STRING_LITERAL
String literal
static int
SUFFIX
"*:" token
static int
TAG
"<" at the start of a tag (XQuery only).
static int
THEN
Ketword "then"
static int
TO
Operator "to"
static int
TREAT_AS
operator "treat as"
static int
TYPESWITCH
Keyword "typeswitch"
static int
UNION
"union" or "|" token
static int
UNKNOWN
Pseudo-token representing the start of the expression
static int
VALIDATE
Various compound symbols supporting XQuery validation expression
static int
VALIDATE_LAX
static int
VALIDATE_STRICT
static int
WHERE
Keyword "where"
static int
XQUERY_VERSION
"xquery version"
static HashMap
doubleKeywords
Lookup table for composite (two-keyword) tokens
static String[]
tokens
The following strings are used to represent tokens in error messages

Method Summary

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

Field Details

AND

public static final int AND
Operator "and"
Field Value:
10

ASSIGN

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

AT

public static final int AT
At token, "@"
Field Value:
3

ATTRIBUTE_QNAME

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

AXIS

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

CASE

public static final int CASE
Keyword "case"
Field Value:
59

CASTABLE_AS

public static final int CASTABLE_AS
operator "castable as"
Field Value:
51

CAST_AS

public static final int CAST_AS
operator "cast as"
Field Value:
42

COLONCOLON

public static final int COLONCOLON
"::" symbol
Field Value:
39

COLONSTAR

public static final int COLONSTAR
":*" symbol
Field Value:
40

COMMA

public static final int COMMA
Comma token
Field Value:
7

DECLARE_BASEURI

public static final int DECLARE_BASEURI
"declare base-uri"
Field Value:
74

DECLARE_BOUNDARY_SPACE

public static final int DECLARE_BOUNDARY_SPACE
"declare boundary-space"
Field Value:
75

DECLARE_CONSTRUCTION

public static final int DECLARE_CONSTRUCTION
"declare construction"
Field Value:
73

DECLARE_COPY_NAMESPACES

public static final int DECLARE_COPY_NAMESPACES
"declare copy-namespaces"
Field Value:
85

DECLARE_DEFAULT

public static final int DECLARE_DEFAULT
"declare default"
Field Value:
72

DECLARE_FUNCTION

public static final int DECLARE_FUNCTION
"define function"
Field Value:
79

DECLARE_NAMESPACE

public static final int DECLARE_NAMESPACE
"declare namespace"
Field Value:
71

DECLARE_OPTION

public static final int DECLARE_OPTION
"declare option"
Field Value:
86

DECLARE_ORDERING

public static final int DECLARE_ORDERING
"declare xmlspace"
Field Value:
84

DECLARE_VARIABLE

public static final int DECLARE_VARIABLE
"define variable"
Field Value:
78

DEFAULT

public static final int DEFAULT
Keyword "default"
Field Value:
112

DIV

public static final int DIV
Operator "div"
Field Value:
18

DOLLAR

public static final int DOLLAR
"$" symbol
Field Value:
21

DOT

public static final int DOT
"." symbol
Field Value:
105

DOTDOT

public static final int DOTDOT
".." symbol
Field Value:
106

ELEMENT_QNAME

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

ELSE

public static final int ELSE
Keyword "else"
Field Value:
27

EOF

public static final int EOF
Pseudo-token representing the end of the expression
Field Value:
0

EQUALS

public static final int EQUALS
Equals token ("=")
Field Value:
6

EVERY

public static final int EVERY
Keyword "every"
Field Value:
32

EXCEPT

public static final int EXCEPT
Operator "except"
Field Value:
24

FEQ

public static final int FEQ
operator "eq"
Field Value:
44

FGE

public static final int FGE
operator "ge"
Field Value:
48

FGT

public static final int FGT
operator "gt"
Field Value:
46

FLE

public static final int FLE
opeartor "le"
Field Value:
49

FLT

public static final int FLT
operator "lt"
Field Value:
47

FNE

public static final int FNE
operator "ne"
Field Value:
45

FOLLOWS

public static final int FOLLOWS
Operator ">>"
Field Value:
38

FOR

public static final int FOR
"for" keyword
Field Value:
111

FUNCTION

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

GE

public static final int GE
Operator ">="
Field Value:
13

GT

public static final int GT
Operator ">"
Field Value:
11

IDIV

public static final int IDIV
operator "idiv"
Field Value:
50

IF

public static final int IF
Keyword "if"
Field Value:
36

IMPORT_MODULE

public static final int IMPORT_MODULE
"import module"
Field Value:
77

IMPORT_SCHEMA

public static final int IMPORT_SCHEMA
"import schema"
Field Value:
76

IN

public static final int IN
Keyword "in"
Field Value:
30

INSTANCE_OF

public static final int INSTANCE_OF
operator "instance of"
Field Value:
41

INTERSECT

public static final int INTERSECT
Operator "intersect"
Field Value:
23

IS

public static final int IS
Operator "is"
Field Value:
20

KEYWORD_CURLY

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

LCURLY

public static final int LCURLY
"{" symbol (XQuery only)
Field Value:
53

LE

public static final int LE
Operator "<="
Field Value:
14

LET

public static final int LET
"let" keyword (XQuery only)
Field Value:
116

LPAR

public static final int LPAR
Left parenthesis
Field Value:
5

LSQB

public static final int LSQB
Left square bracket
Field Value:
4

LT

public static final int LT
Operator "<"
Field Value:
12

MINUS

public static final int MINUS
Binary minus operator
Field Value:
16

MOD

public static final int MOD
Operator "mod"
Field Value:
19

MODULE_NAMESPACE

public static final int MODULE_NAMESPACE
"module namespace"
Field Value:
80

MULT

public static final int MULT
Multiply operator, "*" when used in an operator context
Field Value:
17

NAME

public static final int NAME
Name token (a QName, in general)
Field Value:
101

NE

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

NEGATE

public static final int NEGATE
Unary minus sign
Field Value:
199

NODEKIND

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

NUMBER

public static final int NUMBER
Numeric literal
Field Value:
109

OR

public static final int OR
Operator "or"
Field Value:
9

PI_QNAME

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

PLUS

public static final int PLUS
Operator "+"
Field Value:
15

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.
Field Value:
118

PRECEDES

public static final int PRECEDES
Operator "<<"
Field Value:
37

PREFIX

public static final int PREFIX
"prefix:*" token
Field Value:
108

QMARK

public static final int QMARK
Question mark symbol. That is, "?"
Field Value:
113

RCURLY

public static final int RCURLY
"}" symbol (XQuery only)
Field Value:
115

RETURN

public static final int RETURN
Keyword "return"
Field Value:
25

RPAR

public static final int RPAR
Right parenthesis
Field Value:
104

RSQB

public static final int RSQB
Right square bracket
Field Value:
103

SATISFIES

public static final int SATISFIES
Keyword "satisfies"
Field Value:
33

SEMICOLON

public static final int SEMICOLON
semicolon separator
Field Value:
90

SLASH

public static final int SLASH
Forwards "/"
Field Value:
2

SLSL

public static final int SLSL
Double forwards slash, "//"
Field Value:
8

SOME

public static final int SOME
Keyword "some"
Field Value:
31

STAR

public static final int STAR
"*" symbol when used as a wildcard
Field Value:
107

STRING_LITERAL

public static final int STRING_LITERAL
String literal
Field Value:
102

SUFFIX

public static final int SUFFIX
"*:" token
Field Value:
62

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
Field Value:
117

THEN

public static final int THEN
Ketword "then"
Field Value:
26

TO

public static final int TO
Operator "to"
Field Value:
29

TREAT_AS

public static final int TREAT_AS
operator "treat as"
Field Value:
43

TYPESWITCH

public static final int TYPESWITCH
Keyword "typeswitch"
Field Value:
58

UNION

public static final int UNION
"union" or "|" token
Field Value:
1

UNKNOWN

public static final int UNKNOWN
Pseudo-token representing the start of the expression
Field Value:
-1

VALIDATE

public static final int VALIDATE
Various compound symbols supporting XQuery validation expression
Field Value:
81

VALIDATE_LAX

public static final int VALIDATE_LAX
Field Value:
83

VALIDATE_STRICT

public static final int VALIDATE_STRICT
Field Value:
82

WHERE

public static final int WHERE
Keyword "where"
Field Value:
28

XQUERY_VERSION

public static final int XQUERY_VERSION
"xquery version"
Field Value:
70

doubleKeywords

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

tokens

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

Method Details

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)