List Replicator

Description

A construct that replicates its contents (textually) at parse time. Each replication assigns a different value from a user-provided list to the specified variable (similar to a foreach loop). This can be used, for example, to generate a Stimulus Group of images by using the replicator variable as the path to each image file.

Filenames Directive

The value list can include one or more items of the form filenames(glob_pat), where glob_pat is a glob pattern, similar to those used in Unix shell commands. The glob pattern must match the names of one or more files. Both absolute and relative paths are acceptable. If the pattern matches no files, the parser raises an error.

When the replicator is evaluated, each filenames directive is expanded into a comma-separated list of matching file names. For example, if you have five image files named img1.png to img5.png, then the following value lists are all equivalent:

  • img1.png, img2.png, img3.png, img4.png, img5.png

  • filenames(*.png)

  • filenames(img?.png)

  • filenames(img[12].png), img3.png, filenames(img[!1-3].png)

Signature

list_replicator

Required Parameters

variable

Replicator variable. The variable must have local scope.

values

Comma-separated list of values to assign to variable, one per replication