-
Notifications
You must be signed in to change notification settings - Fork 13
Closed
Description
in cvc5_pythonic.py, the Re function is used to construct a regular expression term from string:
def Re(s, ctx=None):
"""The regular expression that accepts the string s
>>> re = Re('a')
>>> simplify(InRe('a',re))
True
>>> simplify(InRe('b',re))
False
"""
s = _py2expr(s)
return ReRef(s.ctx.tm.mkTerm(Kind.STRING_TO_REGEXP, s.ast), s.ctx)However, there is a problem here. Although this function allows users to provide optional ctx argument, it did not use it in the _py2expr step, which means even if a user provides a custom ctx, the global main_ctx is used nonetheless.
A quick fix is to just pass the input ctx argument:
def Re(s, ctx=None):
"""The regular expression that accepts the string s
>>> re = Re('a')
>>> simplify(InRe('a',re))
True
>>> simplify(InRe('b',re))
False
"""
s = _py2expr(s, ctx)
return ReRef(s.ctx.tm.mkTerm(Kind.STRING_TO_REGEXP, s.ast), s.ctx)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels