Skip to content

Commit 7e6431d

Browse files
authored
Merge pull request #656 from boriel/bugfix/prepro_line_comment_continuation
fix: backlash continuation ignored after comment
2 parents 1f71db8 + d417e3c commit 7e6431d

5 files changed

Lines changed: 24 additions & 13 deletions

File tree

src/zxbpp/zxbpplex.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,13 @@ def t_msg_TEXT(self, t):
185185
t.value = t.value.strip() # remove newline and spaces
186186
return t
187187

188+
def t_singlecomment_CONTINUE(self, t):
189+
r"\\\r?\n"
190+
t.lexer.lineno += 1
191+
t.value = t.value[1:]
192+
t.lexer.pop_state()
193+
return t
194+
188195
# Any other character is ignored until EOL
189196
def t_singlecomment_comment_Skip(self, t):
190197
r"."

tests/functional/prepro03.bi

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11

22
#define test x 'a comment \
3+
this line must be compiled
34
#define test2 y ' This define should not be ignored
45

56
test
67
test2
7-
8-
9-
10-

tests/functional/prepro03.out

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
#line 1 "prepro03.bi"
22

3-
#line 3 "prepro03.bi"
43
#line 4 "prepro03.bi"
4+
#line 5 "prepro03.bi"
55

6-
x
6+
x
7+
this line must be compiled
8+
#line 7
79
y
8-
9-
10-
11-

tests/functional/prepro80.bi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ REM simple WaitRetrace macro
77
halt \
88
end asm
99

10-
#endif
10+
waitretrace
11+
waitretrace
1112

13+
#endif

tests/functional/prepro80.out

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@
33

44

55

6+
7+
68
asm
79
halt
810
halt
911
end asm
10-
#line 9
12+
#line 11
1113

12-
#line 11 "prepro80.bi"
14+
asm
15+
halt
16+
halt
17+
end asm
18+
#line 12
1319

20+
#line 14 "prepro80.bi"

0 commit comments

Comments
 (0)