aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--c/lex.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/c/lex.c b/c/lex.c
index 99db463..5c627f1 100644
--- a/c/lex.c
+++ b/c/lex.c
@@ -23,12 +23,20 @@ fillchrbuf(struct lexer *lx)
uchar c;
/* skip backslash-newline* */
for (;;) {
- if (p[0] == '\\' && p[1] == '\n') {
- idx += 2;
- p += 2;
+ if (p[0] == '\\') {
+ if (p[1] == '\n') {
+ idx += 2;
+ p += 2;
+ } else if (p[1] == '\r' && p[2] == '\n') {
+ idx += 3;
+ p += 3;
+ } else break;
} else if (ccopt.trigraph && !memcmp(p, "\?\?/\n", 4)) {
idx += 4;
p += 4;
+ } else if (ccopt.trigraph && !memcmp(p, "\?\?/\r\n", 5)) {
+ idx += 5;
+ p += 5;
} else break;
addfileline(lx->fileid, idx);
}