Skip to content

Commit

Permalink
cProfile hotspot
Browse files Browse the repository at this point in the history
  • Loading branch information
icmor committed Oct 31, 2024
1 parent 3086ca1 commit 262af35
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions assembler.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,12 @@ class HackValueError(ValueError):


def is_valid_symbol(symbol: str) -> bool:
return (not symbol[0].isdigit() and
all(c.isalnum() or c in "_.$:" for c in symbol))
if symbol[0].isdigit():
return False
for c in symbol:
if not c.isalnum() and c not in "_.$:":
return False
return True


def parse_label(instruction: str, lineno: int) -> str:
Expand Down

0 comments on commit 262af35

Please sign in to comment.