78
78
::= 'declare' 'context' 'item' ( 'as' ItemType )? ( ':=' VarValue | 'external' ( ':=' VarDefaultValue )? )
80
::= 'function' EQName '(' ParamList? ')' ( 'as' SequenceType )? ( FunctionBody | 'external' )
80
::= "function" EQName "(" ParamList? ")" ("as" SequenceType)? ("{" StatementsAndOptionalExpr "}" | "external")
82
82
::= Param ( ',' Param )*
83
83
Param ::= '$' EQName TypeDeclaration?
370
375
| CompCommentConstructor
371
376
| CompPIConstructor
372
377
CompDocConstructor
373
::= 'document' '{' Expr '}'
378
::= 'document' '{' BlockExpr '}'
374
379
CompElemConstructor
375
380
::= 'element' ( EQName | '{' Expr '}' ) '{' ContentExpr? '}'
382
::= StatementsAndExpr
378
383
CompAttrConstructor
379
::= 'attribute' ( EQName | '{' Expr '}' ) '{' Expr? '}'
384
::= "attribute" (EQName | ("{" Expr "}")) ("{" "}" | BlockExpr)
380
385
CompNamespaceConstructor
381
386
::= 'namespace' ( Prefix | '{' PrefixExpr '}' ) '{' URIExpr? '}'
382
387
Prefix ::= NCName
386
391
CompTextConstructor
387
::= 'text' '{' Expr '}'
392
::= 'text' '{' BlockExpr '}'
388
393
CompCommentConstructor
389
::= 'comment' '{' Expr '}'
394
::= 'comment' '{' BlockExpr '}'
390
395
CompPIConstructor
391
::= 'processing-instruction' ( NCName | '{' Expr '}' ) '{' Expr? '}'
396
::= "processing-instruction" (NCName | ("{" Expr "}")) ("{" "}" | BlockExpr)
393
398
::= LiteralFunctionItem
617
622
::= "copy" "$" VarName ":=" ExprSingle ("," "$" VarName ":=" ExprSingle)* "modify" ExprSingle "return" ExprSingle
624
Program ::= StatementsAndOptionalExpr
626
Statements ::= Statement*
628
StatementsAndExpr ::= Statements Expr
630
StatementsAndOptionalExpr ::= Statements1 Expr?
632
Statement ::= Statement1 | Statement2
649
| TypeswitchStatement
651
Statements1 ::= Statement1*
653
ApplyStatement ::= ExprSimple ";"
654
AssignStatement ::= "$" VarName ":=" ExprSingle ";"
655
BlockStatement ::= "{" Statements "}"
656
BreakStatement ::= "break" "loop" ";"
657
ContinueStatement ::= "continue" "loop" ";"
658
ExitStatement ::= "exit" "returning" ExprSingle ";"
659
FLWORStatement ::= InitialClause IntermediateClause* ReturnStatement
660
ReturnStatement ::= "return" Statement
661
IfStatement ::= "if" "(" Expr ")" "then" Statement "else" Statement
662
SwitchStatement ::= "switch" "(" Expr ")" SwitchCaseStatement+ "default" "return" Statement
663
SwitchCaseStatement ::= ("case" SwitchCaseOperand)+ "return" Statement
664
TryCatchStatement ::= "try" BlockStatement ("catch" CatchErrorList BlockStatement)+
665
TypeswitchStatement ::= "typeswitch" "(" Expr ")" CaseStatement+ "default" ("$" VarName)? "return" Statement
666
CaseStatement ::= "case" ("$" VarName "as")? SequenceType "return" Statement
667
VarDeclStatement ::= Annotation* "variable" "$" VarName TypeDeclaration? (":=" ExprSingle)?
668
("," "$" VarName TypeDeclaration? (":=" ExprSingle)?)* ";"
669
WhileStatement ::= "while" "(" Expr ")" Statement
671
BlockExpr ::= "{" StatementsAndExpr "}"
720
773
| ( ( [^(:] | '('+ [^(:] | ':'+ [^:)] )+ | ':' ) ':'* &':'
721
774
'*' << Wildcard '*'^OccurrenceIndicator
723
<< 'ancestor' 'ancestor-or-self' 'and' 'ascending' 'attribute' 'case' 'cast' 'castable' 'child' 'collation' 'comment' 'count' 'declare' 'default' 'descendant' 'descendant-or-self' 'descending' 'div' 'document' 'document-node' 'element' 'else' 'empty' 'empty-sequence' 'end' 'eq' 'every' 'except' 'following' 'following-sibling' 'for' 'function' 'ge' 'group' 'gt' 'idiv' 'if' 'import' 'instance' 'intersect' 'is' 'item' 'le' 'let' 'lt' 'mod' 'module' 'namespace' 'namespace-node' 'ne' 'node' 'only' 'or' 'order' 'ordered' 'parent' 'preceding' 'preceding-sibling' 'processing-instruction' 'return' 'satisfies' 'schema-attribute' 'schema-element' 'self' 'some' 'stable' 'start' 'switch' 'text' 'to' 'treat' 'try' 'typeswitch' 'union' 'unordered' 'validate' 'where' 'xquery' "after" "as" "before" "copy" "delete" "insert" "into" "modify" "rename" "replace" "with"
776
<< 'ancestor' 'ancestor-or-self' 'and' 'ascending' 'attribute' 'case' 'cast' 'castable' 'child' 'collation' 'comment' 'count' 'declare' 'default' 'descendant' 'descendant-or-self' 'descending' 'div' 'document' 'document-node' 'element' 'else' 'empty' 'empty-sequence' 'end' 'eq' 'every' 'except' 'following' 'following-sibling' 'for' 'function' 'ge' 'group' 'gt' 'idiv' 'if' 'import' 'instance' 'intersect' 'is' 'item' 'le' 'let' 'lt' 'mod' 'module' 'namespace' 'namespace-node' 'ne' 'node' 'only' 'or' 'order' 'ordered' 'parent' 'preceding' 'preceding-sibling' 'processing-instruction' 'return' 'satisfies' 'schema-attribute' 'schema-element' 'self' 'some' 'stable' 'start' 'switch' 'text' 'to' 'treat' 'try' 'typeswitch' 'union' 'unordered' 'validate' 'where' 'xquery' "after" "as" "before" "copy" "delete" "insert" "into" "modify" "rename" "replace" "with" "break" "catch" "continue" "exit" "variable" "while"
725
778
<< 'and' 'ascending' 'case' 'cast' 'castable' 'collation' 'count' 'default' 'descending' 'div' 'else' 'empty' 'end' 'eq' 'except' 'for' 'ge' 'group' 'gt' 'idiv' 'instance' 'intersect' 'is' 'le' 'let' 'lt' 'mod' 'ne' 'only' 'or' 'order' 'return' 'satisfies' 'stable' 'start' 'to' 'treat' 'union' 'where' "after" "as" "before" "into" "modify" "with"