authorgravatar for ryan.saunderson88@gmail.comdimenus <ryan.saunderson88@gmail.com> 2017-11-03 16:25:00-05:00
committergravatar for ryan.saunderson88@gmail.comdimenus <ryan.saunderson88@gmail.com> 2017-11-03 16:29:49-05:00
log1ef6cb1b64e926a74db562401ebef3c673c3d7cf
treea3075ba6b2c5a48357271d4bd4f4eb98ba8f84ea
parent795703a39cfe0d59fcd9fff7a605a7efe9c5bdb2

Add support for windows line endings with c macros


1 files changed, 4 insertions(+), 1 deletions(-)

src/c_tokenizer.cpp+4-1
...@@ -91,6 +91,9 @@...@@ -91,6 +91,9 @@
91 IDENT_START: \91 IDENT_START: \
92 case DIGIT92 case DIGIT
9393
94#define LINE_ENDING \
95 '\r': \
96 case '\n'
9497
95static void begin_token(CTokenize *ctok, CTokId id) {98static void begin_token(CTokenize *ctok, CTokId id) {
96 assert(ctok->cur_tok == nullptr);99 assert(ctok->cur_tok == nullptr);
...@@ -191,7 +194,7 @@ void tokenize_c_macro(CTokenize *ctok, const uint8_t *c) {...@@ -191,7 +194,7 @@ void tokenize_c_macro(CTokenize *ctok, const uint8_t *c) {
191 case '\\':194 case '\\':
192 ctok->state = CTokStateBackslash;195 ctok->state = CTokStateBackslash;
193 break;196 break;
194 case '\n':197 case LINE_ENDING:
195 goto found_end_of_macro;198 goto found_end_of_macro;
196 case IDENT_START:199 case IDENT_START:
197 ctok->state = CTokStateIdentifier;200 ctok->state = CTokStateIdentifier;