+std::string Parser::describeErrors() noexcept
+{
+ std::string ret;
+
+ for (auto& err : errors) {
+ switch (err) {
+ case ExpectedProcedureCallOpen:
+ ret += "Expected opening \'(\' for procedure call.\n";
+ break;
+ case ExpectedIdentifier:
+ ret += "Expected a valid identifier.\n";
+ break;
+ case ExpectedProcedureCallClose:
+ ret += "Expected closing \')\' for procedure call.\n";
+ break;
+ case ExpectedArgumentList:
+ ret += "Expected beginning of argument list.\n";
+ break;
+ case UnknownIdentifier:
+ ret += "Given identifier is not valid.\n";
+ break;
+ case InvalidExpression:
+ ret += "Expected a valid expression.\n";
+ break;
+ case InvalidOperand:
+ ret += "Given invalid argument or operand.\n";
+ break;
+ case InvalidCondition:
+ ret += "Given invalid condition for conditional statement.\n";
+ break;
+ case InvalidThenBranch:
+ ret += "Given invalid \"then\" branch for conditional statement.\n";
+ break;
+ case InvalidElseBranch:
+ ret += "Given invalid \"else\" branch for conditional statement.\n";
+ break;
+ case InvalidInitializer:
+ ret += "Given invalid initializer for a declaration.\n";
+ break;
+ case InvalidAssignValue:
+ ret += "Given invalid value for an assignment.\n";
+ break;
+ case InvalidArgumentName:
+ ret += "Given invalid name for an argument.\n";
+ break;
+ case InvalidLambdaBody:
+ ret += "Lambda body is invalid.\n";
+ break;
+ default:
+ break;
+ }
+ }
+
+ return ret;
+}
+