Poco::OSP

class QLParser

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 protected

bool isRelOp(
    const Poco::Token * token
);

parseAndExpr protected

const Poco::Token * parseAndExpr(
    const Poco::Token * next,
    QLExpr::Ptr & pExpr
);

parseExpr protected

const Poco::Token * parseExpr(
    const Poco::Token * next,
    QLExpr::Ptr & pExpr
);

parseRelExpr protected

const Poco::Token * parseRelExpr(
    const Poco::Token * next,
    QLExpr::Ptr & pExpr
);

token2value protected

Poco::Any token2value(
    const Poco::Token * token
);

Securely control IoT edge devices from anywhere   Connect a Device