Packages
abi
0.1.13
1.3.0
1.2.0
1.1.0
1.0.0-bravo6
1.0.0-bravo4
1.0.0-bravo3
1.0.0-bravo2
1.0.0-bravo1
1.0.0-alpha9
1.0.0-alpha8
1.0.0-alpha7
1.0.0-alpha6
1.0.0-alpha5
1.0.0-alpha4
1.0.0-alpha3
1.0.0-alpha2
1.0.0-alpha1
0.1.21
0.1.21-alpha2
0.1.21-alpha1
0.1.20
0.1.19
0.1.18
0.1.17
0.1.16
0.1.15
0.1.13
0.1.12
0.1.11
0.1.10
0.1.9
0.1.8
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
Ethereum's ABI Interface
Current section
Files
Jump to
Current section
Files
lib/abi/parser.ex
defmodule ABI.Parser do
@moduledoc false
@doc false
def parse!(str, opts \\ []) do
{:ok, tokens, _} = str |> String.to_charlist() |> :ethereum_abi_lexer.string()
tokens =
case opts[:as] do
nil -> tokens
:type -> [{:"expecting type", 1} | tokens]
:selector -> [{:"expecting selector", 1} | tokens]
end
{:ok, ast} = :ethereum_abi_parser.parse(tokens)
case ast do
{:type, type} -> type
{:selector, selector_parts} -> struct!(ABI.FunctionSelector, selector_parts)
end
end
end