diff options
-rw-r--r-- | src/lex.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lex.cpp b/src/lex.cpp index 70362a7..851ac87 100644 --- a/src/lex.cpp +++ b/src/lex.cpp @@ -256,6 +256,7 @@ int lex_t::lex_block(parser_value_t *value) { bool line_comment = false; bool block_comment = false; bool str = false; + bool pp = false; size_t pos = 0; size_t len = 1024; @@ -272,7 +273,7 @@ int lex_t::lex_block(parser_value_t *value) { char cur = current(); if (line_comment) { - if (cur == '\n' || cur == '\r') + if (cur == '\n') line_comment = false; } else if (block_comment) { @@ -283,6 +284,10 @@ int lex_t::lex_block(parser_value_t *value) { if (prev != '\\' && cur == '"') str = false; } + else if (pp) { + if (prev != '\\' && cur == '\n') + pp = false; + } else { if (cur == '{') { parens++; @@ -296,6 +301,9 @@ int lex_t::lex_block(parser_value_t *value) { else if (cur == '"') { str = true; } + else if (cur == '#') { + pp = true; + } else if (prev == '/' && cur == '/') { line_comment = true; } |