Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request boriel-basic#656 from boriel/bugfix/prepro_line_co…
Browse files Browse the repository at this point in the history
…mment_continuation

fix: backlash continuation ignored after comment
  • Loading branch information
boriel committed Aug 9, 2023
2 parents 1f71db8 + d417e3c commit 7e6431d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
7 changes: 7 additions & 0 deletions src/zxbpp/zxbpplex.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,13 @@ def t_msg_TEXT(self, t):
t.value = t.value.strip() # remove newline and spaces
return t

def t_singlecomment_CONTINUE(self, t):
r"\\\r?\n"
t.lexer.lineno += 1
t.value = t.value[1:]
t.lexer.pop_state()
return t

# Any other character is ignored until EOL
def t_singlecomment_comment_Skip(self, t):
r"."
Expand Down
5 changes: 1 addition & 4 deletions tests/functional/prepro03.bi
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@

#define test x 'a comment \
this line must be compiled
#define test2 y ' This define should not be ignored

test
test2




10 changes: 4 additions & 6 deletions tests/functional/prepro03.out
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#line 1 "prepro03.bi"

#line 3 "prepro03.bi"
#line 4 "prepro03.bi"
#line 5 "prepro03.bi"

x
x
this line must be compiled
#line 7
y




4 changes: 3 additions & 1 deletion tests/functional/prepro80.bi
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ REM simple WaitRetrace macro
halt \
end asm

#endif
waitretrace
waitretrace

#endif
11 changes: 9 additions & 2 deletions tests/functional/prepro80.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@





asm
halt
halt
end asm
#line 9
#line 11

#line 11 "prepro80.bi"
asm
halt
halt
end asm
#line 12

#line 14 "prepro80.bi"

0 comments on commit 7e6431d

Please sign in to comment.