Compile a match expression. :param input: The input expression - one line.
(self, input: str)
| 200 | |
| 201 | @classmethod |
| 202 | def compile(self, input: str) -> "Expression": |
| 203 | """Compile a match expression. |
| 204 | |
| 205 | :param input: The input expression - one line. |
| 206 | """ |
| 207 | astexpr = expression(Scanner(input)) |
| 208 | code: types.CodeType = compile( |
| 209 | astexpr, |
| 210 | filename="<pytest match expression>", |
| 211 | mode="eval", |
| 212 | ) |
| 213 | return Expression(code) |
| 214 | |
| 215 | def evaluate(self, matcher: Callable[[str], bool]) -> bool: |
| 216 | """Evaluate the match expression. |