From ba6bc73d20e455ab450f651ca7d02dac7dd0b6c6 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Thu, 21 Aug 2014 15:00:42 +0000 Subject: QPID-5999: Update selector syntax documentation to reflect the implementation git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/0.30@1619425 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/broker/SelectorExpression.cpp | 38 +++++++++++++------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/qpid/cpp/src/qpid/broker/SelectorExpression.cpp b/qpid/cpp/src/qpid/broker/SelectorExpression.cpp index 8b74ac4667..1e8a90ed4c 100644 --- a/qpid/cpp/src/qpid/broker/SelectorExpression.cpp +++ b/qpid/cpp/src/qpid/broker/SelectorExpression.cpp @@ -37,49 +37,51 @@ /* * Syntax for JMS style selector expressions (informal): + * This is a mixture of regular expression and EBNF formalism * - * Alpha ::= "a".."z" | "A".."Z" - * Digit ::= "0".."9" + * The top level term is SelectExpression + * + * // Lexical elements + * + * Alpha ::= [a-zA-Z] + * Digit ::= [0-9] * IdentifierInitial ::= Alpha | "_" | "$" * IdentifierPart ::= IdentifierInitial | Digit | "." * Identifier ::= IdentifierInitial IdentifierPart* * Constraint : Identifier NOT IN ("NULL", "TRUE", "FALSE", "NOT", "AND", "OR", "BETWEEN", "LIKE", "IN", "IS") // Case insensitive * - * LiteralString ::= ("'" ~[']* "'")+ // Repeats to cope with embedded single quote + * LiteralString ::= ("'" [^']* "'")+ // Repeats to cope with embedded single quote * * LiteralExactNumeric ::= Digit+ - * Exponent ::= ['+'|'-'] LiteralExactNumeric - * LiteralApproxNumeric ::= ( Digit "." Digit* [ "E" Exponent ] ) | - * ( "." Digit+ [ "E" Exponent ] ) | + * Exponent ::= ('+'|'-')? LiteralExactNumeric + * LiteralApproxNumeric ::= ( Digit "." Digit* ( "E" Exponent )? ) | + * ( "." Digit+ ( "E" Exponent )? ) | * ( Digit+ "E" Exponent ) * LiteralBool ::= "TRUE" | "FALSE" * * Literal ::= LiteralBool | LiteralString | LiteralApproxNumeric | LiteralExactNumeric * * EqOps ::= "=" | "<>" - * * ComparisonOps ::= EqOps | ">" | ">=" | "<" | "<=" + * AddOps ::= "+" | "-" + * MultiplyOps ::= "*" | "/" * - * BoolExpression ::= OrExpression + * // Expression Syntax + * + * SelectExpression ::= OrExpression? // An empty expression is equivalent to "true" * * OrExpression ::= AndExpression ( "OR" AndExpression )* * * AndExpression :: = ComparisonExpression ( "AND" ComparisonExpression )* * - * ComparisonExpression ::= AddExpression "IS" "NULL" | - * AddExpression "IS" "NOT" "NULL" | - * AddExpression "LIKE" LiteralString [ "ESCAPE" LiteralString ] | - * AddExpression "NOT" "LIKE" LiteralString [ "ESCAPE" LiteralString ] | - * AddExpression "BETWEEN" AddExpression "AND" AddExpression | - * AddExpression "NOT" "BETWEEN" AddExpression "AND" AddExpression | + * ComparisonExpression ::= AddExpression "IS" "NOT"? "NULL" | + * AddExpression "NOT"? "LIKE" LiteralString [ "ESCAPE" LiteralString ] | + * AddExpression "NOT"? "BETWEEN" AddExpression "AND" AddExpression | + * AddExpression "NOT"? "IN" "(" PrimaryExpression ("," PrimaryExpression)* ")" | * AddExpression ComparisonOps AddExpression | * "NOT" ComparisonExpression | * AddExpression * - * AddOps ::= "+" | "-" - * - * MultiplyOps ::= "*" | "-" - * * AddExpression :: = MultiplyExpression ( AddOps MultiplyExpression )* * * MultiplyExpression :: = UnaryArithExpression ( MultiplyOps UnaryArithExpression )* -- cgit v1.2.1