11 self
.label_counter
= 0
12 self
.start_node
= Node()
13 self
.end_node
= Node()
14 self
.crnt_node
= self
.start_node
16 # counter access functions
17 def increment_counter(self
):
18 self
.counter
= self
.counter
+ 1
20 def reset_counter(self
):
23 def get_counter(self
):
26 def increment_label_counter(self
):
27 self
.label_counter
= self
.label_counter
+ 1
29 def get_label_counter(self
):
30 return self
.label_counter
32 # add to table functions
33 def add_to_global(self
, key
, value
):
34 if key
in self
.global_table
:
36 self
.global_table
[key
] = value
39 def add_to_local(self
, key
, value
):
40 return self
.crnt_function
.add_to_members(key
, value
)
43 def set_local(self
, function
):
44 self
.local_table
= function
.get_table()
45 self
.crnt_function
= function
47 # return the value of 'key' (if present) from the tables
48 def get_value(self
, key
, structure
= False):
51 if structure
!= False and key
in structure
.in_members(key
):
52 return structure
.get_member(key
)
55 elif key
in self
.local_table
:
56 return self
.local_table
[key
]
58 # find in global table
59 elif key
in self
.global_table
:
60 return self
.global_table
[key
]
63 print "id '" + key
+ "' not defined"
66 # Function return value access functions
67 def get_func_ret(self
):
68 return self
.function_return_type
70 def set_func_ret(self
, rtn_type
):
71 self
.fuction_return_type
= rtn_type
73 # Number of parameters access functions
74 def set_num_params(self
, num_params
):
75 self
.crnt_function
.set_num_params(num_params
)
77 def get_num_params(self
):
78 return self
.crnt_fuctions
.get_num_params()
80 # current node access methods
81 def set_crnt_node(self
, node
):
84 def get_crnt_node(self
):
87 def get_start_node(self
):
88 return self
.start_node
90 def get_end_node(self
):