Groundwork. Prepare for automatic tagging of errors in parser-based classes

[Not compilable until the next commit]
This commit is contained in:
a3d4 2020-05-09 00:24:58 +02:00
parent 4e58c672bb
commit 6965f199fd
2 changed files with 16 additions and 15 deletions

View File

@ -143,27 +143,27 @@ void ParserBase::decreaseRecursionDepth()
m_recursionDepth--;
}
void ParserBase::parserWarning(string const& _description)
void ParserBase::parserWarning(ErrorId _error, string const& _description)
{
m_errorReporter.warning(6635_error, currentLocation(), _description);
m_errorReporter.warning(_error, currentLocation(), _description);
}
void ParserBase::parserError(SourceLocation const& _location, string const& _description)
void ParserBase::parserError(ErrorId _error, SourceLocation const& _location, string const& _description)
{
m_errorReporter.parserError(2314_error, _location, _description);
m_errorReporter.parserError(_error, _location, _description);
}
void ParserBase::parserError(string const& _description)
void ParserBase::parserError(ErrorId _error, string const& _description)
{
parserError(currentLocation(), _description);
parserError(_error, currentLocation(), _description);
}
void ParserBase::fatalParserError(string const& _description)
void ParserBase::fatalParserError(ErrorId _error, string const& _description)
{
fatalParserError(currentLocation(), _description);
fatalParserError(_error, currentLocation(), _description);
}
void ParserBase::fatalParserError(SourceLocation const& _location, string const& _description)
void ParserBase::fatalParserError(ErrorId _error, SourceLocation const& _location, string const& _description)
{
m_errorReporter.fatalParserError(1957_error, _location, _description);
m_errorReporter.fatalParserError(_error, _location, _description);
}

View File

@ -32,6 +32,7 @@ namespace solidity::langutil
class ErrorReporter;
class Scanner;
struct ErrorId;
class ParserBase
{
@ -88,17 +89,17 @@ protected:
/// Creates a @ref ParserError and annotates it with the current position and the
/// given @a _description.
void parserError(std::string const& _description);
void parserError(SourceLocation const& _location, std::string const& _description);
void parserError(ErrorId _error, std::string const& _description);
void parserError(ErrorId _error, SourceLocation const& _location, std::string const& _description);
/// Creates a @ref ParserWarning and annotates it with the current position and the
/// given @a _description.
void parserWarning(std::string const& _description);
void parserWarning(ErrorId _error, std::string const& _description);
/// Creates a @ref ParserError and annotates it with the current position and the
/// given @a _description. Throws the FatalError.
void fatalParserError(std::string const& _description);
void fatalParserError(SourceLocation const& _location, std::string const& _description);
void fatalParserError(ErrorId _error, std::string const& _description);
void fatalParserError(ErrorId _error, SourceLocation const& _location, std::string const& _description);
std::shared_ptr<Scanner> m_scanner;
/// The reference to the list of errors and warning to add errors/warnings during parsing