-
Notifications
You must be signed in to change notification settings - Fork 1
/
Vyper.ebnf
78 lines (76 loc) · 2.12 KB
/
Vyper.ebnf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Vyper.ebnf grammar - 2020/10/25
sourceUnit
::= contractDefinition EOF
contractDefinition
::= customUnitDeclarations* interfaceDefinition* stateVariableDeclaration* eventDefinition* storageVarDefinition* functionDefinition+
customUnitDeclarations
::= 'unit' ':' '{' customUnitDeclaration ( ',' customUnitDeclaration )* '}'
customUnitDeclaration
::= Identifier ':' StringLiteral
interfaceDefinition
::= Identifier
stateVariableDeclaration
::= Identifier ':' 'public('? type ')'?
type ::= referenceType
| valueType
valueType
::= 'bool'
| 'int128'
| 'uint256'
| 'decimal'
| 'address'
| unitType
| 'bytes32'
| 'bytes[' DecimalNumber ']'
unitType ::= 'timestamp'
| 'timedelta'
| 'wei_value'
| customUnitType
customUnitType
::= Identifier
referenceType
::= structType
| mappingType
| listType
| tupleType
structType
::= '{' Identifier ':' valueType ( ',' Identifier ':' valueType )* '}'
mappingType
::= type '[' valueType ']'
listType ::= valueType '[' IntegerNumber ']'
tupleType
::= '(' type ( ',' type )* ')'
eventDefinition
::= Identifier ':' 'event' eventParameterList
eventParameterList
::= '(' '{' eventParameter ( ',' eventParameter )* '}' ')'
eventParameter
::= Identifier ':' 'indexed(' valueType ')'
| valueType
storageVarDefinition
::= Identifier
functionDefinition
::= Identifier
_ ::= WS
| LINE_COMMENT
/* ws: definition */
<?TOKENS?>
StringLiteral
::= '"' DoubleQuotedStringCharacter* '"'
DoubleQuotedStringCharacter
::= [^"\#xd#xa]
| '\' .
Identifier
::= IdentifierStart IdentifierPart*
IdentifierStart
::= [a-zA-Z$_]
IdentifierPart
::= [a-zA-Z0-9$_]
IntegerNumber
::= [1-9] [0-9]+
DecimalNumber
::= [0-9]+ ( '.' [0-9]* )? ( [eE] [0-9]+ )?
WS ::= [ #x9#xd#xa#x000C]+
LINE_COMMENT
::= '#' [^#xd#xa]*
EOF ::= $