aboutsummaryrefslogtreecommitdiff
path: root/build/lexer.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-03-30 12:19:44 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-03-30 12:19:44 +0200
commit70256514a09e4692c6839f5c2b21b7ec9c1055bd (patch)
tree453000060d5180b5ab85a4add1187a826b9289c1 /build/lexer.cxx
parentc699c956d75dfaaded5bb24c5ea16edc73588649 (diff)
Add support for configurable pair separator, use @ instead of = in buildspec
Diffstat (limited to 'build/lexer.cxx')
-rw-r--r--build/lexer.cxx46
1 files changed, 11 insertions, 35 deletions
diff --git a/build/lexer.cxx b/build/lexer.cxx
index 9683567..4cd9cda 100644
--- a/build/lexer.cxx
+++ b/build/lexer.cxx
@@ -64,6 +64,11 @@ namespace build
}
}
+ // Handle pair separator.
+ //
+ if (mode_ == lexer_mode::pairs && c == pair_separator_)
+ return token (token_type::pair_separator, sep, ln, cn);
+
// The following characters are not treated as special in the
// value or pairs mode.
//
@@ -85,26 +90,9 @@ namespace build
next_mode_ = lexer_mode::value;
return token (token_type::plus_equal, sep, ln, cn);
}
- }
- }
-
- // The following characters are not treated as special in the
- // value mode.
- //
- if (mode_ != lexer_mode::value)
- {
- // NOTE: remember to update name() if adding new punctuations.
- //
- switch (c)
- {
case '=':
{
- // Unless we are already in the pairs mode, switch to the
- // value mode.
- //
- if (next_mode_ != lexer_mode::pairs)
- next_mode_ = lexer_mode::value;
-
+ next_mode_ = lexer_mode::value;
return token (token_type::equal, sep, ln, cn);
}
}
@@ -126,6 +114,11 @@ namespace build
{
bool done (false);
+ // Handle pair separator.
+ //
+ if (mode_ == lexer_mode::pairs && c == pair_separator_)
+ break;
+
// The following characters are not treated as special in the
// value or pairs mode.
//
@@ -135,23 +128,6 @@ namespace build
{
case ':':
case '+':
- {
- done = true;
- break;
- }
- }
-
- if (done)
- break;
- }
-
- // The following characters are not treated as special in the
- // value mode.
- //
- if (mode_ != lexer_mode::value)
- {
- switch (c)
- {
case '=':
{
done = true;