Improve Error Reporting of SemVer Parser

This commit is contained in:
Vinay
2022-11-25 13:09:09 -03:00
committed by Matheus Aguiar
parent 10f81425a3
commit 9e7b85ac4b
20 changed files with 135 additions and 64 deletions
+5 -4
View File
@@ -25,17 +25,18 @@
#include <liblangutil/Token.h>
#include <libsolutil/Assertions.h>
#include <liblangutil/Exceptions.h>
#include <string>
#include <optional>
#include <utility>
#include <vector>
namespace solidity::langutil
{
class SemVerError: public util::Exception
struct SemVerError: public util::Exception
{
};
#undef major
@@ -87,8 +88,8 @@ class SemVerMatchExpressionParser
public:
SemVerMatchExpressionParser(std::vector<Token> _tokens, std::vector<std::string> _literals);
/// Returns an expression if it was parseable, or nothing otherwise.
std::optional<SemVerMatchExpression> parse();
/// Returns an expression if it was parsable, or throws a SemVerError otherwise.
SemVerMatchExpression parse();
private:
void reset();