More (English) grammar updates

This commit is contained in:
Thomas Avé 2017-01-27 22:08:18 +01:00
parent 4ea2b40922
commit 2974525b10
1 changed files with 7 additions and 7 deletions

View File

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