From 0dbe7bd53e6791d61ab37ed6ce905c9ed3eaabad Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Fri, 11 Jul 2014 10:07:05 +1000 Subject: [PATCH] Allow empty braces on sct vars and remove semicolons from python code --- site_ansto/instrument/util/gen_sct.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/site_ansto/instrument/util/gen_sct.py b/site_ansto/instrument/util/gen_sct.py index 7332b890..bca5dc3d 100755 --- a/site_ansto/instrument/util/gen_sct.py +++ b/site_ansto/instrument/util/gen_sct.py @@ -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