mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Looking pragma operators per range and not per tokens.
Add 3 invalid tests and 2 valid tests
This commit is contained in:
parent
3a4a504c42
commit
ed7123c8df
@ -208,7 +208,10 @@ void SemVerMatchExpressionParser::parseMatchExpression()
|
|||||||
range.components.push_back(parseMatchComponent());
|
range.components.push_back(parseMatchComponent());
|
||||||
if (currentToken() == Token::Sub)
|
if (currentToken() == Token::Sub)
|
||||||
{
|
{
|
||||||
if (containPrefixingToken())
|
nextToken();
|
||||||
|
range.components.push_back(parseMatchComponent());
|
||||||
|
|
||||||
|
if (TokenTraits::isPragmaOp(range.components[0].prefix) || TokenTraits::isPragmaOp(range.components[1].prefix))
|
||||||
{
|
{
|
||||||
solThrow(
|
solThrow(
|
||||||
SemVerError,
|
SemVerError,
|
||||||
@ -217,8 +220,6 @@ void SemVerMatchExpressionParser::parseMatchExpression()
|
|||||||
}
|
}
|
||||||
|
|
||||||
range.components[0].prefix = Token::GreaterThanOrEqual;
|
range.components[0].prefix = Token::GreaterThanOrEqual;
|
||||||
nextToken();
|
|
||||||
range.components.push_back(parseMatchComponent());
|
|
||||||
range.components[1].prefix = Token::LessThanOrEqual;
|
range.components[1].prefix = Token::LessThanOrEqual;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -332,11 +333,3 @@ void SemVerMatchExpressionParser::nextToken()
|
|||||||
++m_pos;
|
++m_pos;
|
||||||
m_posInside = 0;
|
m_posInside = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SemVerMatchExpressionParser::containPrefixingToken() const
|
|
||||||
{
|
|
||||||
if (std::find_if(m_tokens.begin(), m_tokens.end(), TokenTraits::isPragmaOp) != m_tokens.end())
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
@ -102,7 +102,6 @@ private:
|
|||||||
char nextChar();
|
char nextChar();
|
||||||
Token currentToken() const;
|
Token currentToken() const;
|
||||||
void nextToken();
|
void nextToken();
|
||||||
bool containPrefixingToken() const;
|
|
||||||
|
|
||||||
std::vector<Token> m_tokens;
|
std::vector<Token> m_tokens;
|
||||||
std::vector<std::string> m_literals;
|
std::vector<std::string> m_literals;
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
pragma solidity <0.8.17 - 0.8.20;
|
||||||
|
// ----
|
||||||
|
// ParserError 1684: (0-33): Invalid version pragma. You cannot use operators (<, <=, >=, >, ^) with version ranges (-).
|
@ -0,0 +1,3 @@
|
|||||||
|
pragma solidity 0.8.17 - >0.8.20;
|
||||||
|
// ----
|
||||||
|
// ParserError 1684: (0-33): Invalid version pragma. You cannot use operators (<, <=, >=, >, ^) with version ranges (-).
|
@ -0,0 +1,3 @@
|
|||||||
|
pragma solidity 0.8.14 || 0.8.17 - >0.8.20;
|
||||||
|
// ----
|
||||||
|
// ParserError 1684: (0-43): Invalid version pragma. You cannot use operators (<, <=, >=, >, ^) with version ranges (-).
|
@ -0,0 +1,2 @@
|
|||||||
|
pragma solidity 0.8.17 - 0.8.20;
|
||||||
|
// ----
|
@ -0,0 +1,2 @@
|
|||||||
|
pragma solidity <0.8.15 || 0.8.17 - 0.8.20;
|
||||||
|
// ----
|
Loading…
Reference in New Issue
Block a user