make_msg_matcher(exprstr,
mopts=None,
abort=False)
|
|
Build expression matcher for messages.
For expression syntax, check find-messages sieve
documentation for fexpr parameter. TODO: Put this
instruction here.
The mopts parameter, if given, defines global matching
options. It can be either a dictionary or an object with data attributes,
and can contain the following keys/attributes (in parenthesis: type and
default value in case the key is not present):
-
case (bool , False ):
True for case-sensitive matching
The built matcher function takes up to four parameters, in order:
-
msgf : filtered message (to really match against)
-
msg : raw message (to properly report matched spans)
-
cat : catalog in which the message resides
-
hl : highlight specification (to be filled with matched
spans, can be omitted from the call)
Matcher function returns True if the message is matched,
False otherwise.
In case an error in expression is encountered while building the
matcher, either ExprError exception may be thrown or execution aborted,
depending on the parameter abort .
- Parameters:
exprstr (string) - expression string
mopts (dict or attribute object) - global matching options
abort (bool) - on errors in expression, abort execution if True ,
raise ExprError if False
- Returns: (msgf, msg, cat, hl=[])->bool
- matcher function
|