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 def in_local(self
, key
):
67 if key
in self
.local_table
:
72 def in_global(self
, key
):
73 if key
in self
.global_table
:
78 # Function return value access functions
79 def get_func_ret(self
):
80 return self
.function_return_type
82 def set_func_ret(self
, rtn_type
):
83 self
.fuction_return_type
= rtn_type
85 # Number of parameters access functions
86 def set_num_params(self
, num_params
):
87 self
.crnt_function
.set_num_params(num_params
)
89 def get_num_params(self
):
90 return self
.crnt_fuctions
.get_num_params()
92 # current node access methods
93 def set_crnt_node(self
, node
):
96 def get_crnt_node(self
):
99 def get_start_node(self
):
100 return self
.start_node
102 def get_end_node(self
):