capdag 0.106.243 → 0.119.263

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.
package/machine-parser.js CHANGED
@@ -174,13 +174,15 @@ function peg$parse(input, options) {
174
174
  const peg$c6 = "-";
175
175
  const peg$c7 = ">";
176
176
  const peg$c8 = "cap:";
177
- const peg$c9 = "\"";
178
- const peg$c10 = "\\\"";
179
- const peg$c11 = "\\\\";
177
+ const peg$c9 = "\r\n";
178
+ const peg$c10 = "\"";
179
+ const peg$c11 = "\\\"";
180
+ const peg$c12 = "\\\\";
180
181
 
181
182
  const peg$r0 = /^[a-zA-Z_]/;
182
183
  const peg$r1 = /^[a-zA-Z0-9_\-]/;
183
- const peg$r2 = /^[ \t\r\n]/;
184
+ const peg$r2 = /^[\n\r]/;
185
+ const peg$r3 = /^[ \t\r\n]/;
184
186
 
185
187
  const peg$e0 = peg$literalExpectation("[", false);
186
188
  const peg$e1 = peg$literalExpectation("]", false);
@@ -194,29 +196,33 @@ function peg$parse(input, options) {
194
196
  const peg$e9 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_", "-"], false, false, false);
195
197
  const peg$e10 = peg$literalExpectation("cap:", false);
196
198
  const peg$e11 = peg$anyExpectation();
197
- const peg$e12 = peg$literalExpectation("\"", false);
198
- const peg$e13 = peg$literalExpectation("\\\"", false);
199
- const peg$e14 = peg$literalExpectation("\\\\", false);
200
- const peg$e15 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false, false);
201
- const peg$e16 = peg$otherExpectation("required whitespace");
199
+ const peg$e12 = peg$otherExpectation("newline");
200
+ const peg$e13 = peg$literalExpectation("\r\n", false);
201
+ const peg$e14 = peg$classExpectation(["\n", "\r"], false, false, false);
202
+ const peg$e15 = peg$literalExpectation("\"", false);
203
+ const peg$e16 = peg$literalExpectation("\\\"", false);
204
+ const peg$e17 = peg$literalExpectation("\\\\", false);
205
+ const peg$e18 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false, false);
206
+ const peg$e19 = peg$otherExpectation("required whitespace");
202
207
 
203
208
  function peg$f0(stmts) { return stmts; }
204
209
  function peg$f1(inner) { return inner; }
205
- function peg$f2(a, c) {
210
+ function peg$f2(inner) { return inner; }
211
+ function peg$f3(a, c) {
206
212
  return { type: 'header', alias: a.value, capUrn: c.value, location: location(), aliasLocation: a.location, capUrnLocation: c.location };
207
213
  }
208
- function peg$f3(s, lc, t) {
214
+ function peg$f4(s, lc, t) {
209
215
  return { type: 'wiring', sources: s.values, capAlias: lc.alias, isLoop: lc.isLoop, target: t.value, location: location(), sourceLocations: s.locations, capAliasLocation: lc.location, targetLocation: t.location };
210
216
  }
211
- function peg$f4(a) { return { values: [a.value], locations: [a.location] }; }
212
- function peg$f5(first, a) { return a; }
213
- function peg$f6(first, rest) {
217
+ function peg$f5(a) { return { values: [a.value], locations: [a.location] }; }
218
+ function peg$f6(first, a) { return a; }
219
+ function peg$f7(first, rest) {
214
220
  return { values: [first.value, ...rest.map(r => r.value)], locations: [first.location, ...rest.map(r => r.location)] };
215
221
  }
216
- function peg$f7(a) { return { alias: a.value, isLoop: true, location: a.location }; }
217
- function peg$f8(a) { return { alias: a.value, isLoop: false, location: a.location }; }
218
- function peg$f9(a) { return { value: a, location: location() }; }
219
- function peg$f10(c) { return { value: c, location: location() }; }
222
+ function peg$f8(a) { return { alias: a.value, isLoop: true, location: a.location }; }
223
+ function peg$f9(a) { return { alias: a.value, isLoop: false, location: a.location }; }
224
+ function peg$f10(a) { return { value: a, location: location() }; }
225
+ function peg$f11(c) { return { value: c, location: location() }; }
220
226
  let peg$currPos = options.peg$currPos | 0;
221
227
  let peg$savedPos = peg$currPos;
222
228
  const peg$posDetailsCache = [{ line: 1, column: 1 }];
@@ -444,6 +450,18 @@ function peg$parse(input, options) {
444
450
  peg$currPos = s0;
445
451
  s0 = peg$FAILED;
446
452
  }
453
+ if (s0 === peg$FAILED) {
454
+ s0 = peg$currPos;
455
+ s1 = peg$parseinner();
456
+ if (s1 !== peg$FAILED) {
457
+ s2 = peg$parse_();
458
+ peg$savedPos = s0;
459
+ s0 = peg$f2(s1);
460
+ } else {
461
+ peg$currPos = s0;
462
+ s0 = peg$FAILED;
463
+ }
464
+ }
447
465
 
448
466
  return s0;
449
467
  }
@@ -470,7 +488,7 @@ function peg$parse(input, options) {
470
488
  s3 = peg$parsecap_urn_loc();
471
489
  if (s3 !== peg$FAILED) {
472
490
  peg$savedPos = s0;
473
- s0 = peg$f2(s1, s3);
491
+ s0 = peg$f3(s1, s3);
474
492
  } else {
475
493
  peg$currPos = s0;
476
494
  s0 = peg$FAILED;
@@ -506,7 +524,7 @@ function peg$parse(input, options) {
506
524
  s9 = peg$parsealias_loc();
507
525
  if (s9 !== peg$FAILED) {
508
526
  peg$savedPos = s0;
509
- s0 = peg$f3(s1, s5, s9);
527
+ s0 = peg$f4(s1, s5, s9);
510
528
  } else {
511
529
  peg$currPos = s0;
512
530
  s0 = peg$FAILED;
@@ -549,7 +567,7 @@ function peg$parse(input, options) {
549
567
  s1 = peg$parsealias_loc();
550
568
  if (s1 !== peg$FAILED) {
551
569
  peg$savedPos = s0;
552
- s1 = peg$f4(s1);
570
+ s1 = peg$f5(s1);
553
571
  }
554
572
  s0 = s1;
555
573
 
@@ -585,7 +603,7 @@ function peg$parse(input, options) {
585
603
  s8 = peg$parsealias_loc();
586
604
  if (s8 !== peg$FAILED) {
587
605
  peg$savedPos = s5;
588
- s5 = peg$f5(s3, s8);
606
+ s5 = peg$f6(s3, s8);
589
607
  } else {
590
608
  peg$currPos = s5;
591
609
  s5 = peg$FAILED;
@@ -610,7 +628,7 @@ function peg$parse(input, options) {
610
628
  s8 = peg$parsealias_loc();
611
629
  if (s8 !== peg$FAILED) {
612
630
  peg$savedPos = s5;
613
- s5 = peg$f5(s3, s8);
631
+ s5 = peg$f6(s3, s8);
614
632
  } else {
615
633
  peg$currPos = s5;
616
634
  s5 = peg$FAILED;
@@ -634,7 +652,7 @@ function peg$parse(input, options) {
634
652
  }
635
653
  if (s6 !== peg$FAILED) {
636
654
  peg$savedPos = s0;
637
- s0 = peg$f6(s3, s4);
655
+ s0 = peg$f7(s3, s4);
638
656
  } else {
639
657
  peg$currPos = s0;
640
658
  s0 = peg$FAILED;
@@ -672,7 +690,7 @@ function peg$parse(input, options) {
672
690
  s3 = peg$parsealias_loc();
673
691
  if (s3 !== peg$FAILED) {
674
692
  peg$savedPos = s0;
675
- s0 = peg$f7(s3);
693
+ s0 = peg$f8(s3);
676
694
  } else {
677
695
  peg$currPos = s0;
678
696
  s0 = peg$FAILED;
@@ -690,7 +708,7 @@ function peg$parse(input, options) {
690
708
  s1 = peg$parsealias_loc();
691
709
  if (s1 !== peg$FAILED) {
692
710
  peg$savedPos = s0;
693
- s1 = peg$f8(s1);
711
+ s1 = peg$f9(s1);
694
712
  }
695
713
  s0 = s1;
696
714
  }
@@ -754,7 +772,7 @@ function peg$parse(input, options) {
754
772
  s1 = peg$parsealias();
755
773
  if (s1 !== peg$FAILED) {
756
774
  peg$savedPos = s0;
757
- s1 = peg$f9(s1);
775
+ s1 = peg$f10(s1);
758
776
  }
759
777
  s0 = s1;
760
778
 
@@ -814,7 +832,7 @@ function peg$parse(input, options) {
814
832
  s1 = peg$parsecap_urn();
815
833
  if (s1 !== peg$FAILED) {
816
834
  peg$savedPos = s0;
817
- s1 = peg$f10(s1);
835
+ s1 = peg$f11(s1);
818
836
  }
819
837
  s0 = s1;
820
838
 
@@ -856,7 +874,7 @@ function peg$parse(input, options) {
856
874
  }
857
875
 
858
876
  function peg$parsecap_urn_body() {
859
- let s0, s1, s2;
877
+ let s0, s1, s2, s3;
860
878
 
861
879
  s0 = peg$parsequoted_value();
862
880
  if (s0 === peg$FAILED) {
@@ -878,16 +896,31 @@ function peg$parse(input, options) {
878
896
  s1 = peg$FAILED;
879
897
  }
880
898
  if (s1 !== peg$FAILED) {
881
- if (input.length > peg$currPos) {
882
- s2 = input.charAt(peg$currPos);
883
- peg$currPos++;
899
+ s2 = peg$currPos;
900
+ peg$silentFails++;
901
+ s3 = peg$parseNL();
902
+ peg$silentFails--;
903
+ if (s3 === peg$FAILED) {
904
+ s2 = undefined;
884
905
  } else {
906
+ peg$currPos = s2;
885
907
  s2 = peg$FAILED;
886
- if (peg$silentFails === 0) { peg$fail(peg$e11); }
887
908
  }
888
909
  if (s2 !== peg$FAILED) {
889
- s1 = [s1, s2];
890
- s0 = s1;
910
+ if (input.length > peg$currPos) {
911
+ s3 = input.charAt(peg$currPos);
912
+ peg$currPos++;
913
+ } else {
914
+ s3 = peg$FAILED;
915
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
916
+ }
917
+ if (s3 !== peg$FAILED) {
918
+ s1 = [s1, s2, s3];
919
+ s0 = s1;
920
+ } else {
921
+ peg$currPos = s0;
922
+ s0 = peg$FAILED;
923
+ }
891
924
  } else {
892
925
  peg$currPos = s0;
893
926
  s0 = peg$FAILED;
@@ -901,44 +934,73 @@ function peg$parse(input, options) {
901
934
  return s0;
902
935
  }
903
936
 
937
+ function peg$parseNL() {
938
+ let s0, s1;
939
+
940
+ peg$silentFails++;
941
+ if (input.substr(peg$currPos, 2) === peg$c9) {
942
+ s0 = peg$c9;
943
+ peg$currPos += 2;
944
+ } else {
945
+ s0 = peg$FAILED;
946
+ if (peg$silentFails === 0) { peg$fail(peg$e13); }
947
+ }
948
+ if (s0 === peg$FAILED) {
949
+ s0 = input.charAt(peg$currPos);
950
+ if (peg$r2.test(s0)) {
951
+ peg$currPos++;
952
+ } else {
953
+ s0 = peg$FAILED;
954
+ if (peg$silentFails === 0) { peg$fail(peg$e14); }
955
+ }
956
+ }
957
+ peg$silentFails--;
958
+ if (s0 === peg$FAILED) {
959
+ s1 = peg$FAILED;
960
+ if (peg$silentFails === 0) { peg$fail(peg$e12); }
961
+ }
962
+
963
+ return s0;
964
+ }
965
+
904
966
  function peg$parsequoted_value() {
905
967
  let s0, s1, s2, s3, s4, s5;
906
968
 
907
969
  s0 = peg$currPos;
908
970
  if (input.charCodeAt(peg$currPos) === 34) {
909
- s1 = peg$c9;
971
+ s1 = peg$c10;
910
972
  peg$currPos++;
911
973
  } else {
912
974
  s1 = peg$FAILED;
913
- if (peg$silentFails === 0) { peg$fail(peg$e12); }
975
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
914
976
  }
915
977
  if (s1 !== peg$FAILED) {
916
978
  s2 = [];
917
- if (input.substr(peg$currPos, 2) === peg$c10) {
918
- s3 = peg$c10;
979
+ if (input.substr(peg$currPos, 2) === peg$c11) {
980
+ s3 = peg$c11;
919
981
  peg$currPos += 2;
920
982
  } else {
921
983
  s3 = peg$FAILED;
922
- if (peg$silentFails === 0) { peg$fail(peg$e13); }
984
+ if (peg$silentFails === 0) { peg$fail(peg$e16); }
923
985
  }
924
986
  if (s3 === peg$FAILED) {
925
- if (input.substr(peg$currPos, 2) === peg$c11) {
926
- s3 = peg$c11;
987
+ if (input.substr(peg$currPos, 2) === peg$c12) {
988
+ s3 = peg$c12;
927
989
  peg$currPos += 2;
928
990
  } else {
929
991
  s3 = peg$FAILED;
930
- if (peg$silentFails === 0) { peg$fail(peg$e14); }
992
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
931
993
  }
932
994
  if (s3 === peg$FAILED) {
933
995
  s3 = peg$currPos;
934
996
  s4 = peg$currPos;
935
997
  peg$silentFails++;
936
998
  if (input.charCodeAt(peg$currPos) === 34) {
937
- s5 = peg$c9;
999
+ s5 = peg$c10;
938
1000
  peg$currPos++;
939
1001
  } else {
940
1002
  s5 = peg$FAILED;
941
- if (peg$silentFails === 0) { peg$fail(peg$e12); }
1003
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
942
1004
  }
943
1005
  peg$silentFails--;
944
1006
  if (s5 === peg$FAILED) {
@@ -970,31 +1032,31 @@ function peg$parse(input, options) {
970
1032
  }
971
1033
  while (s3 !== peg$FAILED) {
972
1034
  s2.push(s3);
973
- if (input.substr(peg$currPos, 2) === peg$c10) {
974
- s3 = peg$c10;
1035
+ if (input.substr(peg$currPos, 2) === peg$c11) {
1036
+ s3 = peg$c11;
975
1037
  peg$currPos += 2;
976
1038
  } else {
977
1039
  s3 = peg$FAILED;
978
- if (peg$silentFails === 0) { peg$fail(peg$e13); }
1040
+ if (peg$silentFails === 0) { peg$fail(peg$e16); }
979
1041
  }
980
1042
  if (s3 === peg$FAILED) {
981
- if (input.substr(peg$currPos, 2) === peg$c11) {
982
- s3 = peg$c11;
1043
+ if (input.substr(peg$currPos, 2) === peg$c12) {
1044
+ s3 = peg$c12;
983
1045
  peg$currPos += 2;
984
1046
  } else {
985
1047
  s3 = peg$FAILED;
986
- if (peg$silentFails === 0) { peg$fail(peg$e14); }
1048
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
987
1049
  }
988
1050
  if (s3 === peg$FAILED) {
989
1051
  s3 = peg$currPos;
990
1052
  s4 = peg$currPos;
991
1053
  peg$silentFails++;
992
1054
  if (input.charCodeAt(peg$currPos) === 34) {
993
- s5 = peg$c9;
1055
+ s5 = peg$c10;
994
1056
  peg$currPos++;
995
1057
  } else {
996
1058
  s5 = peg$FAILED;
997
- if (peg$silentFails === 0) { peg$fail(peg$e12); }
1059
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
998
1060
  }
999
1061
  peg$silentFails--;
1000
1062
  if (s5 === peg$FAILED) {
@@ -1026,11 +1088,11 @@ function peg$parse(input, options) {
1026
1088
  }
1027
1089
  }
1028
1090
  if (input.charCodeAt(peg$currPos) === 34) {
1029
- s3 = peg$c9;
1091
+ s3 = peg$c10;
1030
1092
  peg$currPos++;
1031
1093
  } else {
1032
1094
  s3 = peg$FAILED;
1033
- if (peg$silentFails === 0) { peg$fail(peg$e12); }
1095
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
1034
1096
  }
1035
1097
  if (s3 !== peg$FAILED) {
1036
1098
  s1 = [s1, s2, s3];
@@ -1053,20 +1115,20 @@ function peg$parse(input, options) {
1053
1115
  peg$silentFails++;
1054
1116
  s0 = [];
1055
1117
  s1 = input.charAt(peg$currPos);
1056
- if (peg$r2.test(s1)) {
1118
+ if (peg$r3.test(s1)) {
1057
1119
  peg$currPos++;
1058
1120
  } else {
1059
1121
  s1 = peg$FAILED;
1060
- if (peg$silentFails === 0) { peg$fail(peg$e15); }
1122
+ if (peg$silentFails === 0) { peg$fail(peg$e18); }
1061
1123
  }
1062
1124
  while (s1 !== peg$FAILED) {
1063
1125
  s0.push(s1);
1064
1126
  s1 = input.charAt(peg$currPos);
1065
- if (peg$r2.test(s1)) {
1127
+ if (peg$r3.test(s1)) {
1066
1128
  peg$currPos++;
1067
1129
  } else {
1068
1130
  s1 = peg$FAILED;
1069
- if (peg$silentFails === 0) { peg$fail(peg$e15); }
1131
+ if (peg$silentFails === 0) { peg$fail(peg$e18); }
1070
1132
  }
1071
1133
  }
1072
1134
  peg$silentFails--;
@@ -1080,21 +1142,21 @@ function peg$parse(input, options) {
1080
1142
  peg$silentFails++;
1081
1143
  s0 = [];
1082
1144
  s1 = input.charAt(peg$currPos);
1083
- if (peg$r2.test(s1)) {
1145
+ if (peg$r3.test(s1)) {
1084
1146
  peg$currPos++;
1085
1147
  } else {
1086
1148
  s1 = peg$FAILED;
1087
- if (peg$silentFails === 0) { peg$fail(peg$e15); }
1149
+ if (peg$silentFails === 0) { peg$fail(peg$e18); }
1088
1150
  }
1089
1151
  if (s1 !== peg$FAILED) {
1090
1152
  while (s1 !== peg$FAILED) {
1091
1153
  s0.push(s1);
1092
1154
  s1 = input.charAt(peg$currPos);
1093
- if (peg$r2.test(s1)) {
1155
+ if (peg$r3.test(s1)) {
1094
1156
  peg$currPos++;
1095
1157
  } else {
1096
1158
  s1 = peg$FAILED;
1097
- if (peg$silentFails === 0) { peg$fail(peg$e15); }
1159
+ if (peg$silentFails === 0) { peg$fail(peg$e18); }
1098
1160
  }
1099
1161
  }
1100
1162
  } else {
@@ -1103,7 +1165,7 @@ function peg$parse(input, options) {
1103
1165
  peg$silentFails--;
1104
1166
  if (s0 === peg$FAILED) {
1105
1167
  s1 = peg$FAILED;
1106
- if (peg$silentFails === 0) { peg$fail(peg$e16); }
1168
+ if (peg$silentFails === 0) { peg$fail(peg$e19); }
1107
1169
  }
1108
1170
 
1109
1171
  return s0;
package/package.json CHANGED
@@ -40,5 +40,5 @@
40
40
  "pretest": "npm run build:parser",
41
41
  "test": "node capdag.test.js"
42
42
  },
43
- "version": "0.106.243"
43
+ "version": "0.119.263"
44
44
  }