Skip to content

Commit 3dea501

Browse files
committed
feat(RFC): An expression language for format strings
This is a set of 3 RFCs to propose an expression language to use in template format strings based on a subset of the Python language. The three proposals are: RFC 5 - Expression Language RFC 6 - Expression Function Library RFC 7 - Extended Parameter Types Signed-off-by: Mark <399551+mwiebe@users.noreply.github.com>
1 parent 7180f7f commit 3dea501

301 files changed

Lines changed: 14300 additions & 70 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
specificationVersion: jobtemplate-2023-09
2+
extensions:
3+
- EXPR
4+
name: TestJob
5+
parameterDefinitions:
6+
- name: MyInt
7+
type: int
8+
- name: MyFloat
9+
type: Float
10+
- name: MyString
11+
type: STRING
12+
- name: MyPath
13+
type: pAtH
14+
- name: MyBool
15+
type: Bool
16+
default: true
17+
- name: MyRangeExpr
18+
type: range_expr
19+
default: "1-10"
20+
- name: MyListString
21+
type: "list[string]"
22+
default: ["a", "b"]
23+
- name: MyListInt
24+
type: "List[Int]"
25+
default: [1, 2]
26+
- name: MyListFloat
27+
type: "LIST[float]"
28+
default: [1.0, 2.0]
29+
- name: MyListPath
30+
type: "list[PATH]"
31+
default: ["/tmp/a", "/tmp/b"]
32+
- name: MyListBool
33+
type: "List[Bool]"
34+
default: [true, false]
35+
- name: MyListListInt
36+
type: "list[list[int]]"
37+
default: [[1, 2], [3]]
38+
steps:
39+
- name: Step1
40+
script:
41+
actions:
42+
onRun:
43+
command: python
44+
args:
45+
- "-c"
46+
- "print()"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
specificationVersion: jobtemplate-2023-09
2+
extensions:
3+
- EXPR
4+
name: TestJob
5+
parameterDefinitions:
6+
- name: Frames
7+
type: RANGE_EXPR
8+
default: "not-a-range"
9+
steps:
10+
- name: Step1
11+
script:
12+
actions:
13+
onRun:
14+
command: python
15+
args:
16+
- "-c"
17+
- "print()"
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
specificationVersion: jobtemplate-2023-09
2+
extensions:
3+
- EXPR
4+
name: TestJob
5+
parameterDefinitions:
6+
# Single values
7+
- name: SinglePositive
8+
type: RANGE_EXPR
9+
default: "42"
10+
- name: SingleZero
11+
type: RANGE_EXPR
12+
default: "0"
13+
- name: SingleNegative
14+
type: RANGE_EXPR
15+
default: "-100"
16+
# Simple ranges
17+
- name: SimpleRange
18+
type: RANGE_EXPR
19+
default: "1-100"
20+
- name: NegativeRange
21+
type: RANGE_EXPR
22+
default: "-10-10"
23+
# Ranges with step
24+
- name: RangeWithStep
25+
type: RANGE_EXPR
26+
default: "0-100:10"
27+
- name: RangeStepNotEvenlyDivide
28+
type: RANGE_EXPR
29+
default: "1-9:3"
30+
- name: NegativeStep
31+
type: RANGE_EXPR
32+
default: "10-1:-1"
33+
- name: NegativeRangeNegativeStep
34+
type: RANGE_EXPR
35+
default: "-1--10:-1"
36+
# Comma-separated values
37+
- name: CommaSeparated
38+
type: RANGE_EXPR
39+
default: "1,3,5,7"
40+
# Mixed ranges and values
41+
- name: MixedRangesAndValues
42+
type: RANGE_EXPR
43+
default: "1-10,20-30:2,42"
44+
# Multiple ranges
45+
- name: MultipleRanges
46+
type: RANGE_EXPR
47+
default: "0-3:3,5-10:5,12,13,14,15"
48+
# Ranges out of order (parser normalizes)
49+
- name: OutOfOrder
50+
type: RANGE_EXPR
51+
default: "20-29,0-9,10-19"
52+
# Whitespace (parser ignores)
53+
- name: WithWhitespace
54+
type: RANGE_EXPR
55+
default: " 0 - 1 : 1, 2 - 100 : 1"
56+
# Large values
57+
- name: LargeValues
58+
type: RANGE_EXPR
59+
default: "9999999"
60+
# UI controls
61+
- name: WithLineEdit
62+
type: RANGE_EXPR
63+
default: "1-10"
64+
userInterface:
65+
control: LINE_EDIT
66+
label: Frame Range
67+
- name: WithHidden
68+
type: RANGE_EXPR
69+
default: "1-10"
70+
userInterface:
71+
control: HIDDEN
72+
# Length constraints
73+
- name: WithLengthConstraints
74+
type: RANGE_EXPR
75+
default: "1-100"
76+
minLength: 1
77+
maxLength: 1024
78+
steps:
79+
- name: Step1
80+
script:
81+
actions:
82+
onRun:
83+
command: python
84+
args:
85+
- "-c"
86+
- "print()"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
specificationVersion: jobtemplate-2023-09
2+
extensions:
3+
- EXPR
4+
name: TestJob
5+
parameterDefinitions:
6+
- name: Items
7+
type: LIST[STRING]
8+
default: ["x"]
9+
item:
10+
allowedValues: ["a", "b", "c"]
11+
steps:
12+
- name: Step1
13+
script:
14+
actions:
15+
onRun:
16+
command: python
17+
args:
18+
- "-c"
19+
- "print()"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
specificationVersion: jobtemplate-2023-09
2+
extensions:
3+
- EXPR
4+
name: TestJob
5+
parameterDefinitions:
6+
- name: Items
7+
type: LIST[STRING]
8+
default: ["abcdef"]
9+
item:
10+
maxLength: 3
11+
steps:
12+
- name: Step1
13+
script:
14+
actions:
15+
onRun:
16+
command: python
17+
args:
18+
- "-c"
19+
- "print()"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
specificationVersion: jobtemplate-2023-09
2+
extensions:
3+
- EXPR
4+
name: TestJob
5+
parameterDefinitions:
6+
- name: Items
7+
type: LIST[STRING]
8+
default: [""]
9+
item:
10+
minLength: 1
11+
steps:
12+
- name: Step1
13+
script:
14+
actions:
15+
onRun:
16+
command: python
17+
args:
18+
- "-c"
19+
- "print()"
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
specificationVersion: jobtemplate-2023-09
2+
extensions:
3+
- EXPR
4+
name: TestJob
5+
parameterDefinitions:
6+
# Minimal
7+
- name: Minimal
8+
type: LIST[STRING]
9+
# With default
10+
- name: WithDefault
11+
type: LIST[STRING]
12+
default: ["a", "b", "c"]
13+
# Empty default
14+
- name: EmptyDefault
15+
type: LIST[STRING]
16+
default: []
17+
# Single element
18+
- name: SingleElement
19+
type: LIST[STRING]
20+
default: ["only"]
21+
# Long list
22+
- name: LongList
23+
type: LIST[STRING]
24+
default: ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t"]
25+
# Length constraints
26+
- name: WithMinMax
27+
type: LIST[STRING]
28+
default: ["a", "b"]
29+
minLength: 1
30+
maxLength: 50
31+
# Min only
32+
- name: MinOnly
33+
type: LIST[STRING]
34+
default: ["a"]
35+
minLength: 0
36+
# Max only
37+
- name: MaxOnly
38+
type: LIST[STRING]
39+
default: ["a", "b", "c"]
40+
maxLength: 100
41+
# Item constraints - allowedValues
42+
- name: ItemAllowed
43+
type: LIST[STRING]
44+
default: ["alpha", "beta"]
45+
item:
46+
allowedValues: ["alpha", "beta", "gamma"]
47+
# Item constraints - string length
48+
- name: ItemLength
49+
type: LIST[STRING]
50+
default: ["hi", "bye"]
51+
item:
52+
minLength: 1
53+
maxLength: 10
54+
# Both list and item constraints
55+
- name: FullyConstrained
56+
type: LIST[STRING]
57+
default: ["hello", "world"]
58+
minLength: 1
59+
maxLength: 5
60+
item:
61+
allowedValues: ["hello", "world", "foo"]
62+
minLength: 3
63+
maxLength: 5
64+
# Description
65+
- name: WithDescription
66+
type: LIST[STRING]
67+
default: ["x"]
68+
description: A list of string values
69+
# UI controls
70+
- name: WithLineEditList
71+
type: LIST[STRING]
72+
default: ["a"]
73+
userInterface:
74+
control: LINE_EDIT_LIST
75+
label: Items
76+
groupLabel: Options
77+
- name: WithHidden
78+
type: LIST[STRING]
79+
default: ["a"]
80+
userInterface:
81+
control: HIDDEN
82+
steps:
83+
- name: Step1
84+
script:
85+
actions:
86+
onRun:
87+
command: python
88+
args:
89+
- "-c"
90+
- "print()"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
specificationVersion: jobtemplate-2023-09
2+
extensions:
3+
- EXPR
4+
name: TestJob
5+
parameterDefinitions:
6+
- name: Items
7+
type: LIST[STRING]
8+
default: notalist
9+
steps:
10+
- name: Step1
11+
script:
12+
actions:
13+
onRun:
14+
command: python
15+
args:
16+
- "-c"
17+
- "print()"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
specificationVersion: jobtemplate-2023-09
2+
extensions:
3+
- EXPR
4+
name: TestJob
5+
parameterDefinitions:
6+
- name: Items
7+
type: LIST[STRING]
8+
default: ["a", "b", "c"]
9+
maxLength: 2
10+
steps:
11+
- name: Step1
12+
script:
13+
actions:
14+
onRun:
15+
command: python
16+
args:
17+
- "-c"
18+
- "print()"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
specificationVersion: jobtemplate-2023-09
2+
extensions:
3+
- EXPR
4+
name: TestJob
5+
parameterDefinitions:
6+
- name: Items
7+
type: LIST[STRING]
8+
default: []
9+
minLength: 1
10+
steps:
11+
- name: Step1
12+
script:
13+
actions:
14+
onRun:
15+
command: python
16+
args:
17+
- "-c"
18+
- "print()"

0 commit comments

Comments
 (0)