Skip to content
Snippets Groups Projects
Commit d9d60d4f authored by Houtan Bastani's avatar Houtan Bastani
Browse files

preprocessor: allow shock group names to contain spaces. closes #1280

parent 2b835a50
No related branches found
No related tags found
No related merge requests found
......@@ -2686,6 +2686,7 @@ shock_group_list : shock_group_list shock_group_element
;
shock_group_element : symbol EQUAL shock_name_list ';' { driver.add_shock_group($1); }
| QUOTED_STRING EQUAL shock_name_list ';' { driver.add_shock_group($1); }
;
shock_name_list : shock_name_list COMMA symbol {driver.add_shock_group_element($3);}
......
......@@ -463,13 +463,29 @@ ShockGroupsStatement::ShockGroupsStatement(const group_t &shock_groups_arg, cons
void
ShockGroupsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
{
for (vector<Group>::const_iterator it = shock_groups.begin(); it != shock_groups.end(); it++)
int i = 1;
bool unique_label = true;
for (vector<Group>::const_iterator it = shock_groups.begin(); it != shock_groups.end(); it++, unique_label=true)
{
for (vector<Group>::const_iterator it1 = it+1; it1 != shock_groups.end(); it1++)
if (it->name == it1->name)
{
unique_label = false;
cerr << "Warning: shock group label '" << it->name << "' has been reused. "
<< "Only using the last definition." << endl;
break;
}
if (unique_label)
{
output << "M_.shock_groups." << name
<< "." << it->name << " = {";
<< ".group" << i << ".label = '" << it->name << "';" << endl
<< "M_.shock_groups." << name
<< ".group" << i << ".shocks = {";
for ( vector<string>::const_iterator it1 = it->list.begin(); it1 != it->list.end(); it1++)
output << " '" << *it1 << "'";
output << "};" << endl;
i++;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment