aboutsummaryrefslogtreecommitdiff
path: root/src/c_tokenizer.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-11-03 18:40:38 -0400
committerGitHub <noreply@github.com>2017-11-03 18:40:38 -0400
commit75afe73c662307fe07283e497da38adce676de01 (patch)
tree5aa6cd7dcf94946896cae1996f3f58d837692618 /src/c_tokenizer.cpp
parentd4c1ed95acb1c301cd29ee7b452e739df0976dc1 (diff)
parent1ef6cb1b64e926a74db562401ebef3c673c3d7cf (diff)
downloadzig-75afe73c662307fe07283e497da38adce676de01.tar.gz
zig-75afe73c662307fe07283e497da38adce676de01.zip
Merge pull request #581 from Dimenus/line_endings
Add support for windows line endings with c macros within a c_import.
Diffstat (limited to 'src/c_tokenizer.cpp')
-rw-r--r--src/c_tokenizer.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/c_tokenizer.cpp b/src/c_tokenizer.cpp
index 00977e0f32..044831f72e 100644
--- a/src/c_tokenizer.cpp
+++ b/src/c_tokenizer.cpp
@@ -91,6 +91,9 @@
IDENT_START: \
case DIGIT
+#define LINE_ENDING \
+ '\r': \
+ case '\n'
static void begin_token(CTokenize *ctok, CTokId id) {
assert(ctok->cur_tok == nullptr);
@@ -191,7 +194,7 @@ void tokenize_c_macro(CTokenize *ctok, const uint8_t *c) {
case '\\':
ctok->state = CTokStateBackslash;
break;
- case '\n':
+ case LINE_ENDING:
goto found_end_of_macro;
case IDENT_START:
ctok->state = CTokStateIdentifier;