Merge pull request #9215 from a3d4/fix-grammar-pragma-version

Fix pragma solidity version in antlr grammar
This commit is contained in:
chriseth 2020-06-23 12:34:29 +02:00 committed by GitHub
commit e419e904d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 {
}