ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
preprocessor.match_lowering Namespace Reference

Classes

class  _ReadSubject
class  _MatchLowering

Functions

 _bound_names (pattern)
 _test (pattern, subject)
 _guard_is_rewritable (guard)
 _is_lowerable (node, bound)
 _case_branch (case, names, subject, orelse)
 lower_match_statements (module)

Variables

str _SUBJECT_PREFIX = "__esbmc_match_subject_"

Detailed Description

Lower `match` statements whose patterns need no destructuring to if/elif.

Literal and value patterns compare with `==`, `None`/`True`/`False` with `is`,
and wildcard, capture, `as` and `|` patterns combine these. A capture binds the
subject itself, so a guard reads the subject in place of the names its case
binds. A statement with any other pattern is left for the converter to refuse.

Function Documentation

◆ _bound_names()

preprocessor.match_lowering._bound_names ( pattern)
protected
The names @p pattern binds, or None if it needs more than a comparison.

◆ _case_branch()

preprocessor.match_lowering._case_branch ( case,
names,
subject,
orelse )
protected
The statements running @p case when it matches and @p orelse otherwise.

◆ _guard_is_rewritable()

preprocessor.match_lowering._guard_is_rewritable ( guard)
protected

◆ _is_lowerable()

preprocessor.match_lowering._is_lowerable ( node,
bound )
protected

◆ _test()

preprocessor.match_lowering._test ( pattern,
subject )
protected
The condition under which @p pattern matches @p subject, or None if always.

◆ lower_match_statements()

preprocessor.match_lowering.lower_match_statements ( module)
Rewrite in place every `match` in @p module that _MatchLowering supports.

Variable Documentation

◆ _SUBJECT_PREFIX

str preprocessor.match_lowering._SUBJECT_PREFIX = "__esbmc_match_subject_"
protected