From 710f3c42d5889dc958debc0267162f38373263c3 Mon Sep 17 00:00:00 2001 From: sienkiew Date: Fri, 29 Jun 2012 20:46:23 +0000 Subject: conditional CMD in TABLE git-svn-id: https://svn.stsci.edu/svn/ssb/etal/steuermann/trunk@740 d34015c8-bcbb-4646-8ac8-8ba5febf221d --- steuermann/specfile.exy | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/steuermann/specfile.exy b/steuermann/specfile.exy index 73a5b20..f848072 100644 --- a/steuermann/specfile.exy +++ b/steuermann/specfile.exy @@ -47,9 +47,7 @@ parser specfile: name {{ hostlist.append(name) }} | hostgroup {{ hostlist = hostlist + nodes.get_hostgroup( hostgroup ) }} )+ - command_list - # command_list is a list of (command, pos) where command is the text from the file and pos is the location in the file - {{ self.data.add_command_list( table_name, hostlist, command_list ) }} + command_cond<> + | IMPORT string {{ self.data.import_list.append( string[1:-1] ) }} ## @@ -68,15 +66,9 @@ parser specfile: | hostgroup {{ if accept_nodes : nodes.add_hostgroup( hg, hostgroup ) }} )* - rule command_list: - # one or more commands, appended together into a list - {{ cmlist = [ ] }} - command {{ cmlist.append( command ) }} - [ - command_list {{ cmlist += command_list }} - ] - {{ return cmlist }} - | {{ return [ ] }} + rule command_cond<> : + IF name COLON command {{ if nodes.check_condition(name, self._scanner.filename ) : self.data.add_command_list( table_name, hostlist, [ command ] ) }} + | command {{ self.data.add_command_list( table_name, hostlist, [ command ] ) }} rule command: # a single command, including any number of AFTER clauses -- cgit