Johannes Köster avatar Johannes Köster committed 72d51de

Properly raise a SyntaxError if multiple shell keywords appear in one rule.

Comments (0)

Files changed (2)

snakemake/exceptions.py

         logger.critical(format_error(
             ex, ex.lineno, linemaps=linemaps, snakefile=ex.filename,
             show_traceback=print_traceback))
-    if isinstance(ex, TokenError):
+    elif isinstance(ex, TokenError):
         logger.critical(format_error(
             ex, None,
             show_traceback=print_traceback))

snakemake/parser.py

         if is_name(token):
             try:
                 if token.string == "run" or token.string == "shell":
+                    if self.run:
+                        raise self.error("Multiple run or shell keywords in rule {}.".format(self.rulename), token)
                     self.run = True
                 for t in self.subautomaton(
                     token.string,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.