diff --git a/site_ansto/instrument/util/gen_sct.py b/site_ansto/instrument/util/gen_sct.py index 56bf65cf..7734ea71 100755 --- a/site_ansto/instrument/util/gen_sct.py +++ b/site_ansto/instrument/util/gen_sct.py @@ -156,6 +156,8 @@ tokens = [ 'ID', 'TCL_BEG', 'TCL_END', + 'AT_TCL', + 'AT_END', ] + list(reserved.values()) # @@ -167,6 +169,20 @@ t_LBRACE = r'{' t_RBRACE = r'}' t_SLASH = r'/' +def t_AT_TCL(t): + r'@TCL' + if Verbose: + print 'AT_TCL' + t.lexer.begin('tcl') + #return t + +def t_tcl_AT_END(t): + r'[ \t]*@END' + if Verbose: + print 'AT_END' + t.lexer.begin('INITIAL') + #return t + def t_TCL_BEG(t): r'{%%' if Verbose: @@ -513,6 +529,7 @@ def p_true_false(p): def p_code(p): ''' code : CODE code_type id_or_str EQUALS LBRACE code_block RBRACE + | CODE code_type id_or_str EQUALS LBRACE tcl_code_block RBRACE | CODE code_type id_or_str EQUALS TCL_BEG code_block TCL_END ''' p[0] = { 'Code' : { 'name' : p[3], 'type' : p[2], 'text' : p[6] }} @@ -532,6 +549,12 @@ def p_code_type(p): ''' p[0] = p[1] +def p_tcl_code_block(p): + ''' + tcl_code_block : AT_TCL code_block AT_END + ''' + p[0] = p[2] + def p_code_block(p): '''code_block : empty | code_block CODE_STRING