natural 0.2.1 → 0.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 (106) hide show
  1. package/.npmignore +4 -11
  2. package/README.md +156 -41
  3. package/bayes_classifier.json +1 -0
  4. package/lib/natural/brill_pos_tagger/data/Dutch/README.txt +2 -0
  5. package/lib/natural/brill_pos_tagger/data/Dutch/brill_CONTEXTRULES.jg +285 -0
  6. package/lib/natural/brill_pos_tagger/data/Dutch/brill_LEXICON.jg +11699 -0
  7. package/lib/natural/brill_pos_tagger/data/English/README.txt +8 -0
  8. package/lib/natural/brill_pos_tagger/data/English/lexicon_from_posjs.json +297827 -0
  9. package/lib/natural/brill_pos_tagger/data/English/tr_from_brill_paper.txt +10 -0
  10. package/lib/natural/brill_pos_tagger/data/English/tr_from_posjs.txt +18 -0
  11. package/lib/natural/brill_pos_tagger/lib/Brill_POS_Tagger.js +136 -0
  12. package/lib/natural/brill_pos_tagger/lib/Predicate.js +410 -0
  13. package/lib/natural/brill_pos_tagger/lib/TF_Parser.js +717 -0
  14. package/lib/natural/brill_pos_tagger/lib/TF_Parser.pegjs +55 -0
  15. package/lib/natural/brill_pos_tagger/lib/TransformationRule.js +49 -0
  16. package/lib/natural/classifiers/bayes_classifier.js +6 -5
  17. package/lib/natural/classifiers/classifier.js +3 -2
  18. package/lib/natural/classifiers/logistic_regression_classifier.js +9 -5
  19. package/lib/natural/distance/dice_coefficient.js +22 -12
  20. package/lib/natural/index.js +6 -0
  21. package/lib/natural/ngrams/ngrams.js +4 -0
  22. package/lib/natural/stemmers/stemmer.js +31 -6
  23. package/lib/natural/tokenizers/regexp_tokenizer.js +3 -3
  24. package/{examples/inflection/noun.js → lib/natural/tokenizers/sentence_tokenizer.js} +14 -10
  25. package/lib/natural/tokenizers/tokenizer_case.js +58 -0
  26. package/lib/natural/util/bag.js +1 -0
  27. package/lib/natural/wordnet/wordnet.js +2 -2
  28. package/lib/natural/wordnet/wordnet_file.js +1 -1
  29. package/lr_classifier.json +1 -0
  30. package/package.json +6 -3
  31. package/package.json~ +66 -0
  32. package/benchmarks/index.js +0 -32
  33. package/benchmarks/metaphone.js +0 -27
  34. package/benchmarks/soundex.js +0 -27
  35. package/examples/classification/basic.js +0 -35
  36. package/examples/classification/recall.js +0 -28
  37. package/examples/classification/store.js +0 -37
  38. package/examples/inflection/count.js +0 -35
  39. package/examples/inflection/noun_attach.js +0 -33
  40. package/examples/phonetics/compare.js +0 -39
  41. package/examples/phonetics/sounds_like.js +0 -40
  42. package/examples/phonetics/tokenize_and_phoneticize.js +0 -54
  43. package/examples/stemming/stem_corpus.js +0 -29
  44. package/examples/stemming/stem_word.js +0 -26
  45. package/examples/tfidf/array_example.js +0 -34
  46. package/examples/tfidf/multiple_terms.js +0 -33
  47. package/examples/tfidf/tfidf_example.js +0 -44
  48. package/io_spec/test_data/tfidf/one +0 -1
  49. package/io_spec/test_data/tfidf/two +0 -1
  50. package/io_spec/tfidf_spec.js +0 -50
  51. package/io_spec/wordnet_spec.js +0 -81
  52. package/spec/aggressive_tokenizer_es_spec.js +0 -36
  53. package/spec/aggressive_tokenizer_fr_spec.js +0 -101
  54. package/spec/aggressive_tokenizer_nl_spec.js +0 -36
  55. package/spec/aggressive_tokenizer_pt_spec.js +0 -56
  56. package/spec/aggressive_tokenizer_spec.js +0 -56
  57. package/spec/bayes_classifier_spec.js +0 -173
  58. package/spec/classifier_spec.js +0 -175
  59. package/spec/count_inflector_fr_spec.js +0 -44
  60. package/spec/count_inflector_spec.js +0 -73
  61. package/spec/dice_coefficient_spec.js +0 -26
  62. package/spec/double_metaphone_spec.js +0 -752
  63. package/spec/jaro-winkler_spec.js +0 -53
  64. package/spec/lancaster_stemmer_spec.js +0 -73
  65. package/spec/levenshtein_spec.js +0 -66
  66. package/spec/logistic_regression_classifier_spec.js +0 -122
  67. package/spec/longest_path_tree_spec.js +0 -102
  68. package/spec/metaphone_spec.js +0 -252
  69. package/spec/ngram_spec.js +0 -130
  70. package/spec/ngram_zh_spec.js +0 -122
  71. package/spec/normalizer_ja_spec.js +0 -160
  72. package/spec/normalizer_no_spec.js +0 -111
  73. package/spec/normalizer_spec.js +0 -140
  74. package/spec/noun_inflector_fr_spec.js +0 -476
  75. package/spec/noun_inflector_ja_spec.js +0 -112
  76. package/spec/noun_inflector_spec.js +0 -270
  77. package/spec/porter_stemmer_fr_spec.js +0 -101
  78. package/spec/porter_stemmer_it_spec.js +0 -44
  79. package/spec/porter_stemmer_no_spec.js +0 -143
  80. package/spec/porter_stemmer_pt_spec.js +0 -50
  81. package/spec/porter_stemmer_ru_spec.js +0 -63
  82. package/spec/porter_stemmer_spec.js +0 -182
  83. package/spec/present_verb_inflector_spec.js +0 -128
  84. package/spec/remove_diacritics_spec.js +0 -31
  85. package/spec/sentence_analyzer_spec.js +0 -277
  86. package/spec/shortest_path_tree_spec.js +0 -132
  87. package/spec/soundex_spec.js +0 -158
  88. package/spec/spellcheck_spec.js +0 -92
  89. package/spec/stemmer_ja_spec.js +0 -66
  90. package/spec/stemmer_token_spec.js +0 -161
  91. package/spec/test_data/snowball_fr.txt +0 -20402
  92. package/spec/test_data/snowball_it.txt +0 -35482
  93. package/spec/test_data/snowball_no.txt +0 -20628
  94. package/spec/test_data/snowball_pt.txt +0 -32016
  95. package/spec/test_data/tfdif_testcorpus.txt +0 -7
  96. package/spec/test_data/tfidf_document1.txt +0 -1
  97. package/spec/test_data/tfidf_document2.txt +0 -1
  98. package/spec/test_data/tfidf_document3.txt +0 -1
  99. package/spec/test_data/tfidf_document4.txt +0 -1
  100. package/spec/test_data/tfidf_teststopwords.txt +0 -1
  101. package/spec/test_data/wordnet_mini.sql +0 -95
  102. package/spec/tfidf_spec.js +0 -323
  103. package/spec/tokenizer_ja_spec.js +0 -58
  104. package/spec/transliterator_ja_spec.js +0 -103
  105. package/spec/treebank_word_tokenizer_spec.js +0 -36
  106. package/spec/trie_spec.js +0 -206
@@ -0,0 +1,717 @@
1
+ module.exports = (function() {
2
+ /*
3
+ * Generated by PEG.js 0.8.0.
4
+ *
5
+ * http://pegjs.majda.cz/
6
+ */
7
+
8
+ function peg$subclass(child, parent) {
9
+ function ctor() { this.constructor = child; }
10
+ ctor.prototype = parent.prototype;
11
+ child.prototype = new ctor();
12
+ }
13
+
14
+ function SyntaxError(message, expected, found, offset, line, column) {
15
+ this.message = message;
16
+ this.expected = expected;
17
+ this.found = found;
18
+ this.offset = offset;
19
+ this.line = line;
20
+ this.column = column;
21
+
22
+ this.name = "SyntaxError";
23
+ }
24
+
25
+ peg$subclass(SyntaxError, Error);
26
+
27
+ function parse(input) {
28
+ var options = arguments.length > 1 ? arguments[1] : {},
29
+
30
+ peg$FAILED = {},
31
+
32
+ peg$startRuleFunctions = { transformation_rules: peg$parsetransformation_rules },
33
+ peg$startRuleFunction = peg$parsetransformation_rules,
34
+
35
+ peg$c0 = [],
36
+ peg$c1 = peg$FAILED,
37
+ peg$c2 = function(rules) {
38
+ var result = [];
39
+
40
+ for (var i = 0; i < rules.length; i++) {
41
+ result.push(rules[i][1]);
42
+ }
43
+ return(result);
44
+ },
45
+ peg$c3 = null,
46
+ peg$c4 = function(c1, c2, pred, par1, par2) {
47
+ // Construct rule
48
+ var result = new TransformationRule(c1, c2, pred, par1, par2);
49
+ return(result);
50
+ },
51
+ peg$c5 = /^[a-zA-Z_0-9_\-.,()]/,
52
+ peg$c6 = { type: "class", value: "[a-zA-Z_0-9_\\-.,()]", description: "[a-zA-Z_0-9_\\-.,()]" },
53
+ peg$c7 = function(characters) {
54
+ var s = "";
55
+ for (var i = 0; i < characters.length; i++) {
56
+ s += characters[i];
57
+ }
58
+ return(s);
59
+ },
60
+ peg$c8 = "*",
61
+ peg$c9 = { type: "literal", value: "*", description: "\"*\"" },
62
+ peg$c10 = function(wc) {
63
+ return(wc)
64
+ },
65
+ peg$c11 = "\r\n",
66
+ peg$c12 = { type: "literal", value: "\r\n", description: "\"\\r\\n\"" },
67
+ peg$c13 = "\n",
68
+ peg$c14 = { type: "literal", value: "\n", description: "\"\\n\"" },
69
+ peg$c15 = "\r",
70
+ peg$c16 = { type: "literal", value: "\r", description: "\"\\r\"" },
71
+ peg$c17 = "//",
72
+ peg$c18 = { type: "literal", value: "//", description: "\"//\"" },
73
+ peg$c19 = void 0,
74
+ peg$c20 = { type: "any", description: "any character" },
75
+ peg$c21 = " ",
76
+ peg$c22 = { type: "literal", value: " ", description: "\" \"" },
77
+ peg$c23 = "\t",
78
+ peg$c24 = { type: "literal", value: "\t", description: "\"\\t\"" },
79
+
80
+ peg$currPos = 0,
81
+ peg$reportedPos = 0,
82
+ peg$cachedPos = 0,
83
+ peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
84
+ peg$maxFailPos = 0,
85
+ peg$maxFailExpected = [],
86
+ peg$silentFails = 0,
87
+
88
+ peg$result;
89
+
90
+ if ("startRule" in options) {
91
+ if (!(options.startRule in peg$startRuleFunctions)) {
92
+ throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
93
+ }
94
+
95
+ peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
96
+ }
97
+
98
+ function text() {
99
+ return input.substring(peg$reportedPos, peg$currPos);
100
+ }
101
+
102
+ function offset() {
103
+ return peg$reportedPos;
104
+ }
105
+
106
+ function line() {
107
+ return peg$computePosDetails(peg$reportedPos).line;
108
+ }
109
+
110
+ function column() {
111
+ return peg$computePosDetails(peg$reportedPos).column;
112
+ }
113
+
114
+ function expected(description) {
115
+ throw peg$buildException(
116
+ null,
117
+ [{ type: "other", description: description }],
118
+ peg$reportedPos
119
+ );
120
+ }
121
+
122
+ function error(message) {
123
+ throw peg$buildException(message, null, peg$reportedPos);
124
+ }
125
+
126
+ function peg$computePosDetails(pos) {
127
+ function advance(details, startPos, endPos) {
128
+ var p, ch;
129
+
130
+ for (p = startPos; p < endPos; p++) {
131
+ ch = input.charAt(p);
132
+ if (ch === "\n") {
133
+ if (!details.seenCR) { details.line++; }
134
+ details.column = 1;
135
+ details.seenCR = false;
136
+ } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
137
+ details.line++;
138
+ details.column = 1;
139
+ details.seenCR = true;
140
+ } else {
141
+ details.column++;
142
+ details.seenCR = false;
143
+ }
144
+ }
145
+ }
146
+
147
+ if (peg$cachedPos !== pos) {
148
+ if (peg$cachedPos > pos) {
149
+ peg$cachedPos = 0;
150
+ peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
151
+ }
152
+ advance(peg$cachedPosDetails, peg$cachedPos, pos);
153
+ peg$cachedPos = pos;
154
+ }
155
+
156
+ return peg$cachedPosDetails;
157
+ }
158
+
159
+ function peg$fail(expected) {
160
+ if (peg$currPos < peg$maxFailPos) { return; }
161
+
162
+ if (peg$currPos > peg$maxFailPos) {
163
+ peg$maxFailPos = peg$currPos;
164
+ peg$maxFailExpected = [];
165
+ }
166
+
167
+ peg$maxFailExpected.push(expected);
168
+ }
169
+
170
+ function peg$buildException(message, expected, pos) {
171
+ function cleanupExpected(expected) {
172
+ var i = 1;
173
+
174
+ expected.sort(function(a, b) {
175
+ if (a.description < b.description) {
176
+ return -1;
177
+ } else if (a.description > b.description) {
178
+ return 1;
179
+ } else {
180
+ return 0;
181
+ }
182
+ });
183
+
184
+ while (i < expected.length) {
185
+ if (expected[i - 1] === expected[i]) {
186
+ expected.splice(i, 1);
187
+ } else {
188
+ i++;
189
+ }
190
+ }
191
+ }
192
+
193
+ function buildMessage(expected, found) {
194
+ function stringEscape(s) {
195
+ function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
196
+
197
+ return s
198
+ .replace(/\\/g, '\\\\')
199
+ .replace(/"/g, '\\"')
200
+ .replace(/\x08/g, '\\b')
201
+ .replace(/\t/g, '\\t')
202
+ .replace(/\n/g, '\\n')
203
+ .replace(/\f/g, '\\f')
204
+ .replace(/\r/g, '\\r')
205
+ .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
206
+ .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
207
+ .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
208
+ .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
209
+ }
210
+
211
+ var expectedDescs = new Array(expected.length),
212
+ expectedDesc, foundDesc, i;
213
+
214
+ for (i = 0; i < expected.length; i++) {
215
+ expectedDescs[i] = expected[i].description;
216
+ }
217
+
218
+ expectedDesc = expected.length > 1
219
+ ? expectedDescs.slice(0, -1).join(", ")
220
+ + " or "
221
+ + expectedDescs[expected.length - 1]
222
+ : expectedDescs[0];
223
+
224
+ foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
225
+
226
+ return "Expected " + expectedDesc + " but " + foundDesc + " found.";
227
+ }
228
+
229
+ var posDetails = peg$computePosDetails(pos),
230
+ found = pos < input.length ? input.charAt(pos) : null;
231
+
232
+ if (expected !== null) {
233
+ cleanupExpected(expected);
234
+ }
235
+
236
+ return new SyntaxError(
237
+ message !== null ? message : buildMessage(expected, found),
238
+ expected,
239
+ found,
240
+ pos,
241
+ posDetails.line,
242
+ posDetails.column
243
+ );
244
+ }
245
+
246
+ function peg$parsetransformation_rules() {
247
+ var s0, s1, s2, s3, s4, s5;
248
+
249
+ s0 = peg$currPos;
250
+ s1 = [];
251
+ s2 = peg$currPos;
252
+ s3 = peg$parseS();
253
+ if (s3 !== peg$FAILED) {
254
+ s4 = peg$parsetransformation_rule();
255
+ if (s4 !== peg$FAILED) {
256
+ s5 = peg$parseS();
257
+ if (s5 !== peg$FAILED) {
258
+ s3 = [s3, s4, s5];
259
+ s2 = s3;
260
+ } else {
261
+ peg$currPos = s2;
262
+ s2 = peg$c1;
263
+ }
264
+ } else {
265
+ peg$currPos = s2;
266
+ s2 = peg$c1;
267
+ }
268
+ } else {
269
+ peg$currPos = s2;
270
+ s2 = peg$c1;
271
+ }
272
+ if (s2 !== peg$FAILED) {
273
+ while (s2 !== peg$FAILED) {
274
+ s1.push(s2);
275
+ s2 = peg$currPos;
276
+ s3 = peg$parseS();
277
+ if (s3 !== peg$FAILED) {
278
+ s4 = peg$parsetransformation_rule();
279
+ if (s4 !== peg$FAILED) {
280
+ s5 = peg$parseS();
281
+ if (s5 !== peg$FAILED) {
282
+ s3 = [s3, s4, s5];
283
+ s2 = s3;
284
+ } else {
285
+ peg$currPos = s2;
286
+ s2 = peg$c1;
287
+ }
288
+ } else {
289
+ peg$currPos = s2;
290
+ s2 = peg$c1;
291
+ }
292
+ } else {
293
+ peg$currPos = s2;
294
+ s2 = peg$c1;
295
+ }
296
+ }
297
+ } else {
298
+ s1 = peg$c1;
299
+ }
300
+ if (s1 !== peg$FAILED) {
301
+ peg$reportedPos = s0;
302
+ s1 = peg$c2(s1);
303
+ }
304
+ s0 = s1;
305
+
306
+ return s0;
307
+ }
308
+
309
+ function peg$parsetransformation_rule() {
310
+ var s0, s1, s2, s3, s4, s5;
311
+
312
+ s0 = peg$currPos;
313
+ s1 = peg$parsecategory1();
314
+ if (s1 !== peg$FAILED) {
315
+ s2 = peg$parseidentifier();
316
+ if (s2 !== peg$FAILED) {
317
+ s3 = peg$parseidentifier();
318
+ if (s3 !== peg$FAILED) {
319
+ s4 = peg$parseidentifier();
320
+ if (s4 !== peg$FAILED) {
321
+ s5 = peg$parseidentifier();
322
+ if (s5 === peg$FAILED) {
323
+ s5 = peg$c3;
324
+ }
325
+ if (s5 !== peg$FAILED) {
326
+ peg$reportedPos = s0;
327
+ s1 = peg$c4(s1, s2, s3, s4, s5);
328
+ s0 = s1;
329
+ } else {
330
+ peg$currPos = s0;
331
+ s0 = peg$c1;
332
+ }
333
+ } else {
334
+ peg$currPos = s0;
335
+ s0 = peg$c1;
336
+ }
337
+ } else {
338
+ peg$currPos = s0;
339
+ s0 = peg$c1;
340
+ }
341
+ } else {
342
+ peg$currPos = s0;
343
+ s0 = peg$c1;
344
+ }
345
+ } else {
346
+ peg$currPos = s0;
347
+ s0 = peg$c1;
348
+ }
349
+
350
+ return s0;
351
+ }
352
+
353
+ function peg$parsecategory1() {
354
+ var s0;
355
+
356
+ s0 = peg$parsewild_card();
357
+ if (s0 === peg$FAILED) {
358
+ s0 = peg$parseidentifier();
359
+ }
360
+
361
+ return s0;
362
+ }
363
+
364
+ function peg$parseidentifier() {
365
+ var s0, s1, s2;
366
+
367
+ s0 = peg$currPos;
368
+ s1 = [];
369
+ if (peg$c5.test(input.charAt(peg$currPos))) {
370
+ s2 = input.charAt(peg$currPos);
371
+ peg$currPos++;
372
+ } else {
373
+ s2 = peg$FAILED;
374
+ if (peg$silentFails === 0) { peg$fail(peg$c6); }
375
+ }
376
+ if (s2 !== peg$FAILED) {
377
+ while (s2 !== peg$FAILED) {
378
+ s1.push(s2);
379
+ if (peg$c5.test(input.charAt(peg$currPos))) {
380
+ s2 = input.charAt(peg$currPos);
381
+ peg$currPos++;
382
+ } else {
383
+ s2 = peg$FAILED;
384
+ if (peg$silentFails === 0) { peg$fail(peg$c6); }
385
+ }
386
+ }
387
+ } else {
388
+ s1 = peg$c1;
389
+ }
390
+ if (s1 !== peg$FAILED) {
391
+ s2 = peg$parseS_no_eol();
392
+ if (s2 !== peg$FAILED) {
393
+ peg$reportedPos = s0;
394
+ s1 = peg$c7(s1);
395
+ s0 = s1;
396
+ } else {
397
+ peg$currPos = s0;
398
+ s0 = peg$c1;
399
+ }
400
+ } else {
401
+ peg$currPos = s0;
402
+ s0 = peg$c1;
403
+ }
404
+
405
+ return s0;
406
+ }
407
+
408
+ function peg$parsewild_card() {
409
+ var s0, s1, s2;
410
+
411
+ s0 = peg$currPos;
412
+ if (input.charCodeAt(peg$currPos) === 42) {
413
+ s1 = peg$c8;
414
+ peg$currPos++;
415
+ } else {
416
+ s1 = peg$FAILED;
417
+ if (peg$silentFails === 0) { peg$fail(peg$c9); }
418
+ }
419
+ if (s1 !== peg$FAILED) {
420
+ s2 = peg$parseS_no_eol();
421
+ if (s2 !== peg$FAILED) {
422
+ peg$reportedPos = s0;
423
+ s1 = peg$c10(s1);
424
+ s0 = s1;
425
+ } else {
426
+ peg$currPos = s0;
427
+ s0 = peg$c1;
428
+ }
429
+ } else {
430
+ peg$currPos = s0;
431
+ s0 = peg$c1;
432
+ }
433
+
434
+ return s0;
435
+ }
436
+
437
+ function peg$parseEOL() {
438
+ var s0;
439
+
440
+ if (input.substr(peg$currPos, 2) === peg$c11) {
441
+ s0 = peg$c11;
442
+ peg$currPos += 2;
443
+ } else {
444
+ s0 = peg$FAILED;
445
+ if (peg$silentFails === 0) { peg$fail(peg$c12); }
446
+ }
447
+ if (s0 === peg$FAILED) {
448
+ if (input.charCodeAt(peg$currPos) === 10) {
449
+ s0 = peg$c13;
450
+ peg$currPos++;
451
+ } else {
452
+ s0 = peg$FAILED;
453
+ if (peg$silentFails === 0) { peg$fail(peg$c14); }
454
+ }
455
+ if (s0 === peg$FAILED) {
456
+ if (input.charCodeAt(peg$currPos) === 13) {
457
+ s0 = peg$c15;
458
+ peg$currPos++;
459
+ } else {
460
+ s0 = peg$FAILED;
461
+ if (peg$silentFails === 0) { peg$fail(peg$c16); }
462
+ }
463
+ }
464
+ }
465
+
466
+ return s0;
467
+ }
468
+
469
+ function peg$parseComment() {
470
+ var s0, s1, s2, s3, s4, s5;
471
+
472
+ s0 = peg$currPos;
473
+ if (input.substr(peg$currPos, 2) === peg$c17) {
474
+ s1 = peg$c17;
475
+ peg$currPos += 2;
476
+ } else {
477
+ s1 = peg$FAILED;
478
+ if (peg$silentFails === 0) { peg$fail(peg$c18); }
479
+ }
480
+ if (s1 !== peg$FAILED) {
481
+ s2 = [];
482
+ s3 = peg$currPos;
483
+ s4 = peg$currPos;
484
+ peg$silentFails++;
485
+ s5 = peg$parseEOL();
486
+ peg$silentFails--;
487
+ if (s5 === peg$FAILED) {
488
+ s4 = peg$c19;
489
+ } else {
490
+ peg$currPos = s4;
491
+ s4 = peg$c1;
492
+ }
493
+ if (s4 !== peg$FAILED) {
494
+ if (input.length > peg$currPos) {
495
+ s5 = input.charAt(peg$currPos);
496
+ peg$currPos++;
497
+ } else {
498
+ s5 = peg$FAILED;
499
+ if (peg$silentFails === 0) { peg$fail(peg$c20); }
500
+ }
501
+ if (s5 !== peg$FAILED) {
502
+ s4 = [s4, s5];
503
+ s3 = s4;
504
+ } else {
505
+ peg$currPos = s3;
506
+ s3 = peg$c1;
507
+ }
508
+ } else {
509
+ peg$currPos = s3;
510
+ s3 = peg$c1;
511
+ }
512
+ while (s3 !== peg$FAILED) {
513
+ s2.push(s3);
514
+ s3 = peg$currPos;
515
+ s4 = peg$currPos;
516
+ peg$silentFails++;
517
+ s5 = peg$parseEOL();
518
+ peg$silentFails--;
519
+ if (s5 === peg$FAILED) {
520
+ s4 = peg$c19;
521
+ } else {
522
+ peg$currPos = s4;
523
+ s4 = peg$c1;
524
+ }
525
+ if (s4 !== peg$FAILED) {
526
+ if (input.length > peg$currPos) {
527
+ s5 = input.charAt(peg$currPos);
528
+ peg$currPos++;
529
+ } else {
530
+ s5 = peg$FAILED;
531
+ if (peg$silentFails === 0) { peg$fail(peg$c20); }
532
+ }
533
+ if (s5 !== peg$FAILED) {
534
+ s4 = [s4, s5];
535
+ s3 = s4;
536
+ } else {
537
+ peg$currPos = s3;
538
+ s3 = peg$c1;
539
+ }
540
+ } else {
541
+ peg$currPos = s3;
542
+ s3 = peg$c1;
543
+ }
544
+ }
545
+ if (s2 !== peg$FAILED) {
546
+ s3 = peg$parseEOL();
547
+ if (s3 === peg$FAILED) {
548
+ s3 = peg$parseEOI();
549
+ }
550
+ if (s3 !== peg$FAILED) {
551
+ s1 = [s1, s2, s3];
552
+ s0 = s1;
553
+ } else {
554
+ peg$currPos = s0;
555
+ s0 = peg$c1;
556
+ }
557
+ } else {
558
+ peg$currPos = s0;
559
+ s0 = peg$c1;
560
+ }
561
+ } else {
562
+ peg$currPos = s0;
563
+ s0 = peg$c1;
564
+ }
565
+
566
+ return s0;
567
+ }
568
+
569
+ function peg$parseS() {
570
+ var s0, s1;
571
+
572
+ s0 = [];
573
+ if (input.charCodeAt(peg$currPos) === 32) {
574
+ s1 = peg$c21;
575
+ peg$currPos++;
576
+ } else {
577
+ s1 = peg$FAILED;
578
+ if (peg$silentFails === 0) { peg$fail(peg$c22); }
579
+ }
580
+ if (s1 === peg$FAILED) {
581
+ if (input.charCodeAt(peg$currPos) === 9) {
582
+ s1 = peg$c23;
583
+ peg$currPos++;
584
+ } else {
585
+ s1 = peg$FAILED;
586
+ if (peg$silentFails === 0) { peg$fail(peg$c24); }
587
+ }
588
+ if (s1 === peg$FAILED) {
589
+ s1 = peg$parseEOL();
590
+ if (s1 === peg$FAILED) {
591
+ s1 = peg$parseComment();
592
+ }
593
+ }
594
+ }
595
+ while (s1 !== peg$FAILED) {
596
+ s0.push(s1);
597
+ if (input.charCodeAt(peg$currPos) === 32) {
598
+ s1 = peg$c21;
599
+ peg$currPos++;
600
+ } else {
601
+ s1 = peg$FAILED;
602
+ if (peg$silentFails === 0) { peg$fail(peg$c22); }
603
+ }
604
+ if (s1 === peg$FAILED) {
605
+ if (input.charCodeAt(peg$currPos) === 9) {
606
+ s1 = peg$c23;
607
+ peg$currPos++;
608
+ } else {
609
+ s1 = peg$FAILED;
610
+ if (peg$silentFails === 0) { peg$fail(peg$c24); }
611
+ }
612
+ if (s1 === peg$FAILED) {
613
+ s1 = peg$parseEOL();
614
+ if (s1 === peg$FAILED) {
615
+ s1 = peg$parseComment();
616
+ }
617
+ }
618
+ }
619
+ }
620
+
621
+ return s0;
622
+ }
623
+
624
+ function peg$parseS_no_eol() {
625
+ var s0, s1;
626
+
627
+ s0 = [];
628
+ if (input.charCodeAt(peg$currPos) === 32) {
629
+ s1 = peg$c21;
630
+ peg$currPos++;
631
+ } else {
632
+ s1 = peg$FAILED;
633
+ if (peg$silentFails === 0) { peg$fail(peg$c22); }
634
+ }
635
+ if (s1 === peg$FAILED) {
636
+ if (input.charCodeAt(peg$currPos) === 9) {
637
+ s1 = peg$c23;
638
+ peg$currPos++;
639
+ } else {
640
+ s1 = peg$FAILED;
641
+ if (peg$silentFails === 0) { peg$fail(peg$c24); }
642
+ }
643
+ if (s1 === peg$FAILED) {
644
+ s1 = peg$parseComment();
645
+ }
646
+ }
647
+ while (s1 !== peg$FAILED) {
648
+ s0.push(s1);
649
+ if (input.charCodeAt(peg$currPos) === 32) {
650
+ s1 = peg$c21;
651
+ peg$currPos++;
652
+ } else {
653
+ s1 = peg$FAILED;
654
+ if (peg$silentFails === 0) { peg$fail(peg$c22); }
655
+ }
656
+ if (s1 === peg$FAILED) {
657
+ if (input.charCodeAt(peg$currPos) === 9) {
658
+ s1 = peg$c23;
659
+ peg$currPos++;
660
+ } else {
661
+ s1 = peg$FAILED;
662
+ if (peg$silentFails === 0) { peg$fail(peg$c24); }
663
+ }
664
+ if (s1 === peg$FAILED) {
665
+ s1 = peg$parseComment();
666
+ }
667
+ }
668
+ }
669
+
670
+ return s0;
671
+ }
672
+
673
+ function peg$parseEOI() {
674
+ var s0, s1;
675
+
676
+ s0 = peg$currPos;
677
+ peg$silentFails++;
678
+ if (input.length > peg$currPos) {
679
+ s1 = input.charAt(peg$currPos);
680
+ peg$currPos++;
681
+ } else {
682
+ s1 = peg$FAILED;
683
+ if (peg$silentFails === 0) { peg$fail(peg$c20); }
684
+ }
685
+ peg$silentFails--;
686
+ if (s1 === peg$FAILED) {
687
+ s0 = peg$c19;
688
+ } else {
689
+ peg$currPos = s0;
690
+ s0 = peg$c1;
691
+ }
692
+
693
+ return s0;
694
+ }
695
+
696
+
697
+ var TransformationRule = require("./TransformationRule");
698
+
699
+
700
+ peg$result = peg$startRuleFunction();
701
+
702
+ if (peg$result !== peg$FAILED && peg$currPos === input.length) {
703
+ return peg$result;
704
+ } else {
705
+ if (peg$result !== peg$FAILED && peg$currPos < input.length) {
706
+ peg$fail({ type: "end", description: "end of input" });
707
+ }
708
+
709
+ throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
710
+ }
711
+ }
712
+
713
+ return {
714
+ SyntaxError: SyntaxError,
715
+ parse: parse
716
+ };
717
+ })();