Merge pull request #8 from jepler/commas
split instructions on commas and whitespace
This commit is contained in:
commit
a631797c0a
1 changed files with 4 additions and 1 deletions
|
|
@ -12,6 +12,9 @@ Simple assembler to convert pioasm to bytes
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import array
|
import array
|
||||||
|
import re
|
||||||
|
|
||||||
|
splitter = re.compile(r",\s*|\s+(?:,\s*)?").split
|
||||||
|
|
||||||
__version__ = "0.0.0-auto.0"
|
__version__ = "0.0.0-auto.0"
|
||||||
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PIOASM.git"
|
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PIOASM.git"
|
||||||
|
|
@ -61,7 +64,7 @@ def assemble(text_program):
|
||||||
assembled = []
|
assembled = []
|
||||||
for instruction in instructions:
|
for instruction in instructions:
|
||||||
# print(instruction)
|
# print(instruction)
|
||||||
instruction = instruction.split()
|
instruction = splitter(instruction.strip())
|
||||||
delay = 0
|
delay = 0
|
||||||
if instruction[-1].endswith("]"): # Delay
|
if instruction[-1].endswith("]"): # Delay
|
||||||
delay = int(instruction[-1].strip("[]"))
|
delay = int(instruction[-1].strip("[]"))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue