History

Fix tokenization of TOK_DOTS

We really need to use PEEKC during tokenization so as to skip line continuations automatically.

Michael Matz committed 10 years ago

Commit 8fc5a6a1 parent f85db992 files · +14 −3Browse files

Unified · Split

2 files
  1. tccpp.c +9 −3
  2. tests/tcctest.c +5 −0
tccpp.c+9−3
@@ -2553,9 +2553,15 @@ maybe_newline: · 2552 unmodified lines
2553 } else if ((isidnum_table['.' - CH_EOF] & IS_ID) != 0) { /* asm mode */2553 } else if ((isidnum_table['.' - CH_EOF] & IS_ID) != 0) { /* asm mode */
2554 *--p = c = '.';2554 *--p = c = '.';
2555 goto parse_ident_fast;2555 goto parse_ident_fast;
2556 } else if (c == '.' && p[1] == '.') {2556 } else if (c == '.') {
2557 p += 2;2557 PEEKC(c, p);
2558 tok = TOK_DOTS;2558 if (c == '.') {
2559 p++;
2560 tok = TOK_DOTS;
2561 } else {
2562 *--p = '.'; /* may underflow into file->unget[] */
2563 tok = '.';
2564 }
2559 } else {2565 } else {
2560 tok = '.';2566 tok = '.';
2561 }2567 }
tests/tcctest.c+5−0
@@ -114,6 +114,11 @@ void num(int n); · 113 unmodified lines
114void forward_ref(void);114void forward_ref(void);
115int isid(int c);115int isid(int c);
116 116
117/* Line joining happens before tokenization, so the following
118 must be parsed as ellipsis. */
119void funny_line_continuation (int, ..\
120. );
121
117#define A 2122#define A 2
118#define N 1234 + A123#define N 1234 + A
119#define pf printf124#define pf printf

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t