Skip to content

Commit

Permalink
update regex
Browse files Browse the repository at this point in the history
  • Loading branch information
mzuenni authored and RagnarGrootKoerkamp committed May 18, 2024
1 parent 2709bc9 commit 006b53e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions support/schemas/generators.cue
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import "struct"

// A command invokes a generator, like "tree --n 5".
// The regex restricts occurrences of curly-bracketed expressions
// to things like "tree --random --seed {seed:5}"
command: !="" & (=~"^[^{}]*(\\{seed(:[0-9]+)?\\}[^{}]*)*$")
// to things like "tree --random --seed {seed:5} {name} {count}"
// - {seed} can occure at most once
// - {name} and {count} can occure any number of times
command: !="" & (=~"^([^{}]|\\{name\\}|\\{count\\})*(\\{seed(:[0-9]+)?\\})?([^{}]|\\{name\\}|\\{count\\})*$")

#config: {
"testdata.yaml"?: #testdata_settings
Expand Down
4 changes: 2 additions & 2 deletions support/schemas/generators_yaml_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
"/visualizers/vis --large"
],
"type": "string",
"pattern": "^/[^{}]*(\\{seed(:[0-9]+)?\\}[^{}]*)*$"
"pattern": "^([^{}]|\\{name\\})*$"
},
"random_salt": {
"title": "Random Salt",
Expand All @@ -190,7 +190,7 @@
"description": "Invocation of a generator to create this testcase",
"examples": ["forest --n 40 --connected", "path.cpp 20", "random {seed}"],
"type": "string",
"pattern": "^[^{}]*(\\{seed(:[0-9]+)?\\}[^{}]*)*$"
"pattern": "^([^{}]|\\{name\\}|\\{count\\})*(\\{seed(:[0-9]+)?\\})?([^{}]|\\{name\\}|\\{count\\})*$"
},
"slashedfilepath": {
"type": "string",
Expand Down

0 comments on commit 006b53e

Please sign in to comment.