Skip to content

Commit 50a53c4

Browse files
authored
Merge pull request #58 from benber86/fix/dec
version 0.0.6
2 parents a760d6b + 21eb595 commit 50a53c4

File tree

8 files changed

+40
-13
lines changed

8 files changed

+40
-13
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ build-backend = "setuptools.build_meta"
3838

3939
[tool.poetry]
4040
name = "mamushi"
41-
version = "0.0.5"
41+
version = "0.0.6"
4242
description = "Vyper Formatter"
4343
authors = ["benny <[email protected]>"]
4444

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.0.5
2+
current_version = 0.0.6
33
commit = True
44
tag = True
55

src/mamushi/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.0.5"
1+
__version__ = "0.0.6"

src/mamushi/formatting/whitespace.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ def whitespace(leaf: Leaf) -> str:
100100
tokens.CALL,
101101
tokens.EXTERNAL_CALL,
102102
tokens.EMPTY,
103-
tokens.ABI_DECODE,
104103
tokens.SUBSCRIPT,
105104
tokens.INDEXED_ARGS,
106105
tokens.LOG_STMT,

src/mamushi/parsing/grammar.lark

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ _simple_stmt: (declaration
151151
declaration: variable ["=" expr]
152152
skip_assign: "_"
153153
multiple_assign: (atom_expr | skip_assign) ("," (atom_expr | skip_assign))+ [","]
154-
assign: (atom_expr | multiple_assign | "(" multiple_assign ")" ) "=" expr
154+
assign: (atom_expr | multiple_assign | "(" multiple_assign ")") "=" expr
155+
155156
// NOTE: Keep these in sync with bin_op below
156157
?aug_operator: "+" -> add
157158
| "-" -> sub
@@ -302,14 +303,8 @@ call: atom_expr "(" [arguments] ")"
302303
// special rule to handle types as "arguments" (for `empty` builtin)
303304
empty: "empty" "(" type ")"
304305

305-
// special rule to handle types as "arguments" (for `_abi_decode` builtin)
306-
abi_decode: ("_abi_decode" | "abi_decode") "(" arg "," type ( "," kwarg )* ")"
307-
308-
special_builtins: empty | abi_decode
309-
310306
// NOTE: Must end recursive cycle like this (with `atom` calling `operation`)
311307
?atom: literal
312-
| special_builtins
313308
| tuple
314309
| list
315310
| dict
@@ -332,7 +327,7 @@ DEC_NUMBER: /0|[1-9](_?\d)*/
332327
HEX_NUMBER.2: /0x([_]?[0-9a-f])+/i
333328
OCT_NUMBER.2: /0o([_]?[0-7])+/i
334329
BIN_NUMBER.2 : /0b([_]?[01])+/i
335-
FLOAT_NUMBER.2: /(([1-9]\d*(_?\d*)*\.?\d*(_?\d*)?|\.\d+(_?\d*)?)(e[-+]?\d+(_?\d*)?)?|[1-9]\d*(_?\d*)?(e[-+]?\d+(_?\d*)?)?)/i
330+
FLOAT_NUMBER.2: /([0-9]+(_?[0-9])*\.([0-9]+(_?[0-9])*)?|\.[0-9]+(_?[0-9])*)(e[-+]?[0-9]+(_?[0-9])*)?|[0-9]+(_?[0-9])*e[-+]?[0-9]+(_?[0-9])*/i
336331

337332
_number: DEC_NUMBER
338333
| HEX_NUMBER

src/mamushi/parsing/tokens.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@
135135
CALL = "call"
136136
EXTERNAL_CALL = "external_call"
137137
EMPTY = "empty"
138-
ABI_DECODE = "abi_decode"
139138
ATTRIBUTE = "attribute"
140139
GET_VAR = "get_var"
141140
LOG_STMT = "log_stmt"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
@internal
2+
def foo():
3+
(a,
4+
b,
5+
c, d) = abi_decode(
6+
slice(data,
7+
A,
8+
B),
9+
(uint256,
10+
uint256, uint256,
11+
uint256),
12+
)
13+
14+
15+
16+
a, b, c, d = abi_decode( slice( data, A, B), (uint256,
17+
uint256, uint256 ,
18+
uint256),
19+
)
20+
21+
# output
22+
@internal
23+
def foo():
24+
(a, b, c, d) = abi_decode(
25+
slice(data, A, B),
26+
(uint256, uint256, uint256, uint256),
27+
)
28+
29+
a, b, c, d = abi_decode(
30+
slice(data, A, B),
31+
(uint256, uint256, uint256, uint256),
32+
)

tests/data/assignments/operator_negative_numbers_spacing.vy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@external
22
def foo(x: int256) -> int256:
3+
c: uint256 = as_wei_value( 0.0375, "ether")
34
if x <= - 41_446_531_673_892_822_313:
45
return empty(int256)
56
a: int256 = x + ( - 123)
@@ -8,6 +9,7 @@ def foo(x: int256) -> int256:
89
# output
910
@external
1011
def foo(x: int256) -> int256:
12+
c: uint256 = as_wei_value(0.0375, "ether")
1113
if x <= -41_446_531_673_892_822_313:
1214
return empty(int256)
1315
a: int256 = x + (-123)

0 commit comments

Comments
 (0)