python-solidity-parser icon indicating copy to clipboard operation
python-solidity-parser copied to clipboard

Missing spaces in PragmaDirective

Open jff opened this issue 3 years ago • 1 comments

Contracts such as the Ballot contract shown in the official documentation use pragma versions that follow the same syntax as npm:

pragma solidity >=0.7.0 <0.9.0;

According to the official documentation, this is allowed and the parser seems to support this. However, when parsing contracts like this, the value associated with the PragmaDirective doesn't have any spaces:

>>> sourceUnit['children'][0]
{'type': 'PragmaDirective', 'name': 'solidity', 'value': '>=0.7.0<0.9.0'}

Is there any reason for omitting the spaces? Unfortunately, this precludes the use of other modules that already parse version strings that follow the npm specification. This suggests that it would be better to keep the original format.

jff avatar Dec 20 '21 23:12 jff

@tintinweb I wonder if someone from the team had the chance to look at this? Thanks!

jff avatar Feb 15 '22 10:02 jff