Skip to content

Commit

Permalink
fix #21
Browse files Browse the repository at this point in the history
  • Loading branch information
duaraghav8 committed Dec 26, 2017
1 parent aa50ec9 commit d9928c8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
14 changes: 13 additions & 1 deletion solidity.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,19 @@ UnicodeEscapeSequence
}

VersionLiteral
= operator:(RelationalOperator / EqualityOperator / BitwiseXOROperator)? __ ("v")? major:DecimalIntegerLiteral "." minor:DecimalIntegerLiteral "." patch:DecimalIntegerLiteral {
= operator:(RelationalOperator / EqualityOperator / BitwiseXOROperator)? __ ("v")? major:DecimalIntegerLiteral minor:("." DecimalIntegerLiteral)? patch:("." DecimalIntegerLiteral)? {
if (patch === null) {
patch = 0;
} else {
patch = patch[1];
}

if (minor === null) {
minor = 0;
} else {
minor = minor[1];
}

return {
type: "VersionLiteral",
operator: operator,
Expand Down
20 changes: 20 additions & 0 deletions test/doc_examples.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@ pragma solidity > 0.4.0;
pragma solidity != 0.4.0;
pragma solidity >=0.4.0 <0.4.8; // from https://github.com/ethereum/solidity/releases/tag/v0.4.0

pragma solidity 0.4;
pragma solidity v0.4;
pragma solidity ^0.4;
pragma solidity >= 0.4;
pragma solidity <= 0.4;
pragma solidity < 0.5;
pragma solidity > 0.4;
pragma solidity != 0.4;
pragma solidity >=0.4 <=0.4;

pragma solidity 0;
pragma solidity v0;
pragma solidity ^0;
pragma solidity >= 0;
pragma solidity <= 0;
pragma solidity < 1;
pragma solidity > 0;
pragma solidity != 0;
pragma solidity >=0 <=1;


// Pragma statements that enable experimental (breaking) features
pragma experimental "SMTChecker";
Expand Down

0 comments on commit d9928c8

Please sign in to comment.