Skip to content

Commit a631797

Browse files
authored
Merge pull request #8 from jepler/commas
split instructions on commas and whitespace
2 parents f227a50 + bfbd002 commit a631797

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

adafruit_pioasm.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
"""
1313

1414
import array
15+
import re
16+
17+
splitter = re.compile(r",\s*|\s+(?:,\s*)?").split
1518

1619
__version__ = "0.0.0-auto.0"
1720
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PIOASM.git"
@@ -61,7 +64,7 @@ def assemble(text_program):
6164
assembled = []
6265
for instruction in instructions:
6366
# print(instruction)
64-
instruction = instruction.split()
67+
instruction = splitter(instruction.strip())
6568
delay = 0
6669
if instruction[-1].endswith("]"): # Delay
6770
delay = int(instruction[-1].strip("[]"))

0 commit comments

Comments
 (0)