BNF for xpath-grammar.jj

NON-TERMINALS

START ::= Expr <EOF>
ModuleDecl ::= "module" "namespace" NCName "=" URILiteral Separator
Separator ::= ";"
DefaultCollationDecl ::= "declare" "default" "collation" URILiteral
BaseURIDecl ::= "declare" "base-uri" URILiteral
ConstructionDecl ::= "declare" "construction" ( "strip" | "preserve" )
OrderingModeDecl ::= "declare" "ordering" ( "ordered" | "unordered" )
EmptyOrderDecl ::= "declare" "default" "order" "empty" ( <Greatest> | <Least> )
CopyNamespacesDecl ::= "declare" "copy-namespaces" PreserveMode "," InheritMode
PreserveMode ::= ( "preserve" | "no-preserve" )
InheritMode ::= ( "inherit" | "no-inherit" )
SchemaImport ::= "import" "schema" ( SchemaPrefix )? URILiteral ( "at" URILiteral ( "," URILiteral )* )?
SchemaPrefix ::= ( ( "namespace" NCName "=" ) | ( "default" "element" "namespace" ) )
ModuleImport ::= "import" "module" ( "namespace" NCName "=" )? URILiteral ( "at" URILiteral ( "," URILiteral )* )?
NamespaceDecl ::= "declare" "namespace" NCName "=" URILiteral
DefaultNamespaceDecl ::= "declare" "default" ( "element" | "function" ) "namespace" URILiteral
VarDecl ::= "declare" "variable" "$" QName ( TypeDeclaration )? ( ( ":=" ExprSingle ) | ( <External> ) )
FunctionDecl ::= "declare" "function" FunctionQName "(" ( ParamList )? ")" ( "as" SequenceType )? ( EnclosedExpr | <External> )
ParamList ::= Param ( "," Param )*
Param ::= "$" QName ( TypeDeclaration )?
EnclosedExpr ::= <Lbrace> Expr <Rbrace>
OptionDecl ::= "declare" "option" QName <StringLiteral>
Expr ::= ExprSingle ( "," ExprSingle )*
ExprSingle ::= ( FLWORExpr10 | QuantifiedExpr | TypeswitchExpr | IfExpr | OrExpr )
FLWORExpr10 ::= ( ForClause | LetClause ) "return" ExprSingle
ForClause ::= "for" "$" VarName ( TypeDeclaration )? ( PositionalVar )? "in" ExprSingle
PositionalVar ::= "at" "$" VarName
LetClause ::= "let" ( "$" VarName ( TypeDeclaration )? ) ":=" ExprSingle
OrderByClause ::= ( ( "order" "by" ) | ( "stable" "order" "by" ) ) OrderSpecList
OrderSpecList ::= OrderSpec ( "," OrderSpec )*
OrderSpec ::= ExprSingle OrderModifier
OrderModifier ::= ( ( <Ascending> | <Descending> ) )? ( "empty" ( <Greatest> | <Least> ) )? ( "collation" URILiteral )?
QuantifiedExpr ::= ( "some" | "every" ) "$" VarName ( TypeDeclaration )? "in" ExprSingle ( "," "$" VarName ( TypeDeclaration )? "in" ExprSingle )* "satisfies" ExprSingle
TypeswitchExpr ::= "typeswitch" "(" Expr ")" ( CaseClause )+ "default" "$" VarName "return" ExprSingle
CaseClause ::= "case" "$" VarName "as" SequenceType "return" ExprSingle
IfExpr ::= "if" "(" Expr ")" "then" ExprSingle "else" ExprSingle
OperatorExpr ::= OrExpr
OrExpr ::= AndExpr ( "or" AndExpr )*
AndExpr ::= CastableExpr ( "and" CastableExpr )*
CastableExpr ::= CastExpr ( ( "castable" "as" SingleType ) )?
CastExpr ::= ValueExpr ( ( "cast" "as" SingleType ) )?
ValueExpr ::= ( ValidateExpr | StepExpr | ExtensionExpr )
ValidateExpr ::= "validate" ( ValidationMode )? <Lbrace> Expr <Rbrace>
ValidationMode ::= ( "lax" | "strict" )
ExtensionExpr ::= ( Pragma )+ <Lbrace> ( Expr )? <Rbrace>
Pragma ::= <PragmaOpen> ( <S> )? QName ( <S> PragmaContents )? <PragmaClose>
PragmaContents ::= ( <Char> )*
StepExpr ::= ( PrimaryExpr | AxisStep )
AxisStep ::= ( ReverseStep | ForwardStep )
ForwardStep ::= ( ForwardAxis NodeTest )
ForwardAxis ::= ( ( "child" "::" ) | ( "descendant" "::" ) | ( "attribute" "::" ) | ( "self" "::" ) | ( "descendant-or-self" "::" ) | ( "namespace" "::" ) )
ReverseStep ::= ( ReverseAxis NodeTest )
ReverseAxis ::= ( ( "parent" "::" ) | ( "ancestor" "::" ) | ( "ancestor-or-self" "::" ) )
NodeTest ::= ( KindTest | NameTest )
NameTest ::= ( QName | Wildcard )
Wildcard ::= ( "*" | <NCNameColonStar> | <StarColonNCName> )
PrimaryExpr ::= ( Literal | VarRef | ParenthesizedExpr | FunctionCall | OrderedExpr | UnorderedExpr | Constructor )
Literal ::= ( NumericLiteral | <StringLiteral> )
NumericLiteral ::= ( <IntegerLiteral> | <DecimalLiteral> | <DoubleLiteral> )
VarRef ::= "$" VarName
VarName ::= QName
ParenthesizedExpr ::= "(" ( Expr )? ")"
OrderedExpr ::= "ordered" <Lbrace> Expr <Rbrace>
UnorderedExpr ::= "unordered" <Lbrace> Expr <Rbrace>
FunctionCall ::= FunctionQName ( "(" ( ExprSingle ( "," ExprSingle )* )? ")" )
Constructor ::= ComputedConstructor
ComputedConstructor ::= ( CompDocConstructor | CompElemConstructor | CompAttrConstructor | CompTextConstructor | CompCommentConstructor | CompPIConstructor )
CompDocConstructor ::= "document" <Lbrace> Expr <Rbrace>
CompElemConstructor ::= "element" ( QName | ( <Lbrace> Expr <Rbrace> ) ) <Lbrace> ContentExpr <Rbrace> <Lbrace> LocalNamespaceDecls <Rbrace>
LocalNamespaceDecls ::= ( LocalNamespaceDecl )*
LocalNamespaceDecl ::= "namespace" NCName <Lbrace> URILiteral <Rbrace>
ContentExpr ::= Expr
CompAttrConstructor ::= "attribute" ( QName | ( <Lbrace> Expr <Rbrace> ) ) <Lbrace> Expr <Rbrace>
CompTextConstructor ::= "text" <Lbrace> Expr <Rbrace>
CompCommentConstructor ::= "comment" <Lbrace> Expr <Rbrace>
CompPIConstructor ::= "processing-instruction" ( NCName | ( <Lbrace> Expr <Rbrace> ) ) <Lbrace> ( Expr )? <Rbrace>
SingleType ::= AtomicType ( "?" )?
TypeDeclaration ::= "as" SequenceType
SequenceType ::= ( ( "empty-sequence" "(" ")" ) | ( ItemType ( OccurrenceIndicator )? ) )
OccurrenceIndicator ::= ( "?" | "*" | <Plus> )
ItemType ::= ( KindTest | ( "item" "(" ")" ) | AtomicType )
AtomicType ::= QName
KindTest ::= ( DocumentTest | ElementTest | AttributeTest | SchemaElementTest | SchemaAttributeTest | PITest | CommentTest | TextTest | AnyKindTest )
AnyKindTest ::= "node" "(" ")"
DocumentTest ::= "document-node" "(" ( ( ElementTest | SchemaElementTest ) )? ")"
TextTest ::= "text" "(" ")"
CommentTest ::= "comment" "(" ")"
PITest ::= "processing-instruction" "(" ( ( NCName | <StringLiteral> ) )? ")"
AttributeTest ::= "attribute" "(" ( AttribNameOrWildcard ( "," TypeName )? )? ")"
AttribNameOrWildcard ::= ( AttributeName | "*" )
SchemaAttributeTest ::= "schema-attribute" "(" AttributeDeclaration ")"
AttributeDeclaration ::= AttributeName
ElementTest ::= "element" "(" ( ElementNameOrWildcard ( "," TypeName ( "?" )? )? )? ")"
ElementNameOrWildcard ::= ( ElementName | "*" )
SchemaElementTest ::= "schema-element" "(" ElementDeclaration ")"
ElementDeclaration ::= ElementName
AttributeName ::= QName
ElementName ::= QName
TypeName ::= QName
URILiteral ::= <StringLiteral>
NCName ::= QName
QName ::= ( FunctionQName | "attribute" | "comment" | "document-node" | "element" | "empty-sequence" | "if" | "item" | "node" | "processing-instruction" | "schema-attribute" | "schema-element" | "text" | "typeswitch" )
FunctionQName ::= ( <QNameToken> | <Ascending> | <Descending> | <External> | <Greatest> | <Least> | "ancestor" | "ancestor-or-self" | "and" | "as" | "at" | "base-uri" | "by" | "case" | "cast" | "castable" | "child" | "collation" | "construction" | "copy-namespaces" | "declare" | "default" | "descendant" | "descendant-or-self" | "document" | "else" | "empty" | "every" | "for" | "function" | "import" | "in" | "inherit" | "lax" | "let" | "module" | "namespace" | "no-inherit" | "no-preserve" | "option" | "or" | "order" | "ordered" | "ordering" | "parent" | "preserve" | "return" | "satisfies" | "schema" | "self" | "some" | "stable" | "strict" | "strip" | "then" | "unordered" | "validate" | "variable" )