Reduce compiler warnings

This commit is contained in:
Thomas Avé 2017-01-28 16:28:27 +01:00
parent 5c2b4b7fa0
commit 3a4e4b8ec6
1 changed files with 27 additions and 26 deletions

View File

@ -105,54 +105,55 @@ std::unique_ptr<Config> Parser::reduce_0(std::deque<Token> subparts) {
// <section> <sections> // <section> <sections>
// Check whether there are no different parserType's given // Check whether there are no different parserType's given
if (subparts[0].value->parserType.empty()) if (subparts[0].value->parserType.empty()) {
subparts[0].value->parserType = subparts[1].value->parserType; subparts[0].value->parserType = subparts[1].value->parserType;
else if (!subparts[1].value->parserType.empty() && } else if (!subparts[1].value->parserType.empty() &&
subparts[1].value->parserType != subparts[0].value->parserType) subparts[1].value->parserType != subparts[0].value->parserType) {
throw SyntaxError("Found more than 1 different parser type"); throw SyntaxError("Found more than 1 different parser type");
}
// Check whether there are no different lexesisFile's given // Check whether there are no different lexesisFile's given
if (subparts[0].value->lexesisFile.empty()) if (subparts[0].value->lexesisFile.empty()){
subparts[0].value->lexesisFile = subparts[1].value->lexesisFile; subparts[0].value->lexesisFile = subparts[1].value->lexesisFile;
else if (!subparts[1].value->lexesisFile.empty() && } else if (!subparts[1].value->lexesisFile.empty() &&
subparts[1].value->lexesisFile != subparts[0].value->lexesisFile) subparts[1].value->lexesisFile != subparts[0].value->lexesisFile){
throw SyntaxError("Found more than 1 different lexesis file"); throw SyntaxError("Found more than 1 different lexesis file");
}
// Check whether there are no different grammar's given // Check whether there are no different grammar's given
// Check whether there are no different start terminals given // Check whether there are no different start terminals given
if (subparts[0].value->grammar.start.empty()) if (subparts[0].value->grammar.start.empty()){
subparts[0].value->grammar.start = subparts[1].value->grammar.start; subparts[0].value->grammar.start = subparts[1].value->grammar.start;
else if (!subparts[1].value->grammar.start.empty() && } else if (!subparts[1].value->grammar.start.empty() &&
subparts[1].value->grammar.start != subparts[0].value->grammar.start) subparts[1].value->grammar.start != subparts[0].value->grammar.start){
throw SyntaxError("Found more than 1 different start terminal"); throw SyntaxError("Found more than 1 different start terminal");
}
// Check whether there are no different variable sets given // Check whether there are no different variable sets given
if (subparts[0].value->grammar.variables.empty()) if (subparts[0].value->grammar.variables.empty()){
subparts[0].value->grammar.variables = subparts[1].value->grammar.variables; subparts[0].value->grammar.variables = subparts[1].value->grammar.variables;
else if (!subparts[1].value->grammar.variables.empty() && } else if (!subparts[1].value->grammar.variables.empty() &&
subparts[1].value->grammar.variables != subparts[0].value->grammar.variables) subparts[1].value->grammar.variables != subparts[0].value->grammar.variables){
throw SyntaxError("Found more than 1 different variable set"); throw SyntaxError("Found more than 1 different variable set");
}
// Check whether there are no different terminal sets given // Check whether there are no different terminal sets given
if (subparts[0].value->grammar.terminals.empty()) if (subparts[0].value->grammar.terminals.empty()) {
subparts[0].value->grammar.terminals = subparts[1].value->grammar.terminals; subparts[0].value->grammar.terminals = subparts[1].value->grammar.terminals;
else if (!subparts[1].value->grammar.terminals.empty() && } else if (!subparts[1].value->grammar.terminals.empty() &&
subparts[1].value->grammar.terminals != subparts[0].value->grammar.terminals) subparts[1].value->grammar.terminals != subparts[0].value->grammar.terminals){
throw SyntaxError("Found more than 1 different terminal set"); throw SyntaxError("Found more than 1 different terminal set");
}
// Check whether there are no different rule sets given // Check whether there are no different rule sets given
if (subparts[0].value->grammar.rules.empty()) if (subparts[0].value->grammar.rules.empty()) {
subparts[0].value->grammar.rules = subparts[1].value->grammar.rules; subparts[0].value->grammar.rules = subparts[1].value->grammar.rules;
else if (!subparts[1].value->grammar.rules.empty()) } else if (!subparts[1].value->grammar.rules.empty()){
throw SyntaxError("Found more than 1 different rule set"); throw SyntaxError("Found more than 1 different rule set");
}
// Check whether there are no different precedence sets given // Check whether there are no different precedence sets given
if (subparts[0].value->grammar.precedence.empty()) if (subparts[0].value->grammar.precedence.empty()) {
subparts[0].value->grammar.precedence = subparts[1].value->grammar.precedence; subparts[0].value->grammar.precedence = subparts[1].value->grammar.precedence;
else if (!subparts[1].value->grammar.precedence.empty() && } else if (!subparts[1].value->grammar.precedence.empty() &&
subparts[1].value->grammar.precedence != subparts[0].value->grammar.precedence) subparts[1].value->grammar.precedence != subparts[0].value->grammar.precedence) {
throw SyntaxError("Found more than 1 different precedence set"); throw SyntaxError("Found more than 1 different precedence set");
}
// REMARK: Everything is now put into subparts[0] // REMARK: Everything is now put into subparts[0]
return std::move(subparts[0].value); return std::move(subparts[0].value);