# BNF for XPath.jj

## NON-TERMINALS

NCName

::=

( NCName_Without_CoreFunctions | <NODE> | <TEXT> | <COMMENT> | <PI> | <FUNCTION_LAST> | <FUNCTION_POSITION> | <FUNCTION_COUNT> | <FUNCTION_ID> | <FUNCTION_LOCAL_NAME> | <FUNCTION_NAMESPACE_URI> | <FUNCTION_NAME> | <FUNCTION_STRING> | <FUNCTION_CONCAT> | <FUNCTION_STARTS_WITH> | <FUNCTION_CONTAINS> | <FUNCTION_SUBSTRING_BEFORE> | <FUNCTION_SUBSTRING_AFTER> | <FUNCTION_SUBSTRING> | <FUNCTION_STRING_LENGTH> | <FUNCTION_NORMALIZE_SPACE> | <FUNCTION_TRANSLATE> | <FUNCTION_BOOLEAN> | <FUNCTION_NOT> | <FUNCTION_TRUE> | <FUNCTION_FALSE> | <FUNCTION_NULL> | <FUNCTION_LANG> | <FUNCTION_NUMBER> | <FUNCTION_SUM> | <FUNCTION_FLOOR> | <FUNCTION_CEILING> | <FUNCTION_ROUND> | <FUNCTION_KEY> | <FUNCTION_FORMAT_NUMBER> )

NCName_Without_CoreFunctions | ::= | ( <NCName> | <OR> | <AND> | <MOD> | <DIV> )

CoreFunctionName

::=

( <FUNCTION_LAST> | <FUNCTION_POSITION> | <FUNCTION_COUNT> | <FUNCTION_ID> | <FUNCTION_LOCAL_NAME> | <FUNCTION_NAMESPACE_URI> | <FUNCTION_NAME> | <FUNCTION_STRING> | <FUNCTION_CONCAT> | <FUNCTION_STARTS_WITH> | <FUNCTION_CONTAINS> | <FUNCTION_SUBSTRING_BEFORE> | <FUNCTION_SUBSTRING_AFTER> | <FUNCTION_SUBSTRING> | <FUNCTION_STRING_LENGTH> | <FUNCTION_NORMALIZE_SPACE> | <FUNCTION_TRANSLATE> | <FUNCTION_BOOLEAN> | <FUNCTION_NOT> | <FUNCTION_TRUE> | <FUNCTION_FALSE> | <FUNCTION_NULL> | <FUNCTION_LANG> | <FUNCTION_NUMBER> | <FUNCTION_SUM> | <FUNCTION_FLOOR> | <FUNCTION_CEILING> | <FUNCTION_ROUND> | <FUNCTION_KEY> | <FUNCTION_FORMAT_NUMBER> )

QName | ::= | NCName ( ":" NCName )?
QName_Without_CoreFunctions | ::= | ( NCName ":" NCName | NCName_Without_CoreFunctions )
parseExpression | ::= | Expression <EOF>
LocationPath | ::= | ( RelativeLocationPath | AbsoluteLocationPath )
AbsoluteLocationPath | ::= | ( ( LocationStep ( LocationStep )* ) | <SLASH> )
RelativeLocationPath | ::= | ( NodeTest ( LocationStep )* )
LocationStep | ::= | ( <SLASH> | <SLASHSLASH> ) NodeTest
NodeTest | ::= | ( ( AxisSpecifier ( NodeType "(" ")" | <PI> "(" <Literal> ")" | WildcardName ) | "." | ".." ) ( Predicate )* )
AxisSpecifier | ::= | ( AxisName | AbbreviatedAxisSpecifier )
AxisName | ::= | ( <AXIS_SELF> | <AXIS_CHILD> | <AXIS_PARENT> | <AXIS_ANCESTOR> | <AXIS_ATTRIBUTE> | <AXIS_NAMESPACE> | <AXIS_PRECEDING> | <AXIS_FOLLOWING> | <AXIS_DESCENDANT> | <AXIS_ANCESTOR_OR_SELF> | <AXIS_FOLLOWING_SIBLING> | <AXIS_PRECEDING_SIBLING> | <AXIS_DESCENDANT_OR_SELF> )
Predicate | ::= | "[" Expression "]"
AbbreviatedAxisSpecifier | ::= | ( "@" )?
Expression | ::= | OrExpr
PrimaryExpr | ::= | ( VariableReference | "(" Expression ")" | <Literal> | <Number> | CoreFunctionCall | FunctionCall )
FunctionCall | ::= | FunctionName ArgumentList
CoreFunctionCall | ::= | ( CoreFunctionName ) ArgumentList
ArgumentList | ::= | "(" ( Argument ( "," Argument )* )? ")"
Argument | ::= | Expression
UnionExpr | ::= | ( PathExpr ( <UNION> PathExpr )* )
PathExpr | ::= | ( FilterExpr | LocationPath )
FilterExpr | ::= | ( PrimaryExpr ( Predicate )* ( LocationStep )* )
OrExpr | ::= | ( AndExpr ( <OR> AndExpr )* )
AndExpr | ::= | ( EqualityExpr ( <AND> EqualityExpr )* )
EqualityExpr | ::= | ( RelationalExpr ( ( <EQ> RelationalExpr | <NEQ> RelationalExpr ) )* )
RelationalExpr | ::= | ( AdditiveExpr ( ( <LT> AdditiveExpr | <GT> AdditiveExpr | <LTE> AdditiveExpr | <GTE> AdditiveExpr ) )* )
AdditiveExpr | ::= | ( SubtractiveExpr ( ( <PLUS> SubtractiveExpr ) )* )
SubtractiveExpr | ::= | ( MultiplicativeExpr ( <MINUS> MultiplicativeExpr )* )
MultiplicativeExpr | ::= | ( UnaryExpr ( ( "*" UnaryExpr | <DIV> UnaryExpr | <MOD> UnaryExpr ) )* )
UnaryExpr | ::= | ( UnionExpr | <MINUS> UnaryExpr )
FunctionName | ::= | QName_Without_CoreFunctions
VariableReference | ::= | <VARIABLE> QName
WildcardName | ::= | ( ( "*" | NCName ) ( ":" ( "*" | NCName ) )? )
NodeType | ::= | ( <TEXT> | <NODE> | <COMMENT> | <PI> )