capdag 1.222.603 → 1.233.649

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
@@ -170,14 +170,13 @@ function peg$parse(input, options) {
170
170
  const peg$c2 = "(";
171
171
  const peg$c3 = ",";
172
172
  const peg$c4 = ")";
173
- const peg$c5 = "LOOP";
174
- const peg$c6 = "-";
175
- const peg$c7 = ">";
176
- const peg$c8 = "cap:";
177
- const peg$c9 = "\r\n";
178
- const peg$c10 = "\"";
179
- const peg$c11 = "\\\"";
180
- const peg$c12 = "\\\\";
173
+ const peg$c5 = "-";
174
+ const peg$c6 = ">";
175
+ const peg$c7 = "cap:";
176
+ const peg$c8 = "\r\n";
177
+ const peg$c9 = "\"";
178
+ const peg$c10 = "\\\"";
179
+ const peg$c11 = "\\\\";
181
180
 
182
181
  const peg$r0 = /^[a-zA-Z_]/;
183
182
  const peg$r1 = /^[a-zA-Z0-9_\-]/;
@@ -189,21 +188,20 @@ function peg$parse(input, options) {
189
188
  const peg$e2 = peg$literalExpectation("(", false);
190
189
  const peg$e3 = peg$literalExpectation(",", false);
191
190
  const peg$e4 = peg$literalExpectation(")", false);
192
- const peg$e5 = peg$literalExpectation("LOOP", false);
193
- const peg$e6 = peg$literalExpectation("-", false);
194
- const peg$e7 = peg$literalExpectation(">", false);
195
- const peg$e8 = peg$classExpectation([["a", "z"], ["A", "Z"], "_"], false, false, false);
196
- const peg$e9 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_", "-"], false, false, false);
197
- const peg$e10 = peg$literalExpectation("cap:", false);
198
- const peg$e11 = peg$anyExpectation();
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");
191
+ const peg$e5 = peg$literalExpectation("-", false);
192
+ const peg$e6 = peg$literalExpectation(">", false);
193
+ const peg$e7 = peg$classExpectation([["a", "z"], ["A", "Z"], "_"], false, false, false);
194
+ const peg$e8 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_", "-"], false, false, false);
195
+ const peg$e9 = peg$literalExpectation("cap:", false);
196
+ const peg$e10 = peg$anyExpectation();
197
+ const peg$e11 = peg$otherExpectation("newline");
198
+ const peg$e12 = peg$literalExpectation("\r\n", false);
199
+ const peg$e13 = peg$classExpectation(["\n", "\r"], false, false, false);
200
+ const peg$e14 = peg$literalExpectation("\"", false);
201
+ const peg$e15 = peg$literalExpectation("\\\"", false);
202
+ const peg$e16 = peg$literalExpectation("\\\\", false);
203
+ const peg$e17 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false, false);
204
+ const peg$e18 = peg$otherExpectation("required whitespace");
207
205
 
208
206
  function peg$f0(stmts) { return stmts; }
209
207
  function peg$f1(inner) { return inner; }
@@ -211,18 +209,16 @@ function peg$parse(input, options) {
211
209
  function peg$f3(a, c) {
212
210
  return { type: 'header', alias: a.value, capUrn: c.value, location: location(), aliasLocation: a.location, capUrnLocation: c.location };
213
211
  }
214
- function peg$f4(s, lc, t) {
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 };
212
+ function peg$f4(s, c, t) {
213
+ return { type: 'wiring', sources: s.values, capAlias: c.value, target: t.value, location: location(), sourceLocations: s.locations, capAliasLocation: c.location, targetLocation: t.location };
216
214
  }
217
215
  function peg$f5(a) { return { values: [a.value], locations: [a.location] }; }
218
216
  function peg$f6(first, a) { return a; }
219
217
  function peg$f7(first, rest) {
220
218
  return { values: [first.value, ...rest.map(r => r.value)], locations: [first.location, ...rest.map(r => r.location)] };
221
219
  }
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
+ function peg$f8(a) { return { value: a, location: location() }; }
221
+ function peg$f9(c) { return { value: c, location: location() }; }
226
222
  let peg$currPos = options.peg$currPos | 0;
227
223
  let peg$savedPos = peg$currPos;
228
224
  const peg$posDetailsCache = [{ line: 1, column: 1 }];
@@ -515,7 +511,7 @@ function peg$parse(input, options) {
515
511
  s3 = peg$parsearrow();
516
512
  if (s3 !== peg$FAILED) {
517
513
  s4 = peg$parse_();
518
- s5 = peg$parseloop_cap_loc();
514
+ s5 = peg$parsealias_loc();
519
515
  if (s5 !== peg$FAILED) {
520
516
  s6 = peg$parse_();
521
517
  s7 = peg$parsearrow();
@@ -673,70 +669,27 @@ function peg$parse(input, options) {
673
669
  return s0;
674
670
  }
675
671
 
676
- function peg$parseloop_cap_loc() {
677
- let s0, s1, s2, s3;
678
-
679
- s0 = peg$currPos;
680
- if (input.substr(peg$currPos, 4) === peg$c5) {
681
- s1 = peg$c5;
682
- peg$currPos += 4;
683
- } else {
684
- s1 = peg$FAILED;
685
- if (peg$silentFails === 0) { peg$fail(peg$e5); }
686
- }
687
- if (s1 !== peg$FAILED) {
688
- s2 = peg$parse__();
689
- if (s2 !== peg$FAILED) {
690
- s3 = peg$parsealias_loc();
691
- if (s3 !== peg$FAILED) {
692
- peg$savedPos = s0;
693
- s0 = peg$f8(s3);
694
- } else {
695
- peg$currPos = s0;
696
- s0 = peg$FAILED;
697
- }
698
- } else {
699
- peg$currPos = s0;
700
- s0 = peg$FAILED;
701
- }
702
- } else {
703
- peg$currPos = s0;
704
- s0 = peg$FAILED;
705
- }
706
- if (s0 === peg$FAILED) {
707
- s0 = peg$currPos;
708
- s1 = peg$parsealias_loc();
709
- if (s1 !== peg$FAILED) {
710
- peg$savedPos = s0;
711
- s1 = peg$f9(s1);
712
- }
713
- s0 = s1;
714
- }
715
-
716
- return s0;
717
- }
718
-
719
672
  function peg$parsearrow() {
720
673
  let s0, s1, s2;
721
674
 
722
675
  s0 = peg$currPos;
723
676
  s1 = [];
724
677
  if (input.charCodeAt(peg$currPos) === 45) {
725
- s2 = peg$c6;
678
+ s2 = peg$c5;
726
679
  peg$currPos++;
727
680
  } else {
728
681
  s2 = peg$FAILED;
729
- if (peg$silentFails === 0) { peg$fail(peg$e6); }
682
+ if (peg$silentFails === 0) { peg$fail(peg$e5); }
730
683
  }
731
684
  if (s2 !== peg$FAILED) {
732
685
  while (s2 !== peg$FAILED) {
733
686
  s1.push(s2);
734
687
  if (input.charCodeAt(peg$currPos) === 45) {
735
- s2 = peg$c6;
688
+ s2 = peg$c5;
736
689
  peg$currPos++;
737
690
  } else {
738
691
  s2 = peg$FAILED;
739
- if (peg$silentFails === 0) { peg$fail(peg$e6); }
692
+ if (peg$silentFails === 0) { peg$fail(peg$e5); }
740
693
  }
741
694
  }
742
695
  } else {
@@ -744,11 +697,11 @@ function peg$parse(input, options) {
744
697
  }
745
698
  if (s1 !== peg$FAILED) {
746
699
  if (input.charCodeAt(peg$currPos) === 62) {
747
- s2 = peg$c7;
700
+ s2 = peg$c6;
748
701
  peg$currPos++;
749
702
  } else {
750
703
  s2 = peg$FAILED;
751
- if (peg$silentFails === 0) { peg$fail(peg$e7); }
704
+ if (peg$silentFails === 0) { peg$fail(peg$e6); }
752
705
  }
753
706
  if (s2 !== peg$FAILED) {
754
707
  s1 = [s1, s2];
@@ -772,7 +725,7 @@ function peg$parse(input, options) {
772
725
  s1 = peg$parsealias();
773
726
  if (s1 !== peg$FAILED) {
774
727
  peg$savedPos = s0;
775
- s1 = peg$f10(s1);
728
+ s1 = peg$f8(s1);
776
729
  }
777
730
  s0 = s1;
778
731
 
@@ -789,7 +742,7 @@ function peg$parse(input, options) {
789
742
  peg$currPos++;
790
743
  } else {
791
744
  s2 = peg$FAILED;
792
- if (peg$silentFails === 0) { peg$fail(peg$e8); }
745
+ if (peg$silentFails === 0) { peg$fail(peg$e7); }
793
746
  }
794
747
  if (s2 !== peg$FAILED) {
795
748
  s3 = [];
@@ -798,7 +751,7 @@ function peg$parse(input, options) {
798
751
  peg$currPos++;
799
752
  } else {
800
753
  s4 = peg$FAILED;
801
- if (peg$silentFails === 0) { peg$fail(peg$e9); }
754
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
802
755
  }
803
756
  while (s4 !== peg$FAILED) {
804
757
  s3.push(s4);
@@ -807,7 +760,7 @@ function peg$parse(input, options) {
807
760
  peg$currPos++;
808
761
  } else {
809
762
  s4 = peg$FAILED;
810
- if (peg$silentFails === 0) { peg$fail(peg$e9); }
763
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
811
764
  }
812
765
  }
813
766
  s2 = [s2, s3];
@@ -832,7 +785,7 @@ function peg$parse(input, options) {
832
785
  s1 = peg$parsecap_urn();
833
786
  if (s1 !== peg$FAILED) {
834
787
  peg$savedPos = s0;
835
- s1 = peg$f11(s1);
788
+ s1 = peg$f9(s1);
836
789
  }
837
790
  s0 = s1;
838
791
 
@@ -844,12 +797,12 @@ function peg$parse(input, options) {
844
797
 
845
798
  s0 = peg$currPos;
846
799
  s1 = peg$currPos;
847
- if (input.substr(peg$currPos, 4) === peg$c8) {
848
- s2 = peg$c8;
800
+ if (input.substr(peg$currPos, 4) === peg$c7) {
801
+ s2 = peg$c7;
849
802
  peg$currPos += 4;
850
803
  } else {
851
804
  s2 = peg$FAILED;
852
- if (peg$silentFails === 0) { peg$fail(peg$e10); }
805
+ if (peg$silentFails === 0) { peg$fail(peg$e9); }
853
806
  }
854
807
  if (s2 !== peg$FAILED) {
855
808
  s3 = [];
@@ -912,7 +865,7 @@ function peg$parse(input, options) {
912
865
  peg$currPos++;
913
866
  } else {
914
867
  s3 = peg$FAILED;
915
- if (peg$silentFails === 0) { peg$fail(peg$e11); }
868
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
916
869
  }
917
870
  if (s3 !== peg$FAILED) {
918
871
  s1 = [s1, s2, s3];
@@ -938,12 +891,12 @@ function peg$parse(input, options) {
938
891
  let s0, s1;
939
892
 
940
893
  peg$silentFails++;
941
- if (input.substr(peg$currPos, 2) === peg$c9) {
942
- s0 = peg$c9;
894
+ if (input.substr(peg$currPos, 2) === peg$c8) {
895
+ s0 = peg$c8;
943
896
  peg$currPos += 2;
944
897
  } else {
945
898
  s0 = peg$FAILED;
946
- if (peg$silentFails === 0) { peg$fail(peg$e13); }
899
+ if (peg$silentFails === 0) { peg$fail(peg$e12); }
947
900
  }
948
901
  if (s0 === peg$FAILED) {
949
902
  s0 = input.charAt(peg$currPos);
@@ -951,13 +904,13 @@ function peg$parse(input, options) {
951
904
  peg$currPos++;
952
905
  } else {
953
906
  s0 = peg$FAILED;
954
- if (peg$silentFails === 0) { peg$fail(peg$e14); }
907
+ if (peg$silentFails === 0) { peg$fail(peg$e13); }
955
908
  }
956
909
  }
957
910
  peg$silentFails--;
958
911
  if (s0 === peg$FAILED) {
959
912
  s1 = peg$FAILED;
960
- if (peg$silentFails === 0) { peg$fail(peg$e12); }
913
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
961
914
  }
962
915
 
963
916
  return s0;
@@ -968,39 +921,39 @@ function peg$parse(input, options) {
968
921
 
969
922
  s0 = peg$currPos;
970
923
  if (input.charCodeAt(peg$currPos) === 34) {
971
- s1 = peg$c10;
924
+ s1 = peg$c9;
972
925
  peg$currPos++;
973
926
  } else {
974
927
  s1 = peg$FAILED;
975
- if (peg$silentFails === 0) { peg$fail(peg$e15); }
928
+ if (peg$silentFails === 0) { peg$fail(peg$e14); }
976
929
  }
977
930
  if (s1 !== peg$FAILED) {
978
931
  s2 = [];
979
- if (input.substr(peg$currPos, 2) === peg$c11) {
980
- s3 = peg$c11;
932
+ if (input.substr(peg$currPos, 2) === peg$c10) {
933
+ s3 = peg$c10;
981
934
  peg$currPos += 2;
982
935
  } else {
983
936
  s3 = peg$FAILED;
984
- if (peg$silentFails === 0) { peg$fail(peg$e16); }
937
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
985
938
  }
986
939
  if (s3 === peg$FAILED) {
987
- if (input.substr(peg$currPos, 2) === peg$c12) {
988
- s3 = peg$c12;
940
+ if (input.substr(peg$currPos, 2) === peg$c11) {
941
+ s3 = peg$c11;
989
942
  peg$currPos += 2;
990
943
  } else {
991
944
  s3 = peg$FAILED;
992
- if (peg$silentFails === 0) { peg$fail(peg$e17); }
945
+ if (peg$silentFails === 0) { peg$fail(peg$e16); }
993
946
  }
994
947
  if (s3 === peg$FAILED) {
995
948
  s3 = peg$currPos;
996
949
  s4 = peg$currPos;
997
950
  peg$silentFails++;
998
951
  if (input.charCodeAt(peg$currPos) === 34) {
999
- s5 = peg$c10;
952
+ s5 = peg$c9;
1000
953
  peg$currPos++;
1001
954
  } else {
1002
955
  s5 = peg$FAILED;
1003
- if (peg$silentFails === 0) { peg$fail(peg$e15); }
956
+ if (peg$silentFails === 0) { peg$fail(peg$e14); }
1004
957
  }
1005
958
  peg$silentFails--;
1006
959
  if (s5 === peg$FAILED) {
@@ -1015,7 +968,7 @@ function peg$parse(input, options) {
1015
968
  peg$currPos++;
1016
969
  } else {
1017
970
  s5 = peg$FAILED;
1018
- if (peg$silentFails === 0) { peg$fail(peg$e11); }
971
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
1019
972
  }
1020
973
  if (s5 !== peg$FAILED) {
1021
974
  s4 = [s4, s5];
@@ -1032,31 +985,31 @@ function peg$parse(input, options) {
1032
985
  }
1033
986
  while (s3 !== peg$FAILED) {
1034
987
  s2.push(s3);
1035
- if (input.substr(peg$currPos, 2) === peg$c11) {
1036
- s3 = peg$c11;
988
+ if (input.substr(peg$currPos, 2) === peg$c10) {
989
+ s3 = peg$c10;
1037
990
  peg$currPos += 2;
1038
991
  } else {
1039
992
  s3 = peg$FAILED;
1040
- if (peg$silentFails === 0) { peg$fail(peg$e16); }
993
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
1041
994
  }
1042
995
  if (s3 === peg$FAILED) {
1043
- if (input.substr(peg$currPos, 2) === peg$c12) {
1044
- s3 = peg$c12;
996
+ if (input.substr(peg$currPos, 2) === peg$c11) {
997
+ s3 = peg$c11;
1045
998
  peg$currPos += 2;
1046
999
  } else {
1047
1000
  s3 = peg$FAILED;
1048
- if (peg$silentFails === 0) { peg$fail(peg$e17); }
1001
+ if (peg$silentFails === 0) { peg$fail(peg$e16); }
1049
1002
  }
1050
1003
  if (s3 === peg$FAILED) {
1051
1004
  s3 = peg$currPos;
1052
1005
  s4 = peg$currPos;
1053
1006
  peg$silentFails++;
1054
1007
  if (input.charCodeAt(peg$currPos) === 34) {
1055
- s5 = peg$c10;
1008
+ s5 = peg$c9;
1056
1009
  peg$currPos++;
1057
1010
  } else {
1058
1011
  s5 = peg$FAILED;
1059
- if (peg$silentFails === 0) { peg$fail(peg$e15); }
1012
+ if (peg$silentFails === 0) { peg$fail(peg$e14); }
1060
1013
  }
1061
1014
  peg$silentFails--;
1062
1015
  if (s5 === peg$FAILED) {
@@ -1071,7 +1024,7 @@ function peg$parse(input, options) {
1071
1024
  peg$currPos++;
1072
1025
  } else {
1073
1026
  s5 = peg$FAILED;
1074
- if (peg$silentFails === 0) { peg$fail(peg$e11); }
1027
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
1075
1028
  }
1076
1029
  if (s5 !== peg$FAILED) {
1077
1030
  s4 = [s4, s5];
@@ -1088,11 +1041,11 @@ function peg$parse(input, options) {
1088
1041
  }
1089
1042
  }
1090
1043
  if (input.charCodeAt(peg$currPos) === 34) {
1091
- s3 = peg$c10;
1044
+ s3 = peg$c9;
1092
1045
  peg$currPos++;
1093
1046
  } else {
1094
1047
  s3 = peg$FAILED;
1095
- if (peg$silentFails === 0) { peg$fail(peg$e15); }
1048
+ if (peg$silentFails === 0) { peg$fail(peg$e14); }
1096
1049
  }
1097
1050
  if (s3 !== peg$FAILED) {
1098
1051
  s1 = [s1, s2, s3];
@@ -1119,7 +1072,7 @@ function peg$parse(input, options) {
1119
1072
  peg$currPos++;
1120
1073
  } else {
1121
1074
  s1 = peg$FAILED;
1122
- if (peg$silentFails === 0) { peg$fail(peg$e18); }
1075
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
1123
1076
  }
1124
1077
  while (s1 !== peg$FAILED) {
1125
1078
  s0.push(s1);
@@ -1128,7 +1081,7 @@ function peg$parse(input, options) {
1128
1081
  peg$currPos++;
1129
1082
  } else {
1130
1083
  s1 = peg$FAILED;
1131
- if (peg$silentFails === 0) { peg$fail(peg$e18); }
1084
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
1132
1085
  }
1133
1086
  }
1134
1087
  peg$silentFails--;
@@ -1146,7 +1099,7 @@ function peg$parse(input, options) {
1146
1099
  peg$currPos++;
1147
1100
  } else {
1148
1101
  s1 = peg$FAILED;
1149
- if (peg$silentFails === 0) { peg$fail(peg$e18); }
1102
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
1150
1103
  }
1151
1104
  if (s1 !== peg$FAILED) {
1152
1105
  while (s1 !== peg$FAILED) {
@@ -1156,7 +1109,7 @@ function peg$parse(input, options) {
1156
1109
  peg$currPos++;
1157
1110
  } else {
1158
1111
  s1 = peg$FAILED;
1159
- if (peg$silentFails === 0) { peg$fail(peg$e18); }
1112
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
1160
1113
  }
1161
1114
  }
1162
1115
  } else {
@@ -1165,7 +1118,7 @@ function peg$parse(input, options) {
1165
1118
  peg$silentFails--;
1166
1119
  if (s0 === peg$FAILED) {
1167
1120
  s1 = peg$FAILED;
1168
- if (peg$silentFails === 0) { peg$fail(peg$e19); }
1121
+ if (peg$silentFails === 0) { peg$fail(peg$e18); }
1169
1122
  }
1170
1123
 
1171
1124
  return s0;
package/machine.pegjs CHANGED
@@ -13,7 +13,6 @@
13
13
  // extract cap:in="media:ext=pdf";extract;out="media:txt;textable"
14
14
  // doc -> extract -> text
15
15
  // (thumbnail, model_spec) -> describe -> description
16
- // pages -> LOOP p2t -> texts
17
16
  //
18
17
  // Both forms can be freely mixed in the same program.
19
18
 
@@ -29,9 +28,12 @@ header = a:alias_loc __ c:cap_urn_loc {
29
28
  return { type: 'header', alias: a.value, capUrn: c.value, location: location(), aliasLocation: a.location, capUrnLocation: c.location };
30
29
  }
31
30
 
32
- // Wiring: source -> loop_cap -> target
33
- wiring = s:source_loc _ arrow _ lc:loop_cap_loc _ arrow _ t:alias_loc {
34
- 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 };
31
+ // Wiring: source -> cap -> target
32
+ //
33
+ // The cap position is a plain alias. There is no LOOP marker: per-item map
34
+ // (`is_loop`) is a derived cardinality property, never authored syntax.
35
+ wiring = s:source_loc _ arrow _ c:alias_loc _ arrow _ t:alias_loc {
36
+ return { type: 'wiring', sources: s.values, capAlias: c.value, target: t.value, location: location(), sourceLocations: s.locations, capAliasLocation: c.location, targetLocation: t.location };
35
37
  }
36
38
 
37
39
  source_loc = group_loc / single_alias_loc
@@ -42,9 +44,6 @@ group_loc = "(" _ first:alias_loc rest:("," _ a:alias_loc { return a; })+ _ ")"
42
44
  return { values: [first.value, ...rest.map(r => r.value)], locations: [first.location, ...rest.map(r => r.location)] };
43
45
  }
44
46
 
45
- loop_cap_loc = "LOOP" __ a:alias_loc { return { alias: a.value, isLoop: true, location: a.location }; }
46
- / a:alias_loc { return { alias: a.value, isLoop: false, location: a.location }; }
47
-
48
47
  arrow = "-"+ ">"
49
48
 
50
49
  // Alias with location tracking
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": "1.222.603"
43
+ "version": "1.233.649"
44
44
  }