aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-11-23 13:42:03 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-11-23 13:48:13 +0200
commitc7e6b5ab3e244ae5a47c7f461ebc9cb683c93270 (patch)
treec07e03848c042b06d900f11b4eff1f77252ba25a /libbuild2
parent939beb11a5ccf58d7fe79a809a1b592c5c9143c0 (diff)
Fix multi-line comment parsing to accept trailing eos in place of newline
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/lexer.cxx13
1 files changed, 7 insertions, 6 deletions
diff --git a/libbuild2/lexer.cxx b/libbuild2/lexer.cxx
index f445d4b..992e5d1 100644
--- a/libbuild2/lexer.cxx
+++ b/libbuild2/lexer.cxx
@@ -989,7 +989,7 @@ namespace build2
if ((c = peek ()) == '\\')
{
get ();
- if ((c = peek ()) == '\n')
+ if ((c = peek ()) == '\n' || eos (c))
return true;
}
@@ -1000,15 +1000,16 @@ namespace build2
{
// Scan until we see the closing one.
//
- for (; !eos (c); c = peek ())
+ for (;;)
{
- get ();
if (c == '#' && ml ())
break;
- }
- if (eos (c))
- fail (c) << "unterminated multi-line comment";
+ if (eos (c = peek ()))
+ fail (c) << "unterminated multi-line comment";
+
+ get ();
+ }
}
else
{