Allow empty braces on sct vars and remove semicolons from python code

This commit is contained in:
Douglas Clowes
2014-07-11 10:07:05 +10:00
parent 35067c3673
commit 0dbe7bd53e

View File

@@ -365,9 +365,10 @@ def p_group_assignment(p):
def p_variable(p):
'''
variable : VAR id_or_str EQUALS LBRACE variable_statement_list RBRACE
| VAR id_or_str EQUALS LBRACE RBRACE
| VAR id_or_str
'''
if len(p) > 3:
if len(p) > 6:
p[0] = { 'Variable' : [{'name' : p[2]}] + p[5] }
else:
p[0] = { 'Variable' : [{'name' : p[2]}] }
@@ -680,8 +681,8 @@ def build_variable(MyDriver, p):
if 'permlink' in MyVar:
device_type, node_type = MyVar['permlink'].split('.')
if node_type not in MyDriver['Permlink']:
MyDriver['Permlink'][node_type] = [];
MyDriver['Permlink'][node_type] += [make_path(MyVar)];
MyDriver['Permlink'][node_type] = []
MyDriver['Permlink'][node_type] += [make_path(MyVar)]
if Verbose:
print '==>>MyVar:', MyVar
return MyVar
@@ -1478,23 +1479,23 @@ def put_standard_code(MyDriver):
#if theFunc['reference_count'] == 0:
# continue
if theFunc['type'] == 'read_function':
put_read_function(MyDriver, func);
put_read_function(MyDriver, func)
elif theFunc['type'] == 'write_function':
put_write_function(MyDriver, func);
put_write_function(MyDriver, func)
elif theFunc['type'] == 'fetch_function':
put_fetch_function(MyDriver, func);
put_fetch_function(MyDriver, func)
elif theFunc['type'] == 'check_function':
put_check_function(MyDriver, func);
put_check_function(MyDriver, func)
elif theFunc['type'] == 'checkrange_function':
put_checkrange_function(MyDriver, func);
put_checkrange_function(MyDriver, func)
elif theFunc['type'] == 'checklimits_function':
put_checklimits_function(MyDriver, func);
put_checklimits_function(MyDriver, func)
elif theFunc['type'] == 'checkstatus_function':
put_checkstatus_function(MyDriver, func);
put_checkstatus_function(MyDriver, func)
elif theFunc['type'] == 'halt_function':
put_halt_function(MyDriver, func);
put_halt_function(MyDriver, func)
elif theFunc['type'] == 'pid_function':
put_pid_function(MyDriver, func);
put_pid_function(MyDriver, func)
def generate_driver(MyDriver):
global NumberOfLinesOut