|
Gaudi Framework, version v22r2 |
| Home | Generated: Tue May 10 2011 |
Grammar recognize job options file Grammar's EBNF:
More... job_options_file ::= (platform_statement | platform_dependency)*.
#include <ParserGrammar.h>


Classes | |
| struct | definition |
Public Member Functions | |
| ParserGrammar (Parser *parser) | |
| Constructor. | |
| virtual | ~ParserGrammar () |
| Parser * | parser () const |
| Get pointer to parser. | |
| void | matchInclude (const std::string &fileName) const |
| Action called when include statement matched. | |
| void | matchUnits (const std::string &fileName) const |
| Action called when units statement matched. | |
| void | matchAssign (std::vector< std::string > params) const |
| Match assign statement. | |
| void | matchPlatform (const std::string &directive) const |
| Action called when platform dependency statement matched. | |
| void | matchPrint (bool on) const |
| Action called when print pragma matched. | |
| void | matchPrintOptions (bool on) const |
| Action called when printOptions. | |
| void | matchValue (boost::tuple< std::string, std::vector< std::string > > value) const |
| Action called when value in assign statement matched. | |
| bool | doActions () const |
| Check if we can execute platform statements. | |
Private Attributes | |
| Parser * | m_parser |
Grammar recognize job options file Grammar's EBNF: job_options_file ::= (platform_statement | platform_dependency)*.
platform_statement ::= assertable_statement | pragma_statement. assertable_statement ::= include_statement | units_statement | assign_statement. platform_dependency ::= ("#ifdef" | "#ifndef") "WIN32" platform_statement* ("#else" platform_statement*)? "#endif. include_statement ::= "include" string_grammar. units_statement ::= "units" string_grammar. pragma_statement ::= pragma | printopt_statement; printopt_statement ::= "#printOptions" "full". pragma ::= "#pragma" "print" ("on" | "ON" | "off" | "OFF"). assign_statement ::= identifier_grammar ('.' identifier_grammar)+ ('='|'+='|'-=') value_grammar ';'.
Grammar has two attributes
Definition at line 482 of file ParserGrammar.h.
| Gaudi::Parsers::ParserGrammar::ParserGrammar | ( | Parser * | parser ) | [inline] |
| virtual Gaudi::Parsers::ParserGrammar::~ParserGrammar | ( | ) | [inline, virtual] |
Definition at line 490 of file ParserGrammar.h.
{}
| bool Gaudi::Parsers::ParserGrammar::doActions | ( | ) | const [inline] |
Check if we can execute platform statements.
Definition at line 615 of file ParserGrammar.h.
{ return attrs().get<0>();}
| void Gaudi::Parsers::ParserGrammar::matchAssign | ( | std::vector< std::string > | params ) | const [inline] |
Match assign statement.
| params[0]-params[N-3] | Name of object |
| params[N-2] | Delimiter |
| params[N-1] | Option name |
| params[N] | Operation |
Definition at line 521 of file ParserGrammar.h.
{
if(!doActions()) return;
// position where statement appears
file_position fpos = val().get_position();
Position pos(fpos.file,fpos.line,fpos.column);
// get value representation. It's two modes string and vector of strings
std::string value = attrs().get<1>();
std::vector<std::string> vectorValues = attrs().get<2>();
// check if value is vector
bool isVector = false;
if(vectorValues.size()>0 || value=="[]"){
isVector = true;
}else{
vectorValues.push_back(value);
}
// extract object, option name and sign
std::string objectName;
std::string delim;
std::vector< std::string >::const_iterator cur;
for ( cur = params.begin();
*(cur+1) != "#"; cur++ ){
objectName += delim + *cur;
delim = ".";
}
std::string optionName = *cur;
std::string sign = *(cur+2);
Parser::Sign oper;
if(sign == "+="){
oper = Parser::S_PLUSASSIGN;
}else if(sign == "-="){
oper = Parser::S_MINUSASSIGN;
}else{
oper = Parser::S_ASSIGN;
}
m_parser->matchAssign
(objectName, optionName, oper,
vectorValues,pos,isVector);
vectorValues.clear();
}
| void Gaudi::Parsers::ParserGrammar::matchInclude | ( | const std::string & | fileName ) | const [inline] |
Action called when include statement matched.
| fileName | Name of file in include statement |
Definition at line 499 of file ParserGrammar.h.
| void Gaudi::Parsers::ParserGrammar::matchPlatform | ( | const std::string & | directive ) | const [inline] |
Action called when platform dependency statement matched.
| directive | - name of directive |
Definition at line 572 of file ParserGrammar.h.
{
bool iswin = Gaudi::Parsers::Utils::isWin();
if(directive=="endif" || (directive=="ifdef" && iswin)
|| (directive=="ifndef" && !iswin)){
attrs().get<0>() = true;
} else {
attrs().get<0>() = !attrs().get<0>();
}
}
| void Gaudi::Parsers::ParserGrammar::matchPrint | ( | bool | on ) | const [inline] |
Action called when print pragma matched.
| on | true - printing is on, false - printing is off |
Definition at line 586 of file ParserGrammar.h.
{
file_position fpos = this->val().get_position();
Position pos(fpos.file,fpos.line,fpos.column);
m_parser->setIsPrint(on,pos);
}
| void Gaudi::Parsers::ParserGrammar::matchPrintOptions | ( | bool | on ) | const [inline] |
Action called when printOptions.
| on | true - printing is on, false - printing is off |
Definition at line 596 of file ParserGrammar.h.
{
file_position fpos = this->val().get_position();
Position pos(fpos.file,fpos.line,fpos.column);
m_parser->setIsPrintOptions(on,pos);
}
| void Gaudi::Parsers::ParserGrammar::matchUnits | ( | const std::string & | fileName ) | const [inline] |
Action called when units statement matched.
| fileName | Name of file in units statement |
Definition at line 508 of file ParserGrammar.h.
| void Gaudi::Parsers::ParserGrammar::matchValue | ( | boost::tuple< std::string, std::vector< std::string > > | value ) | const [inline] |
Action called when value in assign statement matched.
| value | Tuple of string and vector representation of value |
Definition at line 606 of file ParserGrammar.h.
{
if(!doActions()) return;
attrs().get<1>() = value.get<0>();
attrs().get<2>() = value.get<1>();
}
| Parser* Gaudi::Parsers::ParserGrammar::parser | ( | ) | const [inline] |
Parser* Gaudi::Parsers::ParserGrammar::m_parser [private] |
Definition at line 743 of file ParserGrammar.h.