Fix regular expression warnings on Python 3.12

This commit is contained in:
Mike Naberezny 2024-04-12 12:21:46 -07:00
parent 85ed46fd68
commit 8dce37f6b8
3 changed files with 6 additions and 4 deletions

View File

@ -5,6 +5,8 @@
dropped when pasting in larger amounts of text. This makes it possible
to paste programs into EhBASIC and Taliforth. Patch by SamCoVT.
- Fixed regular expression warnings on Python 3.12.
- The ``fill`` command in the monitor now shows an error message if an
address or value is out of range.

View File

@ -239,7 +239,7 @@ class Monitor(cmd.Cmd):
line = command
break
pattern = '^%s\s+' % re.escape(shortcut)
pattern = r'^%s\s+' % re.escape(shortcut)
matches = re.match(pattern, line)
if matches:
start, end = matches.span()
@ -580,7 +580,7 @@ class Monitor(cmd.Cmd):
if args == '':
return
pairs = re.findall('([^=,\s]*)=([^=,\s]*)', args)
pairs = re.findall(r'([^=,\s]*)=([^=,\s]*)', args)
if pairs == []:
return self._output("Syntax error: %s" % args)

View File

@ -61,7 +61,7 @@ class AddressParser(object):
return self.labels[num]
else:
matches = re.match('^([^\s+-]+)\s*([+\-])\s*([$+%]?\d+)$', num)
matches = re.match(r'^([^\s+-]+)\s*([+\-])\s*([$+%]?\d+)$', num)
if matches:
label, sign, offset = matches.groups()
@ -88,7 +88,7 @@ class AddressParser(object):
"""Parse a string containing an address or a range of addresses
into a tuple of (start address, end address)
"""
matches = re.match('^([^:,]+)\s*[:,]+\s*([^:,]+)$', addresses)
matches = re.match(r'^([^:,]+)\s*[:,]+\s*([^:,]+)$', addresses)
if matches:
start, end = map(self.number, matches.groups(0))
else: