Skip to content

Method with hyphens between quotes fails with in syntax parser v2 #7009

@jorgee

Description

@jorgee

Bug report

When declaring a process with hyphens, it fails because it is not a valid method in groovy. However, when adding it between quotes, it works for syntax parser V1, but not for V2 it fails.

Expected behavior and actual behavior

Both parsers should run the process, or at least this change must be document in the strict syntax.

Steps to reproduce the problem

main.nf

process 'MY-MODULE' {
    input:
    val greeting

    output:
    stdout

    script:
    """
    echo '${greeting}'
    """
}

workflow {
 'MY-MODULE'("hola")
}
$ NXF_SYNTAX_PARSER=v1 nextflow run main.nf

 N E X T F L O W   ~  version 26.03.1-edge

Launching `main.nf` [special_kay] revision: e9bbf97ff2

executor >  local (1)
[08/99abf6] process > MY-MODULE [100%] 1 of 1 ✔

jorgee@PF54MRDZ:~$ NXF_SYNTAX_PARSER=v2 dev_nextflow run main.nf

 N E X T F L O W   ~  version 26.03.1-edge

Launching `main.nf` [serene_kimura] revision: e9bbf97ff2

Error main.nf:5:1: Invalid process definition -- check for missing or out-of-order section labels
│   3 |  */
│   4 | 
│   5 | process 'MY-MODULE' {
│     | ^^^^^^^^^^^^^^^^^^^^^
│   6 |     input:
╰   7 |     val greeting


ERROR ~ Script compilation failed

 -- Check '.nextflow.log' file for details

Program output

Apr-07 15:58:03.862 [main] DEBUG nextflow.Session - Session start
Apr-07 15:58:03.866 [main] DEBUG nextflow.script.ScriptLoaderFactory - Using script parser v2
Apr-07 15:58:03.926 [main] DEBUG nextflow.script.ScriptRunner - Parsed script files:
Apr-07 15:58:03.937 [main] DEBUG n.trace.WorkflowStatsObserver - Workflow completed > WorkflowStats[succeededCount=0; failedCount=0; ignoredCount=0; cachedCount=0; pendingCount=0; submittedCount=0; runningCount=0; retriesCount=0; abortedCount=0; succeedDuration=0ms; failedDuration=0ms; cachedDuration=0ms;loadCpus=0; loadMemory=0; peakRunning=0; peakCpus=0; peakMemory=0; ]
Apr-07 15:58:04.077 [main] ERROR nextflow.cli.Launcher - Script compilation failed
nextflow.exception.ScriptCompilationException: Script compilation failed
        at nextflow.script.parser.v2.ScriptLoaderV2.parse0(ScriptLoaderV2.groovy:129)
        at nextflow.script.parser.v2.ScriptLoaderV2.parse(ScriptLoaderV2.groovy:81)
        at nextflow.script.parser.v2.ScriptLoaderV2.parse(ScriptLoaderV2.groovy)
        at nextflow.script.ScriptRunner.parseScript(ScriptRunner.groovy:215)
        at nextflow.script.ScriptRunner.execute(ScriptRunner.groovy:126)
        at nextflow.cli.CmdRun.run(CmdRun.groovy:441)
        at nextflow.cli.Launcher.run(Launcher.groovy:526)
        at nextflow.cli.Launcher.main(Launcher.groovy:686)
Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Main: 5: Invalid process definition -- check for missing or out-of-order section labels @ line 5, column 1.
   process 'MY-MODULE' {
   ^

1 error

        at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:292)
        at org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:148)
        at nextflow.script.parser.ScriptAstBuilder.collectSyntaxError(ScriptAstBuilder.java:2187)
        at nextflow.script.parser.ScriptAstBuilder.compilationUnit(ScriptAstBuilder.java:230)
        at nextflow.script.parser.ScriptAstBuilder.buildAST(ScriptAstBuilder.java:202)
        at nextflow.script.parser.ScriptParserPlugin.buildAST(ScriptParserPlugin.java:51)
        at org.codehaus.groovy.control.SourceUnit.buildAST(SourceUnit.java:256)
        at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
        at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939)
        at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:631)
        at nextflow.script.parser.v2.ScriptCompiler.compile0(ScriptCompiler.java:146)
        at nextflow.script.parser.v2.ScriptCompiler.compile(ScriptCompiler.java:112)
        at nextflow.script.parser.v2.ScriptLoaderV2.parse0(ScriptLoaderV2.groovy:114)
        ... 7 common frames omitted

Environment

  • Nextflow version: 26.03.1-edge
  • Java version: 24
  • Operating system: Linux, e

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions