Skip to content

Missing spaces in PragmaDirective #23

@jff

Description

@jff

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions