2from lark
import Lark, Transformer, Visitor
5from .type_node
import TypeNode
9 """This pass collects all types within a hcode file."""
10 def __init__(self, skip=None, *args, **kwargs):
18 if key.startswith(str(name)):
35 if re.match(
r'(\+|\-)?0-9+', str(args[0])):
38 return TypeNode(name=str(args[0]), params=[], fields=[])
40 return TypeNode(name=str(args[0]), params=args[1:], fields=[])
44 type_name = str(args[0])
47 raise Exception(
'repeated type definition')
52 mod_name = str(args[0])
55 raise Exception(
'repeated module definition')
73 return (args[0], args[1])