Browse code

add p2c2 taisteur

devnewton authored on 19/06/2016 19:02:47
Showing 5 changed files
... ...
@@ -1 +1,3 @@
1
-# p2c2
2 1
\ No newline at end of file
2
+# p2c2
3
+
4
+A PEG.js based converter from tribune raw post message to xml.
3 5
\ No newline at end of file
4 6
new file mode 100644
... ...
@@ -0,0 +1,23 @@
1
+<!DOCTYPE html>
2
+<html>
3
+<head>
4
+<title>p2c2 taisteur</title>
5
+<meta charset="UTF-8">
6
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+<meta name="robots" content="noindex,nofollow">
8
+<link rel="icon" type="image/png" href="/favicon.png">
9
+</head>
10
+<body>
11
+        <input id="convert" type="button" value="Convert">
12
+        <fieldset>
13
+            <legend>Input : </legend>
14
+            <textarea id="input" rows="5" cols="80"></textarea>
15
+        </fieldset>
16
+        <fieldset>
17
+            <legend>Output : </legend>
18
+            <textarea id="output" rows="5" cols="80"></textarea>
19
+        </fieldset>
20
+        <script src="p2c2.js" defer></script>
21
+	<script src="p2c2-taisteur.js" defer></script>
22
+</body>
23
+</html>
0 24
new file mode 100644
... ...
@@ -0,0 +1,11 @@
1
+var convertButton = document.getElementById('convert');
2
+
3
+convertButton.addEventListener('click', function() {
4
+	var inputArea = document.getElementById('input');
5
+	var outputArea = document.getElementById('output');
6
+try {
7
+	outputArea.value= p2c2.parse(inputArea.value);
8
+} catch(err) {
9
+outputArea.value = err;
10
+}
11
+});
0 12
new file mode 100644
... ...
@@ -0,0 +1,1269 @@
1
+p2c2 = (function() {
2
+  "use strict";
3
+
4
+  /*
5
+   * Generated by PEG.js 0.9.0.
6
+   *
7
+   * http://pegjs.org/
8
+   */
9
+
10
+  function peg$subclass(child, parent) {
11
+    function ctor() { this.constructor = child; }
12
+    ctor.prototype = parent.prototype;
13
+    child.prototype = new ctor();
14
+  }
15
+
16
+  function peg$SyntaxError(message, expected, found, location) {
17
+    this.message  = message;
18
+    this.expected = expected;
19
+    this.found    = found;
20
+    this.location = location;
21
+    this.name     = "SyntaxError";
22
+
23
+    if (typeof Error.captureStackTrace === "function") {
24
+      Error.captureStackTrace(this, peg$SyntaxError);
25
+    }
26
+  }
27
+
28
+  peg$subclass(peg$SyntaxError, Error);
29
+
30
+  function peg$parse(input) {
31
+    var options = arguments.length > 1 ? arguments[1] : {},
32
+        parser  = this,
33
+
34
+        peg$FAILED = {},
35
+
36
+        peg$startRuleFunctions = { post: peg$parsepost },
37
+        peg$startRuleFunction  = peg$parsepost,
38
+
39
+        peg$c0 = function(items) { return items.join(""); },
40
+        peg$c1 = { type: "any", description: "any character" },
41
+        peg$c2 = "<",
42
+        peg$c3 = { type: "literal", value: "<", description: "\"<\"" },
43
+        peg$c4 = ">",
44
+        peg$c5 = { type: "literal", value: ">", description: "\">\"" },
45
+        peg$c6 = "</",
46
+        peg$c7 = { type: "literal", value: "</", description: "\"</\"" },
47
+        peg$c8 = function() { return ""; },
48
+        peg$c9 = /^[A-Za-z]/,
49
+        peg$c10 = { type: "class", value: "[A-Za-z]", description: "[A-Za-z]" },
50
+        peg$c11 = /^[^>]/,
51
+        peg$c12 = { type: "class", value: "[^>]", description: "[^>]" },
52
+        peg$c13 = "a",
53
+        peg$c14 = { type: "literal", value: "a", description: "\"a\"" },
54
+        peg$c15 = "b",
55
+        peg$c16 = { type: "literal", value: "b", description: "\"b\"" },
56
+        peg$c17 = "i",
57
+        peg$c18 = { type: "literal", value: "i", description: "\"i\"" },
58
+        peg$c19 = "s",
59
+        peg$c20 = { type: "literal", value: "s", description: "\"s\"" },
60
+        peg$c21 = "u",
61
+        peg$c22 = { type: "literal", value: "u", description: "\"u\"" },
62
+        peg$c23 = "tt",
63
+        peg$c24 = { type: "literal", value: "tt", description: "\"tt\"" },
64
+        peg$c25 = function(norloge) { return '<norloge>' + norloge +'</norloge>'},
65
+        peg$c26 = "/",
66
+        peg$c27 = { type: "literal", value: "/", description: "\"/\"" },
67
+        peg$c28 = function(y, ln) { return y + "/" + ln; },
68
+        peg$c29 = /^[0-9]/,
69
+        peg$c30 = { type: "class", value: "[0-9]", description: "[0-9]" },
70
+        peg$c31 = function(digits) { return digits.join(""); },
71
+        peg$c32 = "#",
72
+        peg$c33 = { type: "literal", value: "#", description: "\"#\"" },
73
+        peg$c34 = function(m, d, nn) { return m + "/" + d + "#" + nn; },
74
+        peg$c35 = /^[0-1]/,
75
+        peg$c36 = { type: "class", value: "[0-1]", description: "[0-1]" },
76
+        peg$c37 = /^[0-2]/,
77
+        peg$c38 = { type: "class", value: "[0-2]", description: "[0-2]" },
78
+        peg$c39 = function(first, last) { return first + last; },
79
+        peg$c40 = /^[0-3]/,
80
+        peg$c41 = { type: "class", value: "[0-3]", description: "[0-3]" },
81
+        peg$c42 = ":",
82
+        peg$c43 = { type: "literal", value: ":", description: "\":\"" },
83
+        peg$c44 = function(sn, s) { return sn + ":" + s; },
84
+        peg$c45 = function(h, m) { return h + ":" + m; },
85
+        peg$c46 = /^[0-5]/,
86
+        peg$c47 = { type: "class", value: "[0-5]", description: "[0-5]" },
87
+        peg$c48 = /^[a-zA-Z0-9_]/,
88
+        peg$c49 = { type: "class", value: "[a-zA-Z0-9_]", description: "[a-zA-Z0-9_]" },
89
+        peg$c50 = function(chars) { var norlogeId = chars.join("");
90
+           return '<norloge-id' + norlogeId + '">#' + norlogeId + '</norloge-id>';
91
+           },
92
+        peg$c51 = /^[a-zA-Z0-9\-_]/,
93
+        peg$c52 = { type: "class", value: "[a-zA-Z0-9-_]", description: "[a-zA-Z0-9-_]" },
94
+        peg$c53 = /^[<[]/,
95
+        peg$c54 = { type: "class", value: "[<[]", description: "[<[]" },
96
+        peg$c55 = function(bigorno) { return [].concat('<bigorno>', bigorno,'</bigorno>').join("")},
97
+        peg$c56 = "[:",
98
+        peg$c57 = { type: "literal", value: "[:", description: "\"[:\"" },
99
+        peg$c58 = /^[^\]]/,
100
+        peg$c59 = { type: "class", value: "[^\\]]", description: "[^\\]]" },
101
+        peg$c60 = "]",
102
+        peg$c61 = { type: "literal", value: "]", description: "\"]\"" },
103
+        peg$c62 = function(first, totoz, third) { var totozId = totoz.join(""); 
104
+          return '<totoz>' + totozId + '</totoz>'; },
105
+        peg$c63 = /^[ \t\r\n]/,
106
+        peg$c64 = { type: "class", value: "[ \\t\\r\\n]", description: "[ \\t\\r\\n]" },
107
+
108
+        peg$currPos          = 0,
109
+        peg$savedPos         = 0,
110
+        peg$posDetailsCache  = [{ line: 1, column: 1, seenCR: false }],
111
+        peg$maxFailPos       = 0,
112
+        peg$maxFailExpected  = [],
113
+        peg$silentFails      = 0,
114
+
115
+        peg$result;
116
+
117
+    if ("startRule" in options) {
118
+      if (!(options.startRule in peg$startRuleFunctions)) {
119
+        throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
120
+      }
121
+
122
+      peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
123
+    }
124
+
125
+    function text() {
126
+      return input.substring(peg$savedPos, peg$currPos);
127
+    }
128
+
129
+    function location() {
130
+      return peg$computeLocation(peg$savedPos, peg$currPos);
131
+    }
132
+
133
+    function expected(description) {
134
+      throw peg$buildException(
135
+        null,
136
+        [{ type: "other", description: description }],
137
+        input.substring(peg$savedPos, peg$currPos),
138
+        peg$computeLocation(peg$savedPos, peg$currPos)
139
+      );
140
+    }
141
+
142
+    function error(message) {
143
+      throw peg$buildException(
144
+        message,
145
+        null,
146
+        input.substring(peg$savedPos, peg$currPos),
147
+        peg$computeLocation(peg$savedPos, peg$currPos)
148
+      );
149
+    }
150
+
151
+    function peg$computePosDetails(pos) {
152
+      var details = peg$posDetailsCache[pos],
153
+          p, ch;
154
+
155
+      if (details) {
156
+        return details;
157
+      } else {
158
+        p = pos - 1;
159
+        while (!peg$posDetailsCache[p]) {
160
+          p--;
161
+        }
162
+
163
+        details = peg$posDetailsCache[p];
164
+        details = {
165
+          line:   details.line,
166
+          column: details.column,
167
+          seenCR: details.seenCR
168
+        };
169
+
170
+        while (p < pos) {
171
+          ch = input.charAt(p);
172
+          if (ch === "\n") {
173
+            if (!details.seenCR) { details.line++; }
174
+            details.column = 1;
175
+            details.seenCR = false;
176
+          } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
177
+            details.line++;
178
+            details.column = 1;
179
+            details.seenCR = true;
180
+          } else {
181
+            details.column++;
182
+            details.seenCR = false;
183
+          }
184
+
185
+          p++;
186
+        }
187
+
188
+        peg$posDetailsCache[pos] = details;
189
+        return details;
190
+      }
191
+    }
192
+
193
+    function peg$computeLocation(startPos, endPos) {
194
+      var startPosDetails = peg$computePosDetails(startPos),
195
+          endPosDetails   = peg$computePosDetails(endPos);
196
+
197
+      return {
198
+        start: {
199
+          offset: startPos,
200
+          line:   startPosDetails.line,
201
+          column: startPosDetails.column
202
+        },
203
+        end: {
204
+          offset: endPos,
205
+          line:   endPosDetails.line,
206
+          column: endPosDetails.column
207
+        }
208
+      };
209
+    }
210
+
211
+    function peg$fail(expected) {
212
+      if (peg$currPos < peg$maxFailPos) { return; }
213
+
214
+      if (peg$currPos > peg$maxFailPos) {
215
+        peg$maxFailPos = peg$currPos;
216
+        peg$maxFailExpected = [];
217
+      }
218
+
219
+      peg$maxFailExpected.push(expected);
220
+    }
221
+
222
+    function peg$buildException(message, expected, found, location) {
223
+      function cleanupExpected(expected) {
224
+        var i = 1;
225
+
226
+        expected.sort(function(a, b) {
227
+          if (a.description < b.description) {
228
+            return -1;
229
+          } else if (a.description > b.description) {
230
+            return 1;
231
+          } else {
232
+            return 0;
233
+          }
234
+        });
235
+
236
+        while (i < expected.length) {
237
+          if (expected[i - 1] === expected[i]) {
238
+            expected.splice(i, 1);
239
+          } else {
240
+            i++;
241
+          }
242
+        }
243
+      }
244
+
245
+      function buildMessage(expected, found) {
246
+        function stringEscape(s) {
247
+          function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
248
+
249
+          return s
250
+            .replace(/\\/g,   '\\\\')
251
+            .replace(/"/g,    '\\"')
252
+            .replace(/\x08/g, '\\b')
253
+            .replace(/\t/g,   '\\t')
254
+            .replace(/\n/g,   '\\n')
255
+            .replace(/\f/g,   '\\f')
256
+            .replace(/\r/g,   '\\r')
257
+            .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
258
+            .replace(/[\x10-\x1F\x80-\xFF]/g,    function(ch) { return '\\x'  + hex(ch); })
259
+            .replace(/[\u0100-\u0FFF]/g,         function(ch) { return '\\u0' + hex(ch); })
260
+            .replace(/[\u1000-\uFFFF]/g,         function(ch) { return '\\u'  + hex(ch); });
261
+        }
262
+
263
+        var expectedDescs = new Array(expected.length),
264
+            expectedDesc, foundDesc, i;
265
+
266
+        for (i = 0; i < expected.length; i++) {
267
+          expectedDescs[i] = expected[i].description;
268
+        }
269
+
270
+        expectedDesc = expected.length > 1
271
+          ? expectedDescs.slice(0, -1).join(", ")
272
+              + " or "
273
+              + expectedDescs[expected.length - 1]
274
+          : expectedDescs[0];
275
+
276
+        foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
277
+
278
+        return "Expected " + expectedDesc + " but " + foundDesc + " found.";
279
+      }
280
+
281
+      if (expected !== null) {
282
+        cleanupExpected(expected);
283
+      }
284
+
285
+      return new peg$SyntaxError(
286
+        message !== null ? message : buildMessage(expected, found),
287
+        expected,
288
+        found,
289
+        location
290
+      );
291
+    }
292
+
293
+    function peg$parsepost() {
294
+      var s0, s1, s2;
295
+
296
+      s0 = peg$currPos;
297
+      s1 = [];
298
+      s2 = peg$parsepostItem();
299
+      while (s2 !== peg$FAILED) {
300
+        s1.push(s2);
301
+        s2 = peg$parsepostItem();
302
+      }
303
+      if (s1 !== peg$FAILED) {
304
+        peg$savedPos = s0;
305
+        s1 = peg$c0(s1);
306
+      }
307
+      s0 = s1;
308
+
309
+      return s0;
310
+    }
311
+
312
+    function peg$parsepostItem() {
313
+      var s0;
314
+
315
+      s0 = peg$parsetotoz();
316
+      if (s0 === peg$FAILED) {
317
+        s0 = peg$parsebigorno();
318
+        if (s0 === peg$FAILED) {
319
+          s0 = peg$parsenorloge();
320
+          if (s0 === peg$FAILED) {
321
+            s0 = peg$parseopentag();
322
+            if (s0 === peg$FAILED) {
323
+              s0 = peg$parseclosetag();
324
+              if (s0 === peg$FAILED) {
325
+                if (input.length > peg$currPos) {
326
+                  s0 = input.charAt(peg$currPos);
327
+                  peg$currPos++;
328
+                } else {
329
+                  s0 = peg$FAILED;
330
+                  if (peg$silentFails === 0) { peg$fail(peg$c1); }
331
+                }
332
+              }
333
+            }
334
+          }
335
+        }
336
+      }
337
+
338
+      return s0;
339
+    }
340
+
341
+    function peg$parseopentag() {
342
+      var s0, s1, s2, s3, s4;
343
+
344
+      s0 = peg$currPos;
345
+      s1 = peg$currPos;
346
+      if (input.charCodeAt(peg$currPos) === 60) {
347
+        s2 = peg$c2;
348
+        peg$currPos++;
349
+      } else {
350
+        s2 = peg$FAILED;
351
+        if (peg$silentFails === 0) { peg$fail(peg$c3); }
352
+      }
353
+      if (s2 !== peg$FAILED) {
354
+        s3 = peg$parsetag();
355
+        if (s3 !== peg$FAILED) {
356
+          if (input.charCodeAt(peg$currPos) === 62) {
357
+            s4 = peg$c4;
358
+            peg$currPos++;
359
+          } else {
360
+            s4 = peg$FAILED;
361
+            if (peg$silentFails === 0) { peg$fail(peg$c5); }
362
+          }
363
+          if (s4 !== peg$FAILED) {
364
+            s2 = [s2, s3, s4];
365
+            s1 = s2;
366
+          } else {
367
+            peg$currPos = s1;
368
+            s1 = peg$FAILED;
369
+          }
370
+        } else {
371
+          peg$currPos = s1;
372
+          s1 = peg$FAILED;
373
+        }
374
+      } else {
375
+        peg$currPos = s1;
376
+        s1 = peg$FAILED;
377
+      }
378
+      if (s1 !== peg$FAILED) {
379
+        s0 = input.substring(s0, peg$currPos);
380
+      } else {
381
+        s0 = s1;
382
+      }
383
+      if (s0 === peg$FAILED) {
384
+        s0 = peg$parseinvalidOpenTag();
385
+      }
386
+
387
+      return s0;
388
+    }
389
+
390
+    function peg$parseclosetag() {
391
+      var s0, s1, s2, s3, s4;
392
+
393
+      s0 = peg$currPos;
394
+      s1 = peg$currPos;
395
+      if (input.substr(peg$currPos, 2) === peg$c6) {
396
+        s2 = peg$c6;
397
+        peg$currPos += 2;
398
+      } else {
399
+        s2 = peg$FAILED;
400
+        if (peg$silentFails === 0) { peg$fail(peg$c7); }
401
+      }
402
+      if (s2 !== peg$FAILED) {
403
+        s3 = peg$parsetag();
404
+        if (s3 !== peg$FAILED) {
405
+          if (input.charCodeAt(peg$currPos) === 62) {
406
+            s4 = peg$c4;
407
+            peg$currPos++;
408
+          } else {
409
+            s4 = peg$FAILED;
410
+            if (peg$silentFails === 0) { peg$fail(peg$c5); }
411
+          }
412
+          if (s4 !== peg$FAILED) {
413
+            s2 = [s2, s3, s4];
414
+            s1 = s2;
415
+          } else {
416
+            peg$currPos = s1;
417
+            s1 = peg$FAILED;
418
+          }
419
+        } else {
420
+          peg$currPos = s1;
421
+          s1 = peg$FAILED;
422
+        }
423
+      } else {
424
+        peg$currPos = s1;
425
+        s1 = peg$FAILED;
426
+      }
427
+      if (s1 !== peg$FAILED) {
428
+        s0 = input.substring(s0, peg$currPos);
429
+      } else {
430
+        s0 = s1;
431
+      }
432
+      if (s0 === peg$FAILED) {
433
+        s0 = peg$parseinvalidCloseTag();
434
+      }
435
+
436
+      return s0;
437
+    }
438
+
439
+    function peg$parseinvalidOpenTag() {
440
+      var s0, s1, s2, s3;
441
+
442
+      s0 = peg$currPos;
443
+      if (input.charCodeAt(peg$currPos) === 60) {
444
+        s1 = peg$c2;
445
+        peg$currPos++;
446
+      } else {
447
+        s1 = peg$FAILED;
448
+        if (peg$silentFails === 0) { peg$fail(peg$c3); }
449
+      }
450
+      if (s1 !== peg$FAILED) {
451
+        s2 = peg$parsetagName();
452
+        if (s2 !== peg$FAILED) {
453
+          if (input.charCodeAt(peg$currPos) === 62) {
454
+            s3 = peg$c4;
455
+            peg$currPos++;
456
+          } else {
457
+            s3 = peg$FAILED;
458
+            if (peg$silentFails === 0) { peg$fail(peg$c5); }
459
+          }
460
+          if (s3 !== peg$FAILED) {
461
+            peg$savedPos = s0;
462
+            s1 = peg$c8();
463
+            s0 = s1;
464
+          } else {
465
+            peg$currPos = s0;
466
+            s0 = peg$FAILED;
467
+          }
468
+        } else {
469
+          peg$currPos = s0;
470
+          s0 = peg$FAILED;
471
+        }
472
+      } else {
473
+        peg$currPos = s0;
474
+        s0 = peg$FAILED;
475
+      }
476
+
477
+      return s0;
478
+    }
479
+
480
+    function peg$parseinvalidCloseTag() {
481
+      var s0, s1, s2, s3;
482
+
483
+      s0 = peg$currPos;
484
+      if (input.substr(peg$currPos, 2) === peg$c6) {
485
+        s1 = peg$c6;
486
+        peg$currPos += 2;
487
+      } else {
488
+        s1 = peg$FAILED;
489
+        if (peg$silentFails === 0) { peg$fail(peg$c7); }
490
+      }
491
+      if (s1 !== peg$FAILED) {
492
+        s2 = peg$parsetagName();
493
+        if (s2 !== peg$FAILED) {
494
+          if (input.charCodeAt(peg$currPos) === 62) {
495
+            s3 = peg$c4;
496
+            peg$currPos++;
497
+          } else {
498
+            s3 = peg$FAILED;
499
+            if (peg$silentFails === 0) { peg$fail(peg$c5); }
500
+          }
501
+          if (s3 !== peg$FAILED) {
502
+            peg$savedPos = s0;
503
+            s1 = peg$c8();
504
+            s0 = s1;
505
+          } else {
506
+            peg$currPos = s0;
507
+            s0 = peg$FAILED;
508
+          }
509
+        } else {
510
+          peg$currPos = s0;
511
+          s0 = peg$FAILED;
512
+        }
513
+      } else {
514
+        peg$currPos = s0;
515
+        s0 = peg$FAILED;
516
+      }
517
+
518
+      return s0;
519
+    }
520
+
521
+    function peg$parsetagName() {
522
+      var s0, s1, s2, s3;
523
+
524
+      s0 = peg$currPos;
525
+      if (peg$c9.test(input.charAt(peg$currPos))) {
526
+        s1 = input.charAt(peg$currPos);
527
+        peg$currPos++;
528
+      } else {
529
+        s1 = peg$FAILED;
530
+        if (peg$silentFails === 0) { peg$fail(peg$c10); }
531
+      }
532
+      if (s1 !== peg$FAILED) {
533
+        s2 = [];
534
+        if (peg$c11.test(input.charAt(peg$currPos))) {
535
+          s3 = input.charAt(peg$currPos);
536
+          peg$currPos++;
537
+        } else {
538
+          s3 = peg$FAILED;
539
+          if (peg$silentFails === 0) { peg$fail(peg$c12); }
540
+        }
541
+        while (s3 !== peg$FAILED) {
542
+          s2.push(s3);
543
+          if (peg$c11.test(input.charAt(peg$currPos))) {
544
+            s3 = input.charAt(peg$currPos);
545
+            peg$currPos++;
546
+          } else {
547
+            s3 = peg$FAILED;
548
+            if (peg$silentFails === 0) { peg$fail(peg$c12); }
549
+          }
550
+        }
551
+        if (s2 !== peg$FAILED) {
552
+          s1 = [s1, s2];
553
+          s0 = s1;
554
+        } else {
555
+          peg$currPos = s0;
556
+          s0 = peg$FAILED;
557
+        }
558
+      } else {
559
+        peg$currPos = s0;
560
+        s0 = peg$FAILED;
561
+      }
562
+
563
+      return s0;
564
+    }
565
+
566
+    function peg$parsetag() {
567
+      var s0;
568
+
569
+      if (input.charCodeAt(peg$currPos) === 97) {
570
+        s0 = peg$c13;
571
+        peg$currPos++;
572
+      } else {
573
+        s0 = peg$FAILED;
574
+        if (peg$silentFails === 0) { peg$fail(peg$c14); }
575
+      }
576
+      if (s0 === peg$FAILED) {
577
+        if (input.charCodeAt(peg$currPos) === 98) {
578
+          s0 = peg$c15;
579
+          peg$currPos++;
580
+        } else {
581
+          s0 = peg$FAILED;
582
+          if (peg$silentFails === 0) { peg$fail(peg$c16); }
583
+        }
584
+        if (s0 === peg$FAILED) {
585
+          if (input.charCodeAt(peg$currPos) === 105) {
586
+            s0 = peg$c17;
587
+            peg$currPos++;
588
+          } else {
589
+            s0 = peg$FAILED;
590
+            if (peg$silentFails === 0) { peg$fail(peg$c18); }
591
+          }
592
+          if (s0 === peg$FAILED) {
593
+            if (input.charCodeAt(peg$currPos) === 115) {
594
+              s0 = peg$c19;
595
+              peg$currPos++;
596
+            } else {
597
+              s0 = peg$FAILED;
598
+              if (peg$silentFails === 0) { peg$fail(peg$c20); }
599
+            }
600
+            if (s0 === peg$FAILED) {
601
+              if (input.charCodeAt(peg$currPos) === 117) {
602
+                s0 = peg$c21;
603
+                peg$currPos++;
604
+              } else {
605
+                s0 = peg$FAILED;
606
+                if (peg$silentFails === 0) { peg$fail(peg$c22); }
607
+              }
608
+              if (s0 === peg$FAILED) {
609
+                if (input.substr(peg$currPos, 2) === peg$c23) {
610
+                  s0 = peg$c23;
611
+                  peg$currPos += 2;
612
+                } else {
613
+                  s0 = peg$FAILED;
614
+                  if (peg$silentFails === 0) { peg$fail(peg$c24); }
615
+                }
616
+              }
617
+            }
618
+          }
619
+        }
620
+      }
621
+
622
+      return s0;
623
+    }
624
+
625
+    function peg$parsenorloge() {
626
+      var s0;
627
+
628
+      s0 = peg$parsenorlogeTime();
629
+      if (s0 === peg$FAILED) {
630
+        s0 = peg$parsenorlogeId();
631
+      }
632
+
633
+      return s0;
634
+    }
635
+
636
+    function peg$parsenorlogeTime() {
637
+      var s0, s1;
638
+
639
+      s0 = peg$currPos;
640
+      s1 = peg$parsefullNorloge();
641
+      if (s1 === peg$FAILED) {
642
+        s1 = peg$parselongNorloge();
643
+        if (s1 === peg$FAILED) {
644
+          s1 = peg$parsenormalNorloge();
645
+          if (s1 === peg$FAILED) {
646
+            s1 = peg$parseshortNorloge();
647
+          }
648
+        }
649
+      }
650
+      if (s1 !== peg$FAILED) {
651
+        peg$savedPos = s0;
652
+        s1 = peg$c25(s1);
653
+      }
654
+      s0 = s1;
655
+
656
+      return s0;
657
+    }
658
+
659
+    function peg$parsefullNorloge() {
660
+      var s0, s1, s2, s3;
661
+
662
+      s0 = peg$currPos;
663
+      s1 = peg$parsenorlogeYear();
664
+      if (s1 !== peg$FAILED) {
665
+        if (input.charCodeAt(peg$currPos) === 47) {
666
+          s2 = peg$c26;
667
+          peg$currPos++;
668
+        } else {
669
+          s2 = peg$FAILED;
670
+          if (peg$silentFails === 0) { peg$fail(peg$c27); }
671
+        }
672
+        if (s2 !== peg$FAILED) {
673
+          s3 = peg$parselongNorloge();
674
+          if (s3 !== peg$FAILED) {
675
+            peg$savedPos = s0;
676
+            s1 = peg$c28(s1, s3);
677
+            s0 = s1;
678
+          } else {
679
+            peg$currPos = s0;
680
+            s0 = peg$FAILED;
681
+          }
682
+        } else {
683
+          peg$currPos = s0;
684
+          s0 = peg$FAILED;
685
+        }
686
+      } else {
687
+        peg$currPos = s0;
688
+        s0 = peg$FAILED;
689
+      }
690
+
691
+      return s0;
692
+    }
693
+
694
+    function peg$parsenorlogeYear() {
695
+      var s0, s1, s2;
696
+
697
+      s0 = peg$currPos;
698
+      s1 = [];
699
+      if (peg$c29.test(input.charAt(peg$currPos))) {
700
+        s2 = input.charAt(peg$currPos);
701
+        peg$currPos++;
702
+      } else {
703
+        s2 = peg$FAILED;
704
+        if (peg$silentFails === 0) { peg$fail(peg$c30); }
705
+      }
706
+      if (s2 !== peg$FAILED) {
707
+        while (s2 !== peg$FAILED) {
708
+          s1.push(s2);
709
+          if (peg$c29.test(input.charAt(peg$currPos))) {
710
+            s2 = input.charAt(peg$currPos);
711
+            peg$currPos++;
712
+          } else {
713
+            s2 = peg$FAILED;
714
+            if (peg$silentFails === 0) { peg$fail(peg$c30); }
715
+          }
716
+        }
717
+      } else {
718
+        s1 = peg$FAILED;
719
+      }
720
+      if (s1 !== peg$FAILED) {
721
+        peg$savedPos = s0;
722
+        s1 = peg$c31(s1);
723
+      }
724
+      s0 = s1;
725
+
726
+      return s0;
727
+    }
728
+
729
+    function peg$parselongNorloge() {
730
+      var s0, s1, s2, s3, s4, s5;
731
+
732
+      s0 = peg$currPos;
733
+      s1 = peg$parsenorlogeMonth();
734
+      if (s1 !== peg$FAILED) {
735
+        if (input.charCodeAt(peg$currPos) === 47) {
736
+          s2 = peg$c26;
737
+          peg$currPos++;
738
+        } else {
739
+          s2 = peg$FAILED;
740
+          if (peg$silentFails === 0) { peg$fail(peg$c27); }
741
+        }
742
+        if (s2 !== peg$FAILED) {
743
+          s3 = peg$parsenorlogeDay();
744
+          if (s3 !== peg$FAILED) {
745
+            if (input.charCodeAt(peg$currPos) === 35) {
746
+              s4 = peg$c32;
747
+              peg$currPos++;
748
+            } else {
749
+              s4 = peg$FAILED;
750
+              if (peg$silentFails === 0) { peg$fail(peg$c33); }
751
+            }
752
+            if (s4 !== peg$FAILED) {
753
+              s5 = peg$parsenormalNorloge();
754
+              if (s5 !== peg$FAILED) {
755
+                peg$savedPos = s0;
756
+                s1 = peg$c34(s1, s3, s5);
757
+                s0 = s1;
758
+              } else {
759
+                peg$currPos = s0;
760
+                s0 = peg$FAILED;
761
+              }
762
+            } else {
763
+              peg$currPos = s0;
764
+              s0 = peg$FAILED;
765
+            }
766
+          } else {
767
+            peg$currPos = s0;
768
+            s0 = peg$FAILED;
769
+          }
770
+        } else {
771
+          peg$currPos = s0;
772
+          s0 = peg$FAILED;
773
+        }
774
+      } else {
775
+        peg$currPos = s0;
776
+        s0 = peg$FAILED;
777
+      }
778
+
779
+      return s0;
780
+    }
781
+
782
+    function peg$parsenorlogeMonth() {
783
+      var s0, s1, s2;
784
+
785
+      s0 = peg$currPos;
786
+      if (peg$c35.test(input.charAt(peg$currPos))) {
787
+        s1 = input.charAt(peg$currPos);
788
+        peg$currPos++;
789
+      } else {
790
+        s1 = peg$FAILED;
791
+        if (peg$silentFails === 0) { peg$fail(peg$c36); }
792
+      }
793
+      if (s1 !== peg$FAILED) {
794
+        if (peg$c37.test(input.charAt(peg$currPos))) {
795
+          s2 = input.charAt(peg$currPos);
796
+          peg$currPos++;
797
+        } else {
798
+          s2 = peg$FAILED;
799
+          if (peg$silentFails === 0) { peg$fail(peg$c38); }
800
+        }
801
+        if (s2 !== peg$FAILED) {
802
+          peg$savedPos = s0;
803
+          s1 = peg$c39(s1, s2);
804
+          s0 = s1;
805
+        } else {
806
+          peg$currPos = s0;
807
+          s0 = peg$FAILED;
808
+        }
809
+      } else {
810
+        peg$currPos = s0;
811
+        s0 = peg$FAILED;
812
+      }
813
+
814
+      return s0;
815
+    }
816
+
817
+    function peg$parsenorlogeDay() {
818
+      var s0, s1, s2;
819
+
820
+      s0 = peg$currPos;
821
+      if (peg$c40.test(input.charAt(peg$currPos))) {
822
+        s1 = input.charAt(peg$currPos);
823
+        peg$currPos++;
824
+      } else {
825
+        s1 = peg$FAILED;
826
+        if (peg$silentFails === 0) { peg$fail(peg$c41); }
827
+      }
828
+      if (s1 !== peg$FAILED) {
829
+        if (peg$c29.test(input.charAt(peg$currPos))) {
830
+          s2 = input.charAt(peg$currPos);
831
+          peg$currPos++;
832
+        } else {
833
+          s2 = peg$FAILED;
834
+          if (peg$silentFails === 0) { peg$fail(peg$c30); }
835
+        }
836
+        if (s2 !== peg$FAILED) {
837
+          peg$savedPos = s0;
838
+          s1 = peg$c39(s1, s2);
839
+          s0 = s1;
840
+        } else {
841
+          peg$currPos = s0;
842
+          s0 = peg$FAILED;
843
+        }
844
+      } else {
845
+        peg$currPos = s0;
846
+        s0 = peg$FAILED;
847
+      }
848
+
849
+      return s0;
850
+    }
851
+
852
+    function peg$parsenormalNorloge() {
853
+      var s0, s1, s2, s3;
854
+
855
+      s0 = peg$currPos;
856
+      s1 = peg$parseshortNorloge();
857
+      if (s1 !== peg$FAILED) {
858
+        if (input.charCodeAt(peg$currPos) === 58) {
859
+          s2 = peg$c42;
860
+          peg$currPos++;
861
+        } else {
862
+          s2 = peg$FAILED;
863
+          if (peg$silentFails === 0) { peg$fail(peg$c43); }
864
+        }
865
+        if (s2 !== peg$FAILED) {
866
+          s3 = peg$parsenorlogeSeconds();
867
+          if (s3 !== peg$FAILED) {
868
+            peg$savedPos = s0;
869
+            s1 = peg$c44(s1, s3);
870
+            s0 = s1;
871
+          } else {
872
+            peg$currPos = s0;
873
+            s0 = peg$FAILED;
874
+          }
875
+        } else {
876
+          peg$currPos = s0;
877
+          s0 = peg$FAILED;
878
+        }
879
+      } else {
880
+        peg$currPos = s0;
881
+        s0 = peg$FAILED;
882
+      }
883
+
884
+      return s0;
885
+    }
886
+
887
+    function peg$parseshortNorloge() {
888
+      var s0, s1, s2, s3;
889
+
890
+      s0 = peg$currPos;
891
+      s1 = peg$parsenorlogeHours();
892
+      if (s1 !== peg$FAILED) {
893
+        if (input.charCodeAt(peg$currPos) === 58) {
894
+          s2 = peg$c42;
895
+          peg$currPos++;
896
+        } else {
897
+          s2 = peg$FAILED;
898
+          if (peg$silentFails === 0) { peg$fail(peg$c43); }
899
+        }
900
+        if (s2 !== peg$FAILED) {
901
+          s3 = peg$parsenorlogeMinutes();
902
+          if (s3 !== peg$FAILED) {
903
+            peg$savedPos = s0;
904
+            s1 = peg$c45(s1, s3);
905
+            s0 = s1;
906
+          } else {
907
+            peg$currPos = s0;
908
+            s0 = peg$FAILED;
909
+          }
910
+        } else {
911
+          peg$currPos = s0;
912
+          s0 = peg$FAILED;
913
+        }
914
+      } else {
915
+        peg$currPos = s0;
916
+        s0 = peg$FAILED;
917
+      }
918
+
919
+      return s0;
920
+    }
921
+
922
+    function peg$parsenorlogeHours() {
923
+      var s0, s1, s2;
924
+
925
+      s0 = peg$currPos;
926
+      if (peg$c37.test(input.charAt(peg$currPos))) {
927
+        s1 = input.charAt(peg$currPos);
928
+        peg$currPos++;
929
+      } else {
930
+        s1 = peg$FAILED;
931
+        if (peg$silentFails === 0) { peg$fail(peg$c38); }
932
+      }
933
+      if (s1 !== peg$FAILED) {
934
+        if (peg$c40.test(input.charAt(peg$currPos))) {
935
+          s2 = input.charAt(peg$currPos);
936
+          peg$currPos++;
937
+        } else {
938
+          s2 = peg$FAILED;
939
+          if (peg$silentFails === 0) { peg$fail(peg$c41); }
940
+        }
941
+        if (s2 !== peg$FAILED) {
942
+          peg$savedPos = s0;
943
+          s1 = peg$c39(s1, s2);
944
+          s0 = s1;
945
+        } else {
946
+          peg$currPos = s0;
947
+          s0 = peg$FAILED;
948
+        }
949
+      } else {
950
+        peg$currPos = s0;
951
+        s0 = peg$FAILED;
952
+      }
953
+
954
+      return s0;
955
+    }
956
+
957
+    function peg$parsenorlogeMinutes() {
958
+      var s0, s1, s2;
959
+
960
+      s0 = peg$currPos;
961
+      if (peg$c46.test(input.charAt(peg$currPos))) {
962
+        s1 = input.charAt(peg$currPos);
963
+        peg$currPos++;
964
+      } else {
965
+        s1 = peg$FAILED;
966
+        if (peg$silentFails === 0) { peg$fail(peg$c47); }
967
+      }
968
+      if (s1 !== peg$FAILED) {
969
+        if (peg$c29.test(input.charAt(peg$currPos))) {
970
+          s2 = input.charAt(peg$currPos);
971
+          peg$currPos++;
972
+        } else {
973
+          s2 = peg$FAILED;
974
+          if (peg$silentFails === 0) { peg$fail(peg$c30); }
975
+        }
976
+        if (s2 !== peg$FAILED) {
977
+          peg$savedPos = s0;
978
+          s1 = peg$c39(s1, s2);
979
+          s0 = s1;
980
+        } else {
981
+          peg$currPos = s0;
982
+          s0 = peg$FAILED;
983
+        }
984
+      } else {
985
+        peg$currPos = s0;
986
+        s0 = peg$FAILED;
987
+      }
988
+
989
+      return s0;
990
+    }
991
+
992
+    function peg$parsenorlogeSeconds() {
993
+      var s0, s1, s2;
994
+
995
+      s0 = peg$currPos;
996
+      if (peg$c46.test(input.charAt(peg$currPos))) {
997
+        s1 = input.charAt(peg$currPos);
998
+        peg$currPos++;
999
+      } else {
1000
+        s1 = peg$FAILED;
1001
+        if (peg$silentFails === 0) { peg$fail(peg$c47); }
1002
+      }
1003
+      if (s1 !== peg$FAILED) {
1004
+        if (peg$c29.test(input.charAt(peg$currPos))) {
1005
+          s2 = input.charAt(peg$currPos);
1006
+          peg$currPos++;
1007
+        } else {
1008
+          s2 = peg$FAILED;
1009
+          if (peg$silentFails === 0) { peg$fail(peg$c30); }
1010
+        }
1011
+        if (s2 !== peg$FAILED) {
1012
+          peg$savedPos = s0;
1013
+          s1 = peg$c39(s1, s2);
1014
+          s0 = s1;
1015
+        } else {
1016
+          peg$currPos = s0;
1017
+          s0 = peg$FAILED;
1018
+        }
1019
+      } else {
1020
+        peg$currPos = s0;
1021
+        s0 = peg$FAILED;
1022
+      }
1023
+
1024
+      return s0;
1025
+    }
1026
+
1027
+    function peg$parsenorlogeId() {
1028
+      var s0, s1, s2, s3;
1029
+
1030
+      s0 = peg$currPos;
1031
+      if (input.charCodeAt(peg$currPos) === 35) {
1032
+        s1 = peg$c32;
1033
+        peg$currPos++;
1034
+      } else {
1035
+        s1 = peg$FAILED;
1036
+        if (peg$silentFails === 0) { peg$fail(peg$c33); }
1037
+      }
1038
+      if (s1 !== peg$FAILED) {
1039
+        s2 = [];
1040
+        if (peg$c48.test(input.charAt(peg$currPos))) {
1041
+          s3 = input.charAt(peg$currPos);
1042
+          peg$currPos++;
1043
+        } else {
1044
+          s3 = peg$FAILED;
1045
+          if (peg$silentFails === 0) { peg$fail(peg$c49); }
1046
+        }
1047
+        if (s3 !== peg$FAILED) {
1048
+          while (s3 !== peg$FAILED) {
1049
+            s2.push(s3);
1050
+            if (peg$c48.test(input.charAt(peg$currPos))) {
1051
+              s3 = input.charAt(peg$currPos);
1052
+              peg$currPos++;
1053
+            } else {
1054
+              s3 = peg$FAILED;
1055
+              if (peg$silentFails === 0) { peg$fail(peg$c49); }
1056
+            }
1057
+          }
1058
+        } else {
1059
+          s2 = peg$FAILED;
1060
+        }
1061
+        if (s2 !== peg$FAILED) {
1062
+          peg$savedPos = s0;
1063
+          s1 = peg$c50(s2);
1064
+          s0 = s1;
1065
+        } else {
1066
+          peg$currPos = s0;
1067
+          s0 = peg$FAILED;
1068
+        }
1069
+      } else {
1070
+        peg$currPos = s0;
1071
+        s0 = peg$FAILED;
1072
+      }
1073
+
1074
+      return s0;
1075
+    }
1076
+
1077
+    function peg$parsebigorno() {
1078
+      var s0, s1, s2, s3, s4;
1079
+
1080
+      s0 = peg$currPos;
1081
+      s1 = [];
1082
+      if (peg$c51.test(input.charAt(peg$currPos))) {
1083
+        s2 = input.charAt(peg$currPos);
1084
+        peg$currPos++;
1085
+      } else {
1086
+        s2 = peg$FAILED;
1087
+        if (peg$silentFails === 0) { peg$fail(peg$c52); }
1088
+      }
1089
+      if (s2 !== peg$FAILED) {
1090
+        while (s2 !== peg$FAILED) {
1091
+          s1.push(s2);
1092
+          if (peg$c51.test(input.charAt(peg$currPos))) {
1093
+            s2 = input.charAt(peg$currPos);
1094
+            peg$currPos++;
1095
+          } else {
1096
+            s2 = peg$FAILED;
1097
+            if (peg$silentFails === 0) { peg$fail(peg$c52); }
1098
+          }
1099
+        }
1100
+      } else {
1101
+        s1 = peg$FAILED;
1102
+      }
1103
+      if (s1 !== peg$FAILED) {
1104
+        if (input.charCodeAt(peg$currPos) === 60) {
1105
+          s2 = peg$c2;
1106
+          peg$currPos++;
1107
+        } else {
1108
+          s2 = peg$FAILED;
1109
+          if (peg$silentFails === 0) { peg$fail(peg$c3); }
1110
+        }
1111
+        if (s2 !== peg$FAILED) {
1112
+          s3 = peg$currPos;
1113
+          peg$silentFails++;
1114
+          s4 = peg$parsewhitespaces();
1115
+          if (s4 === peg$FAILED) {
1116
+            if (peg$c53.test(input.charAt(peg$currPos))) {
1117
+              s4 = input.charAt(peg$currPos);
1118
+              peg$currPos++;
1119
+            } else {
1120
+              s4 = peg$FAILED;
1121
+              if (peg$silentFails === 0) { peg$fail(peg$c54); }
1122
+            }
1123
+          }
1124
+          peg$silentFails--;
1125
+          if (s4 !== peg$FAILED) {
1126
+            peg$currPos = s3;
1127
+            s3 = void 0;
1128
+          } else {
1129
+            s3 = peg$FAILED;
1130
+          }
1131
+          if (s3 !== peg$FAILED) {
1132
+            peg$savedPos = s0;
1133
+            s1 = peg$c55(s1);
1134
+            s0 = s1;
1135
+          } else {
1136
+            peg$currPos = s0;
1137
+            s0 = peg$FAILED;
1138
+          }
1139
+        } else {
1140
+          peg$currPos = s0;
1141
+          s0 = peg$FAILED;
1142
+        }
1143
+      } else {
1144
+        peg$currPos = s0;
1145
+        s0 = peg$FAILED;
1146
+      }
1147
+
1148
+      return s0;
1149
+    }
1150
+
1151
+    function peg$parsetotoz() {
1152
+      var s0, s1, s2, s3;
1153
+
1154
+      s0 = peg$currPos;
1155
+      if (input.substr(peg$currPos, 2) === peg$c56) {
1156
+        s1 = peg$c56;
1157
+        peg$currPos += 2;
1158
+      } else {
1159
+        s1 = peg$FAILED;
1160
+        if (peg$silentFails === 0) { peg$fail(peg$c57); }
1161
+      }
1162
+      if (s1 !== peg$FAILED) {
1163
+        s2 = [];
1164
+        if (peg$c58.test(input.charAt(peg$currPos))) {
1165
+          s3 = input.charAt(peg$currPos);
1166
+          peg$currPos++;
1167
+        } else {
1168
+          s3 = peg$FAILED;
1169
+          if (peg$silentFails === 0) { peg$fail(peg$c59); }
1170
+        }
1171
+        if (s3 !== peg$FAILED) {
1172
+          while (s3 !== peg$FAILED) {
1173
+            s2.push(s3);
1174
+            if (peg$c58.test(input.charAt(peg$currPos))) {
1175
+              s3 = input.charAt(peg$currPos);
1176
+              peg$currPos++;
1177
+            } else {
1178
+              s3 = peg$FAILED;
1179
+              if (peg$silentFails === 0) { peg$fail(peg$c59); }
1180
+            }
1181
+          }
1182
+        } else {
1183
+          s2 = peg$FAILED;
1184
+        }
1185
+        if (s2 !== peg$FAILED) {
1186
+          if (input.charCodeAt(peg$currPos) === 93) {
1187
+            s3 = peg$c60;
1188
+            peg$currPos++;
1189
+          } else {
1190
+            s3 = peg$FAILED;
1191
+            if (peg$silentFails === 0) { peg$fail(peg$c61); }
1192
+          }
1193
+          if (s3 !== peg$FAILED) {
1194
+            peg$savedPos = s0;
1195
+            s1 = peg$c62(s1, s2, s3);
1196
+            s0 = s1;
1197
+          } else {
1198
+            peg$currPos = s0;
1199
+            s0 = peg$FAILED;
1200
+          }
1201
+        } else {
1202
+          peg$currPos = s0;
1203
+          s0 = peg$FAILED;
1204
+        }
1205
+      } else {
1206
+        peg$currPos = s0;
1207
+        s0 = peg$FAILED;
1208
+      }
1209
+
1210
+      return s0;
1211
+    }
1212
+
1213
+    function peg$parsewhitespaces() {
1214
+      var s0, s1;
1215
+
1216
+      if (peg$c63.test(input.charAt(peg$currPos))) {
1217
+        s0 = input.charAt(peg$currPos);
1218
+        peg$currPos++;
1219
+      } else {
1220
+        s0 = peg$FAILED;
1221
+        if (peg$silentFails === 0) { peg$fail(peg$c64); }
1222
+      }
1223
+      if (s0 === peg$FAILED) {
1224
+        s0 = peg$currPos;
1225
+        peg$silentFails++;
1226
+        if (input.length > peg$currPos) {
1227
+          s1 = input.charAt(peg$currPos);
1228
+          peg$currPos++;
1229
+        } else {
1230
+          s1 = peg$FAILED;
1231
+          if (peg$silentFails === 0) { peg$fail(peg$c1); }
1232
+        }
1233
+        peg$silentFails--;
1234
+        if (s1 === peg$FAILED) {
1235
+          s0 = void 0;
1236
+        } else {
1237
+          peg$currPos = s0;
1238
+          s0 = peg$FAILED;
1239
+        }
1240
+      }
1241
+
1242
+      return s0;
1243
+    }
1244
+
1245
+    peg$result = peg$startRuleFunction();
1246
+
1247
+    if (peg$result !== peg$FAILED && peg$currPos === input.length) {
1248
+      return peg$result;
1249
+    } else {
1250
+      if (peg$result !== peg$FAILED && peg$currPos < input.length) {
1251
+        peg$fail({ type: "end", description: "end of input" });
1252
+      }
1253
+
1254
+      throw peg$buildException(
1255
+        null,
1256
+        peg$maxFailExpected,
1257
+        peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
1258
+        peg$maxFailPos < input.length
1259
+          ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
1260
+          : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
1261
+      );
1262
+    }
1263
+  }
1264
+
1265
+  return {
1266
+    SyntaxError: peg$SyntaxError,
1267
+    parse:       peg$parse
1268
+  };
1269
+})();
0 1270
new file mode 100644
... ...
@@ -0,0 +1,99 @@
1
+post
2
+ = items:postItem*
3
+ { return items.join(""); }
4
+ 
5
+postItem
6
+ = totoz
7
+ / bigorno
8
+ / norloge
9
+ / opentag
10
+ / closetag
11
+ / .
12
+
13
+opentag
14
+ = $("<" tag ">")
15
+ / invalidOpenTag
16
+ 
17
+closetag
18
+ = $("</" tag ">")
19
+ / invalidCloseTag
20
+ 
21
+invalidOpenTag
22
+ = "<" tagName ">"
23
+ { return ""; }
24
+
25
+invalidCloseTag
26
+ = "</" tagName ">"
27
+ { return ""; }
28
+ 
29
+tagName
30
+ = [A-Za-z] [^>]*
31
+ 
32
+tag
33
+ = ("a" / "b" / "i" / "s" / "u" / "tt")
34
+
35
+norloge
36
+ = norlogeTime
37
+ / norlogeId
38
+ 
39
+norlogeTime
40
+ = norloge:(fullNorloge / longNorloge / normalNorloge / shortNorloge)
41
+ { return '<norloge>' + norloge +'</norloge>'}
42
+
43
+fullNorloge
44
+ = y: norlogeYear "/" ln:longNorloge
45
+ { return y + "/" + ln; }
46
+ 
47
+norlogeYear
48
+ = digits: [0-9]+
49
+ { return digits.join(""); }
50
+
51
+longNorloge
52
+ = m: norlogeMonth "/" d:norlogeDay "#" nn:normalNorloge
53
+ { return m + "/" + d + "#" + nn; }
54
+ 
55
+norlogeMonth
56
+ = first: [0-1] last: [0-2]
57
+ { return first + last; }
58
+
59
+norlogeDay
60
+ = first: [0-3] last: [0-9]
61
+ { return first + last; }
62
+
63
+normalNorloge
64
+ = sn:shortNorloge ":" s:norlogeSeconds
65
+ { return sn + ":" + s; }
66
+ 
67
+shortNorloge
68
+ = h:norlogeHours ":" m:norlogeMinutes
69
+ { return h + ":" + m; }
70
+
71
+norlogeHours
72
+ = first: [0-2] last: [0-3]
73
+ { return first + last; }
74
+ 
75
+norlogeMinutes
76
+ = first: [0-5] last: [0-9]
77
+ { return first + last; }
78
+ 
79
+norlogeSeconds
80
+ = first: [0-5] last: [0-9]
81
+ { return first + last; }
82
+
83
+norlogeId =
84
+ "#" chars:[a-zA-Z0-9_]+
85
+ { var norlogeId = chars.join("");
86
+   return '<norloge-id' + norlogeId + '">#' + norlogeId + '</norloge-id>';
87
+   }
88
+
89
+bigorno
90
+ = bigorno:[a-zA-Z0-9-_]+ "<" &(whitespaces / [<[])
91
+ { return [].concat('<bigorno>', bigorno,'</bigorno>').join("")}
92
+
93
+totoz
94
+  = first:"[:" totoz:[^\]]+ third:"]"
95
+  { var totozId = totoz.join("");