Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions src/main/antlr/ScriptParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,6 @@ pathElement

// method call expression (with closure)
| closure #closurePathExprAlt
| closureWithLabels #closureWithLabelsPathExprAlt

// method call expression
| arguments #argumentsPathExprAlt
Expand Down Expand Up @@ -561,19 +560,6 @@ formalParameter
: DEF? type? ELLIPSIS? identifier (nls ASSIGN nls expression)?
;

closureWithLabels
: LBRACE (nls (formalParameterList nls)? ARROW)? nls blockStatementsWithLabels RBRACE
;

blockStatementsWithLabels
: statementOrLabeled (sep statementOrLabeled)* sep?
;

statementOrLabeled
: identifier COLON nls statement
| statement
;

// -- list expression
list
: LBRACK nls expressionList? COMMA? nls RBRACK
Expand Down
25 changes: 0 additions & 25 deletions src/main/groovy/nextflow/script/v2/ScriptAstBuilder.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -832,11 +832,6 @@ class ScriptAstBuilder {
return ast( pathClosureElement(expression, closure), expression, ctx )
}

if( ctx instanceof ClosureWithLabelsPathExprAltContext ) {
final closure = closureWithLabels(ctx.closureWithLabels())
return ast( pathClosureElement(expression, closure), expression, ctx )
}

if( ctx instanceof ArgumentsPathExprAltContext )
return ast( pathArgumentsElement(expression, ctx.arguments()), expression, ctx )

Expand Down Expand Up @@ -1137,26 +1132,6 @@ class ScriptAstBuilder {
ast( closureX(params, code), ctx )
}

private Expression closureWithLabels(ClosureWithLabelsContext ctx) {
final params = parameters(ctx.formalParameterList())
final code = blockStatementsWithLabels(ctx.blockStatementsWithLabels())
ast( closureX(params, code), ctx )
}

private BlockStatement blockStatementsWithLabels(BlockStatementsWithLabelsContext ctx) {
final statements = ctx.statementOrLabeled().collect( this.&statementOrLabeled )
ast( block(new VariableScope(), statements), ctx )
}

private Statement statementOrLabeled(StatementOrLabeledContext ctx) {
final result = statement(ctx.statement())
if( ctx.identifier() ) {
final label = identifier(ctx.identifier())
result.addStatementLabel(label)
}
return result
}

private Expression list(ListContext ctx) {
if( ctx.COMMA() && !ctx.expressionList() )
throw createParsingFailedException("Empty list literal should not contain any comma(,)", ctx.COMMA())
Expand Down