-
Notifications
You must be signed in to change notification settings - Fork 58
/
create_asm_hover.py
42 lines (38 loc) · 1.56 KB
/
create_asm_hover.py
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
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# Author : <github.com/tintinweb>
import evmdasm
template = {
"prefix": "pragma",
"body": "{{ $1 }}",
"description": "Info:\n$1 tes {{ tes test}} test *test* \"test\"",
"example": "{% pragma ${name} %}",
"security": "do not use experimental features!"
}
def main():
hover_asm = {}
for instr in evmdasm.registry.INSTRUCTIONS:
name = instr.name.lower()
if name.startswith("unofficial_"):
continue
hover_asm[name] = {
"prefix":name,
#"body":None,
"description":instr.description,
#"example":None,
#"security":None,
"instr_opcode":instr.opcode,
"instr_gas": instr.gas,
#"instr_args": ["(%s) %s"%(a._type, a) for a in instr.args],
"instr_args": ["%s"%(a) for a in instr.args],
"instr_returns": ["%s"%(a) for a in instr.returns],
"instr_category": instr.category,
"instr_size": instr.size,
"instr_pops": instr.pops,
"instr_pushes": instr.pushes,
"instr_fork": instr.fork
}
import json
print(json.dumps(hover_asm, sort_keys=True, indent=4, separators=(',', ': ')))
if __name__ == "__main__":
main()