forked from cucumber/gherkin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdialects_builtin.go.jq
111 lines (111 loc) · 3 KB
/
dialects_builtin.go.jq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
. as $root
| (
[ to_entries[]
| [
"\t",(.key|@json),": &Dialect{\n",
"\t\t", (.key|@json),", ", (.value.name|@json),", ", (.value.native|@json), ", map[string][]string{\n"
] + (
[ .value
| {"feature","rule","background","scenario","scenarioOutline","examples","given","when","then","and","but"}
| to_entries[]
| "\t\t\t"+(.key), ": {\n",
([ .value[] | "\t\t\t\t", @json, ",\n" ]|add),
"\t\t\t},\n"
]
) + [
"\t\t},\n",
"\t\tmap[string]messages.StepKeywordType{\n"
] + (
[ .value.given
| (
[ .[] | select(. != "* ") |
"\t\t\t",
@json,
": messages.StepKeywordType_CONTEXT",
",\n\n"
] | add
),
""
]
+
[ .value.when
| (
[ .[] | select(. != "* ") |
"\t\t\t",
@json,
": messages.StepKeywordType_ACTION",
",\n\n"
] | add
),
""
]
+
[ .value.then
| (
[ .[] | select(. != "* ") |
"\t\t\t",
@json,
": messages.StepKeywordType_OUTCOME",
",\n\n"
] | add
),
""
]
+
[ .value.and
| (
[ .[] | select(. != "* ") |
"\t\t\t",
@json,
": messages.StepKeywordType_CONJUNCTION",
",\n\n"
] | add
),
""
]
+
[ .value.but
| (
[ .[] | select(. != "* ") |
"\t\t\t",
@json,
": messages.StepKeywordType_CONJUNCTION",
",\n\n"
] | add
),
""
]
+ [
"\t\t\t\"* \": messages.StepKeywordType_UNKNOWN,\n"
]
) + [
"\t\t}",
"},\n"
]
| add
]
| add
)
| "// Code generated from dialects_builtin.go.jq (make dialects_builtin.go); DO NOT EDIT.\n\n" # Standard header defined at https://golang.org/s/generatedcode
+ "package gherkin\n\n"
+ "import messages \"github.com/cucumber/messages/go/v24\"\n\n"
+ "// Builtin dialects for " + ([ $root | to_entries[] | .key+" ("+.value.name+")" ] | join(", ")) + "\n"
+ "func DialectsBuiltin() DialectProvider {\n"
+ "\treturn builtinDialects\n"
+ "}\n\n"
+ "const (\n"
+ " feature = \"feature\"\n"
+ " rule = \"rule\"\n"
+ " background = \"background\"\n"
+ " scenario = \"scenario\"\n"
+ " scenarioOutline = \"scenarioOutline\"\n"
+ " examples = \"examples\"\n"
+ " given = \"given\"\n"
+ " when = \"when\"\n"
+ " then = \"then\"\n"
+ " and = \"and\"\n"
+ " but = \"but\"\n"
+ ")\n\n"
+ "var builtinDialects = gherkinDialectMap{\n"
+ .
+ "}"