Add support for windows line endings with c macros

master
dimenus 2017-11-03 16:25:00 -05:00
parent 795703a39c
commit 1ef6cb1b64
1 changed files with 4 additions and 1 deletions

View File

@ -91,6 +91,9 @@
IDENT_START: \ IDENT_START: \
case DIGIT case DIGIT
#define LINE_ENDING \
'\r': \
case '\n'
static void begin_token(CTokenize *ctok, CTokId id) { static void begin_token(CTokenize *ctok, CTokId id) {
assert(ctok->cur_tok == nullptr); assert(ctok->cur_tok == nullptr);
@ -191,7 +194,7 @@ void tokenize_c_macro(CTokenize *ctok, const uint8_t *c) {
case '\\': case '\\':
ctok->state = CTokStateBackslash; ctok->state = CTokStateBackslash;
break; break;
case '\n': case LINE_ENDING:
goto found_end_of_macro; goto found_end_of_macro;
case IDENT_START: case IDENT_START:
ctok->state = CTokStateIdentifier; ctok->state = CTokStateIdentifier;