1
0
mirror of https://github.com/mnaberez/py65.git synced 2024-06-07 12:29:27 +00:00

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 dropped when pasting in larger amounts of text. This makes it possible
to paste programs into EhBASIC and Taliforth. Patch by SamCoVT. 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 - The ``fill`` command in the monitor now shows an error message if an
address or value is out of range. address or value is out of range.

View File

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

View File

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