|
grepros 1.3.0
grep for ROS bag files and live topics
|

Public Member Functions | |
| __init__ (self, **props) | |
| configure (self, **props) | |
| evaluate (self, tree, terminal=None, eager=()) | |
| format (self, tree, terminal=None) | |
| parse (self, text, terminal=None) | |
Static Public Attributes | |
| AND | |
| tuple | BINARIES = (AND, OR) |
| bool | CASED = False |
| ESCAPE | |
| dict | FORMAT_TEMPLATES = {AND: "%s and %s", OR: "%s or %s", NOT: "not %s"} |
| IMPLICIT = AND | |
| LBRACE | |
| NOT | |
| dict | OPERATORS = {AND: (lambda a, b: a and b), OR: (lambda a, b: a or b), NOT: lambda a: not a} |
| OR | |
| QUOTES | |
| dict | RANKS = {VAL: 1, NOT: 2, AND: 3, OR: 4} |
| RBRACE | |
| SEPARATORS = WHITESPACE + LBRACE + RBRACE | |
| dict | SHORTCIRCUITS = {AND: False, OR: True} |
| tuple | UNARIES = (NOT, ) |
| VAL | |
| VOID = None | |
| WHITESPACE | |
Parses and evaluates operator expressions like "a AND (b OR NOT c)". Operands can be quoted strings, '\' can be used to escape quotes within the string. Operators are case-insensitive.
| __init__ | ( | self, | |
| ** | props | ||
| ) |
| configure | ( | self, | |
| ** | props | ||
| ) |
| evaluate | ( | self, | |
| tree, | |||
terminal = None, |
|||
eager = () |
|||
| ) |
Returns result of evaluating expression tree. @param tree expression tree structure as given by parse() @param terminal callback(value) to evaluate value nodes with, if not using value directly @param eager operators where to evaluate both operands in full, despite short-circuit
| format | ( | self, | |
| tree, | |||
terminal = None |
|||
| ) |
| parse | ( | self, | |
| text, | |||
terminal = None |
|||
| ) |
Returns an operator expression like "a AND (b OR NOT c)" parsed into a binary tree. Binary tree like ["AND", [["VAL", "a"], ["OR", [["VAL", "b"], ["NOT", [["VAL", "c"]]]]]]]. Raises on invalid expression. @param terminal callback(text) returning node value for operands, if not using plain text
|
static |
|
static |
|
static |