jssm 5.112.3 → 5.113.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +3 -3
  2. package/dist/deno/README.md +347 -0
  3. package/dist/deno/jssm.js +1 -0
  4. package/dist/{es6 → deno}/jssm_constants.d.ts +5 -0
  5. package/dist/{es6 → deno}/jssm_types.d.ts +298 -5
  6. package/dist/jssm.es5.cjs +1 -1
  7. package/dist/jssm.es5.iife.js +1 -1
  8. package/dist/jssm.es6.mjs +1 -1
  9. package/dist/jssm_viz.cjs +1 -1
  10. package/dist/jssm_viz.iife.cjs +1 -1
  11. package/dist/jssm_viz.mjs +1 -1
  12. package/jssm.es5.d.cts +241 -2
  13. package/jssm.es6.d.ts +241 -2
  14. package/jssm_viz.es5.d.cts +216 -2
  15. package/jssm_viz.es6.d.ts +216 -2
  16. package/package.json +18 -2
  17. package/.clocignore +0 -1
  18. package/.codeclimate.yml +0 -22
  19. package/.editorconfig +0 -12
  20. package/.eslintrc +0 -20
  21. package/.gitattributes +0 -17
  22. package/.log-progress.json +0 -9
  23. package/.nycrc +0 -6
  24. package/.travis.yml +0 -9
  25. package/CHANGELOG.md +0 -263
  26. package/CLAUDE.md +0 -11
  27. package/dist/es6/fsl_parser.js +0 -1
  28. package/dist/es6/jssm.js +0 -3320
  29. package/dist/es6/jssm_arrow.js +0 -211
  30. package/dist/es6/jssm_compiler.js +0 -380
  31. package/dist/es6/jssm_constants.js +0 -121
  32. package/dist/es6/jssm_error.js +0 -47
  33. package/dist/es6/jssm_theme.js +0 -24
  34. package/dist/es6/jssm_types.js +0 -3
  35. package/dist/es6/jssm_util.js +0 -337
  36. package/dist/es6/jssm_viz.js +0 -560
  37. package/dist/es6/jssm_viz_colors.js +0 -63
  38. package/dist/es6/themes/jssm_base_stylesheet.d.ts +0 -11
  39. package/dist/es6/themes/jssm_base_stylesheet.js +0 -58
  40. package/dist/es6/themes/jssm_theme_bold.d.ts +0 -11
  41. package/dist/es6/themes/jssm_theme_bold.js +0 -58
  42. package/dist/es6/themes/jssm_theme_default.d.ts +0 -11
  43. package/dist/es6/themes/jssm_theme_default.js +0 -58
  44. package/dist/es6/themes/jssm_theme_modern.d.ts +0 -11
  45. package/dist/es6/themes/jssm_theme_modern.js +0 -58
  46. package/dist/es6/themes/jssm_theme_ocean.d.ts +0 -11
  47. package/dist/es6/themes/jssm_theme_ocean.js +0 -56
  48. package/dist/es6/themes/jssm_theme_plain.d.ts +0 -11
  49. package/dist/es6/themes/jssm_theme_plain.js +0 -70
  50. package/dist/es6/version.js +0 -2
  51. package/dist/jssm.es5.nonmin.cjs +0 -24506
  52. package/dist/jssm.es6.nonmin.cjs +0 -24473
  53. package/dist/jssm_viz.es5.iife.nonmin.cjs +0 -24679
  54. package/dist/jssm_viz.es5.nonmin.cjs +0 -24674
  55. package/dist/jssm_viz.es6.nonmin.cjs +0 -24661
  56. package/jest-dragon.config.cjs +0 -36
  57. package/jest-spec.config.cjs +0 -36
  58. package/jest-stoch.config.cjs +0 -36
  59. package/jest-unicode.config.cjs +0 -36
  60. package/log-progress.data.json +0 -28
  61. package/rollup.config.deno.js +0 -44
  62. package/rollup.config.es5.js +0 -52
  63. package/rollup.config.es6.js +0 -55
  64. package/rollup.config.viz.es5.js +0 -46
  65. package/rollup.config.viz.es6.js +0 -46
  66. package/rollup.config.viz.iife.js +0 -36
  67. package/tutorial_learn_testing.md +0 -168
  68. package/typedoc-options.cjs +0 -69
  69. /package/dist/{es6 → deno}/fsl_parser.d.ts +0 -0
  70. /package/dist/{es6 → deno}/jssm.d.ts +0 -0
  71. /package/dist/{es6 → deno}/jssm_arrow.d.ts +0 -0
  72. /package/dist/{es6 → deno}/jssm_compiler.d.ts +0 -0
  73. /package/dist/{es6 → deno}/jssm_error.d.ts +0 -0
  74. /package/dist/{es6 → deno}/jssm_theme.d.ts +0 -0
  75. /package/dist/{es6 → deno}/jssm_util.d.ts +0 -0
  76. /package/dist/{es6 → deno}/jssm_viz.d.ts +0 -0
  77. /package/dist/{es6 → deno}/jssm_viz_colors.d.ts +0 -0
  78. /package/dist/{es6 → deno}/version.d.ts +0 -0
@@ -1,211 +0,0 @@
1
- import { JssmError } from './jssm_error';
2
- /* eslint-disable complexity */
3
- /*********
4
- *
5
- * Return the direction of an arrow - `right`, `left`, or `both`.
6
- *
7
- * ```typescript
8
- * import { arrow_direction } from 'jssm';
9
- *
10
- * arrow_direction('->'); // 'right'
11
- * arrow_direction('<~=>'); // 'both'
12
- * ```
13
- *
14
- * @param arrow The arrow to be evaluated
15
- *
16
- */
17
- function arrow_direction(arrow) {
18
- switch (String(arrow)) {
19
- case '->':
20
- case '→':
21
- case '=>':
22
- case '⇒':
23
- case '~>':
24
- case '↛':
25
- return 'right';
26
- case '<-':
27
- case '←':
28
- case '<=':
29
- case '⇐':
30
- case '<~':
31
- case '↚':
32
- return 'left';
33
- case '<->':
34
- case '↔':
35
- case '<-=>':
36
- case '←⇒':
37
- case '←=>':
38
- case '<-⇒':
39
- case '<-~>':
40
- case '←↛':
41
- case '←~>':
42
- case '<-↛':
43
- case '<=>':
44
- case '⇔':
45
- case '<=->':
46
- case '⇐→':
47
- case '⇐->':
48
- case '<=→':
49
- case '<=~>':
50
- case '⇐↛':
51
- case '⇐~>':
52
- case '<=↛':
53
- case '<~>':
54
- case '↮':
55
- case '<~->':
56
- case '↚→':
57
- case '↚->':
58
- case '<~→':
59
- case '<~=>':
60
- case '↚⇒':
61
- case '↚=>':
62
- case '<~⇒':
63
- return 'both';
64
- default:
65
- throw new JssmError(undefined, `arrow_direction: unknown arrow type ${arrow}`);
66
- }
67
- }
68
- /* eslint-enable complexity */
69
- /* eslint-disable complexity */
70
- /*********
71
- *
72
- * Return the direction of an arrow - `right`, `left`, or `both`.
73
- *
74
- * ```typescript
75
- * import { arrow_left_kind } from 'jssm';
76
- *
77
- * arrow_left_kind('<-'); // 'legal'
78
- * arrow_left_kind('<='); // 'main'
79
- * arrow_left_kind('<~'); // 'forced'
80
- * arrow_left_kind('<->'); // 'legal'
81
- * arrow_left_kind('->'); // 'none'
82
- * ```
83
- *
84
- * @param arrow The arrow to be evaluated
85
- *
86
- */
87
- function arrow_left_kind(arrow) {
88
- switch (String(arrow)) {
89
- case '->':
90
- case '→':
91
- case '=>':
92
- case '⇒':
93
- case '~>':
94
- case '↛':
95
- return 'none';
96
- case '<-':
97
- case '←':
98
- case '<->':
99
- case '↔':
100
- case '<-=>':
101
- case '←⇒':
102
- case '←=>':
103
- case '<-⇒':
104
- case '<-~>':
105
- case '←↛':
106
- case '←~>':
107
- case '<-↛':
108
- return 'legal';
109
- case '<=':
110
- case '⇐':
111
- case '<=>':
112
- case '⇔':
113
- case '<=->':
114
- case '⇐→':
115
- case '⇐->':
116
- case '<=→':
117
- case '<=~>':
118
- case '⇐↛':
119
- case '⇐~>':
120
- case '<=↛':
121
- return 'main';
122
- case '<~':
123
- case '↚':
124
- case '<~>':
125
- case '↮':
126
- case '<~->':
127
- case '↚→':
128
- case '↚->':
129
- case '<~→':
130
- case '<~=>':
131
- case '↚⇒':
132
- case '↚=>':
133
- case '<~⇒':
134
- return 'forced';
135
- default:
136
- throw new JssmError(undefined, `arrow_direction: unknown arrow type ${arrow}`);
137
- }
138
- }
139
- /* eslint-enable complexity */
140
- /* eslint-disable complexity */
141
- /*********
142
- *
143
- * Return the direction of an arrow - `right`, `left`, or `both`.
144
- *
145
- * ```typescript
146
- * import { arrow_left_kind } from 'jssm';
147
- *
148
- * arrow_left_kind('->'); // 'legal'
149
- * arrow_left_kind('=>'); // 'main'
150
- * arrow_left_kind('~>'); // 'forced'
151
- * arrow_left_kind('<->'); // 'legal'
152
- * arrow_left_kind('<-'); // 'none'
153
- * ```
154
- *
155
- * @param arrow The arrow to be evaluated
156
- *
157
- */
158
- function arrow_right_kind(arrow) {
159
- switch (String(arrow)) {
160
- case '<-':
161
- case '←':
162
- case '<=':
163
- case '⇐':
164
- case '<~':
165
- case '↚':
166
- return 'none';
167
- case '->':
168
- case '→':
169
- case '<->':
170
- case '↔':
171
- case '<=->':
172
- case '⇐→':
173
- case '⇐->':
174
- case '<=→':
175
- case '<~->':
176
- case '↚→':
177
- case '↚->':
178
- case '<~→':
179
- return 'legal';
180
- case '=>':
181
- case '⇒':
182
- case '<=>':
183
- case '⇔':
184
- case '<-=>':
185
- case '←⇒':
186
- case '←=>':
187
- case '<-⇒':
188
- case '<~=>':
189
- case '↚⇒':
190
- case '↚=>':
191
- case '<~⇒':
192
- return 'main';
193
- case '~>':
194
- case '↛':
195
- case '<~>':
196
- case '↮':
197
- case '<-~>':
198
- case '←↛':
199
- case '←~>':
200
- case '<-↛':
201
- case '<=~>':
202
- case '⇐↛':
203
- case '⇐~>':
204
- case '<=↛':
205
- return 'forced';
206
- default:
207
- throw new JssmError(undefined, `arrow_direction: unknown arrow type ${arrow}`);
208
- }
209
- }
210
- /* eslint-enable complexity */
211
- export { arrow_direction, arrow_left_kind, arrow_right_kind };
@@ -1,380 +0,0 @@
1
- import { JssmError } from './jssm_error';
2
- import { parse } from './fsl_parser';
3
- import { arrow_left_kind, arrow_right_kind } from './jssm_arrow';
4
- import { find_repeated, name_bind_prop_and_state } from './jssm_util';
5
- import { reduce as reduce_to_639 } from 'reduce-to-639-1';
6
- /*********
7
- *
8
- * Internal method meant to perform factory assembly of an edge. Not meant for
9
- * external use. Constructs a {@link JssmTransition} from a parsed
10
- * semi-edge (`this_se`), a source state, a target state, and directionality.
11
- *
12
- * @internal
13
- *
14
- * @typeparam StateType The type of state names (usually `string`).
15
- * @typeparam mDT The type of the machine data member; usually omitted.
16
- *
17
- * @param this_se - The parsed semi-edge containing kind, action, and
18
- * probability metadata.
19
- * @param from - The source state of the transition.
20
- * @param to - The target state of the transition.
21
- * @param isRight - `true` if this is a left-to-right transition, `false`
22
- * for right-to-left. Determines which arrow kind
23
- * extraction function is used.
24
- * @param _wasList - If the transition was expanded from a list (e.g.
25
- * `[A B C] -> D`), the original list of states.
26
- * @param _wasIndex - The index of `from` within `_wasList`, if applicable.
27
- *
28
- * @returns A fully assembled {@link JssmTransition} edge object.
29
- *
30
- */
31
- function makeTransition(this_se, from, to, isRight, _wasList, _wasIndex) {
32
- const kind = isRight
33
- ? arrow_right_kind(this_se.kind)
34
- : arrow_left_kind(this_se.kind), edge = {
35
- from,
36
- to,
37
- kind,
38
- after_time: isRight ? this_se.r_after : this_se.l_after,
39
- forced_only: kind === 'forced',
40
- main_path: kind === 'main'
41
- };
42
- // if ((wasList !== undefined) && (wasIndex === undefined)) { throw new JssmError(undefined, `Must have an index if transition was in a list"); }
43
- // if ((wasIndex !== undefined) && (wasList === undefined)) { throw new JssmError(undefined, `Must be in a list if transition has an index"); }
44
- /*
45
- if (typeof edge.to === 'object') {
46
-
47
- if (edge.to.key === 'cycle') {
48
- if (wasList === undefined) { throw new JssmError(undefined, "Must have a waslist if a to is type cycle"); }
49
- const nextIndex = wrapBy(wasIndex, edge.to.value, wasList.length);
50
- edge.to = wasList[nextIndex];
51
- }
52
-
53
- }
54
- */
55
- const action = isRight ? 'r_action' : 'l_action', probability = isRight ? 'r_probability' : 'l_probability';
56
- if (this_se[action]) {
57
- edge.action = this_se[action];
58
- }
59
- if (this_se[probability]) {
60
- edge.probability = this_se[probability];
61
- }
62
- return edge;
63
- }
64
- /*********
65
- *
66
- * This method wraps the parser call that comes from the peg grammar,
67
- * {@link parse}. Generally neither this nor that should be used directly
68
- * unless you mean to develop plugins or extensions for the machine.
69
- *
70
- * Parses the intermediate representation of a compiled string down to a
71
- * machine configuration object. If you're using this (probably don't,) you're
72
- * probably also using {@link compile} and {@link Machine.constructor}.
73
- *
74
- * ```typescript
75
- * import { parse, compile, Machine } from 'jssm';
76
- *
77
- * const intermediate = wrap_parse('a -> b;', {});
78
- * // [ {key:'transition', from:'a', se:{kind:'->',to:'b'}} ]
79
- *
80
- * const cfg = compile(intermediate);
81
- * // { start_states:['a'], transitions: [{ from:'a', to:'b', kind:'legal', forced_only:false, main_path:false }] }
82
- *
83
- * const machine = new Machine(cfg);
84
- * // Machine { _instance_name: undefined, _state: 'a', ...
85
- * ```
86
- *
87
- * This method is mostly for plugin and intermediate tool authors, or people
88
- * who need to work with the machine's intermediate representation.
89
- *
90
- * # Hey!
91
- *
92
- * Most people looking at this want either the `sm` operator or method `from`,
93
- * which perform all the steps in the chain. The library's author mostly uses
94
- * operator `sm`, and mostly falls back to `.from` when needing to parse
95
- * strings dynamically instead of from template literals.
96
- *
97
- * Operator {@link sm}:
98
- *
99
- * ```typescript
100
- * import { sm } from 'jssm';
101
- *
102
- * const lswitch = sm`on <=> off;`;
103
- * ```
104
- *
105
- * Method {@link from}:
106
- *
107
- * ```typescript
108
- * import * as jssm from 'jssm';
109
- *
110
- * const toggle = jssm.from('up <=> down;');
111
- * ```
112
- *
113
- * `wrap_parse` itself is an internal convenience method for alting out an
114
- * object as the options call. Not generally meant for external use.
115
- *
116
- * @param input The FSL code to be evaluated
117
- *
118
- * @param options Things to control about the instance
119
- *
120
- */
121
- function wrap_parse(input, options) {
122
- return parse(input, options || {});
123
- }
124
- /*********
125
- *
126
- * Internal method performing one step in compiling rules for transitions. Not
127
- * generally meant for external use.
128
- *
129
- * @internal
130
- *
131
- * @typeparam mDT The type of the machine data member; usually omitted
132
- *
133
- */
134
- function compile_rule_transition_step(acc, from, to, this_se, next_se) {
135
- const edges = [];
136
- const uFrom = (Array.isArray(from) ? from : [from]), uTo = (Array.isArray(to) ? to : [to]);
137
- uFrom.map((f) => {
138
- uTo.map((t) => {
139
- const right = makeTransition(this_se, f, t, true);
140
- if (right.kind !== 'none') {
141
- edges.push(right);
142
- }
143
- const left = makeTransition(this_se, t, f, false);
144
- if (left.kind !== 'none') {
145
- edges.push(left);
146
- }
147
- });
148
- });
149
- const new_acc = acc.concat(edges);
150
- if (next_se) {
151
- return compile_rule_transition_step(new_acc, to, next_se.to, next_se, next_se.se);
152
- }
153
- else {
154
- return new_acc;
155
- }
156
- }
157
- /*********
158
- *
159
- * Internal method performing one step in compiling rules for transitions. Not
160
- * generally meant for external use.
161
- *
162
- * @internal
163
- *
164
- */
165
- function compile_rule_handle_transition(rule) {
166
- return compile_rule_transition_step([], rule.from, rule.se.to, rule.se, rule.se.se);
167
- }
168
- /*********
169
- *
170
- * Internal method performing one step in compiling rules for transitions. Not
171
- * generally meant for external use.
172
- *
173
- * @internal
174
- *
175
- */
176
- function compile_rule_handler(rule) {
177
- if (rule.key === 'transition') {
178
- return { agg_as: 'transition', val: compile_rule_handle_transition(rule) };
179
- }
180
- if (rule.key === 'machine_language') {
181
- return { agg_as: 'machine_language', val: reduce_to_639(rule.value) };
182
- }
183
- // manually rehandled to make `undefined` as a property safe
184
- if (rule.key === 'property_definition') {
185
- const ret = { agg_as: 'property_definition', val: { name: rule.name } };
186
- if (rule.hasOwnProperty('default_value')) {
187
- ret.val.default_value = rule.default_value;
188
- }
189
- if (rule.hasOwnProperty('required')) {
190
- ret.val.required = rule.required;
191
- }
192
- return ret;
193
- }
194
- // state properties are in here
195
- if (rule.key === 'state_declaration') {
196
- if (!rule.name) {
197
- throw new JssmError(undefined, 'State declarations must have a name');
198
- }
199
- return { agg_as: 'state_declaration', val: { state: rule.name, declarations: rule.value } };
200
- }
201
- if (['arrange_declaration', 'arrange_start_declaration',
202
- 'arrange_end_declaration'].includes(rule.key)) {
203
- return { agg_as: rule.key, val: [rule.value] };
204
- }
205
- // things that can only exist once and are just a value under their own name
206
- const tautologies = [
207
- 'graph_layout', 'start_states', 'end_states', 'machine_name', 'machine_version',
208
- 'machine_comment', 'machine_author', 'machine_contributor', 'machine_definition',
209
- 'machine_reference', 'machine_license', 'fsl_version', 'state_config', 'theme',
210
- 'flow', 'dot_preamble', 'allows_override', 'default_state_config',
211
- 'default_start_state_config', 'default_end_state_config',
212
- 'default_hooked_state_config', 'default_active_state_config',
213
- 'default_terminal_state_config'
214
- ];
215
- if (tautologies.includes(rule.key)) {
216
- return { agg_as: rule.key, val: rule.value };
217
- }
218
- throw new JssmError(undefined, `compile_rule_handler: Unknown rule: ${JSON.stringify(rule)}`);
219
- }
220
- /*********
221
- *
222
- * Compile a machine's JSON intermediate representation to a config object. If
223
- * you're using this (probably don't,) you're probably also using
224
- * {@link parse} to get the IR, and the object constructor
225
- * {@link Machine.construct} to turn the config object into a workable machine.
226
- *
227
- * ```typescript
228
- * import { parse, compile, Machine } from 'jssm';
229
- *
230
- * const intermediate = parse('a -> b;');
231
- * // [ {key:'transition', from:'a', se:{kind:'->',to:'b'}} ]
232
- *
233
- * const cfg = compile(intermediate);
234
- * // { start_states:['a'], transitions: [{ from:'a', to:'b', kind:'legal', forced_only:false, main_path:false }] }
235
- *
236
- * const machine = new Machine(cfg);
237
- * // Machine { _instance_name: undefined, _state: 'a', ...
238
- * ```
239
- *
240
- * This method is mostly for plugin and intermediate tool authors, or people
241
- * who need to work with the machine's intermediate representation.
242
- *
243
- * # Hey!
244
- *
245
- * Most people looking at this want either the `sm` operator or method `from`,
246
- * which perform all the steps in the chain. The library's author mostly uses
247
- * operator `sm`, and mostly falls back to `.from` when needing to parse
248
- * strings dynamically instead of from template literals.
249
- *
250
- * Operator {@link sm}:
251
- *
252
- * ```typescript
253
- * import { sm } from 'jssm';
254
- *
255
- * const lswitch = sm`on <=> off;`;
256
- * ```
257
- *
258
- * Method {@link from}:
259
- *
260
- * ```typescript
261
- * import * as jssm from 'jssm';
262
- *
263
- * const toggle = jssm.from('up <=> down;');
264
- * ```
265
- *
266
- * @typeparam mDT The type of the machine data member; usually omitted
267
- *
268
- * @param tree The parse tree to be boiled down into a machine config
269
- *
270
- */
271
- function compile(tree) {
272
- const results = {
273
- graph_layout: [],
274
- transition: [],
275
- start_states: [],
276
- end_states: [],
277
- state_config: [],
278
- state_declaration: [],
279
- fsl_version: [],
280
- machine_author: [],
281
- machine_comment: [],
282
- machine_contributor: [],
283
- machine_definition: [],
284
- machine_language: [],
285
- machine_license: [],
286
- machine_name: [],
287
- machine_reference: [],
288
- property_definition: [],
289
- state_property: {},
290
- theme: [],
291
- flow: [],
292
- dot_preamble: [],
293
- arrange_declaration: [],
294
- arrange_start_declaration: [],
295
- arrange_end_declaration: [],
296
- machine_version: [],
297
- default_state_config: [],
298
- default_active_state_config: [],
299
- default_hooked_state_config: [],
300
- default_terminal_state_config: [],
301
- default_start_state_config: [],
302
- default_end_state_config: [],
303
- allows_override: []
304
- };
305
- tree.map((tr) => {
306
- const rule = compile_rule_handler(tr), agg_as = rule.agg_as, val = rule.val; // TODO FIXME no any
307
- results[agg_as] = results[agg_as].concat(val);
308
- });
309
- const property_keys = results['property_definition'].map(pd => pd.name), repeat_props = find_repeated(property_keys);
310
- if (repeat_props.length) {
311
- throw new JssmError(undefined, `Cannot repeat property definitions. Saw ${JSON.stringify(repeat_props)}`);
312
- }
313
- const assembled_transitions = [].concat(...results['transition']);
314
- const result_cfg = {
315
- start_states: results.start_states.length ? results.start_states : [assembled_transitions[0].from],
316
- end_states: results.end_states,
317
- transitions: assembled_transitions,
318
- state_property: [],
319
- };
320
- const oneOnlyKeys = [
321
- 'graph_layout', 'machine_name', 'machine_version', 'machine_comment',
322
- 'fsl_version', 'machine_license', 'machine_definition', 'machine_language',
323
- 'flow', 'dot_preamble', 'allows_override'
324
- ];
325
- oneOnlyKeys.map((oneOnlyKey) => {
326
- if (results[oneOnlyKey].length > 1) {
327
- throw new JssmError(undefined, `May only have one ${oneOnlyKey} statement maximum: ${JSON.stringify(results[oneOnlyKey])}`);
328
- }
329
- else {
330
- if (results[oneOnlyKey].length) {
331
- result_cfg[oneOnlyKey] = results[oneOnlyKey][0];
332
- }
333
- }
334
- });
335
- ['arrange_declaration', 'arrange_start_declaration', 'arrange_end_declaration',
336
- 'machine_author', 'machine_contributor', 'machine_reference', 'theme',
337
- 'state_declaration', 'property_definition', 'default_state_config',
338
- 'default_start_state_config', 'default_end_state_config',
339
- 'default_hooked_state_config', 'default_terminal_state_config',
340
- 'default_active_state_config'].map((multiKey) => {
341
- if (results[multiKey].length) {
342
- result_cfg[multiKey] = results[multiKey];
343
- }
344
- });
345
- // re-walk state declarations, already wrapped up, to get state properties,
346
- // which go out in a different datastructure
347
- results.state_declaration.forEach(sd => {
348
- sd.declarations.forEach(decl => {
349
- if (decl.key === 'state_property') {
350
- const label = name_bind_prop_and_state(decl.name, sd.state);
351
- if (result_cfg.state_property.findIndex(c => c.name === label) !== -1) {
352
- throw new JssmError(undefined, `A state may only bind a property once (${sd.state} re-binds ${decl.name})`);
353
- }
354
- else {
355
- result_cfg.state_property.push({ name: label, default_value: decl.value });
356
- }
357
- }
358
- });
359
- });
360
- return result_cfg;
361
- }
362
- /*********
363
- *
364
- * An internal convenience wrapper for parsing then compiling a machine string.
365
- * Not generally meant for external use. Please see {@link compile} or
366
- * {@link sm}.
367
- *
368
- * @typeparam mDT The type of the machine data member; usually omitted
369
- *
370
- * @param plan The FSL code to be evaluated and built into a machine config
371
- *
372
- */
373
- function make(plan) {
374
- return compile(wrap_parse(plan));
375
- }
376
- export { compile,
377
- // compile_rule_handler,
378
- // compile_rule_transition_step,
379
- // compile_rule_handle_transition,
380
- make, makeTransition, wrap_parse };