@markdoc/markdoc 0.5.13 → 0.5.14

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 (86) hide show
  1. package/README.md +11 -0
  2. package/dist/index.d.ts +4 -4
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +467 -462
  5. package/dist/index.js.map +4 -4
  6. package/dist/index.mjs +467 -462
  7. package/dist/index.mjs.map +4 -4
  8. package/dist/react.js +1 -1
  9. package/dist/react.js.map +2 -2
  10. package/dist/src/ast/base.d.ts +1 -1
  11. package/dist/src/ast/base.d.ts.map +1 -1
  12. package/dist/src/ast/function.d.ts +1 -1
  13. package/dist/src/ast/function.d.ts.map +1 -1
  14. package/dist/src/ast/index.d.ts +2 -2
  15. package/dist/src/ast/index.d.ts.map +1 -1
  16. package/dist/src/ast/node.d.ts.map +1 -1
  17. package/dist/src/ast/variable.d.ts +1 -1
  18. package/dist/src/ast/variable.d.ts.map +1 -1
  19. package/dist/src/formatter.d.ts.map +1 -1
  20. package/dist/src/functions/index.d.ts.map +1 -1
  21. package/dist/src/parser.d.ts.map +1 -1
  22. package/dist/src/renderers/html.d.ts.map +1 -1
  23. package/dist/src/renderers/react/react.d.ts +2 -2
  24. package/dist/src/renderers/react/react.d.ts.map +1 -1
  25. package/dist/src/renderers/react/static.d.ts +1 -1
  26. package/dist/src/renderers/react/static.d.ts.map +1 -1
  27. package/dist/src/schema-types/class.d.ts +1 -1
  28. package/dist/src/schema-types/class.d.ts.map +1 -1
  29. package/dist/src/schema-types/conditional.d.ts +1 -1
  30. package/dist/src/schema-types/conditional.d.ts.map +1 -1
  31. package/dist/src/schema.d.ts.map +1 -1
  32. package/dist/src/tags/conditional.d.ts +1 -1
  33. package/dist/src/tags/conditional.d.ts.map +1 -1
  34. package/dist/src/tokenizer/index.d.ts.map +1 -1
  35. package/dist/src/tokenizer/plugins/annotations.d.ts.map +1 -1
  36. package/dist/src/transformer.d.ts.map +1 -1
  37. package/dist/src/validator.d.ts +1 -1
  38. package/dist/src/validator.d.ts.map +1 -1
  39. package/index.ts +21 -22
  40. package/package.json +7 -13
  41. package/spec/support/matchers.d.ts +6 -4
  42. package/src/ast/base.ts +2 -2
  43. package/src/ast/function.ts +1 -1
  44. package/src/ast/index.ts +3 -4
  45. package/src/ast/node.test.ts +60 -46
  46. package/src/ast/node.ts +3 -3
  47. package/src/ast/variable.test.ts +5 -4
  48. package/src/ast/variable.ts +1 -1
  49. package/src/formatter.test.ts +4 -3
  50. package/src/formatter.ts +11 -11
  51. package/src/functions/index.test.ts +8 -7
  52. package/src/functions/index.ts +1 -1
  53. package/src/grammar/tag.d.ts +1 -1
  54. package/src/grammar/tag.js +208 -285
  55. package/src/grammar/tag.pegjs +4 -4
  56. package/src/grammar/tag.test.ts +56 -52
  57. package/src/parser.test.ts +93 -70
  58. package/src/parser.ts +19 -6
  59. package/src/renderers/html.test.ts +56 -16
  60. package/src/renderers/html.ts +10 -2
  61. package/src/renderers/react/react.test.ts +29 -28
  62. package/src/renderers/react/react.ts +7 -8
  63. package/src/renderers/react/static.ts +5 -6
  64. package/src/schema-types/class.ts +1 -1
  65. package/src/schema-types/conditional.ts +1 -1
  66. package/src/schema.ts +9 -4
  67. package/src/tag.test.ts +2 -1
  68. package/src/tag.ts +1 -1
  69. package/src/tags/conditional.ts +4 -4
  70. package/src/tags/index.ts +2 -2
  71. package/src/tags/partial.ts +1 -1
  72. package/src/tokenizer/index.ts +6 -5
  73. package/src/tokenizer/plugins/annotations.test.ts +29 -28
  74. package/src/tokenizer/plugins/annotations.ts +12 -12
  75. package/src/tokenizer/plugins/comments.test.ts +11 -10
  76. package/src/tokenizer/plugins/comments.ts +2 -2
  77. package/src/tokenizer/plugins/frontmatter.test.ts +7 -6
  78. package/src/tokenizer/plugins/frontmatter.ts +2 -2
  79. package/src/tokenizer/plugins/link.test.ts +14 -13
  80. package/src/transformer.ts +7 -5
  81. package/src/transforms/table.test.ts +18 -17
  82. package/src/transforms/table.ts +1 -1
  83. package/src/utils.test.ts +23 -22
  84. package/src/utils.ts +3 -3
  85. package/src/validator.test.ts +60 -59
  86. package/src/validator.ts +13 -11
@@ -1,11 +1,9 @@
1
1
  // Generated by PEG.js v0.11.0-master.b7b87ea, https://pegjs.org/
2
2
 
3
- 'use strict';
3
+ "use strict";
4
4
 
5
5
  function peg$subclass(child, parent) {
6
- function C() {
7
- this.constructor = child;
8
- }
6
+ function C() { this.constructor = child; }
9
7
  C.prototype = parent.prototype;
10
8
  child.prototype = new C();
11
9
  }
@@ -15,47 +13,47 @@ function peg$SyntaxError(message, expected, found, location) {
15
13
  this.expected = expected;
16
14
  this.found = found;
17
15
  this.location = location;
18
- this.name = 'SyntaxError';
16
+ this.name = "SyntaxError";
19
17
 
20
18
  // istanbul ignore next
21
- if (typeof Error.captureStackTrace === 'function') {
19
+ if (typeof Error.captureStackTrace === "function") {
22
20
  Error.captureStackTrace(this, peg$SyntaxError);
23
21
  }
24
22
  }
25
23
 
26
24
  peg$subclass(peg$SyntaxError, Error);
27
25
 
28
- peg$SyntaxError.buildMessage = function (expected, found, location) {
26
+ peg$SyntaxError.buildMessage = function(expected, found, location) {
29
27
  var DESCRIBE_EXPECTATION_FNS = {
30
- literal: function (expectation) {
31
- return '"' + literalEscape(expectation.text) + '"';
28
+ literal: function(expectation) {
29
+ return "\"" + literalEscape(expectation.text) + "\"";
32
30
  },
33
31
 
34
- class: function (expectation) {
35
- var escapedParts = expectation.parts.map(function (part) {
32
+ class: function(expectation) {
33
+ var escapedParts = expectation.parts.map(function(part) {
36
34
  return Array.isArray(part)
37
- ? classEscape(part[0]) + '-' + classEscape(part[1])
35
+ ? classEscape(part[0]) + "-" + classEscape(part[1])
38
36
  : classEscape(part);
39
37
  });
40
38
 
41
- return '[' + (expectation.inverted ? '^' : '') + escapedParts + ']';
39
+ return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
42
40
  },
43
41
 
44
- any: function () {
45
- return 'any character';
42
+ any: function() {
43
+ return "any character";
46
44
  },
47
45
 
48
- end: function () {
49
- return 'end of input';
46
+ end: function() {
47
+ return "end of input";
50
48
  },
51
49
 
52
- other: function (expectation) {
50
+ other: function(expectation) {
53
51
  return expectation.description;
54
52
  },
55
53
 
56
- not: function (expectation) {
57
- return 'not ' + describeExpectation(expectation.expected);
58
- },
54
+ not: function(expectation) {
55
+ return "not " + describeExpectation(expectation.expected);
56
+ }
59
57
  };
60
58
 
61
59
  function hex(ch) {
@@ -64,36 +62,28 @@ peg$SyntaxError.buildMessage = function (expected, found, location) {
64
62
 
65
63
  function literalEscape(s) {
66
64
  return s
67
- .replace(/\\/g, '\\\\')
68
- .replace(/"/g, '\\"')
69
- .replace(/\0/g, '\\0')
70
- .replace(/\t/g, '\\t')
71
- .replace(/\n/g, '\\n')
72
- .replace(/\r/g, '\\r')
73
- .replace(/[\x00-\x0F]/g, function (ch) {
74
- return '\\x0' + hex(ch);
75
- })
76
- .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) {
77
- return '\\x' + hex(ch);
78
- });
65
+ .replace(/\\/g, "\\\\")
66
+ .replace(/"/g, "\\\"")
67
+ .replace(/\0/g, "\\0")
68
+ .replace(/\t/g, "\\t")
69
+ .replace(/\n/g, "\\n")
70
+ .replace(/\r/g, "\\r")
71
+ .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); })
72
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); });
79
73
  }
80
74
 
81
75
  function classEscape(s) {
82
76
  return s
83
- .replace(/\\/g, '\\\\')
84
- .replace(/\]/g, '\\]')
85
- .replace(/\^/g, '\\^')
86
- .replace(/-/g, '\\-')
87
- .replace(/\0/g, '\\0')
88
- .replace(/\t/g, '\\t')
89
- .replace(/\n/g, '\\n')
90
- .replace(/\r/g, '\\r')
91
- .replace(/[\x00-\x0F]/g, function (ch) {
92
- return '\\x0' + hex(ch);
93
- })
94
- .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) {
95
- return '\\x' + hex(ch);
96
- });
77
+ .replace(/\\/g, "\\\\")
78
+ .replace(/\]/g, "\\]")
79
+ .replace(/\^/g, "\\^")
80
+ .replace(/-/g, "\\-")
81
+ .replace(/\0/g, "\\0")
82
+ .replace(/\t/g, "\\t")
83
+ .replace(/\n/g, "\\n")
84
+ .replace(/\r/g, "\\r")
85
+ .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); })
86
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); });
97
87
  }
98
88
 
99
89
  function describeExpectation(expectation) {
@@ -121,28 +111,20 @@ peg$SyntaxError.buildMessage = function (expected, found, location) {
121
111
  return descriptions[0];
122
112
 
123
113
  case 2:
124
- return descriptions[0] + ' or ' + descriptions[1];
114
+ return descriptions[0] + " or " + descriptions[1];
125
115
 
126
116
  default:
127
- return (
128
- descriptions.slice(0, -1).join(', ') +
129
- ', or ' +
130
- descriptions[descriptions.length - 1]
131
- );
117
+ return descriptions.slice(0, -1).join(", ")
118
+ + ", or "
119
+ + descriptions[descriptions.length - 1];
132
120
  }
133
121
  }
134
122
 
135
123
  function describeFound(found) {
136
- return found ? '"' + literalEscape(found) + '"' : 'end of input';
124
+ return found ? "\"" + literalEscape(found) + "\"" : "end of input";
137
125
  }
138
126
 
139
- return (
140
- 'Expected ' +
141
- describeExpected(expected) +
142
- ' but ' +
143
- describeFound(found) +
144
- ' found.'
145
- );
127
+ return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
146
128
  };
147
129
 
148
130
  function peg$parse(input, options) {
@@ -153,27 +135,27 @@ function peg$parse(input, options) {
153
135
  var peg$startRuleFunctions = { Top: peg$parseTop };
154
136
  var peg$startRuleFunction = peg$parseTop;
155
137
 
156
- var peg$c0 = '/';
157
- var peg$c1 = '.';
158
- var peg$c2 = '#';
159
- var peg$c3 = '=';
160
- var peg$c4 = '(';
161
- var peg$c5 = ')';
162
- var peg$c6 = ',';
163
- var peg$c7 = '[';
164
- var peg$c8 = ']';
165
- var peg$c9 = 'null';
166
- var peg$c10 = 'true';
167
- var peg$c11 = 'false';
168
- var peg$c12 = '{';
169
- var peg$c13 = '}';
170
- var peg$c14 = ':';
171
- var peg$c15 = '-';
172
- var peg$c16 = '"';
173
- var peg$c17 = '\\';
174
- var peg$c18 = 'n';
175
- var peg$c19 = 'r';
176
- var peg$c20 = 't';
138
+ var peg$c0 = "/";
139
+ var peg$c1 = ".";
140
+ var peg$c2 = "#";
141
+ var peg$c3 = "=";
142
+ var peg$c4 = "(";
143
+ var peg$c5 = ")";
144
+ var peg$c6 = ",";
145
+ var peg$c7 = "[";
146
+ var peg$c8 = "]";
147
+ var peg$c9 = "null";
148
+ var peg$c10 = "true";
149
+ var peg$c11 = "false";
150
+ var peg$c12 = "{";
151
+ var peg$c13 = "}";
152
+ var peg$c14 = ":";
153
+ var peg$c15 = "-";
154
+ var peg$c16 = "\"";
155
+ var peg$c17 = "\\";
156
+ var peg$c18 = "n";
157
+ var peg$c19 = "r";
158
+ var peg$c20 = "t";
177
159
 
178
160
  var peg$r0 = /^[$@]/;
179
161
  var peg$r1 = /^[0-9]/;
@@ -181,140 +163,91 @@ function peg$parse(input, options) {
181
163
  var peg$r3 = /^[a-zA-Z0-9_\-]/;
182
164
  var peg$r4 = /^[ \n\t]/;
183
165
 
184
- var peg$e0 = peg$literalExpectation('/', false);
185
- var peg$e1 = peg$otherExpectation('tag name');
186
- var peg$e2 = peg$otherExpectation('class');
187
- var peg$e3 = peg$otherExpectation('id');
188
- var peg$e4 = peg$literalExpectation('=', false);
189
- var peg$e5 = peg$literalExpectation('(', false);
190
- var peg$e6 = peg$literalExpectation(')', false);
191
- var peg$e7 = peg$literalExpectation(',', false);
192
- var peg$e8 = peg$otherExpectation('variable');
193
- var peg$e9 = peg$otherExpectation('null');
194
- var peg$e10 = peg$otherExpectation('boolean');
195
- var peg$e11 = peg$literalExpectation('[', false);
196
- var peg$e12 = peg$literalExpectation(']', false);
197
- var peg$e13 = peg$literalExpectation('{', false);
198
- var peg$e14 = peg$literalExpectation('}', false);
199
- var peg$e15 = peg$literalExpectation(':', false);
200
- var peg$e16 = peg$otherExpectation('number');
201
- var peg$e17 = peg$otherExpectation('string');
202
- var peg$e18 = peg$otherExpectation('identifier');
203
- var peg$e19 = peg$otherExpectation('whitespace');
204
-
205
- var peg$f0 = function (variable) {
206
- return { type: 'variable', meta: { variable } };
207
- };
208
- var peg$f1 = function (attributes) {
209
- return { type: 'annotation', meta: { attributes } };
210
- };
211
- var peg$f2 = function (tag, value) {
212
- return value;
213
- };
214
- var peg$f3 = function (tag, primary, attributes, close) {
215
- if (primary) {
216
- attributes = attributes || [];
217
- attributes.unshift({
218
- type: 'attribute',
219
- name: 'primary',
220
- value: primary,
221
- });
222
- }
166
+ var peg$e0 = peg$literalExpectation("/", false);
167
+ var peg$e1 = peg$otherExpectation("tag name");
168
+ var peg$e2 = peg$otherExpectation("class");
169
+ var peg$e3 = peg$otherExpectation("id");
170
+ var peg$e4 = peg$literalExpectation("=", false);
171
+ var peg$e5 = peg$literalExpectation("(", false);
172
+ var peg$e6 = peg$literalExpectation(")", false);
173
+ var peg$e7 = peg$literalExpectation(",", false);
174
+ var peg$e8 = peg$otherExpectation("variable");
175
+ var peg$e9 = peg$otherExpectation("null");
176
+ var peg$e10 = peg$otherExpectation("boolean");
177
+ var peg$e11 = peg$literalExpectation("[", false);
178
+ var peg$e12 = peg$literalExpectation("]", false);
179
+ var peg$e13 = peg$literalExpectation("{", false);
180
+ var peg$e14 = peg$literalExpectation("}", false);
181
+ var peg$e15 = peg$literalExpectation(":", false);
182
+ var peg$e16 = peg$otherExpectation("number");
183
+ var peg$e17 = peg$otherExpectation("string");
184
+ var peg$e18 = peg$otherExpectation("identifier");
185
+ var peg$e19 = peg$otherExpectation("whitespace");
186
+
187
+ var peg$f0 = function(variable) {
188
+ return {type: 'variable', meta: {variable}}
189
+ };
190
+ var peg$f1 = function(attributes) {
191
+ return {type: 'annotation', meta: {attributes}}
192
+ };
193
+ var peg$f2 = function(tag, value) { return value; };
194
+ var peg$f3 = function(tag, primary, attributes, close) {
195
+ if (primary) {
196
+ attributes = attributes || [];
197
+ attributes.unshift({type: 'attribute', name: 'primary', value: primary});
198
+ }
223
199
 
224
- const [type, nesting] = close ? ['tag', 0] : ['tag_open', 1];
225
- return { type, nesting, meta: { tag, attributes } };
226
- };
227
- var peg$f4 = function (tag) {
228
- return { type: 'tag_close', nesting: -1, meta: { tag } };
229
- };
230
- var peg$f5 = function (head, tail) {
231
- return !head ? [] : [head, ...tail];
232
- };
233
- var peg$f6 = function (item) {
234
- return item;
235
- };
236
- var peg$f7 = function (ids) {
237
- return ids;
238
- };
239
- var peg$f8 = function (classes) {
240
- return classes;
241
- };
242
- var peg$f9 = function (attribute) {
243
- return attribute;
244
- };
245
- var peg$f10 = function (name) {
246
- return { type: 'class', name, value: true };
247
- };
248
- var peg$f11 = function (value) {
249
- return { type: 'attribute', name: 'id', value };
250
- };
251
- var peg$f12 = function (name, value) {
252
- return { type: 'attribute', name, value };
253
- };
254
- var peg$f13 = function (name, head, tail) {
255
- return head ? [head, ...tail] : [];
256
- };
257
- var peg$f14 = function (name, params) {
258
- const parameters = Object.fromEntries(
259
- params.map(({ name, value }, index) => [name || index, value])
260
- );
261
- return new Function(name, parameters);
262
- };
263
- var peg$f15 = function (name) {
264
- return name;
265
- };
266
- var peg$f16 = function (name, value) {
267
- return { name, value };
268
- };
269
- var peg$f17 = function (value) {
270
- return value;
271
- };
272
- var peg$f18 = function (prefix, head, tail) {
273
- if (prefix === '@') return [head, ...tail];
274
- return new Variable([head, ...tail]);
275
- };
276
- var peg$f19 = function () {
277
- return null;
278
- };
279
- var peg$f20 = function () {
280
- return true;
281
- };
282
- var peg$f21 = function () {
283
- return false;
284
- };
285
- var peg$f22 = function (head, tail) {
286
- return [head, ...tail];
287
- };
288
- var peg$f23 = function (value) {
289
- return value || [];
290
- };
291
- var peg$f24 = function (head, tail) {
292
- return Object.fromEntries([head, ...tail].flatMap(Object.entries));
293
- };
294
- var peg$f25 = function (value) {
295
- return value || {};
296
- };
297
- var peg$f26 = function (key, value) {
298
- return key === '$$mdtype' ? {} : { [key]: value };
299
- };
300
- var peg$f27 = function () {
301
- return parseFloat(text());
302
- };
303
- var peg$f28 = function (value) {
304
- return value.join('');
305
- };
306
- var peg$f29 = function () {
307
- return '\n';
308
- };
309
- var peg$f30 = function () {
310
- return '\r';
311
- };
312
- var peg$f31 = function () {
313
- return '\t';
314
- };
315
- var peg$f32 = function (sequence) {
316
- return sequence;
317
- };
200
+ const [type, nesting] = close ? ['tag', 0] : ['tag_open', 1];
201
+ return {type, nesting, meta: {tag, attributes}};
202
+ };
203
+ var peg$f4 = function(tag) { return {type: 'tag_close', nesting: -1, meta: {tag}}; };
204
+ var peg$f5 = function(head, tail) {
205
+ return !head ? [] : [head, ...tail];
206
+ };
207
+ var peg$f6 = function(item) { return item; };
208
+ var peg$f7 = function(ids) { return ids };
209
+ var peg$f8 = function(classes) { return classes };
210
+ var peg$f9 = function(attribute) { return attribute };
211
+ var peg$f10 = function(name) {
212
+ return {type: 'class', name, value: true};
213
+ };
214
+ var peg$f11 = function(value) {
215
+ return {type: 'attribute', name: 'id', value};
216
+ };
217
+ var peg$f12 = function(name, value) {
218
+ return {type: 'attribute', name, value};
219
+ };
220
+ var peg$f13 = function(name, head, tail) { return head ? [head, ...tail] : []; };
221
+ var peg$f14 = function(name, params) {
222
+ const parameters = Object.fromEntries(
223
+ params.map(({name, value}, index) => [name || index, value])
224
+ );
225
+ return new Function(name, parameters);
226
+ };
227
+ var peg$f15 = function(name) { return name; };
228
+ var peg$f16 = function(name, value) {
229
+ return {name, value};
230
+ };
231
+ var peg$f17 = function(value) { return value; };
232
+ var peg$f18 = function(prefix, head, tail) {
233
+ if (prefix === '@')
234
+ return [head, ...tail];
235
+ return new Variable([head, ...tail]);
236
+ };
237
+ var peg$f19 = function() { return null; };
238
+ var peg$f20 = function() { return true; };
239
+ var peg$f21 = function() { return false; };
240
+ var peg$f22 = function(head, tail) { return [head, ...tail]; };
241
+ var peg$f23 = function(value) { return value || []; };
242
+ var peg$f24 = function(head, tail) { return Object.fromEntries([head, ...tail].flatMap(Object.entries)); };
243
+ var peg$f25 = function(value) { return value || {}; };
244
+ var peg$f26 = function(key, value) { return key === "$$mdtype" ? {} : {[key]: value}; };
245
+ var peg$f27 = function() { return parseFloat(text()); };
246
+ var peg$f28 = function(value) { return value.join(''); };
247
+ var peg$f29 = function() { return '\n' };
248
+ var peg$f30 = function() { return '\r' };
249
+ var peg$f31 = function() { return '\t' };
250
+ var peg$f32 = function(sequence) { return sequence; };
318
251
 
319
252
  var peg$currPos = 0;
320
253
  var peg$savedPos = 0;
@@ -324,11 +257,9 @@ function peg$parse(input, options) {
324
257
 
325
258
  var peg$result;
326
259
 
327
- if ('startRule' in options) {
260
+ if ("startRule" in options) {
328
261
  if (!(options.startRule in peg$startRuleFunctions)) {
329
- throw new Error(
330
- 'Can\'t start parsing from rule "' + options.startRule + '".'
331
- );
262
+ throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
332
263
  }
333
264
 
334
265
  peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
@@ -351,10 +282,9 @@ function peg$parse(input, options) {
351
282
  }
352
283
 
353
284
  function expected(description, location) {
354
- location =
355
- location !== undefined
356
- ? location
357
- : peg$computeLocation(peg$savedPos, peg$currPos);
285
+ location = location !== undefined
286
+ ? location
287
+ : peg$computeLocation(peg$savedPos, peg$currPos);
358
288
 
359
289
  throw peg$buildStructuredError(
360
290
  [peg$otherExpectation(description)],
@@ -364,37 +294,31 @@ function peg$parse(input, options) {
364
294
  }
365
295
 
366
296
  function error(message, location) {
367
- location =
368
- location !== undefined
369
- ? location
370
- : peg$computeLocation(peg$savedPos, peg$currPos);
297
+ location = location !== undefined
298
+ ? location
299
+ : peg$computeLocation(peg$savedPos, peg$currPos);
371
300
 
372
301
  throw peg$buildSimpleError(message, location);
373
302
  }
374
303
 
375
304
  function peg$literalExpectation(text, ignoreCase) {
376
- return { type: 'literal', text: text, ignoreCase: ignoreCase };
305
+ return { type: "literal", text: text, ignoreCase: ignoreCase };
377
306
  }
378
307
 
379
308
  function peg$classExpectation(parts, inverted, ignoreCase) {
380
- return {
381
- type: 'class',
382
- parts: parts,
383
- inverted: inverted,
384
- ignoreCase: ignoreCase,
385
- };
309
+ return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
386
310
  }
387
311
 
388
312
  function peg$anyExpectation() {
389
- return { type: 'any' };
313
+ return { type: "any" };
390
314
  }
391
315
 
392
316
  function peg$endExpectation() {
393
- return { type: 'end' };
317
+ return { type: "end" };
394
318
  }
395
319
 
396
320
  function peg$otherExpectation(description) {
397
- return { type: 'other', description: description };
321
+ return { type: "other", description: description };
398
322
  }
399
323
 
400
324
  function peg$computePosDetails(pos) {
@@ -412,7 +336,7 @@ function peg$parse(input, options) {
412
336
  details = peg$posDetailsCache[p];
413
337
  details = {
414
338
  line: details.line,
415
- column: details.column,
339
+ column: details.column
416
340
  };
417
341
 
418
342
  while (p < pos) {
@@ -432,25 +356,24 @@ function peg$parse(input, options) {
432
356
  }
433
357
  }
434
358
 
435
- var peg$VALIDFILENAME =
436
- typeof options.filename === 'string' && options.filename.length > 0;
359
+ var peg$VALIDFILENAME = typeof options.filename === "string" && options.filename.length > 0;
437
360
  function peg$computeLocation(startPos, endPos) {
438
361
  var loc = {};
439
362
 
440
- if (peg$VALIDFILENAME) loc.filename = options.filename;
363
+ if ( peg$VALIDFILENAME ) loc.filename = options.filename;
441
364
 
442
365
  var startPosDetails = peg$computePosDetails(startPos);
443
366
  loc.start = {
444
367
  offset: startPos,
445
368
  line: startPosDetails.line,
446
- column: startPosDetails.column,
369
+ column: startPosDetails.column
447
370
  };
448
371
 
449
372
  var endPosDetails = peg$computePosDetails(endPos);
450
373
  loc.end = {
451
374
  offset: endPos,
452
375
  line: endPosDetails.line,
453
- column: endPosDetails.column,
376
+ column: endPosDetails.column
454
377
  };
455
378
 
456
379
  return loc;
@@ -463,9 +386,7 @@ function peg$parse(input, options) {
463
386
  function peg$expect(expected) {
464
387
  var top = peg$expected[peg$expected.length - 1];
465
388
 
466
- if (peg$currPos < top.pos) {
467
- return;
468
- }
389
+ if (peg$currPos < top.pos) { return; }
469
390
 
470
391
  if (peg$currPos > top.pos) {
471
392
  top.pos = peg$currPos;
@@ -480,13 +401,11 @@ function peg$parse(input, options) {
480
401
  var top = peg$expected[peg$expected.length - 1];
481
402
  var variants = expected.variants;
482
403
 
483
- if (top.pos !== expected.pos) {
484
- return;
485
- }
404
+ if (top.pos !== expected.pos) { return; }
486
405
 
487
406
  if (invert) {
488
- variants = variants.map(function (e) {
489
- return e.type === 'not' ? e.expected : { type: 'not', expected: e };
407
+ variants = variants.map(function(e) {
408
+ return e.type === "not" ? e.expected : { type: "not", expected: e };
490
409
  });
491
410
  }
492
411
 
@@ -524,7 +443,7 @@ function peg$parse(input, options) {
524
443
 
525
444
  var rule$expects = function (expected) {
526
445
  if (peg$silentFails === 0) peg$expect(expected);
527
- };
446
+ }
528
447
 
529
448
  s0 = peg$parseTopLevelValue();
530
449
  if (s0 === peg$FAILED) {
@@ -545,7 +464,7 @@ function peg$parse(input, options) {
545
464
 
546
465
  var rule$expects = function (expected) {
547
466
  if (peg$silentFails === 0) peg$expect(expected);
548
- };
467
+ }
549
468
 
550
469
  s0 = peg$currPos;
551
470
  s1 = peg$parseVariable();
@@ -566,7 +485,7 @@ function peg$parse(input, options) {
566
485
 
567
486
  var rule$expects = function (expected) {
568
487
  if (peg$silentFails === 0) peg$expect(expected);
569
- };
488
+ }
570
489
 
571
490
  s0 = peg$currPos;
572
491
  s1 = peg$parseTagAttributes();
@@ -592,7 +511,7 @@ function peg$parse(input, options) {
592
511
 
593
512
  var rule$expects = function (expected) {
594
513
  if (peg$silentFails === 0) peg$expect(expected);
595
- };
514
+ }
596
515
 
597
516
  s0 = peg$currPos;
598
517
  s1 = peg$parseTagName();
@@ -654,7 +573,7 @@ function peg$parse(input, options) {
654
573
 
655
574
  var rule$expects = function (expected) {
656
575
  if (peg$silentFails === 0) peg$expect(expected);
657
- };
576
+ }
658
577
 
659
578
  s0 = peg$currPos;
660
579
  rule$expects(peg$e0);
@@ -686,7 +605,7 @@ function peg$parse(input, options) {
686
605
 
687
606
  var rule$expects = function (expected) {
688
607
  if (peg$silentFails === 0) peg$expect(expected);
689
- };
608
+ }
690
609
 
691
610
  rule$expects(peg$e1);
692
611
  peg$silentFails++;
@@ -701,7 +620,7 @@ function peg$parse(input, options) {
701
620
 
702
621
  var rule$expects = function (expected) {
703
622
  if (peg$silentFails === 0) peg$expect(expected);
704
- };
623
+ }
705
624
 
706
625
  s0 = peg$currPos;
707
626
  s1 = peg$parseTagAttributesItem();
@@ -727,7 +646,7 @@ function peg$parse(input, options) {
727
646
 
728
647
  var rule$expects = function (expected) {
729
648
  if (peg$silentFails === 0) peg$expect(expected);
730
- };
649
+ }
731
650
 
732
651
  s0 = peg$currPos;
733
652
  s1 = [];
@@ -762,7 +681,7 @@ function peg$parse(input, options) {
762
681
 
763
682
  var rule$expects = function (expected) {
764
683
  if (peg$silentFails === 0) peg$expect(expected);
765
- };
684
+ }
766
685
 
767
686
  s0 = peg$currPos;
768
687
  s1 = peg$parseTagShortcutId();
@@ -798,7 +717,7 @@ function peg$parse(input, options) {
798
717
 
799
718
  var rule$expects = function (expected) {
800
719
  if (peg$silentFails === 0) peg$expect(expected);
801
- };
720
+ }
802
721
 
803
722
  rule$expects(peg$e2);
804
723
  peg$silentFails++;
@@ -832,7 +751,7 @@ function peg$parse(input, options) {
832
751
 
833
752
  var rule$expects = function (expected) {
834
753
  if (peg$silentFails === 0) peg$expect(expected);
835
- };
754
+ }
836
755
 
837
756
  rule$expects(peg$e3);
838
757
  peg$silentFails++;
@@ -866,7 +785,7 @@ function peg$parse(input, options) {
866
785
 
867
786
  var rule$expects = function (expected) {
868
787
  if (peg$silentFails === 0) peg$expect(expected);
869
- };
788
+ }
870
789
 
871
790
  s0 = peg$currPos;
872
791
  s1 = peg$parseIdentifier();
@@ -904,7 +823,7 @@ function peg$parse(input, options) {
904
823
 
905
824
  var rule$expects = function (expected) {
906
825
  if (peg$silentFails === 0) peg$expect(expected);
907
- };
826
+ }
908
827
 
909
828
  s0 = peg$currPos;
910
829
  s1 = peg$parseIdentifier();
@@ -967,7 +886,7 @@ function peg$parse(input, options) {
967
886
 
968
887
  var rule$expects = function (expected) {
969
888
  if (peg$silentFails === 0) peg$expect(expected);
970
- };
889
+ }
971
890
 
972
891
  s0 = peg$currPos;
973
892
  s1 = peg$currPos;
@@ -1011,7 +930,7 @@ function peg$parse(input, options) {
1011
930
 
1012
931
  var rule$expects = function (expected) {
1013
932
  if (peg$silentFails === 0) peg$expect(expected);
1014
- };
933
+ }
1015
934
 
1016
935
  s0 = peg$currPos;
1017
936
  s1 = [];
@@ -1055,7 +974,7 @@ function peg$parse(input, options) {
1055
974
 
1056
975
  var rule$expects = function (expected) {
1057
976
  if (peg$silentFails === 0) peg$expect(expected);
1058
- };
977
+ }
1059
978
 
1060
979
  s0 = peg$currPos;
1061
980
  s1 = [];
@@ -1090,7 +1009,7 @@ function peg$parse(input, options) {
1090
1009
 
1091
1010
  var rule$expects = function (expected) {
1092
1011
  if (peg$silentFails === 0) peg$expect(expected);
1093
- };
1012
+ }
1094
1013
 
1095
1014
  rule$expects(peg$e8);
1096
1015
  peg$silentFails++;
@@ -1130,7 +1049,7 @@ function peg$parse(input, options) {
1130
1049
 
1131
1050
  var rule$expects = function (expected) {
1132
1051
  if (peg$silentFails === 0) peg$expect(expected);
1133
- };
1052
+ }
1134
1053
 
1135
1054
  s0 = peg$currPos;
1136
1055
  if (input.charCodeAt(peg$currPos) === 46) {
@@ -1197,7 +1116,7 @@ function peg$parse(input, options) {
1197
1116
 
1198
1117
  var rule$expects = function (expected) {
1199
1118
  if (peg$silentFails === 0) peg$expect(expected);
1200
- };
1119
+ }
1201
1120
 
1202
1121
  s0 = peg$parseValueNull();
1203
1122
  if (s0 === peg$FAILED) {
@@ -1230,7 +1149,7 @@ function peg$parse(input, options) {
1230
1149
 
1231
1150
  var rule$expects = function (expected) {
1232
1151
  if (peg$silentFails === 0) peg$expect(expected);
1233
- };
1152
+ }
1234
1153
 
1235
1154
  rule$expects(peg$e9);
1236
1155
  peg$silentFails++;
@@ -1256,7 +1175,7 @@ function peg$parse(input, options) {
1256
1175
 
1257
1176
  var rule$expects = function (expected) {
1258
1177
  if (peg$silentFails === 0) peg$expect(expected);
1259
- };
1178
+ }
1260
1179
 
1261
1180
  rule$expects(peg$e10);
1262
1181
  peg$silentFails++;
@@ -1296,7 +1215,7 @@ function peg$parse(input, options) {
1296
1215
 
1297
1216
  var rule$expects = function (expected) {
1298
1217
  if (peg$silentFails === 0) peg$expect(expected);
1299
- };
1218
+ }
1300
1219
 
1301
1220
  s0 = peg$currPos;
1302
1221
  rule$expects(peg$e11);
@@ -1365,7 +1284,7 @@ function peg$parse(input, options) {
1365
1284
 
1366
1285
  var rule$expects = function (expected) {
1367
1286
  if (peg$silentFails === 0) peg$expect(expected);
1368
- };
1287
+ }
1369
1288
 
1370
1289
  s0 = peg$currPos;
1371
1290
  s1 = [];
@@ -1409,7 +1328,7 @@ function peg$parse(input, options) {
1409
1328
 
1410
1329
  var rule$expects = function (expected) {
1411
1330
  if (peg$silentFails === 0) peg$expect(expected);
1412
- };
1331
+ }
1413
1332
 
1414
1333
  s0 = peg$currPos;
1415
1334
  rule$expects(peg$e13);
@@ -1478,7 +1397,7 @@ function peg$parse(input, options) {
1478
1397
 
1479
1398
  var rule$expects = function (expected) {
1480
1399
  if (peg$silentFails === 0) peg$expect(expected);
1481
- };
1400
+ }
1482
1401
 
1483
1402
  s0 = peg$currPos;
1484
1403
  s1 = [];
@@ -1522,7 +1441,7 @@ function peg$parse(input, options) {
1522
1441
 
1523
1442
  var rule$expects = function (expected) {
1524
1443
  if (peg$silentFails === 0) peg$expect(expected);
1525
- };
1444
+ }
1526
1445
 
1527
1446
  s0 = peg$currPos;
1528
1447
  s1 = peg$parseIdentifier();
@@ -1569,7 +1488,7 @@ function peg$parse(input, options) {
1569
1488
 
1570
1489
  var rule$expects = function (expected) {
1571
1490
  if (peg$silentFails === 0) peg$expect(expected);
1572
- };
1491
+ }
1573
1492
 
1574
1493
  rule$expects(peg$e16);
1575
1494
  peg$silentFails++;
@@ -1662,7 +1581,7 @@ function peg$parse(input, options) {
1662
1581
 
1663
1582
  var rule$expects = function (expected) {
1664
1583
  if (peg$silentFails === 0) peg$expect(expected);
1665
- };
1584
+ }
1666
1585
 
1667
1586
  rule$expects(peg$e17);
1668
1587
  peg$silentFails++;
@@ -1707,7 +1626,7 @@ function peg$parse(input, options) {
1707
1626
 
1708
1627
  var rule$expects = function (expected) {
1709
1628
  if (peg$silentFails === 0) peg$expect(expected);
1710
- };
1629
+ }
1711
1630
 
1712
1631
  if (peg$r2.test(input.charAt(peg$currPos))) {
1713
1632
  s0 = input.charAt(peg$currPos);
@@ -1727,7 +1646,7 @@ function peg$parse(input, options) {
1727
1646
 
1728
1647
  var rule$expects = function (expected) {
1729
1648
  if (peg$silentFails === 0) peg$expect(expected);
1730
- };
1649
+ }
1731
1650
 
1732
1651
  s0 = peg$currPos;
1733
1652
  if (input.charCodeAt(peg$currPos) === 92) {
@@ -1813,7 +1732,7 @@ function peg$parse(input, options) {
1813
1732
 
1814
1733
  var rule$expects = function (expected) {
1815
1734
  if (peg$silentFails === 0) peg$expect(expected);
1816
- };
1735
+ }
1817
1736
 
1818
1737
  rule$expects(peg$e18);
1819
1738
  peg$silentFails++;
@@ -1853,7 +1772,7 @@ function peg$parse(input, options) {
1853
1772
 
1854
1773
  var rule$expects = function (expected) {
1855
1774
  if (peg$silentFails === 0) peg$expect(expected);
1856
- };
1775
+ }
1857
1776
 
1858
1777
  rule$expects(peg$e19);
1859
1778
  peg$silentFails++;
@@ -1868,7 +1787,11 @@ function peg$parse(input, options) {
1868
1787
  return s0;
1869
1788
  }
1870
1789
 
1871
- const { Variable, Function } = options;
1790
+
1791
+
1792
+ const {Variable, Function} = options;
1793
+
1794
+
1872
1795
 
1873
1796
  peg$begin();
1874
1797
  peg$result = peg$startRuleFunction();
@@ -1886,5 +1809,5 @@ function peg$parse(input, options) {
1886
1809
 
1887
1810
  module.exports = {
1888
1811
  SyntaxError: peg$SyntaxError,
1889
- parse: peg$parse,
1812
+ parse: peg$parse
1890
1813
  };