From: <mar...@us...> - 2013-08-07 08:20:43
|
Revision: 6311 http://sourceforge.net/p/freeorion/code/6311 Author: marcel_metz Date: 2013-08-07 08:20:39 +0000 (Wed, 07 Aug 2013) Log Message: ----------- Renamed some parser variables to make their purpose more clear. * Renamed first_token to variable_scope. * Renamed final_token to variable_name. * Renamed container_token to container_type. Modified Paths: -------------- trunk/FreeOrion/parse/DoubleValueRefParser.cpp trunk/FreeOrion/parse/IntValueRefParser.cpp trunk/FreeOrion/parse/PlanetEnvironmentValueRefParser.cpp trunk/FreeOrion/parse/PlanetSizeValueRefParser.cpp trunk/FreeOrion/parse/PlanetTypeValueRefParser.cpp trunk/FreeOrion/parse/StarTypeValueRefParser.cpp trunk/FreeOrion/parse/StringValueRefParser.cpp trunk/FreeOrion/parse/UniverseObjectTypeValueRefParser.cpp trunk/FreeOrion/parse/ValueRefParserImpl.h Modified: trunk/FreeOrion/parse/DoubleValueRefParser.cpp =================================================================== --- trunk/FreeOrion/parse/DoubleValueRefParser.cpp 2013-08-07 06:48:18 UTC (rev 6310) +++ trunk/FreeOrion/parse/DoubleValueRefParser.cpp 2013-08-07 08:20:39 UTC (rev 6311) @@ -1,10 +1,5 @@ #include "ValueRefParserImpl.h" -//#include "Double.h" - -//extern name_token_rule first_token; // in IntValueRefParser.cpp -//extern name_token_rule container_token; // in IntValueRefParser.cpp - namespace { struct double_parser_rules { double_parser_rules() { @@ -17,7 +12,7 @@ const parse::lexer& tok = parse::lexer::instance(); - final_token + variable_name = tok.Industry_ | tok.TargetIndustry_ | tok.Research_ @@ -63,12 +58,12 @@ variable = ( - first_token [ push_back(_a, _1) ] > '.' - > -(container_token [ push_back(_a, _1) ] > '.') + variable_scope [ push_back(_a, _1) ] > '.' + > -(container_type [ push_back(_a, _1) ] > '.') > ( - final_token + variable_name [ push_back(_a, _1), _val = new_<ValueRef::Variable<double> >(_a) ] - | int_var_final_token() + | int_var_variable_name() [ push_back(_a, _1), _val = new_<ValueRef::StaticCast<int, double> >(new_<ValueRef::Variable<int> >(_a)) ] ) ) @@ -86,7 +81,7 @@ ) ; - initialize_numeric_statistic_parser<double>(statistic, final_token); + initialize_numeric_statistic_parser<double>(statistic, variable_name); initialize_expression_parsers<double>(function_expr, exponential_expr, @@ -107,7 +102,7 @@ | int_statistic ; - final_token.name("real number variable name (e.g., Growth)"); + variable_name.name("real number variable name (e.g., Growth)"); constant.name("real number constant"); @@ -122,7 +117,7 @@ primary_expr.name("real number expression"); #if DEBUG_VALUEREF_PARSERS - debug(final_token); + debug(variable_name); debug(constant); debug(variable); debug(statistic); @@ -140,7 +135,7 @@ typedef statistic_rule<double>::type statistic_rule; typedef expression_rule<double>::type expression_rule; - name_token_rule final_token; + name_token_rule variable_name; rule constant; variable_rule variable; statistic_rule statistic; @@ -159,8 +154,8 @@ } } -const name_token_rule& double_var_final_token() -{ return get_double_parser_rules().final_token; } +const name_token_rule& double_var_variable_name() +{ return get_double_parser_rules().variable_name; } const statistic_rule<double>::type& double_var_statistic() { return get_double_parser_rules().statistic; } Modified: trunk/FreeOrion/parse/IntValueRefParser.cpp =================================================================== --- trunk/FreeOrion/parse/IntValueRefParser.cpp 2013-08-07 06:48:18 UTC (rev 6310) +++ trunk/FreeOrion/parse/IntValueRefParser.cpp 2013-08-07 08:20:39 UTC (rev 6311) @@ -1,8 +1,8 @@ #include "ValueRefParserImpl.h" -name_token_rule first_token; -name_token_rule container_token; +name_token_rule variable_scope; +name_token_rule container_type; namespace { struct int_parser_rules { @@ -16,23 +16,23 @@ const parse::lexer& tok = parse::lexer::instance(); - first_token + variable_scope = tok.Source_ | tok.Target_ | tok.LocalCandidate_ | tok.RootCandidate_ ; - container_token + container_type = tok.Planet_ | tok.System_ | tok.Fleet_ ; // TODO: Should we apply elements of this list only to certain - // containers? For example, if one writes "Source.Planet.", + // objects? For example, if one writes "Source.Planet.", // "NumShips" should not follow. - final_token + variable_name = tok.Owner_ | tok.ID_ | tok.CreationTurn_ @@ -59,9 +59,9 @@ variable = ( ( - first_token [ push_back(_a, _1) ] > '.' - > -(container_token [ push_back(_a, _1) ] > '.') - > final_token [ push_back(_a, _1) ] + variable_scope [ push_back(_a, _1) ] > '.' + > -(container_type [ push_back(_a, _1) ] > '.') + > variable_name [ push_back(_a, _1) ] ) | ( tok.CurrentTurn_ @@ -73,7 +73,7 @@ [ _val = new_<ValueRef::Variable<int> >(_a) ] ; - initialize_numeric_statistic_parser<int>(statistic, final_token); + initialize_numeric_statistic_parser<int>(statistic, variable_name); initialize_expression_parsers<int>(function_expr, exponential_expr, @@ -89,9 +89,9 @@ | statistic ; - first_token.name("Source, Target, LocalCandidate, or RootCandidate"); - container_token.name("Planet, System, or Fleet"); - final_token.name("integer variable name (e.g., FleetID)"); + variable_scope.name("Source, Target, LocalCandidate, or RootCandidate"); + container_type.name("Planet, System, or Fleet"); + variable_name.name("integer variable name (e.g., FleetID)"); constant.name("integer constant"); variable.name("integer variable"); statistic.name("integer statistic"); @@ -104,9 +104,9 @@ primary_expr.name("integer expression"); #if DEBUG_VALUEREF_PARSERS - debug(first_token); - debug(container_token); - debug(final_token); + debug(variable_scope); + debug(container_type); + debug(variable_name); debug(constant); debug(variable); debug(statistic); @@ -123,7 +123,7 @@ typedef statistic_rule<int>::type statistic_rule; typedef expression_rule<int>::type expression_rule; - name_token_rule final_token; + name_token_rule variable_name; rule constant; variable_rule variable; statistic_rule statistic; @@ -142,8 +142,8 @@ } } -const name_token_rule& int_var_final_token() -{ return get_int_parser_rules().final_token; } +const name_token_rule& int_var_variable_name() +{ return get_int_parser_rules().variable_name; } const statistic_rule<int>::type& int_var_statistic() { return get_int_parser_rules().statistic; } Modified: trunk/FreeOrion/parse/PlanetEnvironmentValueRefParser.cpp =================================================================== --- trunk/FreeOrion/parse/PlanetEnvironmentValueRefParser.cpp 2013-08-07 06:48:18 UTC (rev 6310) +++ trunk/FreeOrion/parse/PlanetEnvironmentValueRefParser.cpp 2013-08-07 08:20:39 UTC (rev 6311) @@ -14,7 +14,7 @@ const parse::lexer& tok = parse::lexer::instance(); - final_token + variable_name %= tok.PlanetEnvironment_ ; @@ -23,12 +23,12 @@ ; variable - = first_token [ push_back(_a, _1) ] > '.' - > -(container_token [ push_back(_a, _1) ] > '.') - > final_token [ push_back(_a, _1), _val = new_<ValueRef::Variable<PlanetEnvironment> >(_a) ] + = variable_scope [ push_back(_a, _1) ] > '.' + > -(container_type [ push_back(_a, _1) ] > '.') + > variable_name [ push_back(_a, _1), _val = new_<ValueRef::Variable<PlanetEnvironment> >(_a) ] ; - initialize_nonnumeric_statistic_parser<PlanetEnvironment>(statistic, final_token); + initialize_nonnumeric_statistic_parser<PlanetEnvironment>(statistic, variable_name); primary_expr %= constant @@ -36,14 +36,14 @@ | statistic ; - final_token.name("PlanetEnvironment variable name (e.g., PlanetEnvironment)"); + variable_name.name("PlanetEnvironment variable name (e.g., PlanetEnvironment)"); constant.name("PlanetEnvironment"); variable.name("PlanetEnvironment variable"); statistic.name("PlanetEnvironment statistic"); primary_expr.name("PlanetEnvironment expression"); #if DEBUG_VALUEREF_PARSERS - debug(final_token); + debug(variable_name); debug(constant); debug(variable); debug(statistic); @@ -55,7 +55,7 @@ typedef variable_rule<PlanetEnvironment>::type variable_rule; typedef statistic_rule<PlanetEnvironment>::type statistic_rule; - name_token_rule final_token; + name_token_rule variable_name; rule constant; variable_rule variable; statistic_rule statistic; Modified: trunk/FreeOrion/parse/PlanetSizeValueRefParser.cpp =================================================================== --- trunk/FreeOrion/parse/PlanetSizeValueRefParser.cpp 2013-08-07 06:48:18 UTC (rev 6310) +++ trunk/FreeOrion/parse/PlanetSizeValueRefParser.cpp 2013-08-07 08:20:39 UTC (rev 6311) @@ -14,7 +14,7 @@ const parse::lexer& tok = parse::lexer::instance(); - final_token + variable_name %= tok.PlanetSize_ | tok.NextLargerPlanetSize_ | tok.NextSmallerPlanetSize_ @@ -25,12 +25,12 @@ ; variable - = first_token [ push_back(_a, _1) ] > '.' - > -(container_token [ push_back(_a, _1) ] > '.') - > final_token [ push_back(_a, _1), _val = new_<ValueRef::Variable<PlanetSize> >(_a) ] + = variable_scope [ push_back(_a, _1) ] > '.' + > -(container_type [ push_back(_a, _1) ] > '.') + > variable_name [ push_back(_a, _1), _val = new_<ValueRef::Variable<PlanetSize> >(_a) ] ; - initialize_nonnumeric_statistic_parser<PlanetSize>(statistic, final_token); + initialize_nonnumeric_statistic_parser<PlanetSize>(statistic, variable_name); primary_expr %= constant @@ -38,14 +38,14 @@ | statistic ; - final_token.name("PlanetSize variable name (e.g., PlanetSize)"); + variable_name.name("PlanetSize variable name (e.g., PlanetSize)"); constant.name("PlanetSize"); variable.name("PlanetSize variable"); statistic.name("PlanetSize statistic"); primary_expr.name("PlanetSize expression"); #if DEBUG_VALUEREF_PARSERS - debug(final_token); + debug(variable_name); debug(constant); debug(variable); debug(statistic); @@ -57,7 +57,7 @@ typedef variable_rule<PlanetSize>::type variable_rule; typedef statistic_rule<PlanetSize>::type statistic_rule; - name_token_rule final_token; + name_token_rule variable_name; rule constant; variable_rule variable; statistic_rule statistic; Modified: trunk/FreeOrion/parse/PlanetTypeValueRefParser.cpp =================================================================== --- trunk/FreeOrion/parse/PlanetTypeValueRefParser.cpp 2013-08-07 06:48:18 UTC (rev 6310) +++ trunk/FreeOrion/parse/PlanetTypeValueRefParser.cpp 2013-08-07 08:20:39 UTC (rev 6311) @@ -14,7 +14,7 @@ const parse::lexer& tok = parse::lexer::instance(); - final_token + variable_name %= tok.PlanetType_ | tok.OriginalType_ | tok.NextCloserToOriginalPlanetType_ @@ -28,12 +28,12 @@ ; variable - = first_token [ push_back(_a, _1) ] > '.' - > -(container_token [ push_back(_a, _1) ] > '.') - > final_token [ push_back(_a, _1), _val = new_<ValueRef::Variable<PlanetType> >(_a) ] + = variable_scope [ push_back(_a, _1) ] > '.' + > -(container_type [ push_back(_a, _1) ] > '.') + > variable_name [ push_back(_a, _1), _val = new_<ValueRef::Variable<PlanetType> >(_a) ] ; - initialize_nonnumeric_statistic_parser<PlanetType>(statistic, final_token); + initialize_nonnumeric_statistic_parser<PlanetType>(statistic, variable_name); primary_expr %= constant @@ -41,14 +41,14 @@ | statistic ; - final_token.name("PlanetType variable name (e.g., PlanetType)"); + variable_name.name("PlanetType variable name (e.g., PlanetType)"); constant.name("PlanetType"); variable.name("PlanetType variable"); statistic.name("PlanetType statistic"); primary_expr.name("PlanetType expression"); #if DEBUG_VALUEREF_PARSERS - debug(final_token); + debug(variable_name); debug(constant); debug(variable); debug(statistic); @@ -60,7 +60,7 @@ typedef variable_rule<PlanetType>::type variable_rule; typedef statistic_rule<PlanetType>::type statistic_rule; - name_token_rule final_token; + name_token_rule variable_name; rule constant; variable_rule variable; statistic_rule statistic; Modified: trunk/FreeOrion/parse/StarTypeValueRefParser.cpp =================================================================== --- trunk/FreeOrion/parse/StarTypeValueRefParser.cpp 2013-08-07 06:48:18 UTC (rev 6310) +++ trunk/FreeOrion/parse/StarTypeValueRefParser.cpp 2013-08-07 08:20:39 UTC (rev 6311) @@ -14,7 +14,7 @@ const parse::lexer& tok = parse::lexer::instance(); - final_token + variable_name %= tok.StarType_ | tok.NextOlderStarType_ | tok.NextYoungerStarType_ @@ -25,12 +25,12 @@ ; variable - = first_token [ push_back(_a, _1) ] > '.' - > -(container_token [ push_back(_a, _1) ] > '.') - > final_token [ push_back(_a, _1), _val = new_<ValueRef::Variable<StarType> >(_a) ] + = variable_scope [ push_back(_a, _1) ] > '.' + > -(container_type [ push_back(_a, _1) ] > '.') + > variable_name [ push_back(_a, _1), _val = new_<ValueRef::Variable<StarType> >(_a) ] ; - initialize_nonnumeric_statistic_parser<StarType>(statistic, final_token); + initialize_nonnumeric_statistic_parser<StarType>(statistic, variable_name); primary_expr %= constant @@ -38,14 +38,14 @@ | statistic ; - final_token.name("StarType variable name (e.g., StarType)"); + variable_name.name("StarType variable name (e.g., StarType)"); constant.name("StarType"); variable.name("StarType variable"); statistic.name("StarType statistic"); primary_expr.name("StarType expression"); #if DEBUG_VALUEREF_PARSERS - debug(final_token); + debug(variable_name); debug(constant); debug(variable); debug(statistic); @@ -57,7 +57,7 @@ typedef variable_rule<StarType>::type variable_rule; typedef statistic_rule<StarType>::type statistic_rule; - name_token_rule final_token; + name_token_rule variable_name; rule constant; variable_rule variable; statistic_rule statistic; Modified: trunk/FreeOrion/parse/StringValueRefParser.cpp =================================================================== --- trunk/FreeOrion/parse/StringValueRefParser.cpp 2013-08-07 06:48:18 UTC (rev 6310) +++ trunk/FreeOrion/parse/StringValueRefParser.cpp 2013-08-07 08:20:39 UTC (rev 6311) @@ -14,7 +14,7 @@ const parse::lexer& tok = parse::lexer::instance(); - final_token + variable_name %= tok.Name_ | tok.Species_ | tok.BuildingType_ @@ -36,14 +36,14 @@ variable = ( - first_token [ push_back(_a, _1) ] > '.' - > -(container_token [ push_back(_a, _1) ] > '.') + variable_scope [ push_back(_a, _1) ] > '.' + > -(container_type [ push_back(_a, _1) ] > '.') > ( - final_token + variable_name [ push_back(_a, _1), _val = new_<ValueRef::Variable<std::string> >(_a) ] - | int_var_final_token() + | int_var_variable_name() [ push_back(_a, _1), _val = new_<ValueRef::StringCast<int> >(new_<ValueRef::Variable<int> >(_a)) ] - | double_var_final_token() + | double_var_variable_name() [ push_back(_a, _1), _val = new_<ValueRef::StringCast<double> >(new_<ValueRef::Variable<double> >(_a)) ] ) ) @@ -53,7 +53,7 @@ ) ; - initialize_nonnumeric_statistic_parser<std::string>(statistic, final_token); + initialize_nonnumeric_statistic_parser<std::string>(statistic, variable_name); int_statistic = int_var_statistic() [ _val = new_<ValueRef::StringCast<int> >(_1) ] @@ -71,7 +71,7 @@ | statistic ; - final_token.name("string variable name (e.g., Name)"); + variable_name.name("string variable name (e.g., Name)"); constant.name("string"); variable.name("string variable"); statistic.name("string statistic"); @@ -80,7 +80,7 @@ expr.name("string expression"); #if DEBUG_VALUEREF_PARSERS - debug(final_token); + debug(variable_name); debug(constant); debug(variable); debug(statistic); @@ -94,7 +94,7 @@ typedef variable_rule<std::string>::type variable_rule; typedef statistic_rule<std::string>::type statistic_rule; - name_token_rule final_token; + name_token_rule variable_name; rule constant; variable_rule variable; statistic_rule statistic; Modified: trunk/FreeOrion/parse/UniverseObjectTypeValueRefParser.cpp =================================================================== --- trunk/FreeOrion/parse/UniverseObjectTypeValueRefParser.cpp 2013-08-07 06:48:18 UTC (rev 6310) +++ trunk/FreeOrion/parse/UniverseObjectTypeValueRefParser.cpp 2013-08-07 08:20:39 UTC (rev 6311) @@ -14,7 +14,7 @@ const parse::lexer& tok = parse::lexer::instance(); - final_token + variable_name %= tok.ObjectType_ ; @@ -23,13 +23,13 @@ ; variable - = first_token [ push_back(_a, _1) ] > '.' - > -(container_token [ push_back(_a, _1) ] > '.') - > final_token [ push_back(_a, _1), _val = new_<ValueRef::Variable<UniverseObjectType> >(_a) ] + = variable_scope [ push_back(_a, _1) ] > '.' + > -(container_type [ push_back(_a, _1) ] > '.') + > variable_name [ push_back(_a, _1), _val = new_<ValueRef::Variable<UniverseObjectType> >(_a) ] ; - initialize_nonnumeric_statistic_parser<UniverseObjectType>(statistic, final_token); + initialize_nonnumeric_statistic_parser<UniverseObjectType>(statistic, variable_name); primary_expr %= constant @@ -37,14 +37,14 @@ | statistic ; - final_token.name("ObjectType variable name (e.g., ObjectType)"); + variable_name.name("ObjectType variable name (e.g., ObjectType)"); constant.name("ObjectType"); variable.name("ObjectType variable"); statistic.name("ObjectType statistic"); primary_expr.name("ObjectType expression"); #if DEBUG_VALUEREF_PARSERS - debug(final_token); + debug(variable_name); debug(constant); debug(variable); debug(statistic); @@ -56,7 +56,7 @@ typedef variable_rule<UniverseObjectType>::type variable_rule; typedef statistic_rule<UniverseObjectType>::type statistic_rule; - name_token_rule final_token; + name_token_rule variable_name; rule constant; variable_rule variable; statistic_rule statistic; Modified: trunk/FreeOrion/parse/ValueRefParserImpl.h =================================================================== --- trunk/FreeOrion/parse/ValueRefParserImpl.h 2013-08-07 06:48:18 UTC (rev 6310) +++ trunk/FreeOrion/parse/ValueRefParserImpl.h 2013-08-07 08:20:39 UTC (rev 6311) @@ -180,17 +180,17 @@ ; } -extern name_token_rule first_token; -extern name_token_rule container_token; -const name_token_rule& int_var_final_token(); +extern name_token_rule variable_scope; +extern name_token_rule container_type; +const name_token_rule& int_var_variable_name(); const statistic_rule<int>::type& int_var_statistic(); -const name_token_rule& double_var_final_token(); +const name_token_rule& double_var_variable_name(); const statistic_rule<double>::type& double_var_statistic(); template <typename T> void initialize_numeric_statistic_parser( typename statistic_rule<T>::type& statistic, - const name_token_rule& final_token) + const name_token_rule& variable_name) { const parse::lexer& tok = parse::lexer::instance(); @@ -217,8 +217,8 @@ parse::enum_parser<ValueRef::StatisticType>() [ _b = _1 ] >> parse::label(Property_name) >> eps [ push_back(_a, val(LocalCandidate_name)) ] - >> -(container_token [ push_back(_a, _1) ] >> '.') - >> final_token [ push_back(_a, _1) ] + >> -(container_type [ push_back(_a, _1) ] >> '.') + >> variable_name [ push_back(_a, _1) ] >> parse::label(Condition_name) >> parse::detail::condition_parser [ _c = _1 ] ) ) @@ -229,7 +229,7 @@ template <typename T> void initialize_nonnumeric_statistic_parser( typename statistic_rule<T>::type& statistic, - const name_token_rule& final_token) + const name_token_rule& variable_name) { const parse::lexer& tok = parse::lexer::instance(); @@ -248,8 +248,8 @@ tok.Mode_ [ _b = ValueRef::MODE ] >> parse::label(Property_name) >> eps [ push_back(_a, val(LocalCandidate_name)) ] - >> -(container_token [ push_back(_a, _1) ] > '.') - >> final_token [ push_back(_a, _1) ] + >> -(container_type [ push_back(_a, _1) ] > '.') + >> variable_name [ push_back(_a, _1) ] > parse::label(Condition_name) > parse::detail::condition_parser [ _c = _1 ] ) [ _val = new_<ValueRef::Statistic<T> >(_a, _b, _c) ] |