jssm 5.44.0 → 5.46.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 (85) hide show
  1. package/dist/es6/jssm.d.ts +6 -1
  2. package/dist/es6/jssm.js +104 -14
  3. package/dist/es6/jssm_types.d.ts +26 -1
  4. package/dist/es6/jssm_util.d.ts +3 -1
  5. package/dist/es6/jssm_util.js +3 -1
  6. package/dist/es6/version.js +1 -1
  7. package/dist/jssm.es5.cjs.js +1 -1
  8. package/jssm.d.ts +6 -1
  9. package/jssm_types.d.ts +26 -1
  10. package/jssm_util.d.ts +3 -1
  11. package/package.json +2 -3
  12. package/.codeclimate.yml +0 -22
  13. package/.editorconfig +0 -12
  14. package/.eslintrc +0 -20
  15. package/.nycrc +0 -6
  16. package/.travis.yml +0 -9
  17. package/dist/jssm.es5.iife.js +0 -1
  18. package/jest-spec.config.js +0 -27
  19. package/jest-stoch.config.js +0 -27
  20. package/rollup.config.iife.js +0 -44
  21. package/rollup.config.js +0 -44
  22. package/src/demo/index.html +0 -38
  23. package/src/demo/style.css +0 -2
  24. package/src/ts/jssm-dot.peg +0 -928
  25. package/src/ts/jssm.ts +0 -1120
  26. package/src/ts/jssm_types.ts +0 -346
  27. package/src/ts/jssm_util.ts +0 -100
  28. package/src/ts/tests/actions.spec.ts +0 -167
  29. package/src/ts/tests/arrange.spec.ts +0 -72
  30. package/src/ts/tests/arrange.stoch.ts +0 -4
  31. package/src/ts/tests/array_box_if_string.spec.ts +0 -30
  32. package/src/ts/tests/array_transitions.spec.ts +0 -129
  33. package/src/ts/tests/arrow unicode.spec.ts +0 -88
  34. package/src/ts/tests/arrow.spec.ts +0 -124
  35. package/src/ts/tests/colors.spec.ts +0 -58
  36. package/src/ts/tests/comment.spec.ts +0 -134
  37. package/src/ts/tests/compile.spec.ts +0 -79
  38. package/src/ts/tests/constants.spec.ts +0 -98
  39. package/src/ts/tests/cycles.spec.ts +0 -153
  40. package/src/ts/tests/dot_preamble.spec.ts +0 -16
  41. package/src/ts/tests/embedded_sm.spec.ts +0 -36
  42. package/src/ts/tests/flow.spec.ts +0 -22
  43. package/src/ts/tests/forced transitions.spec.ts +0 -26
  44. package/src/ts/tests/general.spec.ts +0 -933
  45. package/src/ts/tests/graph node lists.spec.ts +0 -21
  46. package/src/ts/tests/histo.spec.ts +0 -24
  47. package/src/ts/tests/hooks.spec.ts +0 -28
  48. package/src/ts/tests/language.spec.ts +0 -37
  49. package/src/ts/tests/language_data/belarussian.json +0 -14
  50. package/src/ts/tests/language_data/bengali.json +0 -16
  51. package/src/ts/tests/language_data/emoji.json +0 -22
  52. package/src/ts/tests/language_data/english.json +0 -17
  53. package/src/ts/tests/language_data/french.json +0 -17
  54. package/src/ts/tests/language_data/german.json +0 -17
  55. package/src/ts/tests/language_data/hebrew.json +0 -16
  56. package/src/ts/tests/language_data/portuguese.json +0 -13
  57. package/src/ts/tests/language_data/russian.json +0 -13
  58. package/src/ts/tests/language_data/spanish.json +0 -17
  59. package/src/ts/tests/language_data/ukrainian.json +0 -19
  60. package/src/ts/tests/layout.spec.ts +0 -29
  61. package/src/ts/tests/machine_attributes.spec.ts +0 -398
  62. package/src/ts/tests/machine_name.spec.ts +0 -14
  63. package/src/ts/tests/named lists.spec.ts +0 -24
  64. package/src/ts/tests/nominated states.spec.ts +0 -133
  65. package/src/ts/tests/parse actions.spec.ts +0 -32
  66. package/src/ts/tests/parse.spec.ts +0 -94
  67. package/src/ts/tests/probability.spec.ts +0 -146
  68. package/src/ts/tests/r639.spec.ts +0 -27
  69. package/src/ts/tests/sample_select.spec.ts +0 -173
  70. package/src/ts/tests/seq.spec.ts +0 -14
  71. package/src/ts/tests/seq.stoch.ts +0 -83
  72. package/src/ts/tests/shapes.spec.ts +0 -63
  73. package/src/ts/tests/sm_tag.spec.ts +0 -37
  74. package/src/ts/tests/special characters.spec.ts +0 -39
  75. package/src/ts/tests/state_declaration.spec.ts +0 -214
  76. package/src/ts/tests/state_style.spec.ts +0 -82
  77. package/src/ts/tests/stop light.spec.ts +0 -157
  78. package/src/ts/tests/stripes.spec.ts +0 -52
  79. package/src/ts/tests/theme.spec.ts +0 -45
  80. package/src/ts/tests/weighted_histo_key.spec.ts +0 -22
  81. package/src/ts/tests/weighted_rand_select.spec.ts +0 -27
  82. package/src/ts/tests/weighted_sample_select.spec.ts +0 -24
  83. package/src/ts/version.ts +0 -3
  84. package/tree.txt +0 -1794
  85. package/tsconfig.json +0 -27
@@ -1,98 +0,0 @@
1
-
2
- /* In general, this shouldn't import anything, because this is both run and
3
- partially imported by other things. */
4
-
5
- /* We make an exception for arr_uniq_p() from util */
6
-
7
- import { arr_uniq_p } from '../jssm_util';
8
-
9
-
10
-
11
-
12
-
13
- /* constant lists for tests */
14
-
15
- test.todo('These constants should be derived from the source and compared');
16
-
17
- const Shapes = ["box", "polygon", "ellipse", "oval", "circle", "point", "egg", "triangle", "plaintext", "plain",
18
- "diamond", "trapezium", "parallelogram", "house", "pentagon", "hexagon", "septagon", "octagon", "doublecircle",
19
- "doubleoctagon", "tripleoctagon", "invtriangle", "invtrapezium", "invhouse", "Mdiamond", "Msquare", "Mcircle", "rect",
20
- "rectangle", "square", "star", "none", "underline", "cylinder", "note", "tab", "folder", "box3d", "component",
21
- "promoter", "cds", "terminator", "utr", "primersite", "restrictionsite", "fivepoverhang", "threepoverhang",
22
- "noverhang", "assembly", "signature", "insulator", "ribosite", "rnastab", "proteasesite", "proteinstab", "rpromoter",
23
- "rarrow", "larrow", "lpromoter", "record"];
24
-
25
-
26
-
27
-
28
-
29
- const NamedColors = ["AliceBlue", "AntiqueWhite", "Aqua", "Aquamarine", "Azure", "Beige", "Bisque", "Black",
30
- "BlanchedAlmond", "Blue", "BlueViolet", "Brown", "BurlyWood", "CadetBlue", "Chartreuse", "Chocolate", "Coral",
31
- "CornflowerBlue", "Cornsilk", "Crimson", "Cyan", "DarkBlue", "DarkCyan", "DarkGoldenRod", "DarkGray", "DarkGrey",
32
- "DarkGreen", "DarkKhaki", "DarkMagenta", "DarkOliveGreen", "Darkorange", "DarkOrchid", "DarkRed", "DarkSalmon",
33
- "DarkSeaGreen", "DarkSlateBlue", "DarkSlateGray", "DarkSlateGrey", "DarkTurquoise", "DarkViolet", "DeepPink",
34
- "DeepSkyBlue", "DimGray", "DimGrey", "DodgerBlue", "FireBrick", "FloralWhite", "ForestGreen", "Fuchsia", "Gainsboro",
35
- "GhostWhite", "Gold", "GoldenRod", "Gray", "Grey", "Green", "GreenYellow", "HoneyDew", "HotPink", "IndianRed",
36
- "Indigo", "Ivory", "Khaki", "Lavender", "LavenderBlush", "LawnGreen", "LemonChiffon", "LightBlue", "LightCoral",
37
- "LightCyan", "LightGoldenRodYellow", "LightGray", "LightGrey", "LightGreen", "LightPink", "LightSalmon",
38
- "LightSeaGreen", "LightSkyBlue", "LightSlateGray", "LightSlateGrey", "LightSteelBlue", "LightYellow", "Lime",
39
- "LimeGreen", "Linen", "Magenta", "Maroon", "MediumAquaMarine", "MediumBlue", "MediumOrchid", "MediumPurple",
40
- "MediumSeaGreen", "MediumSlateBlue", "MediumSpringGreen", "MediumTurquoise", "MediumVioletRed", "MidnightBlue",
41
- "MintCream", "MistyRose", "Moccasin", "NavajoWhite", "Navy", "OldLace", "Olive", "OliveDrab", "Orange", "OrangeRed",
42
- "Orchid", "PaleGoldenRod", "PaleGreen", "PaleTurquoise", "PaleVioletRed", "PapayaWhip", "PeachPuff", "Peru", "Pink",
43
- "Plum", "PowderBlue", "Purple", "Red", "RosyBrown", "RoyalBlue", "SaddleBrown", "Salmon", "SandyBrown", "SeaGreen",
44
- "SeaShell", "Sienna", "Silver", "SkyBlue", "SlateBlue", "SlateGray", "SlateGrey", "Snow", "SpringGreen", "SteelBlue",
45
- "Tan", "Teal", "Thistle", "Tomato", "Turquoise", "Violet", "Wheat", "White", "WhiteSmoke", "Yellow", "YellowGreen"];
46
-
47
-
48
-
49
-
50
-
51
- const Themes = ['default', 'ocean', 'none', 'modern'],
52
- FlowDirections = ['up','down','left','right'],
53
- LineStyles = ['solid', 'dotted', 'dashed'];
54
-
55
-
56
-
57
-
58
-
59
- // for coverage, and because ava throws on no-test files in its test directory
60
-
61
- describe('Constants test lists', () => {
62
-
63
- const testdata: [ string, string[] ][] = [
64
- [ 'Shapes', Shapes ],
65
- [ 'NamedColors', NamedColors ],
66
- [ 'Themes', Themes ],
67
- [ 'FlowDirections', FlowDirections ]
68
- ];
69
-
70
- testdata.map(datum => {
71
-
72
- test(`List "${datum[0]}" is an array`, () =>
73
- expect( Array.isArray(datum[1]) ).toBe(true) );
74
-
75
- test(`List "${datum[0]}" isn't empty`, () =>
76
- expect( datum[1].length > 1 ).toBe(true) );
77
-
78
- test(`List "${datum[0]}" contains no null, undefined, or holes`, () =>
79
- // eslint-disable-next-line no-eq-null, eqeqeq
80
- expect( datum[1].length == null ).toBe(false) ); // LEAVE THIS DOUBLE-EQUALS
81
-
82
- test(`List "${datum[0]}" contains no empty strings`, () =>
83
- expect( datum[1].every(s => s !== '') ).toBe(true) );
84
-
85
- test(`List "${datum[0]}" contains no repetitions`, () => {
86
- const deduped = datum[1].filter(arr_uniq_p);
87
- expect( datum[1].length ).toBe(deduped.length);
88
- });
89
-
90
- });
91
-
92
- });
93
-
94
-
95
-
96
-
97
-
98
- export { NamedColors, Shapes, Themes, FlowDirections, LineStyles };
@@ -1,153 +0,0 @@
1
-
2
- /* eslint-disable max-len */
3
-
4
- import * as jssm from '../jssm';
5
-
6
-
7
-
8
-
9
-
10
- const testdata = [
11
-
12
- [
13
- 'basic cycle',
14
- '[a b c] -> +1;',
15
- [{from: ['a','b','c'], key: 'transition', se: {kind: '->', to: {key: 'cycle', value: 1}}}]
16
- ],
17
-
18
- [
19
- 'negative cycle',
20
- '[a b c] -> -1;',
21
- [{from: ['a','b','c'], key: 'transition', se: {kind: '->', to: {key: 'cycle', value: -1}}}]
22
- ],
23
-
24
- [
25
- 'nullary cycle',
26
- '[a b c] -> +0;',
27
- [{from: ['a','b','c'], key: 'transition', se: {kind: '->', to: {key: 'cycle', value: 0}}}]
28
- ],
29
-
30
- [
31
- 'wide cycle',
32
- '[a b c] -> +2;',
33
- [{from: ['a','b','c'], key: 'transition', se: {kind: '->', to: {key: 'cycle', value: 2}}}]
34
- ],
35
-
36
- [
37
- 'reverse basic cycle',
38
- '+1 <- [a b c];',
39
- [{from: {key: 'cycle', value: 1}, key: 'transition', se: {kind: '<-', to: ['a','b','c']}}]
40
- ],
41
-
42
- [
43
- 'reverse negative cycle',
44
- '-1 <- [a b c];',
45
- [{from: {key: 'cycle', value: -1}, key: 'transition', se: {kind: '<-', to: ['a','b','c']}}]
46
- ],
47
-
48
- [
49
- 'reverse nullary cycle',
50
- '+0 <- [a b c];',
51
- [{from: {key: 'cycle', value: 0}, key: 'transition', se: {kind: '<-', to: ['a','b','c']}}]
52
- ],
53
-
54
- [
55
- 'reverse wide cycle',
56
- '+2 <- [a b c];',
57
- [{from: {key: 'cycle', value: 2}, key: 'transition', se: {kind: '<-', to: ['a','b','c']}}]
58
- ],
59
-
60
- [
61
- 'bidi basic cycle',
62
- '+1 <- [a b c] -> +1;',
63
- [{from: {key: 'cycle', value: 1}, key: 'transition', se: {kind: '<-', se: {kind: '->', to: {key: 'cycle', value: 1}}, to: ['a','b','c']}}]
64
- ],
65
-
66
- [
67
- 'bidi negative cycle',
68
- '-1 <- [a b c] -> -1;',
69
- [{from: {key: 'cycle', value: -1}, key: 'transition', se: {kind: '<-', se: {kind: '->', to: {key: 'cycle', value: -1}}, to: ['a','b','c']}}]
70
- ],
71
-
72
- [
73
- 'bidi basic/negative cycle',
74
- '+1 <- [a b c] -> -1;',
75
- [{from: {key: 'cycle', value: 1}, key: 'transition', se: {kind: '<-', se: {kind: '->', to: {key: 'cycle', value: -1}}, to: ['a','b','c']}}]
76
- ],
77
-
78
- [
79
- 'bidi nullary cycle',
80
- '+0 <- [a b c] -> +0;',
81
- [{from: {key: 'cycle', value: 0}, key: 'transition', se: {kind: '<-', se: {kind: '->', to: {key: 'cycle', value: 0}}, to: ['a','b','c']}}]
82
- ],
83
-
84
- [
85
- 'bidi wide cycle',
86
- '+2 <- [a b c] -> -2;',
87
- [{from: {key: 'cycle', value: 2}, key: 'transition', se: {kind: '<-', se: {kind: '->', to: {key: 'cycle', value: -2}}, to: ['a','b','c']}}]
88
- ]
89
-
90
- ];
91
-
92
-
93
-
94
-
95
-
96
- describe('cycle strategies', () => {
97
-
98
-
99
- const is_v = (label, str, v) =>
100
- test(`${label} (strategy ${str})`, () =>
101
- expect( jssm.parse(str) ).toEqual(v) );
102
-
103
- testdata.map( ([ label, code, res ]) => is_v(label, code, res) );
104
-
105
- test.todo('cycle full parses');
106
-
107
- /*
108
- describe('full parse of 2-step cycle', () => {
109
- it('[a b] -> +1;', t => t.deepEqual(
110
- sm`[a b] -> +1;`.list_edges(),
111
- [{"from":"a","to":"b","kind":"legal","forced_only":false,"main_path":false},
112
- {"from":"b","to":"a","kind":"legal","forced_only":false,"main_path":false}]
113
- ));
114
- });
115
-
116
- describe('full parse of 5-step cycle', () => {
117
- it('[a b c d e] -> +1;', t => t.deepEqual(
118
- sm`[a b] -> +1;`.list_edges(),
119
- [{"from":"a","to":"b","kind":"legal","forced_only":false,"main_path":false},
120
- {"from":"b","to":"c","kind":"legal","forced_only":false,"main_path":false},
121
- {"from":"c","to":"d","kind":"legal","forced_only":false,"main_path":false},
122
- {"from":"d","to":"e","kind":"legal","forced_only":false,"main_path":false},
123
- {"from":"e","to":"a","kind":"legal","forced_only":false,"main_path":false}]
124
- ));
125
-
126
- describe('full parse of 5-step reverse cycle', () => {
127
- it('[a b c d e] -> -1;', t => t.deepEqual(
128
- sm`[a b] -> +1;`.list_edges(),
129
- [{"from":"a","to":"e","kind":"legal","forced_only":false,"main_path":false},
130
- {"from":"b","to":"a","kind":"legal","forced_only":false,"main_path":false},
131
- {"from":"c","to":"b","kind":"legal","forced_only":false,"main_path":false},
132
- {"from":"d","to":"c","kind":"legal","forced_only":false,"main_path":false},
133
- {"from":"e","to":"d","kind":"legal","forced_only":false,"main_path":false}]
134
- ));
135
- });
136
-
137
- describe('full parse of 5-step two-step cycle (star)', () => {
138
- it('[a b c d e] -> +2;', t => t.deepEqual(
139
- sm`[a b] -> +1;`.list_edges(),
140
- [{"from":"a","to":"c","kind":"legal","forced_only":false,"main_path":false},
141
- {"from":"b","to":"d","kind":"legal","forced_only":false,"main_path":false},
142
- {"from":"c","to":"e","kind":"legal","forced_only":false,"main_path":false},
143
- {"from":"d","to":"a","kind":"legal","forced_only":false,"main_path":false},
144
- {"from":"e","to":"b","kind":"legal","forced_only":false,"main_path":false}]
145
- ));
146
- });
147
- */
148
-
149
- });
150
-
151
- test('illegal fractional cycle throws', () => {
152
- expect( () => jssm.parse('[a b c] -> +2.5;') ).toThrow();
153
- });
@@ -1,16 +0,0 @@
1
-
2
- import { sm } from '../jssm';
3
-
4
-
5
-
6
-
7
-
8
- describe('Dot preamble', () => {
9
-
10
- test(`doesn't throw`, () =>
11
- expect( () => { const _foo = sm`dot_preamble: "x -> y;"; a-> b;`; }).not.toThrow() );
12
-
13
- test('parses correctly', () =>
14
- expect( sm`dot_preamble: "x -> y;"; a-> b;`.dot_preamble() ).toBe('x -> y;') );
15
-
16
- });
@@ -1,36 +0,0 @@
1
-
2
- import { sm } from '../jssm';
3
-
4
-
5
-
6
-
7
-
8
- const testdata = [
9
- 'a -> b;',
10
- 'flow: right; a -> b -> c -> d -> a;'
11
- ];
12
-
13
- const host = sm`x -> y;`;
14
-
15
-
16
-
17
-
18
-
19
- describe('Embedded sm parses the same as regular sm', () => {
20
-
21
- testdata.map(code => {
22
-
23
- test(`Self-match of \`${code}\``, () => {
24
- expect( sm`${code}` ).toEqual( host.sm`${code}` );
25
- });
26
-
27
- });
28
-
29
- });
30
-
31
-
32
-
33
-
34
-
35
- test.todo('Boy is this embedded sm matching thing ever a candidate for stochastics');
36
- // stochable
@@ -1,22 +0,0 @@
1
-
2
- import { FlowDirections } from './constants.spec';
3
- import { sm } from '../jssm';
4
-
5
-
6
-
7
-
8
-
9
- describe('Flow directions', () => {
10
-
11
- FlowDirections.map( thisDir =>
12
- test(`Direction "${thisDir}" parses as a flow direction`, () =>
13
- expect( () => { const _foo = sm`flow: ${thisDir}; a-> b;`; }).not.toThrow() ) );
14
-
15
- FlowDirections.map( thisDir =>
16
- test(`Direction "${thisDir}" parses correctly`, () =>
17
- expect( sm`flow: ${thisDir}; a-> b;`.flow() ).toBe(thisDir) ) );
18
-
19
- test('Fake flow direction throws', () =>
20
- expect( () => { const _foo = sm`flow: yourFlowIsWhackSon; a-> b;`; } ).toThrow() );
21
-
22
- });
@@ -1,26 +0,0 @@
1
-
2
- /* eslint-disable max-len */
3
-
4
- import { sm } from '../jssm';
5
-
6
-
7
-
8
-
9
-
10
- describe('reject and accept correctly', () => {
11
-
12
- const machine = sm` a ~> b -> c; `;
13
-
14
- test('starts in a', () => expect( machine.state() ).toBe('a') );
15
- test('rejects transition to b', () => expect( machine.transition('b') ).toBe(false) );
16
- test('still in a', () => expect( machine.state() ).toBe('a') );
17
- test('rejects transition to c', () => expect( machine.transition('c') ).toBe(false) );
18
- test('still in a 2', () => expect( machine.state() ).toBe('a') );
19
- test('rejects forced transition to c', () => expect( machine.force_transition('c') ).toBe(false) );
20
- test('still in a 3', () => expect( machine.state() ).toBe('a') );
21
- test('accepts forced transition to b', () => expect( machine.force_transition('b') ).toBe(true) );
22
- test('now in b', () => expect( machine.state() ).toBe('b') );
23
- test('accepts transition to c', () => expect( machine.transition('c') ).toBe(true) );
24
- test('now in c', () => expect( machine.state() ).toBe('c') );
25
-
26
- });