@retorquere/bibtex-parser 6.3.11 → 6.4.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 (4) hide show
  1. package/grammar.js +277 -160
  2. package/index.d.ts +3 -3
  3. package/index.js +18 -3
  4. package/package.json +11 -11
package/grammar.js CHANGED
@@ -191,14 +191,17 @@ function peg$parse(input, options) {
191
191
  var peg$c15 = "\\[";
192
192
  var peg$c16 = "\\]";
193
193
  var peg$c17 = "%";
194
- var peg$c18 = "newcommand";
195
- var peg$c19 = "href";
196
- var peg$c20 = "begin";
197
- var peg$c21 = "end";
198
- var peg$c22 = "[";
199
- var peg$c23 = "]";
200
- var peg$c24 = "=";
201
- var peg$c25 = "#";
194
+ var peg$c18 = "\\\\";
195
+ var peg$c19 = "\r";
196
+ var peg$c20 = "\n";
197
+ var peg$c21 = "newcommand";
198
+ var peg$c22 = "href";
199
+ var peg$c23 = "begin";
200
+ var peg$c24 = "end";
201
+ var peg$c25 = "[";
202
+ var peg$c26 = "]";
203
+ var peg$c27 = "=";
204
+ var peg$c28 = "#";
202
205
 
203
206
  var peg$r0 = /^[^\n\r]/;
204
207
  var peg$r1 = /^[\n\r]/;
@@ -265,32 +268,35 @@ function peg$parse(input, options) {
265
268
  var peg$e32 = peg$literalExpectation("\\]", false);
266
269
  var peg$e33 = peg$literalExpectation("%", false);
267
270
  var peg$e34 = peg$classExpectation(["\r", "\n"], true, false);
268
- var peg$e35 = peg$classExpectation(["_", "^"], false, false);
269
- var peg$e36 = peg$classExpectation([["A", "Z"], ["a", "z"], ["0", "9"], "\t", "\r", "\n"], true, false);
270
- var peg$e37 = peg$literalExpectation("newcommand", false);
271
- var peg$e38 = peg$literalExpectation("href", false);
272
- var peg$e39 = peg$literalExpectation("begin", false);
273
- var peg$e40 = peg$literalExpectation("end", false);
274
- var peg$e41 = peg$classExpectation([["A", "Z"], ["a", "z"]], false, false);
275
- var peg$e42 = peg$literalExpectation("[", false);
276
- var peg$e43 = peg$classExpectation(["]"], true, false);
277
- var peg$e44 = peg$literalExpectation("]", false);
278
- var peg$e45 = peg$classExpectation([" ", "\t", "^", "_", "$", "{", "}", "\\"], true, false);
279
- var peg$e46 = peg$classExpectation([["a", "z"], ["A", "Z"], "-", "_"], false, false);
280
- var peg$e47 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "-", "&", "_", ":"], false, false);
281
- var peg$e48 = peg$classExpectation(["'", "`", "\"", "=", "~", "^", "."], false, false);
282
- var peg$e49 = peg$classExpectation(["'", "`", "\"", "=", "~", "^", ".", "c", "b", "u", "v", "d", "r", "H", "k"], false, false);
283
- var peg$e50 = peg$literalExpectation("=", false);
284
- var peg$e51 = peg$literalExpectation("#", false);
285
- var peg$e52 = peg$classExpectation(["\r", "\n"], false, false);
286
- var peg$e53 = peg$otherExpectation("Mandatory Horizontal Whitespace");
287
- var peg$e54 = peg$classExpectation([" ", "\t"], false, false);
288
- var peg$e55 = peg$otherExpectation("Optional Horizontal Whitespace");
289
- var peg$e56 = peg$otherExpectation("Mandatory Vertical Whitespace");
290
- var peg$e57 = peg$otherExpectation("Optional Vertical Whitespace");
291
- var peg$e58 = peg$otherExpectation("Mandatory Whitespace");
292
- var peg$e59 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false);
293
- var peg$e60 = peg$otherExpectation("Optional Whitespace");
271
+ var peg$e35 = peg$literalExpectation("\\\\", false);
272
+ var peg$e36 = peg$literalExpectation("\r", false);
273
+ var peg$e37 = peg$literalExpectation("\n", false);
274
+ var peg$e38 = peg$classExpectation(["_", "^"], false, false);
275
+ var peg$e39 = peg$classExpectation([["A", "Z"], ["a", "z"], ["0", "9"], "\t", "\r", "\n"], true, false);
276
+ var peg$e40 = peg$literalExpectation("newcommand", false);
277
+ var peg$e41 = peg$literalExpectation("href", false);
278
+ var peg$e42 = peg$literalExpectation("begin", false);
279
+ var peg$e43 = peg$literalExpectation("end", false);
280
+ var peg$e44 = peg$classExpectation([["A", "Z"], ["a", "z"]], false, false);
281
+ var peg$e45 = peg$literalExpectation("[", false);
282
+ var peg$e46 = peg$classExpectation(["]"], true, false);
283
+ var peg$e47 = peg$literalExpectation("]", false);
284
+ var peg$e48 = peg$classExpectation([" ", "\t", "^", "_", "$", "{", "}", "\\"], true, false);
285
+ var peg$e49 = peg$classExpectation([["a", "z"], ["A", "Z"], "-", "_"], false, false);
286
+ var peg$e50 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "-", "&", "_", ":"], false, false);
287
+ var peg$e51 = peg$classExpectation(["'", "`", "\"", "=", "~", "^", "."], false, false);
288
+ var peg$e52 = peg$classExpectation(["'", "`", "\"", "=", "~", "^", ".", "c", "b", "u", "v", "d", "r", "H", "k"], false, false);
289
+ var peg$e53 = peg$literalExpectation("=", false);
290
+ var peg$e54 = peg$literalExpectation("#", false);
291
+ var peg$e55 = peg$classExpectation(["\r", "\n"], false, false);
292
+ var peg$e56 = peg$otherExpectation("Mandatory Horizontal Whitespace");
293
+ var peg$e57 = peg$classExpectation([" ", "\t"], false, false);
294
+ var peg$e58 = peg$otherExpectation("Optional Horizontal Whitespace");
295
+ var peg$e59 = peg$otherExpectation("Mandatory Vertical Whitespace");
296
+ var peg$e60 = peg$otherExpectation("Optional Vertical Whitespace");
297
+ var peg$e61 = peg$otherExpectation("Mandatory Whitespace");
298
+ var peg$e62 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false);
299
+ var peg$e63 = peg$otherExpectation("Optional Whitespace");
294
300
 
295
301
  var peg$f0 = function(r) {
296
302
  return {
@@ -571,7 +577,31 @@ function peg$parse(input, options) {
571
577
  value: v,
572
578
  }
573
579
  };
574
- var peg$f43 = function(mode, v) {
580
+ var peg$f43 = function() {
581
+ return {
582
+ kind: 'RegularCommand',
583
+ loc: location(),
584
+ source: text(),
585
+ command: '\\',
586
+ arguments: {
587
+ optional: [],
588
+ required: [],
589
+ },
590
+ }
591
+ };
592
+ var peg$f44 = function() {
593
+ return {
594
+ kind: 'RegularCommand',
595
+ loc: location(),
596
+ source: text(),
597
+ command: 'par',
598
+ arguments: {
599
+ optional: [],
600
+ required: [],
601
+ },
602
+ }
603
+ };
604
+ var peg$f45 = function(mode, v) {
575
605
  if (v.kind === 'Block') v = v.value
576
606
 
577
607
  return {
@@ -581,7 +611,7 @@ function peg$parse(input, options) {
581
611
  value: v,
582
612
  }
583
613
  };
584
- var peg$f44 = function(mark, char) {
614
+ var peg$f46 = function(mark, char) {
585
615
  return {
586
616
  kind: 'DiacriticCommand',
587
617
  loc: location(),
@@ -591,7 +621,7 @@ function peg$parse(input, options) {
591
621
  character: char[1] || char[0],
592
622
  }
593
623
  };
594
- var peg$f45 = function(mark, char) {
624
+ var peg$f47 = function(mark, char) {
595
625
  return {
596
626
  kind: 'DiacriticCommand',
597
627
  loc: location(),
@@ -601,7 +631,7 @@ function peg$parse(input, options) {
601
631
  character: char[1] || char[0],
602
632
  }
603
633
  };
604
- var peg$f46 = function(mark, v) {
634
+ var peg$f48 = function(mark, v) {
605
635
  return {
606
636
  kind: 'RegularCommand',
607
637
  loc: location(),
@@ -613,7 +643,7 @@ function peg$parse(input, options) {
613
643
  },
614
644
  }
615
645
  };
616
- var peg$f47 = function(v) {
646
+ var peg$f49 = function(v) {
617
647
  return {
618
648
  kind: 'SymbolCommand',
619
649
  loc: location(),
@@ -621,8 +651,8 @@ function peg$parse(input, options) {
621
651
  command: v,
622
652
  }
623
653
  };
624
- var peg$f48 = function(cmd, name) { return name.value.length == 1 && name.value[0].kind === 'RegularCommand' };
625
- var peg$f49 = function(cmd, name, optional, def) {
654
+ var peg$f50 = function(cmd, name) { return name.value.length == 1 && name.value[0].kind === 'RegularCommand' };
655
+ var peg$f51 = function(cmd, name, optional, def) {
626
656
  return {
627
657
  kind: 'RegularCommand',
628
658
  loc: location(),
@@ -634,7 +664,7 @@ function peg$parse(input, options) {
634
664
  },
635
665
  }
636
666
  };
637
- var peg$f50 = function(cmd, url, label) {
667
+ var peg$f52 = function(cmd, url, label) {
638
668
  return {
639
669
  kind: 'RegularCommand',
640
670
  loc: location(),
@@ -646,8 +676,8 @@ function peg$parse(input, options) {
646
676
  },
647
677
  }
648
678
  };
649
- var peg$f51 = function(cmd) { return verbatimCommands.includes(cmd) && (has_arguments[cmd] === 2) };
650
- var peg$f52 = function(cmd, optional, req1, req2) {
679
+ var peg$f53 = function(cmd) { return verbatimCommands.includes(cmd) && (has_arguments[cmd] === 2) };
680
+ var peg$f54 = function(cmd, optional, req1, req2) {
651
681
  return {
652
682
  kind: 'RegularCommand',
653
683
  loc: location(),
@@ -659,8 +689,8 @@ function peg$parse(input, options) {
659
689
  },
660
690
  }
661
691
  };
662
- var peg$f53 = function(cmd) { return verbatimCommands.includes(cmd) && (has_arguments[cmd] === 1) };
663
- var peg$f54 = function(cmd, optional, req) {
692
+ var peg$f55 = function(cmd) { return verbatimCommands.includes(cmd) && (has_arguments[cmd] === 1) };
693
+ var peg$f56 = function(cmd, optional, req) {
664
694
  return {
665
695
  kind: 'RegularCommand',
666
696
  loc: location(),
@@ -672,8 +702,8 @@ function peg$parse(input, options) {
672
702
  },
673
703
  }
674
704
  };
675
- var peg$f55 = function(cmd) { return (has_arguments[cmd] === 2) };
676
- var peg$f56 = function(cmd, optional, req1, req2) {
705
+ var peg$f57 = function(cmd) { return (has_arguments[cmd] === 2) };
706
+ var peg$f58 = function(cmd, optional, req1, req2) {
677
707
  return {
678
708
  kind: 'RegularCommand',
679
709
  loc: location(),
@@ -685,8 +715,8 @@ function peg$parse(input, options) {
685
715
  },
686
716
  }
687
717
  };
688
- var peg$f57 = function(cmd) { return (has_arguments[cmd] === 1) };
689
- var peg$f58 = function(cmd, optional, req) {
718
+ var peg$f59 = function(cmd) { return (has_arguments[cmd] === 1) };
719
+ var peg$f60 = function(cmd, optional, req) {
690
720
  let m
691
721
  if (req.kind === 'Block') {
692
722
  switch (cmd) {
@@ -736,7 +766,7 @@ function peg$parse(input, options) {
736
766
  }
737
767
  }
738
768
  };
739
- var peg$f59 = function(cmd, optional) {
769
+ var peg$f61 = function(cmd, optional) {
740
770
  return {
741
771
  kind: 'RegularCommand',
742
772
  loc: location(),
@@ -748,7 +778,7 @@ function peg$parse(input, options) {
748
778
  }
749
779
  }
750
780
  };
751
- var peg$f60 = function(v) {
781
+ var peg$f62 = function(v) {
752
782
  return basicTextConversions({
753
783
  kind: 'Text', // this isn't really correct but I don't need these right now
754
784
  loc: location(),
@@ -757,7 +787,7 @@ function peg$parse(input, options) {
757
787
  mode: math.on ? 'math' : 'text',
758
788
  })
759
789
  };
760
- var peg$f61 = function(v) {
790
+ var peg$f63 = function(v) {
761
791
  return basicTextConversions({
762
792
  kind: 'Text',
763
793
  loc: location(),
@@ -766,7 +796,7 @@ function peg$parse(input, options) {
766
796
  mode: math.on ? 'math' : 'text',
767
797
  })
768
798
  };
769
- var peg$f62 = function(v) { return v };
799
+ var peg$f64 = function(v) { return v };
770
800
  var peg$currPos = 0;
771
801
  var peg$savedPos = 0;
772
802
  var peg$posDetailsCache = [{ line: 1, column: 1 }];
@@ -2883,11 +2913,17 @@ function peg$parse(input, options) {
2883
2913
 
2884
2914
  s0 = peg$parseScriptCommand();
2885
2915
  if (s0 === peg$FAILED) {
2886
- s0 = peg$parseDiacriticCommand();
2916
+ s0 = peg$parseLineBreak();
2887
2917
  if (s0 === peg$FAILED) {
2888
- s0 = peg$parseRegularCommand();
2918
+ s0 = peg$parseParBreak();
2889
2919
  if (s0 === peg$FAILED) {
2890
- s0 = peg$parseSymbolCommand();
2920
+ s0 = peg$parseDiacriticCommand();
2921
+ if (s0 === peg$FAILED) {
2922
+ s0 = peg$parseRegularCommand();
2923
+ if (s0 === peg$FAILED) {
2924
+ s0 = peg$parseSymbolCommand();
2925
+ }
2926
+ }
2891
2927
  }
2892
2928
  }
2893
2929
  }
@@ -2895,6 +2931,87 @@ function peg$parse(input, options) {
2895
2931
  return s0;
2896
2932
  }
2897
2933
 
2934
+ function peg$parseLineBreak() {
2935
+ var s0, s1, s2, s3;
2936
+
2937
+ s0 = peg$currPos;
2938
+ s1 = peg$parse__();
2939
+ if (input.substr(peg$currPos, 2) === peg$c18) {
2940
+ s2 = peg$c18;
2941
+ peg$currPos += 2;
2942
+ } else {
2943
+ s2 = peg$FAILED;
2944
+ if (peg$silentFails === 0) { peg$fail(peg$e35); }
2945
+ }
2946
+ if (s2 !== peg$FAILED) {
2947
+ s3 = peg$parse__();
2948
+ peg$savedPos = s0;
2949
+ s0 = peg$f43();
2950
+ } else {
2951
+ peg$currPos = s0;
2952
+ s0 = peg$FAILED;
2953
+ }
2954
+
2955
+ return s0;
2956
+ }
2957
+
2958
+ function peg$parseParBreak() {
2959
+ var s0, s1, s2, s3, s4, s5, s6, s7;
2960
+
2961
+ s0 = peg$currPos;
2962
+ s1 = peg$parse__h();
2963
+ if (input.charCodeAt(peg$currPos) === 13) {
2964
+ s2 = peg$c19;
2965
+ peg$currPos++;
2966
+ } else {
2967
+ s2 = peg$FAILED;
2968
+ if (peg$silentFails === 0) { peg$fail(peg$e36); }
2969
+ }
2970
+ if (s2 === peg$FAILED) {
2971
+ s2 = null;
2972
+ }
2973
+ if (input.charCodeAt(peg$currPos) === 10) {
2974
+ s3 = peg$c20;
2975
+ peg$currPos++;
2976
+ } else {
2977
+ s3 = peg$FAILED;
2978
+ if (peg$silentFails === 0) { peg$fail(peg$e37); }
2979
+ }
2980
+ if (s3 !== peg$FAILED) {
2981
+ s4 = peg$parse__h();
2982
+ if (input.charCodeAt(peg$currPos) === 13) {
2983
+ s5 = peg$c19;
2984
+ peg$currPos++;
2985
+ } else {
2986
+ s5 = peg$FAILED;
2987
+ if (peg$silentFails === 0) { peg$fail(peg$e36); }
2988
+ }
2989
+ if (s5 === peg$FAILED) {
2990
+ s5 = null;
2991
+ }
2992
+ if (input.charCodeAt(peg$currPos) === 10) {
2993
+ s6 = peg$c20;
2994
+ peg$currPos++;
2995
+ } else {
2996
+ s6 = peg$FAILED;
2997
+ if (peg$silentFails === 0) { peg$fail(peg$e37); }
2998
+ }
2999
+ if (s6 !== peg$FAILED) {
3000
+ s7 = peg$parse__();
3001
+ peg$savedPos = s0;
3002
+ s0 = peg$f44();
3003
+ } else {
3004
+ peg$currPos = s0;
3005
+ s0 = peg$FAILED;
3006
+ }
3007
+ } else {
3008
+ peg$currPos = s0;
3009
+ s0 = peg$FAILED;
3010
+ }
3011
+
3012
+ return s0;
3013
+ }
3014
+
2898
3015
  function peg$parseScriptCommand() {
2899
3016
  var s0, s1, s2, s3;
2900
3017
 
@@ -2904,14 +3021,14 @@ function peg$parse(input, options) {
2904
3021
  peg$currPos++;
2905
3022
  } else {
2906
3023
  s1 = peg$FAILED;
2907
- if (peg$silentFails === 0) { peg$fail(peg$e35); }
3024
+ if (peg$silentFails === 0) { peg$fail(peg$e38); }
2908
3025
  }
2909
3026
  if (s1 !== peg$FAILED) {
2910
3027
  s2 = peg$parse__h();
2911
3028
  s3 = peg$parseArgument();
2912
3029
  if (s3 !== peg$FAILED) {
2913
3030
  peg$savedPos = s0;
2914
- s0 = peg$f43(s1, s3);
3031
+ s0 = peg$f45(s1, s3);
2915
3032
  } else {
2916
3033
  peg$currPos = s0;
2917
3034
  s0 = peg$FAILED;
@@ -2977,7 +3094,7 @@ function peg$parse(input, options) {
2977
3094
  }
2978
3095
  if (s4 !== peg$FAILED) {
2979
3096
  peg$savedPos = s0;
2980
- s0 = peg$f44(s2, s4);
3097
+ s0 = peg$f46(s2, s4);
2981
3098
  } else {
2982
3099
  peg$currPos = s0;
2983
3100
  s0 = peg$FAILED;
@@ -3056,7 +3173,7 @@ function peg$parse(input, options) {
3056
3173
  }
3057
3174
  if (s5 !== peg$FAILED) {
3058
3175
  peg$savedPos = s0;
3059
- s0 = peg$f45(s2, s4);
3176
+ s0 = peg$f47(s2, s4);
3060
3177
  } else {
3061
3178
  peg$currPos = s0;
3062
3179
  s0 = peg$FAILED;
@@ -3109,7 +3226,7 @@ function peg$parse(input, options) {
3109
3226
  s4 = peg$parseRegularValue();
3110
3227
  if (s4 !== peg$FAILED) {
3111
3228
  peg$savedPos = s0;
3112
- s0 = peg$f46(s2, s4);
3229
+ s0 = peg$f48(s2, s4);
3113
3230
  } else {
3114
3231
  peg$currPos = s0;
3115
3232
  s0 = peg$FAILED;
@@ -3150,7 +3267,7 @@ function peg$parse(input, options) {
3150
3267
  peg$currPos++;
3151
3268
  } else {
3152
3269
  s3 = peg$FAILED;
3153
- if (peg$silentFails === 0) { peg$fail(peg$e36); }
3270
+ if (peg$silentFails === 0) { peg$fail(peg$e39); }
3154
3271
  }
3155
3272
  if (s3 !== peg$FAILED) {
3156
3273
  s2 = input.substring(s2, peg$currPos);
@@ -3159,7 +3276,7 @@ function peg$parse(input, options) {
3159
3276
  }
3160
3277
  if (s2 !== peg$FAILED) {
3161
3278
  peg$savedPos = s0;
3162
- s0 = peg$f47(s2);
3279
+ s0 = peg$f49(s2);
3163
3280
  } else {
3164
3281
  peg$currPos = s0;
3165
3282
  s0 = peg$FAILED;
@@ -3184,18 +3301,18 @@ function peg$parse(input, options) {
3184
3301
  if (peg$silentFails === 0) { peg$fail(peg$e27); }
3185
3302
  }
3186
3303
  if (s1 !== peg$FAILED) {
3187
- if (input.substr(peg$currPos, 10) === peg$c18) {
3188
- s2 = peg$c18;
3304
+ if (input.substr(peg$currPos, 10) === peg$c21) {
3305
+ s2 = peg$c21;
3189
3306
  peg$currPos += 10;
3190
3307
  } else {
3191
3308
  s2 = peg$FAILED;
3192
- if (peg$silentFails === 0) { peg$fail(peg$e37); }
3309
+ if (peg$silentFails === 0) { peg$fail(peg$e40); }
3193
3310
  }
3194
3311
  if (s2 !== peg$FAILED) {
3195
3312
  s3 = peg$parseBlock();
3196
3313
  if (s3 !== peg$FAILED) {
3197
3314
  peg$savedPos = peg$currPos;
3198
- s4 = peg$f48(s2, s3);
3315
+ s4 = peg$f50(s2, s3);
3199
3316
  if (s4) {
3200
3317
  s4 = undefined;
3201
3318
  } else {
@@ -3211,7 +3328,7 @@ function peg$parse(input, options) {
3211
3328
  s6 = peg$parseArgument();
3212
3329
  if (s6 !== peg$FAILED) {
3213
3330
  peg$savedPos = s0;
3214
- s0 = peg$f49(s2, s3, s5, s6);
3331
+ s0 = peg$f51(s2, s3, s5, s6);
3215
3332
  } else {
3216
3333
  peg$currPos = s0;
3217
3334
  s0 = peg$FAILED;
@@ -3242,12 +3359,12 @@ function peg$parse(input, options) {
3242
3359
  if (peg$silentFails === 0) { peg$fail(peg$e27); }
3243
3360
  }
3244
3361
  if (s1 !== peg$FAILED) {
3245
- if (input.substr(peg$currPos, 4) === peg$c19) {
3246
- s2 = peg$c19;
3362
+ if (input.substr(peg$currPos, 4) === peg$c22) {
3363
+ s2 = peg$c22;
3247
3364
  peg$currPos += 4;
3248
3365
  } else {
3249
3366
  s2 = peg$FAILED;
3250
- if (peg$silentFails === 0) { peg$fail(peg$e38); }
3367
+ if (peg$silentFails === 0) { peg$fail(peg$e41); }
3251
3368
  }
3252
3369
  if (s2 !== peg$FAILED) {
3253
3370
  s3 = peg$parse__h();
@@ -3273,7 +3390,7 @@ function peg$parse(input, options) {
3273
3390
  s6 = peg$parseArgument();
3274
3391
  if (s6 !== peg$FAILED) {
3275
3392
  peg$savedPos = s0;
3276
- s0 = peg$f50(s2, s5, s6);
3393
+ s0 = peg$f52(s2, s5, s6);
3277
3394
  } else {
3278
3395
  peg$currPos = s0;
3279
3396
  s0 = peg$FAILED;
@@ -3306,12 +3423,12 @@ function peg$parse(input, options) {
3306
3423
  if (s1 !== peg$FAILED) {
3307
3424
  s2 = peg$currPos;
3308
3425
  peg$silentFails++;
3309
- if (input.substr(peg$currPos, 5) === peg$c20) {
3310
- s3 = peg$c20;
3426
+ if (input.substr(peg$currPos, 5) === peg$c23) {
3427
+ s3 = peg$c23;
3311
3428
  peg$currPos += 5;
3312
3429
  } else {
3313
3430
  s3 = peg$FAILED;
3314
- if (peg$silentFails === 0) { peg$fail(peg$e39); }
3431
+ if (peg$silentFails === 0) { peg$fail(peg$e42); }
3315
3432
  }
3316
3433
  peg$silentFails--;
3317
3434
  if (s3 === peg$FAILED) {
@@ -3323,12 +3440,12 @@ function peg$parse(input, options) {
3323
3440
  if (s2 !== peg$FAILED) {
3324
3441
  s3 = peg$currPos;
3325
3442
  peg$silentFails++;
3326
- if (input.substr(peg$currPos, 3) === peg$c21) {
3327
- s4 = peg$c21;
3443
+ if (input.substr(peg$currPos, 3) === peg$c24) {
3444
+ s4 = peg$c24;
3328
3445
  peg$currPos += 3;
3329
3446
  } else {
3330
3447
  s4 = peg$FAILED;
3331
- if (peg$silentFails === 0) { peg$fail(peg$e40); }
3448
+ if (peg$silentFails === 0) { peg$fail(peg$e43); }
3332
3449
  }
3333
3450
  peg$silentFails--;
3334
3451
  if (s4 === peg$FAILED) {
@@ -3345,7 +3462,7 @@ function peg$parse(input, options) {
3345
3462
  peg$currPos++;
3346
3463
  } else {
3347
3464
  s6 = peg$FAILED;
3348
- if (peg$silentFails === 0) { peg$fail(peg$e41); }
3465
+ if (peg$silentFails === 0) { peg$fail(peg$e44); }
3349
3466
  }
3350
3467
  if (s6 !== peg$FAILED) {
3351
3468
  while (s6 !== peg$FAILED) {
@@ -3355,7 +3472,7 @@ function peg$parse(input, options) {
3355
3472
  peg$currPos++;
3356
3473
  } else {
3357
3474
  s6 = peg$FAILED;
3358
- if (peg$silentFails === 0) { peg$fail(peg$e41); }
3475
+ if (peg$silentFails === 0) { peg$fail(peg$e44); }
3359
3476
  }
3360
3477
  }
3361
3478
  } else {
@@ -3368,7 +3485,7 @@ function peg$parse(input, options) {
3368
3485
  }
3369
3486
  if (s4 !== peg$FAILED) {
3370
3487
  peg$savedPos = peg$currPos;
3371
- s5 = peg$f51(s4);
3488
+ s5 = peg$f53(s4);
3372
3489
  if (s5) {
3373
3490
  s5 = undefined;
3374
3491
  } else {
@@ -3404,7 +3521,7 @@ function peg$parse(input, options) {
3404
3521
  s10 = peg$parseVerbatimFieldValue();
3405
3522
  if (s10 !== peg$FAILED) {
3406
3523
  peg$savedPos = s0;
3407
- s0 = peg$f52(s4, s6, s9, s10);
3524
+ s0 = peg$f54(s4, s6, s9, s10);
3408
3525
  } else {
3409
3526
  peg$currPos = s0;
3410
3527
  s0 = peg$FAILED;
@@ -3449,12 +3566,12 @@ function peg$parse(input, options) {
3449
3566
  if (s1 !== peg$FAILED) {
3450
3567
  s2 = peg$currPos;
3451
3568
  peg$silentFails++;
3452
- if (input.substr(peg$currPos, 5) === peg$c20) {
3453
- s3 = peg$c20;
3569
+ if (input.substr(peg$currPos, 5) === peg$c23) {
3570
+ s3 = peg$c23;
3454
3571
  peg$currPos += 5;
3455
3572
  } else {
3456
3573
  s3 = peg$FAILED;
3457
- if (peg$silentFails === 0) { peg$fail(peg$e39); }
3574
+ if (peg$silentFails === 0) { peg$fail(peg$e42); }
3458
3575
  }
3459
3576
  peg$silentFails--;
3460
3577
  if (s3 === peg$FAILED) {
@@ -3466,12 +3583,12 @@ function peg$parse(input, options) {
3466
3583
  if (s2 !== peg$FAILED) {
3467
3584
  s3 = peg$currPos;
3468
3585
  peg$silentFails++;
3469
- if (input.substr(peg$currPos, 3) === peg$c21) {
3470
- s4 = peg$c21;
3586
+ if (input.substr(peg$currPos, 3) === peg$c24) {
3587
+ s4 = peg$c24;
3471
3588
  peg$currPos += 3;
3472
3589
  } else {
3473
3590
  s4 = peg$FAILED;
3474
- if (peg$silentFails === 0) { peg$fail(peg$e40); }
3591
+ if (peg$silentFails === 0) { peg$fail(peg$e43); }
3475
3592
  }
3476
3593
  peg$silentFails--;
3477
3594
  if (s4 === peg$FAILED) {
@@ -3488,7 +3605,7 @@ function peg$parse(input, options) {
3488
3605
  peg$currPos++;
3489
3606
  } else {
3490
3607
  s6 = peg$FAILED;
3491
- if (peg$silentFails === 0) { peg$fail(peg$e41); }
3608
+ if (peg$silentFails === 0) { peg$fail(peg$e44); }
3492
3609
  }
3493
3610
  if (s6 !== peg$FAILED) {
3494
3611
  while (s6 !== peg$FAILED) {
@@ -3498,7 +3615,7 @@ function peg$parse(input, options) {
3498
3615
  peg$currPos++;
3499
3616
  } else {
3500
3617
  s6 = peg$FAILED;
3501
- if (peg$silentFails === 0) { peg$fail(peg$e41); }
3618
+ if (peg$silentFails === 0) { peg$fail(peg$e44); }
3502
3619
  }
3503
3620
  }
3504
3621
  } else {
@@ -3511,7 +3628,7 @@ function peg$parse(input, options) {
3511
3628
  }
3512
3629
  if (s4 !== peg$FAILED) {
3513
3630
  peg$savedPos = peg$currPos;
3514
- s5 = peg$f53(s4);
3631
+ s5 = peg$f55(s4);
3515
3632
  if (s5) {
3516
3633
  s5 = undefined;
3517
3634
  } else {
@@ -3545,7 +3662,7 @@ function peg$parse(input, options) {
3545
3662
  s9 = peg$parseVerbatimFieldValue();
3546
3663
  if (s9 !== peg$FAILED) {
3547
3664
  peg$savedPos = s0;
3548
- s0 = peg$f54(s4, s6, s9);
3665
+ s0 = peg$f56(s4, s6, s9);
3549
3666
  } else {
3550
3667
  peg$currPos = s0;
3551
3668
  s0 = peg$FAILED;
@@ -3586,12 +3703,12 @@ function peg$parse(input, options) {
3586
3703
  if (s1 !== peg$FAILED) {
3587
3704
  s2 = peg$currPos;
3588
3705
  peg$silentFails++;
3589
- if (input.substr(peg$currPos, 5) === peg$c20) {
3590
- s3 = peg$c20;
3706
+ if (input.substr(peg$currPos, 5) === peg$c23) {
3707
+ s3 = peg$c23;
3591
3708
  peg$currPos += 5;
3592
3709
  } else {
3593
3710
  s3 = peg$FAILED;
3594
- if (peg$silentFails === 0) { peg$fail(peg$e39); }
3711
+ if (peg$silentFails === 0) { peg$fail(peg$e42); }
3595
3712
  }
3596
3713
  peg$silentFails--;
3597
3714
  if (s3 === peg$FAILED) {
@@ -3603,12 +3720,12 @@ function peg$parse(input, options) {
3603
3720
  if (s2 !== peg$FAILED) {
3604
3721
  s3 = peg$currPos;
3605
3722
  peg$silentFails++;
3606
- if (input.substr(peg$currPos, 3) === peg$c21) {
3607
- s4 = peg$c21;
3723
+ if (input.substr(peg$currPos, 3) === peg$c24) {
3724
+ s4 = peg$c24;
3608
3725
  peg$currPos += 3;
3609
3726
  } else {
3610
3727
  s4 = peg$FAILED;
3611
- if (peg$silentFails === 0) { peg$fail(peg$e40); }
3728
+ if (peg$silentFails === 0) { peg$fail(peg$e43); }
3612
3729
  }
3613
3730
  peg$silentFails--;
3614
3731
  if (s4 === peg$FAILED) {
@@ -3625,7 +3742,7 @@ function peg$parse(input, options) {
3625
3742
  peg$currPos++;
3626
3743
  } else {
3627
3744
  s6 = peg$FAILED;
3628
- if (peg$silentFails === 0) { peg$fail(peg$e41); }
3745
+ if (peg$silentFails === 0) { peg$fail(peg$e44); }
3629
3746
  }
3630
3747
  if (s6 !== peg$FAILED) {
3631
3748
  while (s6 !== peg$FAILED) {
@@ -3635,7 +3752,7 @@ function peg$parse(input, options) {
3635
3752
  peg$currPos++;
3636
3753
  } else {
3637
3754
  s6 = peg$FAILED;
3638
- if (peg$silentFails === 0) { peg$fail(peg$e41); }
3755
+ if (peg$silentFails === 0) { peg$fail(peg$e44); }
3639
3756
  }
3640
3757
  }
3641
3758
  } else {
@@ -3648,7 +3765,7 @@ function peg$parse(input, options) {
3648
3765
  }
3649
3766
  if (s4 !== peg$FAILED) {
3650
3767
  peg$savedPos = peg$currPos;
3651
- s5 = peg$f55(s4);
3768
+ s5 = peg$f57(s4);
3652
3769
  if (s5) {
3653
3770
  s5 = undefined;
3654
3771
  } else {
@@ -3667,7 +3784,7 @@ function peg$parse(input, options) {
3667
3784
  s9 = peg$parseArgument();
3668
3785
  if (s9 !== peg$FAILED) {
3669
3786
  peg$savedPos = s0;
3670
- s0 = peg$f56(s4, s6, s8, s9);
3787
+ s0 = peg$f58(s4, s6, s8, s9);
3671
3788
  } else {
3672
3789
  peg$currPos = s0;
3673
3790
  s0 = peg$FAILED;
@@ -3708,12 +3825,12 @@ function peg$parse(input, options) {
3708
3825
  if (s1 !== peg$FAILED) {
3709
3826
  s2 = peg$currPos;
3710
3827
  peg$silentFails++;
3711
- if (input.substr(peg$currPos, 5) === peg$c20) {
3712
- s3 = peg$c20;
3828
+ if (input.substr(peg$currPos, 5) === peg$c23) {
3829
+ s3 = peg$c23;
3713
3830
  peg$currPos += 5;
3714
3831
  } else {
3715
3832
  s3 = peg$FAILED;
3716
- if (peg$silentFails === 0) { peg$fail(peg$e39); }
3833
+ if (peg$silentFails === 0) { peg$fail(peg$e42); }
3717
3834
  }
3718
3835
  peg$silentFails--;
3719
3836
  if (s3 === peg$FAILED) {
@@ -3725,12 +3842,12 @@ function peg$parse(input, options) {
3725
3842
  if (s2 !== peg$FAILED) {
3726
3843
  s3 = peg$currPos;
3727
3844
  peg$silentFails++;
3728
- if (input.substr(peg$currPos, 3) === peg$c21) {
3729
- s4 = peg$c21;
3845
+ if (input.substr(peg$currPos, 3) === peg$c24) {
3846
+ s4 = peg$c24;
3730
3847
  peg$currPos += 3;
3731
3848
  } else {
3732
3849
  s4 = peg$FAILED;
3733
- if (peg$silentFails === 0) { peg$fail(peg$e40); }
3850
+ if (peg$silentFails === 0) { peg$fail(peg$e43); }
3734
3851
  }
3735
3852
  peg$silentFails--;
3736
3853
  if (s4 === peg$FAILED) {
@@ -3747,7 +3864,7 @@ function peg$parse(input, options) {
3747
3864
  peg$currPos++;
3748
3865
  } else {
3749
3866
  s6 = peg$FAILED;
3750
- if (peg$silentFails === 0) { peg$fail(peg$e41); }
3867
+ if (peg$silentFails === 0) { peg$fail(peg$e44); }
3751
3868
  }
3752
3869
  if (s6 !== peg$FAILED) {
3753
3870
  while (s6 !== peg$FAILED) {
@@ -3757,7 +3874,7 @@ function peg$parse(input, options) {
3757
3874
  peg$currPos++;
3758
3875
  } else {
3759
3876
  s6 = peg$FAILED;
3760
- if (peg$silentFails === 0) { peg$fail(peg$e41); }
3877
+ if (peg$silentFails === 0) { peg$fail(peg$e44); }
3761
3878
  }
3762
3879
  }
3763
3880
  } else {
@@ -3770,7 +3887,7 @@ function peg$parse(input, options) {
3770
3887
  }
3771
3888
  if (s4 !== peg$FAILED) {
3772
3889
  peg$savedPos = peg$currPos;
3773
- s5 = peg$f57(s4);
3890
+ s5 = peg$f59(s4);
3774
3891
  if (s5) {
3775
3892
  s5 = undefined;
3776
3893
  } else {
@@ -3787,7 +3904,7 @@ function peg$parse(input, options) {
3787
3904
  s8 = peg$parseArgument();
3788
3905
  if (s8 !== peg$FAILED) {
3789
3906
  peg$savedPos = s0;
3790
- s0 = peg$f58(s4, s6, s8);
3907
+ s0 = peg$f60(s4, s6, s8);
3791
3908
  } else {
3792
3909
  peg$currPos = s0;
3793
3910
  s0 = peg$FAILED;
@@ -3824,12 +3941,12 @@ function peg$parse(input, options) {
3824
3941
  if (s1 !== peg$FAILED) {
3825
3942
  s2 = peg$currPos;
3826
3943
  peg$silentFails++;
3827
- if (input.substr(peg$currPos, 5) === peg$c20) {
3828
- s3 = peg$c20;
3944
+ if (input.substr(peg$currPos, 5) === peg$c23) {
3945
+ s3 = peg$c23;
3829
3946
  peg$currPos += 5;
3830
3947
  } else {
3831
3948
  s3 = peg$FAILED;
3832
- if (peg$silentFails === 0) { peg$fail(peg$e39); }
3949
+ if (peg$silentFails === 0) { peg$fail(peg$e42); }
3833
3950
  }
3834
3951
  peg$silentFails--;
3835
3952
  if (s3 === peg$FAILED) {
@@ -3841,12 +3958,12 @@ function peg$parse(input, options) {
3841
3958
  if (s2 !== peg$FAILED) {
3842
3959
  s3 = peg$currPos;
3843
3960
  peg$silentFails++;
3844
- if (input.substr(peg$currPos, 3) === peg$c21) {
3845
- s4 = peg$c21;
3961
+ if (input.substr(peg$currPos, 3) === peg$c24) {
3962
+ s4 = peg$c24;
3846
3963
  peg$currPos += 3;
3847
3964
  } else {
3848
3965
  s4 = peg$FAILED;
3849
- if (peg$silentFails === 0) { peg$fail(peg$e40); }
3966
+ if (peg$silentFails === 0) { peg$fail(peg$e43); }
3850
3967
  }
3851
3968
  peg$silentFails--;
3852
3969
  if (s4 === peg$FAILED) {
@@ -3863,7 +3980,7 @@ function peg$parse(input, options) {
3863
3980
  peg$currPos++;
3864
3981
  } else {
3865
3982
  s6 = peg$FAILED;
3866
- if (peg$silentFails === 0) { peg$fail(peg$e41); }
3983
+ if (peg$silentFails === 0) { peg$fail(peg$e44); }
3867
3984
  }
3868
3985
  if (s6 !== peg$FAILED) {
3869
3986
  while (s6 !== peg$FAILED) {
@@ -3873,7 +3990,7 @@ function peg$parse(input, options) {
3873
3990
  peg$currPos++;
3874
3991
  } else {
3875
3992
  s6 = peg$FAILED;
3876
- if (peg$silentFails === 0) { peg$fail(peg$e41); }
3993
+ if (peg$silentFails === 0) { peg$fail(peg$e44); }
3877
3994
  }
3878
3995
  }
3879
3996
  } else {
@@ -3893,7 +4010,7 @@ function peg$parse(input, options) {
3893
4010
  }
3894
4011
  s6 = peg$parse__();
3895
4012
  peg$savedPos = s0;
3896
- s0 = peg$f59(s4, s5);
4013
+ s0 = peg$f61(s4, s5);
3897
4014
  } else {
3898
4015
  peg$currPos = s0;
3899
4016
  s0 = peg$FAILED;
@@ -3925,11 +4042,11 @@ function peg$parse(input, options) {
3925
4042
 
3926
4043
  s0 = peg$currPos;
3927
4044
  if (input.charCodeAt(peg$currPos) === 91) {
3928
- s1 = peg$c22;
4045
+ s1 = peg$c25;
3929
4046
  peg$currPos++;
3930
4047
  } else {
3931
4048
  s1 = peg$FAILED;
3932
- if (peg$silentFails === 0) { peg$fail(peg$e42); }
4049
+ if (peg$silentFails === 0) { peg$fail(peg$e45); }
3933
4050
  }
3934
4051
  if (s1 !== peg$FAILED) {
3935
4052
  s2 = peg$parse__h();
@@ -3940,7 +4057,7 @@ function peg$parse(input, options) {
3940
4057
  peg$currPos++;
3941
4058
  } else {
3942
4059
  s5 = peg$FAILED;
3943
- if (peg$silentFails === 0) { peg$fail(peg$e43); }
4060
+ if (peg$silentFails === 0) { peg$fail(peg$e46); }
3944
4061
  }
3945
4062
  if (s5 !== peg$FAILED) {
3946
4063
  while (s5 !== peg$FAILED) {
@@ -3950,7 +4067,7 @@ function peg$parse(input, options) {
3950
4067
  peg$currPos++;
3951
4068
  } else {
3952
4069
  s5 = peg$FAILED;
3953
- if (peg$silentFails === 0) { peg$fail(peg$e43); }
4070
+ if (peg$silentFails === 0) { peg$fail(peg$e46); }
3954
4071
  }
3955
4072
  }
3956
4073
  } else {
@@ -3964,15 +4081,15 @@ function peg$parse(input, options) {
3964
4081
  if (s3 !== peg$FAILED) {
3965
4082
  s4 = peg$parse__h();
3966
4083
  if (input.charCodeAt(peg$currPos) === 93) {
3967
- s5 = peg$c23;
4084
+ s5 = peg$c26;
3968
4085
  peg$currPos++;
3969
4086
  } else {
3970
4087
  s5 = peg$FAILED;
3971
- if (peg$silentFails === 0) { peg$fail(peg$e44); }
4088
+ if (peg$silentFails === 0) { peg$fail(peg$e47); }
3972
4089
  }
3973
4090
  if (s5 !== peg$FAILED) {
3974
4091
  peg$savedPos = s0;
3975
- s0 = peg$f60(s3);
4092
+ s0 = peg$f62(s3);
3976
4093
  } else {
3977
4094
  peg$currPos = s0;
3978
4095
  s0 = peg$FAILED;
@@ -3999,11 +4116,11 @@ function peg$parse(input, options) {
3999
4116
  peg$currPos++;
4000
4117
  } else {
4001
4118
  s2 = peg$FAILED;
4002
- if (peg$silentFails === 0) { peg$fail(peg$e45); }
4119
+ if (peg$silentFails === 0) { peg$fail(peg$e48); }
4003
4120
  }
4004
4121
  if (s2 !== peg$FAILED) {
4005
4122
  peg$savedPos = s0;
4006
- s0 = peg$f61(s2);
4123
+ s0 = peg$f63(s2);
4007
4124
  } else {
4008
4125
  peg$currPos = s0;
4009
4126
  s0 = peg$FAILED;
@@ -4016,7 +4133,7 @@ function peg$parse(input, options) {
4016
4133
  }
4017
4134
  if (s1 !== peg$FAILED) {
4018
4135
  peg$savedPos = s0;
4019
- s1 = peg$f62(s1);
4136
+ s1 = peg$f64(s1);
4020
4137
  }
4021
4138
  s0 = s1;
4022
4139
  }
@@ -4034,7 +4151,7 @@ function peg$parse(input, options) {
4034
4151
  peg$currPos++;
4035
4152
  } else {
4036
4153
  s2 = peg$FAILED;
4037
- if (peg$silentFails === 0) { peg$fail(peg$e46); }
4154
+ if (peg$silentFails === 0) { peg$fail(peg$e49); }
4038
4155
  }
4039
4156
  if (s2 !== peg$FAILED) {
4040
4157
  s3 = [];
@@ -4043,7 +4160,7 @@ function peg$parse(input, options) {
4043
4160
  peg$currPos++;
4044
4161
  } else {
4045
4162
  s4 = peg$FAILED;
4046
- if (peg$silentFails === 0) { peg$fail(peg$e47); }
4163
+ if (peg$silentFails === 0) { peg$fail(peg$e50); }
4047
4164
  }
4048
4165
  while (s4 !== peg$FAILED) {
4049
4166
  s3.push(s4);
@@ -4052,7 +4169,7 @@ function peg$parse(input, options) {
4052
4169
  peg$currPos++;
4053
4170
  } else {
4054
4171
  s4 = peg$FAILED;
4055
- if (peg$silentFails === 0) { peg$fail(peg$e47); }
4172
+ if (peg$silentFails === 0) { peg$fail(peg$e50); }
4056
4173
  }
4057
4174
  }
4058
4175
  s2 = [s2, s3];
@@ -4078,7 +4195,7 @@ function peg$parse(input, options) {
4078
4195
  peg$currPos++;
4079
4196
  } else {
4080
4197
  s0 = peg$FAILED;
4081
- if (peg$silentFails === 0) { peg$fail(peg$e48); }
4198
+ if (peg$silentFails === 0) { peg$fail(peg$e51); }
4082
4199
  }
4083
4200
 
4084
4201
  return s0;
@@ -4092,7 +4209,7 @@ function peg$parse(input, options) {
4092
4209
  peg$currPos++;
4093
4210
  } else {
4094
4211
  s0 = peg$FAILED;
4095
- if (peg$silentFails === 0) { peg$fail(peg$e49); }
4212
+ if (peg$silentFails === 0) { peg$fail(peg$e52); }
4096
4213
  }
4097
4214
 
4098
4215
  return s0;
@@ -4104,11 +4221,11 @@ function peg$parse(input, options) {
4104
4221
  s0 = peg$currPos;
4105
4222
  s1 = peg$parse__();
4106
4223
  if (input.charCodeAt(peg$currPos) === 61) {
4107
- s2 = peg$c24;
4224
+ s2 = peg$c27;
4108
4225
  peg$currPos++;
4109
4226
  } else {
4110
4227
  s2 = peg$FAILED;
4111
- if (peg$silentFails === 0) { peg$fail(peg$e50); }
4228
+ if (peg$silentFails === 0) { peg$fail(peg$e53); }
4112
4229
  }
4113
4230
  if (s2 !== peg$FAILED) {
4114
4231
  s3 = peg$parse__();
@@ -4162,11 +4279,11 @@ function peg$parse(input, options) {
4162
4279
  s0 = peg$currPos;
4163
4280
  s1 = peg$parse__();
4164
4281
  if (input.charCodeAt(peg$currPos) === 35) {
4165
- s2 = peg$c25;
4282
+ s2 = peg$c28;
4166
4283
  peg$currPos++;
4167
4284
  } else {
4168
4285
  s2 = peg$FAILED;
4169
- if (peg$silentFails === 0) { peg$fail(peg$e51); }
4286
+ if (peg$silentFails === 0) { peg$fail(peg$e54); }
4170
4287
  }
4171
4288
  if (s2 !== peg$FAILED) {
4172
4289
  s3 = peg$parse__();
@@ -4188,7 +4305,7 @@ function peg$parse(input, options) {
4188
4305
  peg$currPos++;
4189
4306
  } else {
4190
4307
  s0 = peg$FAILED;
4191
- if (peg$silentFails === 0) { peg$fail(peg$e52); }
4308
+ if (peg$silentFails === 0) { peg$fail(peg$e55); }
4192
4309
  }
4193
4310
 
4194
4311
  return s0;
@@ -4204,7 +4321,7 @@ function peg$parse(input, options) {
4204
4321
  peg$currPos++;
4205
4322
  } else {
4206
4323
  s1 = peg$FAILED;
4207
- if (peg$silentFails === 0) { peg$fail(peg$e54); }
4324
+ if (peg$silentFails === 0) { peg$fail(peg$e57); }
4208
4325
  }
4209
4326
  if (s1 !== peg$FAILED) {
4210
4327
  while (s1 !== peg$FAILED) {
@@ -4214,7 +4331,7 @@ function peg$parse(input, options) {
4214
4331
  peg$currPos++;
4215
4332
  } else {
4216
4333
  s1 = peg$FAILED;
4217
- if (peg$silentFails === 0) { peg$fail(peg$e54); }
4334
+ if (peg$silentFails === 0) { peg$fail(peg$e57); }
4218
4335
  }
4219
4336
  }
4220
4337
  } else {
@@ -4223,7 +4340,7 @@ function peg$parse(input, options) {
4223
4340
  peg$silentFails--;
4224
4341
  if (s0 === peg$FAILED) {
4225
4342
  s1 = peg$FAILED;
4226
- if (peg$silentFails === 0) { peg$fail(peg$e53); }
4343
+ if (peg$silentFails === 0) { peg$fail(peg$e56); }
4227
4344
  }
4228
4345
 
4229
4346
  return s0;
@@ -4239,7 +4356,7 @@ function peg$parse(input, options) {
4239
4356
  peg$currPos++;
4240
4357
  } else {
4241
4358
  s1 = peg$FAILED;
4242
- if (peg$silentFails === 0) { peg$fail(peg$e54); }
4359
+ if (peg$silentFails === 0) { peg$fail(peg$e57); }
4243
4360
  }
4244
4361
  while (s1 !== peg$FAILED) {
4245
4362
  s0.push(s1);
@@ -4248,12 +4365,12 @@ function peg$parse(input, options) {
4248
4365
  peg$currPos++;
4249
4366
  } else {
4250
4367
  s1 = peg$FAILED;
4251
- if (peg$silentFails === 0) { peg$fail(peg$e54); }
4368
+ if (peg$silentFails === 0) { peg$fail(peg$e57); }
4252
4369
  }
4253
4370
  }
4254
4371
  peg$silentFails--;
4255
4372
  s1 = peg$FAILED;
4256
- if (peg$silentFails === 0) { peg$fail(peg$e55); }
4373
+ if (peg$silentFails === 0) { peg$fail(peg$e58); }
4257
4374
 
4258
4375
  return s0;
4259
4376
  }
@@ -4268,7 +4385,7 @@ function peg$parse(input, options) {
4268
4385
  peg$currPos++;
4269
4386
  } else {
4270
4387
  s1 = peg$FAILED;
4271
- if (peg$silentFails === 0) { peg$fail(peg$e52); }
4388
+ if (peg$silentFails === 0) { peg$fail(peg$e55); }
4272
4389
  }
4273
4390
  if (s1 !== peg$FAILED) {
4274
4391
  while (s1 !== peg$FAILED) {
@@ -4278,7 +4395,7 @@ function peg$parse(input, options) {
4278
4395
  peg$currPos++;
4279
4396
  } else {
4280
4397
  s1 = peg$FAILED;
4281
- if (peg$silentFails === 0) { peg$fail(peg$e52); }
4398
+ if (peg$silentFails === 0) { peg$fail(peg$e55); }
4282
4399
  }
4283
4400
  }
4284
4401
  } else {
@@ -4287,7 +4404,7 @@ function peg$parse(input, options) {
4287
4404
  peg$silentFails--;
4288
4405
  if (s0 === peg$FAILED) {
4289
4406
  s1 = peg$FAILED;
4290
- if (peg$silentFails === 0) { peg$fail(peg$e56); }
4407
+ if (peg$silentFails === 0) { peg$fail(peg$e59); }
4291
4408
  }
4292
4409
 
4293
4410
  return s0;
@@ -4303,7 +4420,7 @@ function peg$parse(input, options) {
4303
4420
  peg$currPos++;
4304
4421
  } else {
4305
4422
  s1 = peg$FAILED;
4306
- if (peg$silentFails === 0) { peg$fail(peg$e52); }
4423
+ if (peg$silentFails === 0) { peg$fail(peg$e55); }
4307
4424
  }
4308
4425
  while (s1 !== peg$FAILED) {
4309
4426
  s0.push(s1);
@@ -4312,12 +4429,12 @@ function peg$parse(input, options) {
4312
4429
  peg$currPos++;
4313
4430
  } else {
4314
4431
  s1 = peg$FAILED;
4315
- if (peg$silentFails === 0) { peg$fail(peg$e52); }
4432
+ if (peg$silentFails === 0) { peg$fail(peg$e55); }
4316
4433
  }
4317
4434
  }
4318
4435
  peg$silentFails--;
4319
4436
  s1 = peg$FAILED;
4320
- if (peg$silentFails === 0) { peg$fail(peg$e57); }
4437
+ if (peg$silentFails === 0) { peg$fail(peg$e60); }
4321
4438
 
4322
4439
  return s0;
4323
4440
  }
@@ -4332,7 +4449,7 @@ function peg$parse(input, options) {
4332
4449
  peg$currPos++;
4333
4450
  } else {
4334
4451
  s1 = peg$FAILED;
4335
- if (peg$silentFails === 0) { peg$fail(peg$e59); }
4452
+ if (peg$silentFails === 0) { peg$fail(peg$e62); }
4336
4453
  }
4337
4454
  if (s1 !== peg$FAILED) {
4338
4455
  while (s1 !== peg$FAILED) {
@@ -4342,7 +4459,7 @@ function peg$parse(input, options) {
4342
4459
  peg$currPos++;
4343
4460
  } else {
4344
4461
  s1 = peg$FAILED;
4345
- if (peg$silentFails === 0) { peg$fail(peg$e59); }
4462
+ if (peg$silentFails === 0) { peg$fail(peg$e62); }
4346
4463
  }
4347
4464
  }
4348
4465
  } else {
@@ -4351,7 +4468,7 @@ function peg$parse(input, options) {
4351
4468
  peg$silentFails--;
4352
4469
  if (s0 === peg$FAILED) {
4353
4470
  s1 = peg$FAILED;
4354
- if (peg$silentFails === 0) { peg$fail(peg$e58); }
4471
+ if (peg$silentFails === 0) { peg$fail(peg$e61); }
4355
4472
  }
4356
4473
 
4357
4474
  return s0;
@@ -4367,7 +4484,7 @@ function peg$parse(input, options) {
4367
4484
  peg$currPos++;
4368
4485
  } else {
4369
4486
  s1 = peg$FAILED;
4370
- if (peg$silentFails === 0) { peg$fail(peg$e59); }
4487
+ if (peg$silentFails === 0) { peg$fail(peg$e62); }
4371
4488
  }
4372
4489
  while (s1 !== peg$FAILED) {
4373
4490
  s0.push(s1);
@@ -4376,12 +4493,12 @@ function peg$parse(input, options) {
4376
4493
  peg$currPos++;
4377
4494
  } else {
4378
4495
  s1 = peg$FAILED;
4379
- if (peg$silentFails === 0) { peg$fail(peg$e59); }
4496
+ if (peg$silentFails === 0) { peg$fail(peg$e62); }
4380
4497
  }
4381
4498
  }
4382
4499
  peg$silentFails--;
4383
4500
  s1 = peg$FAILED;
4384
- if (peg$silentFails === 0) { peg$fail(peg$e60); }
4501
+ if (peg$silentFails === 0) { peg$fail(peg$e63); }
4385
4502
 
4386
4503
  return s0;
4387
4504
  }
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as bibtex from './grammar';
2
2
  import { JabRefMetadata } from './jabref';
3
3
  export declare function toSentenceCase(text: string, ignoreHTML?: boolean): string;
4
- declare type Node = bibtex.Bibliography | bibtex.Math | bibtex.Environment | bibtex.Block | bibtex.RegularCommand | bibtex.DiacriticCommand | bibtex.Entry | bibtex.Field | bibtex.NumberValue | bibtex.StringDeclaration | bibtex.StringReference | bibtex.SubscriptCommand | bibtex.SuperscriptCommand | bibtex.SymbolCommand | bibtex.TextValue | bibtex.PreambleExpression | bibtex.BracedComment | bibtex.LineComment | bibtex.Markup | bibtex.NonEntryText;
4
+ type Node = bibtex.Bibliography | bibtex.Math | bibtex.Environment | bibtex.Block | bibtex.RegularCommand | bibtex.DiacriticCommand | bibtex.Entry | bibtex.Field | bibtex.NumberValue | bibtex.StringDeclaration | bibtex.StringReference | bibtex.SubscriptCommand | bibtex.SuperscriptCommand | bibtex.SymbolCommand | bibtex.TextValue | bibtex.PreambleExpression | bibtex.BracedComment | bibtex.LineComment | bibtex.Markup | bibtex.NonEntryText;
5
5
  export interface Name {
6
6
  /**
7
7
  * If the name is a literal (surrounded by braces) it will be in this property, and none of the other properties will be set
@@ -230,8 +230,8 @@ export interface ParserOptions {
230
230
  */
231
231
  verbatimCommands?: string[];
232
232
  /**
233
- * In the past many bibtex entries would just always wrap a field in double braces ({{ title here }}), likely because whomever was writing them couldn't figure out the case meddling rules (and who could
234
- * blame them. Fields listed here will either have one outer layer of braces treated as case-preserve, or have the outer braced be ignored completely, if this is detected.
233
+ * In the past many bibtex entries would just always wrap a field in double braces, likely because whomever was writing them couldn't figure out the case meddling rules (and who could
234
+ * blame them). Fields listed here will either have one outer layer of braces treated as case-preserve, or have the outer braced be ignored completely, if this is detected.
235
235
  */
236
236
  unnestFields?: string[];
237
237
  unnestMode?: 'preserve' | 'unwrap';
package/index.js CHANGED
@@ -586,9 +586,16 @@ class Parser {
586
586
  }
587
587
  return false;
588
588
  }
589
+ isBreak(node, kind) {
590
+ return node && node.kind === 'RegularCommand' && kind.includes(node.command);
591
+ }
589
592
  clean(node) {
590
- if (Array.isArray(node))
591
- return node.map(child => this.clean(child)); // eslint-disable-line @typescript-eslint/no-unsafe-return
593
+ if (Array.isArray(node)) {
594
+ return node
595
+ .filter((child, i) => !(this.isBreak(child, ['\\']) && this.isBreak(node[i - 1], ['\\', 'par']))) // condense linebreaks
596
+ .filter((child, i) => !this.isBreak(child, ['par']) || !this.isBreak(node[i - 1], ['par'])) // condense parbreaks
597
+ .map(child => this.clean(child)); // eslint-disable-line @typescript-eslint/no-unsafe-return
598
+ }
592
599
  delete node.loc;
593
600
  switch (node.kind) {
594
601
  case 'InlineMath':
@@ -623,6 +630,7 @@ class Parser {
623
630
  case 'Text':
624
631
  case 'BracedComment':
625
632
  case 'LineComment':
633
+ case 'NonEntryText':
626
634
  return node;
627
635
  default:
628
636
  return this.error(new ParserError(`no cleanup method for ${this.show(node)}`, node), this.text());
@@ -985,7 +993,8 @@ class Parser {
985
993
  case 'right':
986
994
  return this.text();
987
995
  case 'par':
988
- return this.text('\n\n');
996
+ case '\\':
997
+ return node;
989
998
  case 'cyr':
990
999
  if (this.argument(node, 'none'))
991
1000
  return this.text();
@@ -1151,6 +1160,12 @@ class Parser {
1151
1160
  if (node.kind === 'RegularCommand' && node.command === 'href') {
1152
1161
  this.convert_href(node);
1153
1162
  }
1163
+ else if (node.kind === 'RegularCommand' && node.command === 'par') {
1164
+ this.field.text += this.field.html ? '<p>\n' : ' ';
1165
+ }
1166
+ else if (node.kind === 'RegularCommand' && node.command === '\\') {
1167
+ this.field.text += this.field.html ? '<b>\n' : ' ';
1168
+ }
1154
1169
  else {
1155
1170
  return this.error(new ParserError(`no converter for ${node.kind}: ${this.show(node)}`, node));
1156
1171
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@retorquere/bibtex-parser",
3
- "version": "6.3.11",
3
+ "version": "6.4.0",
4
4
  "description": "BibTeX parser",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -32,27 +32,27 @@
32
32
  "author": "Emiliano Heyns",
33
33
  "license": "ISC",
34
34
  "devDependencies": {
35
- "@types/node": "^18.11.7",
36
- "@typescript-eslint/eslint-plugin": "^5.41.0",
37
- "@typescript-eslint/parser": "^5.41.0",
35
+ "@types/node": "^18.11.18",
36
+ "@typescript-eslint/eslint-plugin": "^5.48.0",
37
+ "@typescript-eslint/parser": "^5.48.0",
38
38
  "command-line-args": "^5.2.1",
39
- "csv": "^6.2.1",
39
+ "csv": "^6.2.5",
40
40
  "digital-tree": "^2.0.4",
41
41
  "ejs": "^3.1.8",
42
- "eslint": "^8.26.0",
42
+ "eslint": "^8.31.0",
43
43
  "eslint-plugin-import": "^2.26.0",
44
44
  "eslint-plugin-prefer-arrow": "^1.2.3",
45
45
  "glob": "^8.0.3",
46
46
  "mkdirp": "^1.0.4",
47
- "node-fetch": "^3.2.10",
47
+ "node-fetch": "^3.3.0",
48
48
  "peggy": "^2.0.1",
49
49
  "piscina": "^3.2.0",
50
50
  "slug": "^8.2.2",
51
- "tap": "^16.3.0",
51
+ "tap": "^16.3.2",
52
52
  "ts-node": "^10.9.1",
53
- "tslib": "^2.4.0",
54
- "typedoc": "^0.23.19",
55
- "typescript": "^4.8.4"
53
+ "tslib": "^2.4.1",
54
+ "typedoc": "^0.23.23",
55
+ "typescript": "^4.9.4"
56
56
  },
57
57
  "dependencies": {
58
58
  "unicode2latex": "^3.0.0",