Skip to contents

Converts a parser_spec list (as returned by bids_datatype_spec or the internal func_spec() etc.) into a parser object suitable for passing to register_datatype.

Usage

gen_parser(spec, typename = "kind")

Arguments

spec

A parser_spec list with elements keystruc, kinds, and type, as returned by bids_datatype_spec.

typename

The name given to the final type element. Default is "kind".

Value

A regex-based parser object.

Examples

spec <- bids_datatype_spec(
  type     = "dwi",
  entities = c("sub", "ses", "acq", "run"),
  suffixes = list(dwi = c(".nii.gz", ".nii", ".bvec", ".bval", ".json"))
)
parser <- gen_parser(spec)