Clean up the config parser a bit

This commit is contained in:
Gunnar Beutner 2014-11-01 05:23:14 +01:00
parent 1811f8689b
commit 93b66a0c4a

View File

@ -212,7 +212,6 @@ static std::stack<TypeRuleList::Ptr> m_RuleLists;
static ConfigType::Ptr m_Type; static ConfigType::Ptr m_Type;
static Dictionary::Ptr m_ModuleScope; static Dictionary::Ptr m_ModuleScope;
static int m_StatementNum;
static bool m_Apply; static bool m_Apply;
static bool m_ObjectAssign; static bool m_ObjectAssign;
@ -224,9 +223,6 @@ void ConfigCompiler::Compile(void)
{ {
m_ModuleScope = make_shared<Dictionary>(); m_ModuleScope = make_shared<Dictionary>();
int parentStatementNum = m_StatementNum;
m_StatementNum = 0;
try { try {
yyparse(this); yyparse(this);
} catch (const ConfigError& ex) { } catch (const ConfigError& ex) {
@ -235,8 +231,6 @@ void ConfigCompiler::Compile(void)
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
ConfigCompilerContext::GetInstance()->AddMessage(true, DiagnosticInformation(ex)); ConfigCompilerContext::GetInstance()->AddMessage(true, DiagnosticInformation(ex));
} }
m_StatementNum = parentStatementNum;
} }
#define scanner (context->GetScanner()) #define scanner (context->GetScanner())
@ -249,9 +243,7 @@ statements: /* empty */
; ;
statement: type | include | include_recursive | library | constant statement: type | include | include_recursive | library | constant
{ { }
m_StatementNum++;
}
| newlines | newlines
{ } { }
| lterm | lterm
@ -259,8 +251,6 @@ statement: type | include | include_recursive | library | constant
Expression::Ptr aexpr = *$1; Expression::Ptr aexpr = *$1;
aexpr->Evaluate(m_ModuleScope); aexpr->Evaluate(m_ModuleScope);
delete $1; delete $1;
m_StatementNum++;
} }
; ;