aboutsummaryrefslogtreecommitdiff
path: root/build/parser.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-12-14 15:16:42 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-12-14 15:16:42 +0200
commitf81a767e262309d47d4a0d521a7a2c12f0abad99 (patch)
treec25838883e12966bb2e7c5f9cc8f7e97c69921f7 /build/parser.cxx
parentb46902cc090a6f43c4be7955322ade9399a9f3d3 (diff)
Fix bugs in keyword recognition logic
Diffstat (limited to 'build/parser.cxx')
-rw-r--r--build/parser.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/build/parser.cxx b/build/parser.cxx
index 1c8f4f6..e238628 100644
--- a/build/parser.cxx
+++ b/build/parser.cxx
@@ -1041,7 +1041,7 @@ namespace build
{
const string& n (t.value);
- if (!t.quoted && (n == "else" || n == "elif" || n == "elif!"))
+ if (n == "else" || n == "elif" || n == "elif!")
continue;
}
@@ -1806,7 +1806,7 @@ namespace build
// potential keyword if:
//
// - it is not quoted [so a keyword can always be escaped] and
- // - next token is eos or '(' [so if(...) will work] or
+ // - next token is '\n' (or eos) or '(' [so if(...) will work] or
// - next token is separated and is not '=', '=+', or '+=' [which
// means a "directive trailer" can never start with one of them].
//
@@ -1820,7 +1820,8 @@ namespace build
pair<char, bool> p (lexer_->peek_char ());
char c (p.first);
- return c == '\0' || c == '(' || (p.second && c != '=' && c != '+');
+ return c == '\n' || c == '\0' || c == '(' ||
+ (p.second && c != '=' && c != '+');
}
return false;