Compile a match expression. :param input: The input expression - one line. :raises SyntaxError: If the expression is malformed.
(cls, input: str)
| 323 | |
| 324 | @classmethod |
| 325 | def compile(cls, input: str) -> Expression: |
| 326 | """Compile a match expression. |
| 327 | |
| 328 | :param input: The input expression - one line. |
| 329 | |
| 330 | :raises SyntaxError: If the expression is malformed. |
| 331 | """ |
| 332 | astexpr = expression(Scanner(input)) |
| 333 | code = compile( |
| 334 | astexpr, |
| 335 | filename="<pytest match expression>", |
| 336 | mode="eval", |
| 337 | ) |
| 338 | return Expression(input, code) |
| 339 | |
| 340 | def evaluate(self, matcher: ExpressionMatcher) -> bool: |
| 341 | """Evaluate the match expression. |