Added support for full error messages
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-06-18 19:56:47 +02:00
parent dc35ba4698
commit 8541085b27
7 changed files with 133 additions and 39 deletions

View File

@@ -289,7 +289,8 @@ namespace Porygon::Parser {
}
auto closeToken = this->Next();
if (closeToken != c) {
this->ScriptData->Diagnostics->LogError(Diagnostics::DiagnosticCode::UnexpectedCharacter, this->_position - 1, 1);
const char* s = string(1, closeToken).c_str();
this->ScriptData->Diagnostics->LogError(Diagnostics::DiagnosticCode::UnexpectedCharacter, this->_position - 1, 1, { s });
return new SimpleToken(TokenKind::BadToken, start, end - start + 1);
}
@@ -303,8 +304,9 @@ namespace Porygon::Parser {
if (ControlCharacters.find(c) != ControlCharacters.end()) {
stream << ControlCharacters.at(c);
} else {
auto v = string(1, c).c_str();
this->ScriptData->Diagnostics->LogError(Diagnostics::DiagnosticCode::InvalidStringControlCharacter,
start + 1 + i, 1);
start + 1 + i, 1, {v});
stream << c;
}
} else {