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
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,13 @@ class ConfigValidator {
names.clear()

if( value instanceof Map ) {
log.debug "validate config block ${names}"
if( isSelector(key) )
names.removeLast()
log.debug " is map option ${isMapOption(names)}"
if( isMapOption(names) )
continue
validate(value, names)
}
else {
log.debug "validate config option ${names}"
validateOption(names)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ class ConfigDsl extends Script {
if( names.size() == 1 && names.first() == 'plugins' )
return new PluginsDsl(this)

if( names.size() == 1 && names.first() == 'process' )
final relativeNames = names.size() == 3 && names.first() == 'profiles'
? List.of(names.last())
: names

if( relativeNames.size() == 1 && relativeNames.last() == 'process' )
return new ProcessDsl(this, names)

if( names.size() == 1 && names.first() == 'profiles' )
Expand Down
2 changes: 1 addition & 1 deletion modules/nf-lang/src/main/antlr/ConfigParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ configBlockStatement
;

configSelector
: kind=Identifier COLON target=configPrimary nls LBRACE nls (configAssign (sep configAssign)* sep?)? RBRACE
: kind=Identifier COLON target=configPrimary nls LBRACE nls (configBlockStatement (sep configBlockStatement)* sep?)? RBRACE
;

// -- config "apply" block (e.g. plugins)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ else if( ctx instanceof ConfigInvalidBlockStmtAltContext ciac ) {
private ConfigStatement configSelector(ConfigSelectorContext ctx) {
var kind = ctx.kind.getText();
var target = configPrimary(ctx.target);
var statements = ctx.configAssign().stream()
.map(this::configAssign)
var statements = ctx.configBlockStatement().stream()
.map(this::configBlockStatement)
.toList();
return new ConfigBlockNode(kind, target, statements);
}
Expand Down
1 change: 1 addition & 0 deletions tests/checks/.IGNORE-PARSER-V2
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ eval-out-typed.nf
nullable-path.nf
output-dsl.nf
params-dsl.nf
task-ext-block.nf
topic-channel-typed.nf
type-annotations.nf
workflow-oncomplete-v2.nf
7 changes: 7 additions & 0 deletions tests/checks/task-ext-block.nf/.checks
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set -e

echo ''
$NXF_RUN -c ../../task-ext-block.config -profile test | tee stdout

grep 'FOO: \[foo:foo\]' stdout
grep 'BAR: \[bar:bar\]' stdout
22 changes: 22 additions & 0 deletions tests/task-ext-block.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

profiles {
test {
process {
withName:'FOO' {
ext {
foo = 'foo'
}
}
withName:'BAR' {
ext {
bar = 'bar'
}
}
withName:'DOES_NOT_MATCH_ANYTHING' {
ext {
test = 'test'
}
}
}
}
}
15 changes: 15 additions & 0 deletions tests/task-ext-block.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

workflow {
FOO()
BAR()
}

process FOO {
exec:
println "FOO: ${task.ext}"
}

process BAR {
exec:
println "BAR: ${task.ext}"
}
Loading