diff options
Diffstat (limited to 'steuermann/specfile.exy')
-rw-r--r-- | steuermann/specfile.exy | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/steuermann/specfile.exy b/steuermann/specfile.exy index 5dc715f..7cdf1f3 100644 --- a/steuermann/specfile.exy +++ b/steuermann/specfile.exy @@ -31,10 +31,11 @@ parser specfile: rule table_section: TABLE tablename {{ table_name = tablename }} - HOST - {{ hostlist = [ ] }} - ( name {{ hostlist.append(name) }} )+ - command_list + HOST {{ hostlist = [ ] }} + ( + name {{ hostlist.append(name) }} + )+ + 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 ) }} @@ -42,16 +43,22 @@ parser specfile: # one or more commands, appended together into a list {{ cmlist = [ ] }} command {{ cmlist.append( command ) }} - [ command_list {{ cmlist += command_list }} ] + [ + command_list {{ cmlist += command_list }} + ] {{ return cmlist }} - - | {{ return [ ] }} + | {{ return [ ] }} rule command: # a single command, including any number of AFTER clauses - CMD {{ cmd_pos = self._scanner.get_pos() }} cmdname {{ cmd_name=cmdname; script=cmdname; x_after_clause = [ ] }} - [ RUN string {{ script = string[1:-1]; script_type='r' }} | LOCAL string {{ script = string[1:-1]; script_type='l' }} ] - ( {{ after_pos = self._scanner.get_pos() }} AFTER optword after_spec {{ x_after_clause.append( (after_spec,optword, after_pos) ) }} )* + CMD {{ cmd_pos = self._scanner.get_pos() }} + cmdname {{ cmd_name=cmdname; script=cmdname; x_after_clause = [ ] }} + [ RUN string {{ script = string[1:-1]; script_type='r' }} + | LOCAL string {{ script = string[1:-1]; script_type='l' }} + ] + ( {{ after_pos = self._scanner.get_pos() }} + AFTER optword after_spec {{ x_after_clause.append( (after_spec, optword, after_pos) ) }} + )* {{ return ( cmd_name, script, script_type, x_after_clause, cmd_pos ) }} # in the AFTER clause, you can say OPT to mean the node is optional (not an error if it does not exist) |