From 3deca3f2d3d63d7a4e7919be0c0d1921c613249c Mon Sep 17 00:00:00 2001 From: dehnert Date: Thu, 10 Jan 2013 09:59:42 +0100 Subject: [PATCH] Intermediate Commit to switch workplace. --- src/parser/PrismParser.h | 56 ++++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/src/parser/PrismParser.h b/src/parser/PrismParser.h index 14ca7fba3..5706a2273 100644 --- a/src/parser/PrismParser.h +++ b/src/parser/PrismParser.h @@ -97,21 +97,19 @@ private: expression %= (booleanExpression | integerExpression | doubleExpression); - booleanVariableDefinition = (freeIdentifierName >> qi::lit(":") >> qi::lit("bool") >> qi::lit(";"))[qi::_val = phoenix::construct(qi::_1), qi::_a = phoenix::construct>(phoenix::new_(qi::_1)), phoenix::bind(booleanVariables_.add, qi::_1, qi::_a), phoenix::bind(booleanVariableNames_.add, qi::_1, qi::_1), phoenix::bind(allVariables_.add, qi::_1, qi::_a)]; - integerVariableDefinition = (freeIdentifierName >> qi::lit(":") >> qi::lit("[") >> integerConstantExpression >> qi::lit("..") >> integerConstantExpression >> qi::lit("]") >> qi::lit(";"))[qi::_val = phoenix::construct(qi::_1, qi::_2, qi::_3), qi::_a = phoenix::construct>(phoenix::new_(qi::_1)), phoenix::bind(integerVariables_.add, qi::_1, qi::_a), phoenix::bind(integerVariableNames_.add, qi::_1, qi::_1), phoenix::bind(allVariables_.add, qi::_1, qi::_a)]; - variableDefinition = (booleanVariableDefinition[phoenix::bind(&storm::ir::Module::addBooleanVariable, qi::_r1, qi::_1)] | integerVariableDefinition[phoenix::bind(&storm::ir::Module::addIntegerVariable, qi::_r1, qi::_1)]); + booleanVariableDefinition = (freeIdentifierName >> qi::lit(":") >> qi::lit("bool") >> qi::lit(";"))[qi::_val = phoenix::construct(qi::_1), qi::_a = phoenix::construct>(phoenix::new_(qi::_1)), phoenix::bind(booleanVariables_.add, qi::_1, qi::_a), phoenix::bind(booleanVariableNames_.add, qi::_1, qi::_1), phoenix::bind(allVariables_.add, qi::_1, qi::_a), phoenix::bind(booleanVariableInfo_.add, qi::_1, qi::_val)]; + integerVariableDefinition = (freeIdentifierName >> qi::lit(":") >> qi::lit("[") >> integerConstantExpression >> qi::lit("..") >> integerConstantExpression >> qi::lit("]") >> qi::lit(";"))[qi::_val = phoenix::construct(qi::_1, qi::_2, qi::_3), qi::_a = phoenix::construct>(phoenix::new_(qi::_1)), phoenix::bind(integerVariables_.add, qi::_1, qi::_a), phoenix::bind(integerVariableNames_.add, qi::_1, qi::_1), phoenix::bind(allVariables_.add, qi::_1, qi::_a), phoenix::bind(integerVariableInfo_.add, qi::_1, qi::_val)]; + variableDefinition = (booleanVariableDefinition | integerVariableDefinition); definedBooleanConstantDefinition = (qi::lit("const") >> qi::lit("bool") >> freeIdentifierName >> qi::lit("=") >> booleanLiteralExpression >> qi::lit(";"))[phoenix::bind(booleanConstants_.add, qi::_1, qi::_2), phoenix::bind(allConstants_.add, qi::_1, qi::_2), qi::_val = qi::_2]; definedIntegerConstantDefinition = (qi::lit("const") >> qi::lit("int") >> freeIdentifierName >> qi::lit("=") >> integerLiteralExpression >> qi::lit(";"))[phoenix::bind(integerConstants_.add, qi::_1, qi::_2), phoenix::bind(allConstants_.add, qi::_1, qi::_2), qi::_val = qi::_2]; definedDoubleConstantDefinition = (qi::lit("const") >> qi::lit("double") >> freeIdentifierName >> qi::lit("=") >> doubleLiteralExpression >> qi::lit(";"))[phoenix::bind(doubleConstants_.add, qi::_1, qi::_2), phoenix::bind(allConstants_.add, qi::_1, qi::_2), qi::_val = qi::_2]; - undefinedBooleanConstantDefinition = (qi::lit("const") >> qi::lit("bool") >> freeIdentifierName >> qi::lit(";"))[qi::_val = phoenix::construct>(phoenix::new_(qi::_1)), phoenix::bind(booleanConstants_.add, qi::_1, qi::_val), phoenix::bind(allConstants_.add, qi::_1, qi::_val), phoenix::bind(&storm::ir::Program::addBooleanUndefinedConstantExpression, program, qi::_1, qi::_val)]; - undefinedIntegerConstantDefinition = (qi::lit("const") >> qi::lit("int") >> freeIdentifierName >> qi::lit(";"))[qi::_val = phoenix::construct>(phoenix::new_(qi::_1)), phoenix::bind(integerConstants_.add, qi::_1, qi::_val), phoenix::bind(allConstants_.add, qi::_1, qi::_val), phoenix::bind(&storm::ir::Program::addIntegerUndefinedConstantExpression, program, qi::_1, qi::_val)]; - undefinedDoubleConstantDefinition = (qi::lit("const") >> qi::lit("double") >> freeIdentifierName >> qi::lit(";"))[qi::_val = phoenix::construct>(phoenix::new_(qi::_1)), phoenix::bind(doubleConstants_.add, qi::_1, qi::_val), phoenix::bind(allConstants_.add, qi::_1, qi::_val), phoenix::bind(&storm::ir::Program::addDoubleUndefinedConstantExpression, program, qi::_1, qi::_val)]; + undefinedBooleanConstantDefinition = (qi::lit("const") >> qi::lit("bool") >> freeIdentifierName >> qi::lit(";"))[qi::_a = phoenix::construct>(phoenix::new_(qi::_1)), phoenix::bind(booleanConstantInfo_.add, qi::_1, qi::_a), phoenix::bind(booleanConstants_.add, qi::_1, qi::_a), phoenix::bind(allConstants_.add, qi::_1, qi::_a)]; + undefinedIntegerConstantDefinition = (qi::lit("const") >> qi::lit("int") >> freeIdentifierName >> qi::lit(";"))[qi::_a = phoenix::construct>(phoenix::new_(qi::_1)), phoenix::bind(integerConstantInfo_.add, qi::_1, qi::_a), phoenix::bind(integerConstants_.add, qi::_1, qi::_a), phoenix::bind(allConstants_.add, qi::_1, qi::_a)]; + undefinedDoubleConstantDefinition = (qi::lit("const") >> qi::lit("double") >> freeIdentifierName >> qi::lit(";"))[qi::_a = phoenix::construct>(phoenix::new_(qi::_1)), phoenix::bind(doubleConstantInfo_.add, qi::_1, qi::_a), phoenix::bind(doubleConstants_.add, qi::_1, qi::_a), phoenix::bind(allConstants_.add, qi::_1, qi::_a)]; definedConstantDefinition %= (definedBooleanConstantDefinition | definedIntegerConstantDefinition | definedDoubleConstantDefinition); - undefinedConstantDefinition %= (undefinedBooleanConstantDefinition | undefinedIntegerConstantDefinition | undefinedDoubleConstantDefinition); - constantDefinition %= (definedConstantDefinition | undefinedConstantDefinition); - - constantDefinitionList = +constantDefinition; + // undefinedConstantDefinition = (undefinedBooleanConstantDefinition | undefinedIntegerConstantDefinition | undefinedDoubleConstantDefinition); + // constantDefinitionList = *(definedConstantDefinition | undefinedConstantDefinition); integerVariableName %= integerVariableNames_; booleanVariableName %= booleanVariableNames_; @@ -122,21 +120,21 @@ private: updateListDefinition = +updateDefinition; commandDefinition = (qi::lit("[") >> freeIdentifierName >> qi::lit("]") >> booleanExpression >> qi::lit("->") >> updateListDefinition >> qi::lit(";"))[qi::_val = phoenix::construct(qi::_1, qi::_2, qi::_3)]; - moduleDefinition = (qi::lit("module") >> freeIdentifierName >> *variableDefinition(qi::_val) >> *commandDefinition >> qi::lit("endmodule"))[qi::_val = phoenix::construct(qi::_1, qi::_2)]; + moduleDefinition = (qi::lit("module") >> freeIdentifierName >> *(booleanVariableDefinition[phoenix::push_back(qi::_a, qi::_1)] | integerVariableDefinition[phoenix::push_back(qi::_b, qi::_1)]) >> *commandDefinition >> qi::lit("endmodule"))[qi::_val = phoenix::construct(qi::_1, qi::_a, qi::_b, qi::_3)]; moduleDefinitionList = +moduleDefinition; - start = (constantDefinitionList >> moduleDefinitionList)[qi::_val = phoenix::construct(storm::ir::Program::ModelType::DTMC, qi::_1)]; + start = (*(definedConstantDefinition | (undefinedBooleanConstantDefinition[phoenix::push_back(qi::_a, qi::_1)] | undefinedIntegerConstantDefinition[phoenix::push_back(qi::_b, qi::_1)] | undefinedDoubleConstantDefinition[phoenix::push_back(qi::_c, qi::_1)])) >> moduleDefinitionList)[qi::_val = phoenix::construct(storm::ir::Program::ModelType::DTMC, qi::_a, qi::_b, qi::_c, qi::_1)]; } // The starting point of the grammar. - qi::rule start; + qi::rule>,std::vector>,std::vector>>, ascii::space_type> start; qi::rule constantDefinitionList; qi::rule(), ascii::space_type> moduleDefinitionList; - qi::rule moduleDefinition; + qi::rule, std::vector>, ascii::space_type> moduleDefinition; - qi::rule variableDefinition; + qi::rule variableDefinition; qi::rule>, ascii::space_type> booleanVariableDefinition; qi::rule>, ascii::space_type> integerVariableDefinition; @@ -151,11 +149,11 @@ private: qi::rule booleanVariableName; qi::rule(), ascii::space_type> constantDefinition; - qi::rule(), ascii::space_type> undefinedConstantDefinition; + qi::rule undefinedConstantDefinition; qi::rule(), ascii::space_type> definedConstantDefinition; - qi::rule(), ascii::space_type> undefinedBooleanConstantDefinition; - qi::rule(), ascii::space_type> undefinedIntegerConstantDefinition; - qi::rule(), ascii::space_type> undefinedDoubleConstantDefinition; + qi::rule>, ascii::space_type> undefinedBooleanConstantDefinition; + qi::rule>, ascii::space_type> undefinedIntegerConstantDefinition; + qi::rule>, ascii::space_type> undefinedDoubleConstantDefinition; qi::rule(), ascii::space_type> definedBooleanConstantDefinition; qi::rule(), ascii::space_type> definedIntegerConstantDefinition; qi::rule(), ascii::space_type> definedDoubleConstantDefinition; @@ -241,10 +239,30 @@ private: // Intentionally left empty. This map is filled during parsing. } integerVariableNames_, booleanVariableNames_; + struct booleanVariableTypesStruct : qi::symbols { + // Intentionally left empty. This map is filled during parsing. + } booleanVariableInfo_; + + struct integerVariableTypesStruct : qi::symbols { + // Intentionally left empty. This map is filled during parsing. + } integerVariableInfo_; + struct constantsStruct : qi::symbols> { // Intentionally left empty. This map is filled during parsing. } integerConstants_, booleanConstants_, doubleConstants_, allConstants_; + struct undefinedBooleanConstantsTypesStruct : qi::symbols> { + // Intentionally left empty. This map is filled during parsing. + } booleanConstantInfo_; + + struct undefinedIntegerConstantsTypesStruct : qi::symbols> { + // Intentionally left empty. This map is filled during parsing. + } integerConstantInfo_; + + struct undefinedDoubleConstantsTypesStruct : qi::symbols> { + // Intentionally left empty. This map is filled during parsing. + } doubleConstantInfo_; + struct modulesStruct : qi::symbols { // Intentionally left empty. This map is filled during parsing. } modules_;