Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions asm/preproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5616,6 +5616,10 @@ static bool paste_tokens(Token **head, const struct concat_mask *m,
if (!t) {
/* Nothing to actually paste, just zapping the paste */
*prev_next = tok = next;
if (tok_white(tok) || tok_is(tok, TOKEN_PASTE))
prev_nonspace = NULL;
else
prev_nonspace = prev_next;
Comment thread
agourakis82 marked this conversation as resolved.
Resolved
break;
}

Expand Down Expand Up @@ -5695,10 +5699,9 @@ static bool paste_tokens(Token **head, const struct concat_mask *m,
if (did_paste) {
pasted = true;
} else {
prev_next = &tok->next;
if (next && next->type != TOKEN_WHITESPACE &&
next->type != TOKEN_PASTE)
if (!tok_white(tok) && !tok_is(tok, TOKEN_PASTE))
prev_nonspace = prev_next;
prev_next = &tok->next;
}
tok = next;
}
Expand Down
9 changes: 9 additions & 0 deletions travis/br294/br294-paste.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
; Literal issue #294 inputs and consecutive pastes after empty expansion.
%+s%+t
%+ts %+ts
%+s%+%+t
%define EMPTY
%+s%+EMPTY%+t
s%+EMPTY%+t
EMPTY %+ st
st %+ EMPTY
9 changes: 9 additions & 0 deletions travis/br294/br294-paste.i.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
%line 2+1 ./travis/br294/br294-paste.asm
st
tsts
st

st
st
st
st
7 changes: 7 additions & 0 deletions travis/br294/br294.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
; Test for issue #294: leading and consecutive %+ tokens in preprocessor
%define test_lead %+ nop
%define test_consec no %+ %+ p
%define test_both %+ %+ nop
test_lead
test_consec
test_both
1 change: 1 addition & 0 deletions travis/br294/br294.bin.t
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
���
18 changes: 18 additions & 0 deletions travis/br294/br294.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"description": "Issue #294: leading and consecutive %+ tokens in preprocessor",
"format": "bin",
"source": "br294.asm",
"target": [
{ "output": "br294.bin" }
]
},
{
"description": "Issue #294: literal reports and consecutive/empty-expansion pastes",
"source": "br294-paste.asm",
"option": "-E",
"target": [
{ "output": "br294-paste.i" }
]
}
]