maha.parsers.templates.value_expressions#
Module Contents#
Classes#
Expression that returns a predefined value if the pattern matches. |
|
Expression that returns a predefined value of a matched expression from the input |
|
Expression that returns the output value of an input function when matched. |
- class Value(value, pattern, pickle=False)[source]#
Bases:
maha.rexy.ExpressionExpression that returns a predefined value if the pattern matches.
- Parameters
value (Any) –
pattern (str) –
pickle (bool) –
- class MatchedValue(expressions, pattern)[source]#
Bases:
ValueExpression that returns a predefined value of a matched expression from the input expressions
- Parameters
expressions (ExpressionGroup) – The expressions to match
pattern (str) – The pattern to match
- Returns
The result of the expression
- Return type
- class FunctionValue(function, pattern, pickle=True)[source]#
Bases:
ValueExpression that returns the output value of an input function when matched.
- Parameters
function (Callable) – The function to be called when the pattern matches.
pattern (str) – The pattern to be matched.
pickle (bool) –
- Returns
The result of the expression.
- Return type