Skip to content

Commit 71a04ee

Browse files
support C style // to-end-of-line comments, see #17
1 parent c82cc06 commit 71a04ee

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

demo.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
.text
44

55
textstart: ld r0, r1, 0 # a comment!
6-
st r0, r1, 0
6+
st r0, r1, 0 // another comment!
77
add r0, r1, r2
88
add r0, r1, 42
99
sub r0, r1, r2

esp32_ulp/assemble.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ def parse_line(self, line):
2222
2323
label: opcode arg1, arg2, ... # rest-of-line comment
2424
"""
25-
line = line.split('#', 1)[0].rstrip()
25+
line = line.split('#', 1)[0]
26+
line = line.split('//', 1)[0]
27+
line = line.rstrip()
2628
if not line:
2729
return
2830
has_label = line[0] not in '\t '

tests/assemble.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
ld r0, r1, 0
1010
st r0, r1,0 # line 7
1111
halt
12-
end:
12+
end: // C style comment
1313
"""
1414

1515

0 commit comments

Comments
 (0)