Skip to content

Commit

Permalink
Fix regular expression warnings on Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
mnaberez committed Apr 12, 2024
1 parent 85ed46f commit 8dce37f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions py65/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def _preprocess_line(self, line):
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()
Expand Down Expand Up @@ -580,7 +580,7 @@ def do_registers(self, args):
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)

Expand Down
4 changes: 2 additions & 2 deletions py65/utils/addressing.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def number(self, num):
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()

Expand All @@ -88,7 +88,7 @@ def range(self, addresses):
"""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:
Expand Down

0 comments on commit 8dce37f

Please sign in to comment.