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
@@ -0,0 +1,3 @@
pragma solidity ;
// ----
// ParserError 1684: (0-17): Invalid version pragma. Empty version pragma.
@@ -1,3 +1,3 @@
pragma solidity pragma;
// ----
// ParserError 1684: (0-23): Found version pragma, but failed to parse it. Please ensure there is a trailing semicolon.
// ParserError 1684: (0-23): Invalid version pragma. Expected the start of a version number but instead found character 'p'. Version number is invalid or the pragma is not terminated with a semicolon.
@@ -1,3 +1,3 @@
pragma solidity (8.0.0);
// ----
// ParserError 1684: (0-24): Found version pragma, but failed to parse it. Please ensure there is a trailing semicolon.
// ParserError 1684: (0-24): Invalid version pragma. Expected the start of a version number but instead found character '('. Version number is invalid or the pragma is not terminated with a semicolon.
@@ -1,3 +1,3 @@
pragma solidity 88_;
// ----
// ParserError 1684: (0-20): Found version pragma, but failed to parse it. Please ensure there is a trailing semicolon.
// ParserError 1684: (0-20): Invalid version pragma. Expected the start of a version number but instead found character '_'. Version number is invalid or the pragma is not terminated with a semicolon.
@@ -1,3 +1,3 @@
pragma solidity v1.2.3;
// ----
// ParserError 1684: (0-23): Found version pragma, but failed to parse it. Please ensure there is a trailing semicolon.
// ParserError 1684: (0-23): Invalid version pragma. Expected the start of a version number but instead found character 'v'. Version number is invalid or the pragma is not terminated with a semicolon.
@@ -1,3 +1,3 @@
pragma solidity >0.5.0<;
// ----
// ParserError 1684: (0-24): Found version pragma, but failed to parse it. Please ensure there is a trailing semicolon.
// ParserError 1684: (0-24): Invalid version pragma. Expected version number but reached end of pragma.
@@ -1,3 +1,3 @@
pragma solidity;
// ----
// ParserError 1684: (0-16): Found version pragma, but failed to parse it. Please ensure there is a trailing semicolon.
// ParserError 1684: (0-16): Invalid version pragma. Empty version pragma.
@@ -0,0 +1,3 @@
pragma solidity 0.4.1 - 0.6.2 0.8.17;
// ----
// ParserError 1684: (0-37): Invalid version pragma. You can only combine version ranges using the || operator.
@@ -0,0 +1,3 @@
pragma solidity 0.8.17 0.4.1 - 0.6.2;
// ----
// ParserError 1684: (0-37): Invalid version pragma. Expected the start of a version number but instead found character '-'. Version number is invalid or the pragma is not terminated with a semicolon.
@@ -0,0 +1,3 @@
pragma solidity 0.4.0 - 0.4.1 0.4.1 - 0.6.2;
// ----
// ParserError 1684: (0-44): Invalid version pragma. You can only combine version ranges using the || operator.
@@ -1,4 +1,4 @@
pragma solidity 0.4.3
pragma abicoder v2;
// ----
// ParserError 1684: (0-41): Found version pragma, but failed to parse it. Please ensure there is a trailing semicolon.
// ParserError 1684: (0-41): Invalid version pragma. Expected the start of a version number but instead found character 'p'. Version number is invalid or the pragma is not terminated with a semicolon.
@@ -0,0 +1,2 @@
pragma solidity 0.8.17 || 0.4.1 - 0.9.0;
// ----
@@ -0,0 +1,2 @@
pragma solidity 0.4.0 - 0.9.0 || 0.4.1 - 0.6.2;
// ----
@@ -0,0 +1,3 @@
pragma solidity 4294967296;
// ----
// ParserError 1684: (0-27): Invalid version pragma. Integer too large to be used in a version number.