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

Functions

int try_match_char_class_range (str pattern, int pattern_len, str string, bool prefix_only=False)
int try_match_digit_sequence (str pattern, int pattern_len, str string, bool prefix_only=False)
int try_match_alternation (str pattern, int pattern_len, str string)
int try_match_two_char_class_range (str pattern, int pattern_len, str string)
int try_match_dot_literal (str pattern, int pattern_len, str string)
int _flag_mode (str pattern, int flags)
bool match (str pattern, str string)
bool search (str pattern, str string)
int _digit_prefix_len (str string, int string_len)
bool _is_paren_digit_plus (str pattern, int pattern_len)
str _group (str pattern, str string, int n)
tuple _groups (str pattern, str string)
tuple _span (str pattern, str string, int n)
bool fullmatch (str pattern, str string)
bool _match_flags (str pattern, str string, int flags)
bool _search_flags (str pattern, str string, int flags)
bool _fullmatch_flags (str pattern, str string, int flags)

Variables

int IGNORECASE = 2
int I = 2
int MULTILINE = 8
int M = 8
int DOTALL = 16
int S = 16
int UNICODE = 32
int U = 32
int VERBOSE = 64
int X = 64
int ASCII = 256
int A = 256

Function Documentation

◆ _digit_prefix_len()

int re._digit_prefix_len ( str string,
int string_len )
protected
Return the length of the leading digit run in ``string``.

◆ _flag_mode()

int re._flag_mode ( str pattern,
int flags )
protected
0: the flags change nothing for this model, 1: match case-insensitively
by lowering both sides, 2: not modelled, so the result is nondet.
UNICODE and ASCII only differ on non-ASCII text; lowering a pattern would
turn an escape such as \\D into \\d, so IGNORECASE needs a pattern without one.

◆ _fullmatch_flags()

bool re._fullmatch_flags ( str pattern,
str string,
int flags )
protected
re.fullmatch with a flags argument; the converter routes such calls here.

◆ _group()

str re._group ( str pattern,
str string,
int n )
protected
Return the n-th captured group when re.match(pattern, string) succeeded.

Group 0 is the full match. For supported patterns the recognised
substring is returned exactly; for everything else a symbolic string
is returned so downstream assertions remain sound.

◆ _groups()

tuple re._groups ( str pattern,
str string )
protected
Return the tuple of capturing groups (group 1, group 2, ...).

◆ _is_paren_digit_plus()

bool re._is_paren_digit_plus ( str pattern,
int pattern_len )
protected
Return True iff ``pattern`` is exactly ``(\d+)``.

◆ _match_flags()

bool re._match_flags ( str pattern,
str string,
int flags )
protected
re.match with a flags argument; the converter routes such calls here.

◆ _search_flags()

bool re._search_flags ( str pattern,
str string,
int flags )
protected
re.search with a flags argument; the converter routes such calls here.

◆ _span()

tuple re._span ( str pattern,
str string,
int n )
protected
Return the ``(start, end)`` tuple for the n-th group.

For group 0 this is the span of the full match. For supported patterns
the exact bounds are returned; for everything else a symbolic pair is
returned so downstream assertions remain sound.

◆ fullmatch()

bool re.fullmatch ( str pattern,
str string )
Match pattern against entire string
Returns True if entire string matches, False otherwise

◆ match()

bool re.match ( str pattern,
str string )
Try to match pattern at the beginning of string
Returns True if successful, False otherwise    

◆ search()

bool re.search ( str pattern,
str string )
Search for pattern anywhere in string
Returns True if found, False otherwise

◆ try_match_alternation()

int re.try_match_alternation ( str pattern,
int pattern_len,
str string )
Match (x|y)z* patterns

◆ try_match_char_class_range()

int re.try_match_char_class_range ( str pattern,
int pattern_len,
str string,
bool prefix_only = False )
Match [x-y]+ or [x-y]* patterns.

Handles the bare single-character class ``[x-y]`` (length 5, no quantifier,
matches exactly one character in the range) as well as ``[x-y]+`` and
``[x-y]*`` (length 6).

When ``prefix_only`` is False (default, used by ``fullmatch``), every
character of ``string`` must lie in [x-y]. When True (used by ``match``),
only the leading run of in-range characters is required: ``+`` needs at
least one such character, ``*`` always matches at the start of the
string. This mirrors CPython's at-the-start semantics for ``re.match``.

◆ try_match_digit_sequence()

int re.try_match_digit_sequence ( str pattern,
int pattern_len,
str string,
bool prefix_only = False )
Match \d+ or \d* patterns.

See ``try_match_char_class_range`` for the ``prefix_only`` semantics:
full-string when False, at-the-start when True.

◆ try_match_dot_literal()

int re.try_match_dot_literal ( str pattern,
int pattern_len,
str string )
Match .x patterns (any character followed by literal character)

◆ try_match_two_char_class_range()

int re.try_match_two_char_class_range ( str pattern,
int pattern_len,
str string )
Match ^[x-y][x-y]$ patterns (exactly two characters in range)

Variable Documentation

◆ A

int re.A = 256

◆ ASCII

int re.ASCII = 256

◆ DOTALL

int re.DOTALL = 16

◆ I

int re.I = 2

◆ IGNORECASE

int re.IGNORECASE = 2

◆ M

int re.M = 8

◆ MULTILINE

int re.MULTILINE = 8

◆ S

int re.S = 16

◆ U

int re.U = 32

◆ UNICODE

int re.UNICODE = 32

◆ VERBOSE

int re.VERBOSE = 64

◆ X

int re.X = 64