Fix pragma solidity version in antlr grammar

This commit is contained in:
a3d4 2020-06-17 04:58:15 +02:00
parent 1cb02af240
commit 25ebff3a38
2 changed files with 8 additions and 16 deletions

View File

@ -11,23 +11,11 @@ sourceUnit
: (pragmaDirective | importDirective | structDefinition | enumDefinition | contractDefinition)* EOF ;
pragmaDirective
: 'pragma' pragmaName pragmaValue ';' ;
: 'pragma' pragmaName ( ~';' )* ';' ;
pragmaName
: identifier ;
pragmaValue
: version | expression ;
version
: versionConstraint versionConstraint? ;
versionConstraint
: versionOperator? VersionLiteral ;
versionOperator
: '^' | '~' | '>=' | '>' | '<' | '<=' | '=' ;
importDirective
: 'import' StringLiteralFragment ('as' identifier)? ';'
| 'import' ('*' | identifier) ('as' identifier)? 'from' StringLiteralFragment ';'
@ -473,9 +461,6 @@ fragment
SingleQuotedStringCharacter
: ~['\r\n\\] | ('\\' .) ;
VersionLiteral
: [0-9]+ ( '.' [0-9]+ ('.' [0-9]+)? )? ;
WS
: [ \t\r\n\u000C]+ -> skip ;

View File

@ -0,0 +1,7 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity < 142857;
pragma solidity >= 0.0;
pragma solidity >= 0.0.0;
contract C {
}