File Information
Library: OSP
Package: Util
Header: Poco/OSP/QLParser.h
Description
QLParser implements a parser for property query expressions, such as used by the ServiceRegistry.
Member Summary
Member Functions: isRelOp, parse, parseAndExpr, parseExpr, parseRelExpr, token2value
Constructors
QLParser
QLParser(
const std::string & expr
);
Creates the QLParser for parsing the given expression.
Destructor
~QLParser
~QLParser();
Destroys the QLParser.
Member Functions
parse
QLExpr::Ptr parse();
Parses the expression.
Throws a SyntaxExpression if the expression is not valid.
The language syntax is as follows:
expr ::= andExpr ["||" andExpr] andExpr ::= relExpr ["&&" relExpr] relExpr ::= ["!"] (id [relOp value | "=~" matchExpr]) | subExpr subExpr ::= "(" expr ")" relOp ::= "==" | "!=" | "<" | "<=" | ">" | ">=" value ::= numLiteral | boolLiteral | stringLiteral numLiteral ::= [sign] digit*"."digit*["E"["+" | "-"]digit*] boolLiteral ::= "true" | "false" stringLiteral ::= """ char* """ matchExpr ::= stringLiteral | regExpr regExpr ::= delim char+ delim /* valid Perl regular expression, enclosed in delim */ delim ::= "/" | "#"
isRelOp
bool isRelOp(
const Poco::Token * token
);
parseAndExpr
const Poco::Token * parseAndExpr(
const Poco::Token * next,
QLExpr::Ptr & pExpr
);
parseExpr
const Poco::Token * parseExpr(
const Poco::Token * next,
QLExpr::Ptr & pExpr
);
parseRelExpr
const Poco::Token * parseRelExpr(
const Poco::Token * next,
QLExpr::Ptr & pExpr
);
token2value
Poco::Any token2value(
const Poco::Token * token
);