#include <pattern_match.h>
|
| | PMatchesOneOf (const TPattern &... patterns) |
| |
| template<typename NodeType > |
| bool | Match (const NodeType &value) const |
| | Check if value matches one of the patterns.
|
| |
| template<typename NodeType , typename Condition > |
| bool | Match (const NodeType &value, Condition cond) const |
| | Check if value matches one of the patterns.
|
| |
◆ PMatchesOneOf()
template<typename... TPattern>
◆ Match() [1/2]
template<typename... TPattern>
template<typename NodeType >
Check if value matches one of the patterns.
This call also populates the PVars with matched value based on the first successful match. The values in PVars are valid until the next call to Match.
- Parameters
-
| value | The value to be matched against. |
- Returns
- Whether value matches the pattern.
◆ Match() [2/2]
template<typename... TPattern>
template<typename NodeType , typename Condition >
| bool tvm::PMatchesOneOf< TPattern >::Match |
( |
const NodeType & |
value, |
|
|
Condition |
cond |
|
) |
| const |
|
inline |
Check if value matches one of the patterns.
This call also populates the PVars with matched value based on the first successful match. The values in PVars are valid until the next call to Match.
- Parameters
-
| value | The value to be matched against. |
| cond | A callable that performs additional validation, returning true if the match passes. This will typically be a lambda function written in terms of the filled PVars. This will be called once for each successful pattern match. If cond() returns false, the next match will be attempted. |
- Returns
- Whether value matches the pattern.
The documentation for this class was generated from the following file: