XPath 4.0 Grammar

XPath::=(DefaultElementNamespaceDecl ";") (NamespaceDecl ";") Expr
AbbreviatedStep::=(".." | ("@" NodeTest) | SimpleNodeTest)
AbsolutePathExpr::=(("/" RelativePathExpr) | ("//" RelativePathExpr))
AdditiveExpr::=MultiplicativeExpr (("+" | "-") MultiplicativeExpr)
AndExpr::=ComparisonExpr ("and" ComparisonExpr)
AnyArrayType::="array" "(" "*" ")"
AnyFunctionType::=("function" | "fn") "(" "*" ")"
AnyItemTest::="item" "(" ")"
AnyMapType::="map" "(" "*" ")"
AnyNodeKindTest::="node" "(" ")"
AposStringLiteral::=("'" (EscapeApos | [']) "'")
Argument::=(ExprSingle | ArgumentPlaceholder)
ArgumentList::="(" ((PositionalArguments ("," KeywordArguments)) | KeywordArguments) ")"
ArgumentPlaceholder::="?"
ArrayConstructor::=(SquareArrayConstructor | CurlyArrayConstructor)
ArrayType::=(AnyArrayType | TypedArrayType)
ArrowExpr::=UnaryExpr (SequenceArrowTarget | MappingArrowTarget)
ArrowTarget::=(FunctionCall | RestrictedDynamicCall)
AttributeName::=EQName
AttributeTest::="attribute" "(" (NameTestUnion ("," TypeName)) ")"
Axis::=("ancestor" | "ancestor-or-self" | "attribute" | "child" | "descendant" | "descendant-or-self" | "following" | "following-or-self" | "following-sibling" | "following-sibling-or-self" | "namespace" | "parent" | "preceding" | "preceding-or-self" | "preceding-sibling" | "preceding-sibling-or-self" | "self") "::"
AxisStep::=(AbbreviatedStep | FullStep) Predicate
BaseChar::=[AAZZ aazz ÀÀÖÖ ØØöö øøÿÿ ĀĀıı ĴĴľľ ŁŁňň ŊŊžž ƀƀǃǃ ǍǍǰǰ ǴǴǵǵ ǺǺȗȗ ɐɐʨʨ ʻʻˁˁ ΆΆ ΈΈΊΊ ΌΌ ΎΎΡΡ ΣΣώώ ϐϐϖϖ ϚϚ ϜϜ ϞϞ ϠϠ ϢϢϳϳ ЁЁЌЌ ЎЎяя ёёќќ ўўҁҁ ҐҐӄӄ ӇӇӈӈ ӋӋӌӌ ӐӐӫӫ ӮӮӵӵ ӸӸӹӹ ԱԱՖՖ ՙՙ աաֆֆ אאתת װװײײ ءءغغ ففيي ٱٱڷڷ ںںھھ ۀۀێێ ېېۓۓ ەە ۥۥۦۦ अह ऽ क़ॡ অঌ এঐ ওন পর ল শহ ড়ঢ় য়ৡ ৰৱ ਅਊ ਏਐ ਓਨ ਪਰ ਲਲ਼ ਵਸ਼ ਸਹ ਖ਼ੜ ਫ਼ ੲੴ અઋ ઍ એઑ ઓન પર લળ વહ ઽ ૠ ଅଌ ଏଐ ଓନ ପର ଲଳ ଶହ ଽ ଡ଼ଢ଼ ୟୡ அஊ எஐ ஒக ஙச ஜ ஞட ணத நப மவ ஷஹ అఌ ఎఐ ఒన పళ వహ ౠౡ ಅಌ ಎಐ ಒನ ಪಳ ವಹ ೞ ೠೡ അഌ എഐ ഒന പഹ ൠൡ กฮ ะ าำ เๅ ກຂ ຄ ງຈ ຊ ຍ ດທ ນຟ ມຣ ລ ວ ສຫ ອຮ ະ າຳ ຽ ເໄ ཀཇ ཉཀྵ ႠჅ აჶ ᄀ ᄂᄃ ᄅᄇ ᄉ ᄋᄌ ᄎᄒ ᄼ ᄾ ᅀ ᅌ ᅎ ᅐ ᅔᅕ ᅙ ᅟᅡ ᅣ ᅥ ᅧ ᅩ ᅭᅮ ᅲᅳ ᅵ ᆞ ᆨ ᆫ ᆮᆯ ᆷᆸ ᆺ ᆼᇂ ᇫ ᇰ ᇹ Ḁẛ Ạỹ ἀἕ ἘἝ ἠὅ ὈὍ ὐὗ Ὑ Ὓ Ὕ Ὗώ ᾀᾴ ᾶᾼ ι ῂῄ ῆῌ ῐΐ ῖΊ ῠῬ ῲῴ ῶῼ Ω KÅ ℮ ↀↂ ぁゔ ァヺ ㄅㄬ 가힣 ]
BinaryDigit::=[01]
BinaryDigits::=(BinaryDigit ((BinaryDigit | "_") BinaryDigit))
BinaryIntegerLiteral::=("0b" BinaryDigits)
BracedAction::=EnclosedExpr
BracedURILiteral::="Q" "{" ([{}]) "}"
CastableExpr::=CastExpr ("castable" "as" CastTarget "?")
CastExpr::=PipelineExpr ("cast" "as" CastTarget "?")
CastTarget::=(TypeName | ChoiceItemType | EnumerationType)
Char::=[	 
 
   � ]
ChoiceItemType::="(" ItemType ")"
CombiningChar::=[̀ͅ ͠͡ ҃҆ ֑֡ ֹ֣ ֻֽ ֿ ׁׂ ׄ ًْ ٰ ۖۜ ۝۟ ۠ۤ ۧۨ ۪ۭ ँः ़ ाौ ् ॑॔ ॢॣ ঁঃ ় া ি ীৄ েৈ ো্ ৗ ৢৣ ਂ ਼ ਾ ਿ ੀੂ ੇੈ ੋ੍ ੰੱ ઁઃ ઼ ાૅ ેૉ ો્ ଁଃ ଼ ାୃ େୈ ୋ୍ ୖୗ ஂஃ ாூ ெை ொ் ௗ ఁః ాౄ ెై ొ్ ౕౖ ಂಃ ಾೄ ೆೈ ೊ್ ೕೖ ംഃ ാൃ െൈ ൊ് ൗ ั ิฺ ็๎ ັ ິູ ົຼ ່ໍ ༘༙ ༵ ༷ ༹ ༾ ༿ ྄ཱ ྆ྋ ྐྕ ྗ ྙྭ ྱྷ ྐྵ ⃐⃜ ⃡ 〪〯 ゙ ゚ ]
Comment::=CommentStart (CommentContents | Comment) CommentEnd
CommentContent::=Char
CommentContents::=CommentContent
CommentEnd::=":)"
CommentStart::="(:"
CommentTest::="comment" "(" ")"
ComparisonExpr::=OtherwiseExpr ((ValueComp | GeneralComp | NodeComp) OtherwiseExpr)
Constant::=(StringLiteral | ("-" NumericLiteral) | QNameLiteral | ("true" "(" ")") | ("false" "(" ")"))
ContextValueRef::="."
CurlyArrayConstructor::="array" EnclosedExpr
DecDigit::=[09]
DecimalLiteral::=(("." Digits) | (Digits "." Digits))
DefaultElementNamespaceDecl::="declare" "default" "element" "namespace" URILiteral
Digit::=[0099 ٠٠٩٩ ۰۰۹۹ ०९ ০৯ ੦੯ ૦૯ ୦୯ ௧௯ ౦౯ ೦೯ ൦൯ ๐๙ ໐໙ ༠༩ ]
Digits::=(DecDigit ((DecDigit | "_") DecDigit))
DocumentTest::="document-node" "(" (ElementTest | SchemaElementTest | NameTestUnion) ")"
DoubleLiteral::=(("." Digits) | (Digits ("." Digits))) [eE] [+-] Digits
DynamicFunctionCall::=PostfixExpr PositionalArgumentList
ElementName::=EQName
ElementTest::="element" "(" (NameTestUnion ("," TypeName "?")) ")"
EnclosedExpr::="{" Expr "}"
EnumerationType::="enum" "(" StringLiteral ")"
EQName::=(QName | URIQualifiedName)
EscapeApos::="''"
EscapeQuot::=""""
Expr::=ExprSingle
ExprSingle::=(ForExpr | LetExpr | QuantifiedExpr | IfExpr | OrExpr)
Extender::=[·· ːː ˑˑ ·· ــ ๆ ໆ 々 〱〵 ゝゞ ーヾ ]
FieldDeclaration::=FieldName "?" ("as" SequenceType)
FieldName::=(NCName | StringLiteral)
FilterExpr::=PostfixExpr Predicate
FilterExprAM::=PostfixExpr "?[" Expr "]"
ForBinding::=(ForItemBinding | ForMemberBinding | ForEntryBinding)
ForClause::="for" ForBinding
ForEntryBinding::=((ForEntryKeyBinding ForEntryValueBinding) | ForEntryValueBinding) PositionalVar "in" ExprSingle
ForEntryKeyBinding::="key" VarNameAndType
ForEntryValueBinding::="value" VarNameAndType
ForExpr::=ForClause ForLetReturn
ForItemBinding::=VarNameAndType PositionalVar "in" ExprSingle
ForLetReturn::=(ForExpr | LetExpr | ("return" ExprSingle))
ForMemberBinding::="member" VarNameAndType PositionalVar "in" ExprSingle
FullStep::=Axis NodeTest
FunctionBody::=EnclosedExpr
FunctionCall::=EQName ArgumentList
FunctionItemExpr::=(NamedFunctionRef | InlineFunctionExpr)
FunctionSignature::="(" ParamList ")" TypeDeclaration
FunctionType::=(AnyFunctionType | TypedFunctionType)
GeneralComp::=("=" | "!=" | "<" | "<=" | ">" | ">=")
GNodeType::="gnode" "(" ")"
HexDigit::=[09afAF]
HexDigits::=(HexDigit ((HexDigit | "_") HexDigit))
HexIntegerLiteral::=("0x" HexDigits)
Ideographic::=[&#x4e00;&#x9fa5; &#x3007; &#x3021;&#x3029; ]
IfExpr::="if" "(" Expr ")" (UnbracedActions | BracedAction)
ImplicitlyAllowedWhitespace::=WhitespaceChar
InlineFunctionExpr::=("function" | "fn") FunctionSignature FunctionBody
InstanceofExpr::=TreatExpr ("instance" "of" SequenceType)
IntegerLiteral::=Digits
IntersectExceptExpr::=InstanceofExpr (("intersect" | "except") InstanceofExpr)
ItemType::=(RegularItemType | FunctionType | TypeName | ChoiceItemType)
JNodeType::="jnode" "(" (("*" | NCName | Constant) ("," ("*" | SequenceType))) ")"
KeySpecifier::=(NCName | Literal | ContextValueRef | VarRef | ParenthesizedExpr | LookupWildcard)
KeywordArgument::=EQName ":=" Argument
KeywordArguments::=KeywordArgument
LetArrayBinding::="$" "[" VarNameAndType "]" TypeDeclaration ":=" ExprSingle
LetBinding::=(LetValueBinding | LetSequenceBinding | LetArrayBinding | LetMapBinding)
LetClause::="let" LetBinding
LetExpr::=LetClause ForLetReturn
LetMapBinding::="$" "{" VarNameAndType "}" TypeDeclaration ":=" ExprSingle
LetSequenceBinding::="$" "(" VarNameAndType ")" TypeDeclaration ":=" ExprSingle
Letter::=(BaseChar | Ideographic)
LetValueBinding::=VarNameAndType ":=" ExprSingle
Literal::=(NumericLiteral | StringLiteral | QNameLiteral)
LocalPart::=NCNameToken
Lookup::="?" KeySpecifier
LookupExpr::=PostfixExpr Lookup
LookupWildcard::="*"
MapConstructor::="map" "{" MapConstructorEntry "}"
MapConstructorEntry::=ExprSingle (":" ExprSingle)
MappingArrowTarget::="=!>" ArrowTarget
MapType::=(AnyMapType | TypedMapType)
MethodCall::=PostfixExpr "=?>" NCName PositionalArgumentList
MultiplicativeExpr::=UnionExpr (("*" | "×" | "div" | "÷" | "idiv" | "mod") UnionExpr)
NamedFunctionRef::=EQName "#" IntegerLiteral
NamespaceDecl::="declare" "namespace" NCName "=" URILiteral
NamespaceNodeTest::="namespace-node" "(" ")"
NameTest::=(EQName | Wildcard)
NameTestUnion::=NameTest
NCName::=QName
NCNameColonStar::=NCNameToken ":*"
NCNameToken::=Nmstart Nmchar
Nmchar::=(Letter | CombiningChar | Extender | Digit | "." | "-" | "_")
Nmstart::=(Letter | "_")
NodeComp::=("is" | "is-not" | NodePrecedes | NodeFollows | "precedes-or-is" | "follows-or-is")
NodeFollows::=(">>" | "follows")
NodeKindTest::=(DocumentTest | ElementTest | AttributeTest | SchemaElementTest | SchemaAttributeTest | PITest | CommentTest | TextTest | NamespaceNodeTest | AnyNodeKindTest)
NodePrecedes::=("<<" | "precedes")
NodeTest::=(UnionNodeTest | SimpleNodeTest)
NumericLiteral::=(IntegerLiteral | HexIntegerLiteral | BinaryIntegerLiteral | DecimalLiteral | DoubleLiteral)
OccurrenceIndicator::=("?" | "*" | "+")
OrExpr::=AndExpr ("or" AndExpr)
OtherwiseExpr::=StringConcatExpr ("otherwise" StringConcatExpr)
ParamList::=VarNameAndType
ParenthesizedExpr::="(" Expr ")"
PathExpr::=(AbsolutePathExpr | RelativePathExpr)
PipelineExpr::=ArrowExpr ("->" ArrowExpr)
PITest::="processing-instruction" "(" (NCName | StringLiteral) ")"
PositionalArgumentList::="(" PositionalArguments ")"
PositionalArguments::=Argument
PositionalVar::="at" VarName
PostfixExpr::=(PrimaryExpr | FilterExpr | DynamicFunctionCall | LookupExpr | MethodCall | FilterExprAM)
Predicate::="[" Expr "]"
PrimaryExpr::=(Literal | VarRef | ParenthesizedExpr | ContextValueRef | FunctionCall | FunctionItemExpr | MapConstructor | ArrayConstructor | StringTemplate | UnaryLookup)
QName::=(NCNameToken ":") LocalPart
QNameLiteral::="#" EQName
QuantifiedExpr::=("some" | "every") QuantifierBinding "satisfies" ExprSingle
QuantifierBinding::=VarNameAndType "in" ExprSingle
QuotStringLiteral::=(""" (EscapeQuot | ["]) """)
RangeExpr::=AdditiveExpr ("to" AdditiveExpr)
RecordType::="record" "(" FieldDeclaration ")"
RegularItemType::=(AnyItemTest | NodeKindTest | GNodeType | JNodeType | MapType | ArrayType | RecordType | EnumerationType)
RelativePathExpr::=StepExpr (("/" | "//") StepExpr)
RestrictedDynamicCall::=(VarRef | ParenthesizedExpr | FunctionItemExpr | MapConstructor | ArrayConstructor) PositionalArgumentList
SchemaAttributeTest::="schema-attribute" "(" AttributeName ")"
SchemaElementTest::="schema-element" "(" ElementName ")"
Selector::=(EQName | Wildcard | ("get" "(" ExprSingle ")"))
SequenceArrowTarget::="=>" ArrowTarget
SequenceType::=(("empty-sequence" "(" ")") | (ItemType OccurrenceIndicator))
SimpleMapExpr::=PathExpr ("!" PathExpr)
SimpleNodeTest::=(TypeTest | Selector)
SquareArrayConstructor::="[" ExprSingle "]"
StarColonNCName::="*:" NCNameToken
StepExpr::=(PostfixExpr | AxisStep)
StringConcatExpr::=RangeExpr ("||" RangeExpr)
StringLiteral::=(AposStringLiteral | QuotStringLiteral)
StringTemplate::="`" (StringTemplateFixedPart | StringTemplateVariablePart) "`"
StringTemplateFixedPart::=(Char | "{{" | "}}" | "``")
StringTemplateVariablePart::=EnclosedExpr
TextTest::="text" "(" ")"
TreatExpr::=CastableExpr ("treat" "as" SequenceType)
TypedArrayType::="array" "(" SequenceType ")"
TypeDeclaration::="as" SequenceType
TypedFunctionParam::=("$" EQName "as") SequenceType
TypedFunctionType::=("function" | "fn") "(" TypedFunctionParam ")" "as" SequenceType
TypedMapType::="map" "(" ItemType "," SequenceType ")"
TypeName::=EQName
TypeTest::=(NodeKindTest | JNodeType)
UnaryExpr::=("-" | "+") ValueExpr
UnaryLookup::=Lookup
UnbracedActions::="then" ExprSingle "else" ExprSingle
UnionExpr::=IntersectExceptExpr (("union" | "|") IntersectExceptExpr)
UnionNodeTest::="(" SimpleNodeTest ")"
URILiteral::=StringLiteral
URIQualifiedName::=BracedURILiteral (NCNameToken ":") NCNameToken
URIQualifiedStar::=BracedURILiteral "*"
ValueComp::=("eq" | "ne" | "lt" | "le" | "gt" | "ge")
ValueExpr::=(SimpleMapExpr)
VarName::="$" EQName
VarNameAndType::="$" EQName TypeDeclaration
VarRef::="$" EQName
WhitespaceChar::=[&#x0009; &#x000D; &#x000A; &#x0020; ]
Wildcard::=("*" | NCNameColonStar | StarColonNCName | URIQualifiedStar)