diff options
| author | 2025-12-11 13:51:58 +0100 | |
|---|---|---|
| committer | 2025-12-11 13:51:58 +0100 | |
| commit | 9708e5fed9eb27329ca7cc95914c7b2f12e60c56 (patch) | |
| tree | 652f939b072db456bc2dcb652430fffcf77a6804 /c/lex.c | |
| parent | 7fc7f7b650cd54aaa9d675f0b247b90e22977fc1 (diff) | |
-trigraphs option
Diffstat (limited to 'c/lex.c')
| -rw-r--r-- | c/lex.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -85,7 +85,6 @@ ident: static void fillchrbuf(struct lexer *lx) { - bool trigraph = ccopt.trigraph; const uchar *p = lx->dat + lx->idx; int i = lx->chrbuf0, idx = lx->idx, c; int rem = arraylength(lx->chrbuf) - i; @@ -101,14 +100,15 @@ fillchrbuf(struct lexer *lx) for (; i < arraylength(lx->chrbuf); ++i) { int n; - while (!memcmp(p, "\\\n", n = 2) || (trigraph && !memcmp(p, "\?\?/\n", n = 4))) { + /* skip backslash-newline */ + while ((n = 2, (p[0] == '\\') & (p[1] == '\n')) || (ccopt.trigraph && !memcmp(p, "\?\?/\n", n = 4))) { idx += n; p += n; addfileline(lx->fileid, idx); } if (idx >= lx->ndat) { c = TKEOF; - } else if (trigraph && ((p[0] == '?') & (p[1] == '?'))) { + } else if (ccopt.trigraph && ((p[0] == '?') & (p[1] == '?'))) { switch (p[2]) { case '=': c = '#'; break; case '(': c = '['; break; |