Skip to content

Commit

Permalink
[C++] Fix handling CRLF after a backslash
Browse files Browse the repository at this point in the history
This fixes #77
  • Loading branch information
shinh committed Jun 7, 2016
1 parent 71e7934 commit 3e98b6b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions expr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,8 @@ Value* ParseExprImpl(const Loc& loc,
r->AddValue(new Literal(StringPiece(" ")));
// Skip the current escaped newline
i += 2;
if (n == '\r' && s.get(i) == '\n')
i++;
// Then continue skipping escaped newlines, spaces, and tabs
for (; i < s.size(); i++) {
if (s[i] == '\\' && (s.get(i+1) == '\r' || s.get(i+1) == '\n')) {
Expand Down
1 change: 1 addition & 0 deletions testcase/crlf.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PASS := \
PASS \
PASS

test:
Expand Down

0 comments on commit 3e98b6b

Please sign in to comment.