aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/cc/lexer.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/build2/cc/lexer.cxx b/build2/cc/lexer.cxx
index 0615941..e904921 100644
--- a/build2/cc/lexer.cxx
+++ b/build2/cc/lexer.cxx
@@ -62,6 +62,20 @@ namespace build2
get (c);
xchar p (base::peek ());
+ // Handle Windows CRLF sequence. Similar to char_scanner, we treat
+ // a single CR as if it was followed by LF.
+ //
+ if (p == '\r')
+ {
+ get (p);
+ p = base::peek ();
+
+ if (p != '\n') // Pretend it was there.
+ return peek (e); // Recurse.
+
+ // Fall through.
+ }
+
if (p == '\n')
{
get (p);