diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-01-21 08:47:07 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-01-21 08:47:07 +0200 |
commit | 075404d03607048609a6f1b226d8e2845806b838 (patch) | |
tree | 2b0a958928a19e013c9b3c559e25504876fe94ae | |
parent | c7c3fd96e97ae2ec3914d36cb920a6f02c9a3414 (diff) |
Rename equal token to assign, etc
-rw-r--r-- | build2/b.cxx | 6 | ||||
-rw-r--r-- | build2/file.cxx | 6 | ||||
-rw-r--r-- | build2/lexer.cxx | 6 | ||||
-rw-r--r-- | build2/parser.cxx | 26 | ||||
-rw-r--r-- | build2/token | 6 | ||||
-rw-r--r-- | build2/token.cxx | 6 |
6 files changed, 25 insertions, 31 deletions
diff --git a/build2/b.cxx b/build2/b.cxx index 04e7455..636951a 100644 --- a/build2/b.cxx +++ b/build2/b.cxx @@ -165,9 +165,9 @@ main (int argc, char* argv[]) token_type tt (l.next ().type); - if (tt != token_type::equal && - tt != token_type::equal_plus && - tt != token_type::plus_equal) + if (tt != token_type::assign && + tt != token_type::prepend && + tt != token_type::append) break; parser p; diff --git a/build2/file.cxx b/build2/file.cxx index 02357c5..68b655e 100644 --- a/build2/file.cxx +++ b/build2/file.cxx @@ -282,9 +282,9 @@ namespace build2 token_type tt; if (t.type != token_type::name || t.value != var || - ((tt = lex.next ().type) != token_type::equal && - tt != token_type::equal_plus && - tt != token_type::plus_equal)) + ((tt = lex.next ().type) != token_type::assign && + tt != token_type::prepend && + tt != token_type::append)) { error << "variable '" << var << "' expected as first line in " << rbf; throw failed (); // Suppress "used uninitialized" warning. diff --git a/build2/lexer.cxx b/build2/lexer.cxx index aa216aa..65bb5e9 100644 --- a/build2/lexer.cxx +++ b/build2/lexer.cxx @@ -93,17 +93,17 @@ namespace build2 if (peek () == '+') { get (); - return token (type::equal_plus, sep, ln, cn); + return token (type::prepend, sep, ln, cn); } else - return token (type::equal, sep, ln, cn); + return token (type::assign, sep, ln, cn); } case '+': { if (peek () == '=') { get (); - return token (type::plus_equal, sep, ln, cn); + return token (type::append, sep, ln, cn); } } } diff --git a/build2/parser.cxx b/build2/parser.cxx index e80edf4..b1a4414 100644 --- a/build2/parser.cxx +++ b/build2/parser.cxx @@ -302,9 +302,7 @@ namespace build2 // Scope/target-specific variable assignment. // - if (tt == type::equal || - tt == type::equal_plus || - tt == type::plus_equal) + if (tt == type::assign || tt == type::prepend || tt == type::append) { token at (t); type att (tt); @@ -380,11 +378,11 @@ namespace build2 if (ti == nullptr) fail (nloc) << "unknown target type " << n.type; - if (att == type::equal_plus) + if (att == type::prepend) fail (at) << "prepend to target type/pattern-specific " << "variable " << v; - if (att == type::plus_equal) + if (att == type::append) fail (at) << "append to target type/pattern-specific " << "variable " << v; @@ -471,9 +469,7 @@ namespace build2 // Variable assignment. // - if (tt == type::equal || - tt == type::equal_plus || - tt == type::plus_equal) + if (tt == type::assign || tt == type::prepend || tt == type::append) { variable (t, tt, variable_name (move (ns), nloc), tt); @@ -742,12 +738,10 @@ namespace build2 { at = peek (); - if (at == type::equal || - at == type::equal_plus || - at == type::plus_equal) + if (at == type::assign || at == type::prepend || at == type::append) { var = &var_pool.find (t.value); - val = at == type::equal + val = at == type::assign ? &scope_->assign (*var) : &scope_->append (*var); next (t, tt); // Consume =/=+/+=. @@ -772,9 +766,9 @@ namespace build2 if (val != nullptr) { - if (at == type::equal) + if (at == type::assign) val->assign (move (r), *var); - else if (at == type::equal_plus) + else if (at == type::prepend) val->prepend (move (r), *var); else val->append (move (r), *var); @@ -1100,7 +1094,7 @@ namespace build2 const auto& var (var_pool.find (move (name))); names_type vns (variable_value (t, tt, var)); - if (kind == type::equal) + if (kind == type::assign) { value& v (target_ != nullptr ? target_->assign (var) @@ -1113,7 +1107,7 @@ namespace build2 ? target_->append (var) : scope_->append (var)); - if (kind == type::equal_plus) + if (kind == type::prepend) v.prepend (move (vns), var); else v.append (move (vns), var); diff --git a/build2/token b/build2/token index 57ea875..f2e9978 100644 --- a/build2/token +++ b/build2/token @@ -22,9 +22,9 @@ namespace build2 colon, lcbrace, rcbrace, - equal, - equal_plus, - plus_equal, + assign, // = + prepend, // =+ + append, // += dollar, lparen, rparen diff --git a/build2/token.cxx b/build2/token.cxx index 0e7b899..ed47740 100644 --- a/build2/token.cxx +++ b/build2/token.cxx @@ -21,9 +21,9 @@ namespace build2 case token_type::colon: os << ":"; break; case token_type::lcbrace: os << "{"; break; case token_type::rcbrace: os << "}"; break; - case token_type::equal: os << "="; break; - case token_type::equal_plus: os << "=+"; break; - case token_type::plus_equal: os << "+="; break; + case token_type::assign: os << "="; break; + case token_type::prepend: os << "=+"; break; + case token_type::append: os << "+="; break; case token_type::dollar: os << "$"; break; case token_type::lparen: os << "("; break; case token_type::rparen: os << ")"; break; |