systemc-clang 2.0.0
Parsing SystemC constructs
Loading...
Searching...
No Matches
node_merge.py
Go to the documentation of this file.
1from parselib.transforms import TopDown
2
3
5 """
6 This pass merges separate nodes that are created for easy recognition for grammar,
7 but actually shares the same semantics
8 """
9 def hnsbinop(self, tree):
10 self.__push_up(tree)
11 tree.data = 'hbinop'
12 return tree
13
15 if len(tree.children) == 2 and tree.children[1].data == 'hbinop' and tree.children[1].children[0] == 'ARRAYSUBSCRIPT':
16 true_node = tree.children[1]
17 true_node.children = true_node.children[1:]
18 true_node.data = 'harrayref'
19 return true_node
20 return tree
21
22 def blkassign(self, tree):
23 """this handler fixes the a[b].read() case by removing read() and making it a[b]"""
24 self.__push_up(tree)
25 for idx, t in enumerate(tree.children):
26 if t.data == 'syscread':
27 tree.children[idx] = self.__transform_arrayref_syscread(t)
28 # dprint(tree)
29 return tree
__push_up(self, current_node)
Definition top_down.py:29