Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Recompile shmakowiki grammar

  • Loading branch information...
commit 37c28e0be77865fc1531dbd4e356cec035843bd3 1 parent 7648622
Sergey Belov authored October 13, 2012
549  lib/_shmakowiki.js
@@ -146,16 +146,16 @@ if (global === ometajs_) {
146 146
             var $elf = this, _fromIdx = this.input.idx;
147 147
             return function() {
148 148
                 switch (this._apply("anything")) {
149  
-                  case "[":
150  
-                    return function() {
151  
-                        this._applyWithArgs("exactly", "[");
152  
-                        return "[[";
153  
-                    }.call(this);
154 149
                   case "(":
155 150
                     return function() {
156 151
                         this._applyWithArgs("exactly", "(");
157 152
                         return "((";
158 153
                     }.call(this);
  154
+                  case "[":
  155
+                    return function() {
  156
+                        this._applyWithArgs("exactly", "[");
  157
+                        return "[[";
  158
+                    }.call(this);
159 159
                   default:
160 160
                     throw fail();
161 161
                 }
@@ -550,15 +550,19 @@ if (global === ometajs_) {
550 550
                 return this._applyWithArgs("allInline", []);
551 551
             });
552 552
         },
  553
+        noNlSpace: function() {
  554
+            var $elf = this, _fromIdx = this.input.idx;
  555
+            return function() {
  556
+                this._not(function() {
  557
+                    return this._applyWithArgs("exactly", "\n");
  558
+                });
  559
+                return this._apply("space");
  560
+            }.call(this);
  561
+        },
553 562
         spacesNoNl: function() {
554 563
             var $elf = this, _fromIdx = this.input.idx;
555 564
             return this._many(function() {
556  
-                return function() {
557  
-                    this._not(function() {
558  
-                        return this._applyWithArgs("exactly", "\n");
559  
-                    });
560  
-                    return this._apply("space");
561  
-                }.call(this);
  565
+                return this._apply("noNlSpace");
562 566
             });
563 567
         },
564 568
         spacesNlSpaces: function() {
@@ -591,8 +595,10 @@ if (global === ometajs_) {
591 595
                 c = this._many1(function() {
592 596
                     return this._applyWithArgs("exactly", "=");
593 597
                 });
594  
-                this._apply("spacesNoNl");
595  
-                return c.join("")["length"] - 1;
  598
+                this._many(function() {
  599
+                    return this._apply("noNlSpace");
  600
+                });
  601
+                return c["length"] - 1;
596 602
             }.call(this);
597 603
         },
598 604
         headerEnd: function() {
@@ -603,7 +609,9 @@ if (global === ometajs_) {
603 609
                       case "\n":
604 610
                         return this._many(function() {
605 611
                             return function() {
606  
-                                this._apply("spacesNoNl");
  612
+                                this._many(function() {
  613
+                                    return this._apply("noNlSpace");
  614
+                                });
607 615
                                 return this._applyWithArgs("exactly", "\n");
608 616
                             }.call(this);
609 617
                         });
@@ -671,25 +679,25 @@ if (global === ometajs_) {
671 679
                 return function() {
672 680
                     switch (this._apply("anything")) {
673 681
                       case "\n":
674  
-                        return this._not(function() {
  682
+                        return this._or(function() {
675 683
                             return this._not(function() {
676  
-                                return this._apply("extBlockStart");
  684
+                                return this._not(function() {
  685
+                                    return this._apply("extBlockStart");
  686
+                                });
677 687
                             });
678  
-                        });
679  
-                      default:
680  
-                        throw fail();
681  
-                    }
682  
-                }.call(this);
683  
-            }, function() {
684  
-                return this._apply("nl");
685  
-            }, function() {
686  
-                return function() {
687  
-                    switch (this._apply("anything")) {
688  
-                      case "\n":
689  
-                        return this._or(function() {
  688
+                        }, function() {
  689
+                            return this._many1(function() {
  690
+                                return function() {
  691
+                                    this._many(function() {
  692
+                                        return this._apply("noNlSpace");
  693
+                                    });
  694
+                                    return this._applyWithArgs("exactly", "\n");
  695
+                                }.call(this);
  696
+                            });
  697
+                        }, function() {
690 698
                             return this._not(function() {
691 699
                                 return this._not(function() {
692  
-                                    return this._apply("anyLi");
  700
+                                    return this._apply("listStart");
693 701
                                 });
694 702
                             });
695 703
                         }, function() {
@@ -721,7 +729,19 @@ if (global === ometajs_) {
721 729
                             return this._apply("blockEnd");
722 730
                         });
723 731
                         return this._or(function() {
724  
-                            return this._apply("spacesNlSpaces");
  732
+                            return function() {
  733
+                                this._many(function() {
  734
+                                    return this._apply("noNlSpace");
  735
+                                });
  736
+                                this._applyWithArgs("exactly", "\n");
  737
+                                this._many(function() {
  738
+                                    return this._apply("noNlSpace");
  739
+                                });
  740
+                                this._not(function() {
  741
+                                    return this._apply("end");
  742
+                                });
  743
+                                return " ";
  744
+                            }.call(this);
725 745
                         }, function() {
726 746
                             return this._apply("char");
727 747
                         });
@@ -732,38 +752,56 @@ if (global === ometajs_) {
732 752
                 return [ "para", ShmakoWiki.matchAll(c, "topInline") ];
733 753
             }.call(this);
734 754
         },
735  
-        uli: function() {
736  
-            var $elf = this, _fromIdx = this.input.idx, s;
  755
+        listStart: function() {
  756
+            var $elf = this, _fromIdx = this.input.idx;
  757
+            return function() {
  758
+                this._many(function() {
  759
+                    return this._apply("noNlSpace");
  760
+                });
  761
+                return this._apply("bullet");
  762
+            }.call(this);
  763
+        },
  764
+        uliBullet: function() {
  765
+            var $elf = this, _fromIdx = this.input.idx;
737 766
             return function() {
738  
-                s = this._apply("spacesNoNl");
739 767
                 this._applyWithArgs("exactly", "*");
740 768
                 this._not(function() {
741 769
                     return this._applyWithArgs("exactly", "*");
742 770
                 });
743  
-                this._apply("spacesNoNl");
744  
-                return s.join("");
  771
+                this._many(function() {
  772
+                    return this._apply("noNlSpace");
  773
+                });
  774
+                return "u";
745 775
             }.call(this);
746 776
         },
747  
-        oli: function() {
748  
-            var $elf = this, _fromIdx = this.input.idx, s;
  777
+        oliBullet: function() {
  778
+            var $elf = this, _fromIdx = this.input.idx;
749 779
             return function() {
750  
-                s = this._apply("spacesNoNl");
751 780
                 this._many1(function() {
752 781
                     return this._apply("digit");
753 782
                 });
754 783
                 this._applyWithArgs("exactly", ".");
755  
-                this._apply("spacesNoNl");
756  
-                return s.join("");
  784
+                this._many(function() {
  785
+                    return this._apply("noNlSpace");
  786
+                });
  787
+                return "o";
757 788
             }.call(this);
758 789
         },
759  
-        anyLi: function() {
  790
+        bullet: function() {
760 791
             var $elf = this, _fromIdx = this.input.idx;
761 792
             return this._or(function() {
762  
-                return this._apply("uli");
  793
+                return this._apply("uliBullet");
763 794
             }, function() {
764  
-                return this._apply("oli");
  795
+                return this._apply("oliBullet");
765 796
             });
766 797
         },
  798
+        bullet1: function() {
  799
+            var $elf = this, _fromIdx = this.input.idx, t;
  800
+            return function() {
  801
+                t = this._apply("anything");
  802
+                return this._applyWithArgs("apply", t + "liBullet");
  803
+            }.call(this);
  804
+        },
767 805
         listItemContent: function() {
768 806
             var $elf = this, _fromIdx = this.input.idx, c;
769 807
             return function() {
@@ -778,91 +816,68 @@ if (global === ometajs_) {
778 816
                 return ShmakoWiki.matchAll(c.join(""), "topInline");
779 817
             }.call(this);
780 818
         },
781  
-        anySubList: function() {
782  
-            var $elf = this, _fromIdx = this.input.idx, l, s, sl;
783  
-            return function() {
784  
-                l = this._apply("anything");
785  
-                this._applyWithArgs("exactly", "\n");
786  
-                this._not(function() {
787  
-                    return this._not(function() {
788  
-                        return s = this._apply("anyLi");
789  
-                    });
790  
-                });
791  
-                this._pred(s["length"] > l["length"]);
792  
-                sl = this._apply("anyList");
793  
-                return sl;
794  
-            }.call(this);
795  
-        },
796 819
         listItem: function() {
797  
-            var $elf = this, _fromIdx = this.input.idx, t, l, s, c, cc;
  820
+            var $elf = this, _fromIdx = this.input.idx, t, n, s, p, b;
798 821
             return function() {
799 822
                 t = this._apply("anything");
800  
-                l = this._apply("anything");
801  
-                s = this._applyWithArgs("apply", t);
802  
-                this._pred(s["length"] == l["length"]);
803  
-                c = this._apply("listItemContent");
804  
-                cc = this._or(function() {
805  
-                    return this._many1(function() {
806  
-                        return this._applyWithArgs("anySubList", s);
807  
-                    });
808  
-                }, function() {
  823
+                n = this._apply("anything");
  824
+                s = this._many(function() {
  825
+                    return this._applyWithArgs("exactly", " ");
  826
+                });
  827
+                this._pred(n == s["length"]);
  828
+                this._applyWithArgs("bullet1", t);
  829
+                p = this._apply("listItemContent");
  830
+                this._or(function() {
809 831
                     return function() {
810  
-                        this._or(function() {
811  
-                            return function() {
812  
-                                switch (this._apply("anything")) {
813  
-                                  case "\n":
814  
-                                    return this._not(function() {
815  
-                                        return this._not(function() {
816  
-                                            return this._applyWithArgs("apply", t);
817  
-                                        });
818  
-                                    });
819  
-                                  default:
820  
-                                    throw fail();
821  
-                                }
822  
-                            }.call(this);
823  
-                        }, function() {
824  
-                            return this._not(function() {
825  
-                                return this._not(function() {
826  
-                                    return this._apply("blockEnd");
827  
-                                });
828  
-                            });
829  
-                        });
830  
-                        return "";
  832
+                        switch (this._apply("anything")) {
  833
+                          case "\n":
  834
+                            return "\n";
  835
+                          default:
  836
+                            throw fail();
  837
+                        }
831 838
                     }.call(this);
  839
+                }, function() {
  840
+                    return this._apply("end");
832 841
                 });
833  
-                return function() {
834  
-                    if (cc) {
835  
-                        c = c.concat(cc);
836  
-                    } else {
837  
-                        undefined;
838  
-                    }
839  
-                    return [ t + "stItem", c ];
840  
-                }.call(this);
  842
+                b = this._many(function() {
  843
+                    return this._applyWithArgs("list1", n + 1);
  844
+                });
  845
+                return [ t + "listItem", p.concat(b) ];
841 846
             }.call(this);
842 847
         },
843 848
         list: function() {
844  
-            var $elf = this, _fromIdx = this.input.idx, t, s, c;
  849
+            var $elf = this, _fromIdx = this.input.idx;
  850
+            return this._applyWithArgs("list1", 0);
  851
+        },
  852
+        list1: function() {
  853
+            var $elf = this, _fromIdx = this.input.idx, n, s, b, ss;
845 854
             return function() {
846  
-                t = this._apply("anything");
  855
+                n = this._apply("anything");
847 856
                 this._not(function() {
848 857
                     return this._not(function() {
849  
-                        return s = this._applyWithArgs("apply", t);
  858
+                        return function() {
  859
+                            s = this._many(function() {
  860
+                                return this._apply("noNlSpace");
  861
+                            });
  862
+                            return b = this._apply("bullet");
  863
+                        }.call(this);
850 864
                     });
851 865
                 });
852  
-                c = this._many1(function() {
853  
-                    return this._applyWithArgs("listItem", t, s);
  866
+                this._pred(n <= s["length"]);
  867
+                ss = this._many1(function() {
  868
+                    return this._applyWithArgs("listItem", b, s["length"]);
  869
+                });
  870
+                this._many(function() {
  871
+                    return function() {
  872
+                        this._applyWithArgs("exactly", "\n");
  873
+                        return this._many(function() {
  874
+                            return this._apply("noNlSpace");
  875
+                        });
  876
+                    }.call(this);
854 877
                 });
855  
-                return [ t + "st", c ];
  878
+                return [ b + "list", ss ];
856 879
             }.call(this);
857 880
         },
858  
-        anyList: function() {
859  
-            var $elf = this, _fromIdx = this.input.idx;
860  
-            return this._or(function() {
861  
-                return this._applyWithArgs("list", "uli");
862  
-            }, function() {
863  
-                return this._applyWithArgs("list", "oli");
864  
-            });
865  
-        },
866 881
         extBlockStart: function() {
867 882
             var $elf = this, _fromIdx = this.input.idx, t, tt, c, cc;
868 883
             return function() {
@@ -956,15 +971,11 @@ if (global === ometajs_) {
956 971
             }.call(this);
957 972
         },
958 973
         allBlock: function() {
959  
-            var $elf = this, _fromIdx = this.input.idx, l;
  974
+            var $elf = this, _fromIdx = this.input.idx;
960 975
             return this._or(function() {
961 976
                 return this._apply("extBlock");
962 977
             }, function() {
963  
-                return function() {
964  
-                    l = this._apply("anyList");
965  
-                    this._apply("blockEnd");
966  
-                    return l;
967  
-                }.call(this);
  978
+                return this._apply("list");
968 979
             }, function() {
969 980
                 return this._apply("header");
970 981
             }, function() {
@@ -1049,48 +1060,48 @@ if (global === ometajs_) {
1049 1060
         var $elf = this, _fromIdx = this.input.idx;
1050 1061
         return function() {
1051 1062
             switch (this._apply("anything")) {
1052  
-              case "underline_":
1053  
-                return "underline_";
1054  
-              case "strike":
1055  
-                return "strike";
1056  
-              case "header4":
1057  
-                return "header4";
  1063
+              case "bold":
  1064
+                return "bold";
  1065
+              case "monospace":
  1066
+                return "monospace";
1058 1067
               case "italic_":
1059 1068
                 return "italic_";
1060  
-              case "bold_":
1061  
-                return "bold_";
1062  
-              case "underline":
1063  
-                return "underline";
1064  
-              case "header5":
1065  
-                return "header5";
  1069
+              case "strike":
  1070
+                return "strike";
1066 1071
               case "subscript":
1067 1072
                 return "subscript";
1068  
-              case "superscript":
1069  
-                return "superscript";
1070  
-              case "monospace_":
1071  
-                return "monospace_";
1072  
-              case "header6":
1073  
-                return "header6";
1074  
-              case "monospace":
1075  
-                return "monospace";
1076  
-              case "strike_":
1077  
-                return "strike_";
1078  
-              case "italic":
1079  
-                return "italic";
1080 1073
               case "para":
1081 1074
                 return "para";
  1075
+              case "header5":
  1076
+                return "header5";
  1077
+              case "header4":
  1078
+                return "header4";
1082 1079
               case "header1":
1083 1080
                 return "header1";
1084  
-              case "header2":
1085  
-                return "header2";
  1081
+              case "superscript":
  1082
+                return "superscript";
  1083
+              case "italic":
  1084
+                return "italic";
1086 1085
               case "header3":
1087 1086
                 return "header3";
1088  
-              case "subscript_":
1089  
-                return "subscript_";
1090 1087
               case "superscript_":
1091 1088
                 return "superscript_";
1092  
-              case "bold":
1093  
-                return "bold";
  1089
+              case "subscript_":
  1090
+                return "subscript_";
  1091
+              case "strike_":
  1092
+                return "strike_";
  1093
+              case "bold_":
  1094
+                return "bold_";
  1095
+              case "header6":
  1096
+                return "header6";
  1097
+              case "monospace_":
  1098
+                return "monospace_";
  1099
+              case "header2":
  1100
+                return "header2";
  1101
+              case "underline":
  1102
+                return "underline";
  1103
+              case "underline_":
  1104
+                return "underline_";
1094 1105
               default:
1095 1106
                 throw fail();
1096 1107
             }
@@ -1197,66 +1208,66 @@ if (global === ometajs_) {
1197 1208
         var $elf = this, _fromIdx = this.input.idx;
1198 1209
         return function() {
1199 1210
             switch (this._apply("anything")) {
1200  
-              case "olistItem":
1201  
-                return "olistItem";
1202  
-              case "underline_":
1203  
-                return "underline_";
1204  
-              case "strike":
1205  
-                return "strike";
1206  
-              case "header4":
1207  
-                return "header4";
1208  
-              case "link_":
1209  
-                return "link_";
1210  
-              case "escaped":
1211  
-                return "escaped";
1212  
-              case "lineBreak":
1213  
-                return "lineBreak";
  1211
+              case "bold":
  1212
+                return "bold";
  1213
+              case "monospace":
  1214
+                return "monospace";
1214 1215
               case "italic_":
1215 1216
                 return "italic_";
1216  
-              case "bold_":
1217  
-                return "bold_";
1218  
-              case "underline":
1219  
-                return "underline";
1220  
-              case "header5":
1221  
-                return "header5";
1222  
-              case "subscript":
1223  
-                return "subscript";
  1217
+              case "link_":
  1218
+                return "link_";
1224 1219
               case "link":
1225 1220
                 return "link";
  1221
+              case "strike":
  1222
+                return "strike";
  1223
+              case "subscript":
  1224
+                return "subscript";
  1225
+              case "escaped":
  1226
+                return "escaped";
1226 1227
               case "olist":
1227 1228
                 return "olist";
1228  
-              case "superscript":
1229  
-                return "superscript";
1230  
-              case "monospace_":
1231  
-                return "monospace_";
1232  
-              case "header6":
1233  
-                return "header6";
1234  
-              case "extension":
1235  
-                return "extension";
1236  
-              case "monospace":
1237  
-                return "monospace";
1238  
-              case "strike_":
1239  
-                return "strike_";
1240  
-              case "italic":
1241  
-                return "italic";
1242 1229
               case "para":
1243 1230
                 return "para";
1244  
-              case "ulistItem":
1245  
-                return "ulistItem";
1246  
-              case "header2":
1247  
-                return "header2";
  1231
+              case "header5":
  1232
+                return "header5";
  1233
+              case "ulist":
  1234
+                return "ulist";
  1235
+              case "lineBreak":
  1236
+                return "lineBreak";
  1237
+              case "header4":
  1238
+                return "header4";
1248 1239
               case "header1":
1249 1240
                 return "header1";
  1241
+              case "superscript":
  1242
+                return "superscript";
  1243
+              case "italic":
  1244
+                return "italic";
1250 1245
               case "header3":
1251 1246
                 return "header3";
1252  
-              case "ulist":
1253  
-                return "ulist";
1254  
-              case "subscript_":
1255  
-                return "subscript_";
  1247
+              case "olistItem":
  1248
+                return "olistItem";
1256 1249
               case "superscript_":
1257 1250
                 return "superscript_";
1258  
-              case "bold":
1259  
-                return "bold";
  1251
+              case "subscript_":
  1252
+                return "subscript_";
  1253
+              case "strike_":
  1254
+                return "strike_";
  1255
+              case "bold_":
  1256
+                return "bold_";
  1257
+              case "ulistItem":
  1258
+                return "ulistItem";
  1259
+              case "header6":
  1260
+                return "header6";
  1261
+              case "monospace_":
  1262
+                return "monospace_";
  1263
+              case "header2":
  1264
+                return "header2";
  1265
+              case "underline":
  1266
+                return "underline";
  1267
+              case "extension":
  1268
+                return "extension";
  1269
+              case "underline_":
  1270
+                return "underline_";
1260 1271
               default:
1261 1272
                 throw fail();
1262 1273
             }
@@ -1574,66 +1585,66 @@ if (global === ometajs_) {
1574 1585
         var $elf = this, _fromIdx = this.input.idx;
1575 1586
         return function() {
1576 1587
             switch (this._apply("anything")) {
1577  
-              case "olistItem":
1578  
-                return "olistItem";
1579  
-              case "underline_":
1580  
-                return "underline_";
1581  
-              case "strike":
1582  
-                return "strike";
1583  
-              case "header4":
1584  
-                return "header4";
1585  
-              case "link_":
1586  
-                return "link_";
1587  
-              case "escaped":
1588  
-                return "escaped";
1589  
-              case "lineBreak":
1590  
-                return "lineBreak";
  1588
+              case "bold":
  1589
+                return "bold";
  1590
+              case "monospace":
  1591
+                return "monospace";
1591 1592
               case "italic_":
1592 1593
                 return "italic_";
1593  
-              case "bold_":
1594  
-                return "bold_";
1595  
-              case "underline":
1596  
-                return "underline";
1597  
-              case "header5":
1598  
-                return "header5";
1599  
-              case "subscript":
1600  
-                return "subscript";
  1594
+              case "link_":
  1595
+                return "link_";
1601 1596
               case "link":
1602 1597
                 return "link";
  1598
+              case "strike":
  1599
+                return "strike";
  1600
+              case "subscript":
  1601
+                return "subscript";
  1602
+              case "escaped":
  1603
+                return "escaped";
1603 1604
               case "olist":
1604 1605
                 return "olist";
1605  
-              case "superscript":
1606  
-                return "superscript";
1607  
-              case "monospace_":
1608  
-                return "monospace_";
1609  
-              case "header6":
1610  
-                return "header6";
1611  
-              case "extension":
1612  
-                return "extension";
1613  
-              case "monospace":
1614  
-                return "monospace";
1615  
-              case "strike_":
1616  
-                return "strike_";
1617  
-              case "italic":
1618  
-                return "italic";
1619 1606
               case "para":
1620 1607
                 return "para";
1621  
-              case "ulistItem":
1622  
-                return "ulistItem";
1623  
-              case "header2":
1624  
-                return "header2";
  1608
+              case "header5":
  1609
+                return "header5";
  1610
+              case "ulist":
  1611
+                return "ulist";
  1612
+              case "lineBreak":
  1613
+                return "lineBreak";
  1614
+              case "header4":
  1615
+                return "header4";
1625 1616
               case "header1":
1626 1617
                 return "header1";
  1618
+              case "superscript":
  1619
+                return "superscript";
  1620
+              case "italic":
  1621
+                return "italic";
1627 1622
               case "header3":
1628 1623
                 return "header3";
1629  
-              case "ulist":
1630  
-                return "ulist";
1631  
-              case "subscript_":
1632  
-                return "subscript_";
  1624
+              case "olistItem":
  1625
+                return "olistItem";
1633 1626
               case "superscript_":
1634 1627
                 return "superscript_";
1635  
-              case "bold":
1636  
-                return "bold";
  1628
+              case "subscript_":
  1629
+                return "subscript_";
  1630
+              case "strike_":
  1631
+                return "strike_";
  1632
+              case "bold_":
  1633
+                return "bold_";
  1634
+              case "ulistItem":
  1635
+                return "ulistItem";
  1636
+              case "header6":
  1637
+                return "header6";
  1638
+              case "monospace_":
  1639
+                return "monospace_";
  1640
+              case "header2":
  1641
+                return "header2";
  1642
+              case "underline":
  1643
+                return "underline";
  1644
+              case "extension":
  1645
+                return "extension";
  1646
+              case "underline_":
  1647
+                return "underline_";
1637 1648
               default:
1638 1649
                 throw fail();
1639 1650
             }
@@ -2067,50 +2078,50 @@ if (global === ometajs_) {
2067 2078
         var $elf = this, _fromIdx = this.input.idx;
2068 2079
         return function() {
2069 2080
             switch (this._apply("anything")) {
2070  
-              case "underline_":
2071  
-                return "underline_";
  2081
+              case "bold":
  2082
+                return "bold";
  2083
+              case "monospace":
  2084
+                return "monospace";
  2085
+              case "italic_":
  2086
+                return "italic_";
2072 2087
               case "strike":
2073 2088
                 return "strike";
2074  
-              case "header4":
2075  
-                return "header4";
  2089
+              case "subscript":
  2090
+                return "subscript";
2076 2091
               case "escaped":
2077 2092
                 return "escaped";
2078  
-              case "italic_":
2079  
-                return "italic_";
2080  
-              case "bold_":
2081  
-                return "bold_";
2082  
-              case "underline":
2083  
-                return "underline";
  2093
+              case "para":
  2094
+                return "para";
2084 2095
               case "header5":
2085 2096
                 return "header5";
2086  
-              case "subscript":
2087  
-                return "subscript";
  2097
+              case "header4":
  2098
+                return "header4";
  2099
+              case "header1":
  2100
+                return "header1";
2088 2101
               case "superscript":
2089 2102
                 return "superscript";
2090  
-              case "monospace_":
2091  
-                return "monospace_";
2092  
-              case "header6":
2093  
-                return "header6";
2094  
-              case "monospace":
2095  
-                return "monospace";
2096  
-              case "strike_":
2097  
-                return "strike_";
2098 2103
               case "italic":
2099 2104
                 return "italic";
2100  
-              case "para":
2101  
-                return "para";
2102  
-              case "header1":
2103  
-                return "header1";
2104  
-              case "header2":
2105  
-                return "header2";
2106 2105
               case "header3":
2107 2106
                 return "header3";
2108  
-              case "subscript_":
2109  
-                return "subscript_";
2110 2107
               case "superscript_":
2111 2108
                 return "superscript_";
2112  
-              case "bold":
2113  
-                return "bold";
  2109
+              case "subscript_":
  2110
+                return "subscript_";
  2111
+              case "strike_":
  2112
+                return "strike_";
  2113
+              case "bold_":
  2114
+                return "bold_";
  2115
+              case "header6":
  2116
+                return "header6";
  2117
+              case "monospace_":
  2118
+                return "monospace_";
  2119
+              case "header2":
  2120
+                return "header2";
  2121
+              case "underline":
  2122
+                return "underline";
  2123
+              case "underline_":
  2124
+                return "underline_";
2114 2125
               default:
2115 2126
                 throw fail();
2116 2127
             }
245  src/shmakowiki.ometajs.js
@@ -143,16 +143,16 @@ if (global === ometajs_) {
143 143
             var $elf = this, _fromIdx = this.input.idx;
144 144
             return function() {
145 145
                 switch (this._apply("anything")) {
146  
-                  case "[":
147  
-                    return function() {
148  
-                        this._applyWithArgs("exactly", "[");
149  
-                        return "[[";
150  
-                    }.call(this);
151 146
                   case "(":
152 147
                     return function() {
153 148
                         this._applyWithArgs("exactly", "(");
154 149
                         return "((";
155 150
                     }.call(this);
  151
+                  case "[":
  152
+                    return function() {
  153
+                        this._applyWithArgs("exactly", "[");
  154
+                        return "[[";
  155
+                    }.call(this);
156 156
                   default:
157 157
                     throw fail();
158 158
                 }
@@ -547,15 +547,19 @@ if (global === ometajs_) {
547 547
                 return this._applyWithArgs("allInline", []);
548 548
             });
549 549
         },
  550
+        noNlSpace: function() {
  551
+            var $elf = this, _fromIdx = this.input.idx;
  552
+            return function() {
  553
+                this._not(function() {
  554
+                    return this._applyWithArgs("exactly", "\n");
  555
+                });
  556
+                return this._apply("space");
  557
+            }.call(this);
  558
+        },
550 559
         spacesNoNl: function() {
551 560
             var $elf = this, _fromIdx = this.input.idx;
552 561
             return this._many(function() {
553  
-                return function() {
554  
-                    this._not(function() {
555  
-                        return this._applyWithArgs("exactly", "\n");
556  
-                    });
557  
-                    return this._apply("space");
558  
-                }.call(this);
  562
+                return this._apply("noNlSpace");
559 563
             });
560 564
         },
561 565
         spacesNlSpaces: function() {
@@ -588,8 +592,10 @@ if (global === ometajs_) {
588 592
                 c = this._many1(function() {
589 593
                     return this._applyWithArgs("exactly", "=");
590 594
                 });
591  
-                this._apply("spacesNoNl");
592  
-                return c.join("")["length"] - 1;
  595
+                this._many(function() {
  596
+                    return this._apply("noNlSpace");
  597
+                });
  598
+                return c["length"] - 1;
593 599
             }.call(this);
594 600
         },
595 601
         headerEnd: function() {
@@ -600,7 +606,9 @@ if (global === ometajs_) {
600 606
                       case "\n":
601 607
                         return this._many(function() {
602 608
                             return function() {
603  
-                                this._apply("spacesNoNl");
  609
+                                this._many(function() {
  610
+                                    return this._apply("noNlSpace");
  611
+                                });
604 612
                                 return this._applyWithArgs("exactly", "\n");
605 613
                             }.call(this);
606 614
                         });
@@ -668,25 +676,25 @@ if (global === ometajs_) {
668 676
                 return function() {
669 677
                     switch (this._apply("anything")) {
670 678
                       case "\n":
671  
-                        return this._not(function() {
  679
+                        return this._or(function() {
672 680
                             return this._not(function() {
673  
-                                return this._apply("extBlockStart");
  681
+                                return this._not(function() {
  682
+                                    return this._apply("extBlockStart");
  683
+                                });
674 684
                             });
675  
-                        });
676  
-                      default:
677  
-                        throw fail();
678  
-                    }
679  
-                }.call(this);
680  
-            }, function() {
681  
-                return this._apply("nl");
682  
-            }, function() {
683  
-                return function() {
684  
-                    switch (this._apply("anything")) {
685  
-                      case "\n":
686  
-                        return this._or(function() {
  685
+                        }, function() {
  686
+                            return this._many1(function() {
  687
+                                return function() {
  688
+                                    this._many(function() {
  689
+                                        return this._apply("noNlSpace");
  690
+                                    });
  691
+                                    return this._applyWithArgs("exactly", "\n");
  692
+                                }.call(this);
  693
+                            });
  694
+                        }, function() {
687 695
                             return this._not(function() {
688 696
                                 return this._not(function() {
689  
-                                    return this._apply("anyLi");
  697
+                                    return this._apply("listStart");
690 698
                                 });
691 699
                             });
692 700
                         }, function() {
@@ -718,7 +726,19 @@ if (global === ometajs_) {
718 726
                             return this._apply("blockEnd");
719 727
                         });
720 728
                         return this._or(function() {
721  
-                            return this._apply("spacesNlSpaces");
  729
+                            return function() {
  730
+                                this._many(function() {
  731
+                                    return this._apply("noNlSpace");
  732
+                                });
  733
+                                this._applyWithArgs("exactly", "\n");
  734
+                                this._many(function() {
  735
+                                    return this._apply("noNlSpace");
  736
+                                });
  737
+                                this._not(function() {
  738
+                                    return this._apply("end");
  739
+                                });
  740
+                                return " ";
  741
+                            }.call(this);
722 742
                         }, function() {
723 743
                             return this._apply("char");
724 744
                         });
@@ -729,38 +749,56 @@ if (global === ometajs_) {
729 749
                 return [ "para", ShmakoWiki.matchAll(c, "topInline") ];
730 750
             }.call(this);
731 751
         },
732  
-        uli: function() {
733  
-            var $elf = this, _fromIdx = this.input.idx, s;
  752
+        listStart: function() {
  753
+            var $elf = this, _fromIdx = this.input.idx;
  754
+            return function() {
  755
+                this._many(function() {
  756
+                    return this._apply("noNlSpace");
  757
+                });
  758
+                return this._apply("bullet");
  759
+            }.call(this);
  760
+        },
  761
+        uliBullet: function() {
  762
+            var $elf = this, _fromIdx = this.input.idx;
734 763
             return function() {
735  
-                s = this._apply("spacesNoNl");
736 764
                 this._applyWithArgs("exactly", "*");
737 765
                 this._not(function() {
738 766
                     return this._applyWithArgs("exactly", "*");
739 767
                 });
740  
-                this._apply("spacesNoNl");
741  
-                return s.join("");
  768
+                this._many(function() {
  769
+                    return this._apply("noNlSpace");
  770
+                });
  771
+                return "u";
742 772
             }.call(this);
743 773
         },
744  
-        oli: function() {
745  
-            var $elf = this, _fromIdx = this.input.idx, s;
  774
+        oliBullet: function() {
  775
+            var $elf = this, _fromIdx = this.input.idx;
746 776
             return function() {
747  
-                s = this._apply("spacesNoNl");
748 777
                 this._many1(function() {
749 778
                     return this._apply("digit");
750 779
                 });
751 780
                 this._applyWithArgs("exactly", ".");
752  
-                this._apply("spacesNoNl");
753  
-                return s.join("");
  781
+                this._many(function() {
  782
+                    return this._apply("noNlSpace");
  783
+                });
  784
+                return "o";
754 785
             }.call(this);
755 786
         },
756  
-        anyLi: function() {
  787
+        bullet: function() {
757 788
             var $elf = this, _fromIdx = this.input.idx;
758 789
             return this._or(function() {
759  
-                return this._apply("uli");
  790
+                return this._apply("uliBullet");
760 791
             }, function() {
761  
-                return this._apply("oli");
  792
+                return this._apply("oliBullet");
762 793
             });
763 794
         },
  795
+        bullet1: function() {
  796
+            var $elf = this, _fromIdx = this.input.idx, t;
  797
+            return function() {
  798
+                t = this._apply("anything");
  799
+                return this._applyWithArgs("apply", t + "liBullet");
  800
+            }.call(this);
  801
+        },
764 802
         listItemContent: function() {
765 803
             var $elf = this, _fromIdx = this.input.idx, c;
766 804
             return function() {
@@ -775,91 +813,68 @@ if (global === ometajs_) {
775 813
                 return ShmakoWiki.matchAll(c.join(""), "topInline");
776 814
             }.call(this);
777 815
         },
778  
-        anySubList: function() {
779  
-            var $elf = this, _fromIdx = this.input.idx, l, s, sl;
780  
-            return function() {
781  
-                l = this._apply("anything");
782  
-                this._applyWithArgs("exactly", "\n");
783  
-                this._not(function() {
784  
-                    return this._not(function() {
785  
-                        return s = this._apply("anyLi");
786  
-                    });
787  
-                });
788  
-                this._pred(s["length"] > l["length"]);
789  
-                sl = this._apply("anyList");
790  
-                return sl;
791  
-            }.call(this);
792  
-        },
793 816
         listItem: function() {
794  
-            var $elf = this, _fromIdx = this.input.idx, t, l, s, c, cc;
  817
+            var $elf = this, _fromIdx = this.input.idx, t, n, s, p, b;
795 818
             return function() {
796 819
                 t = this._apply("anything");
797  
-                l = this._apply("anything");
798  
-                s = this._applyWithArgs("apply", t);
799  
-                this._pred(s["length"] == l["length"]);
800  
-                c = this._apply("listItemContent");
801  
-                cc = this._or(function() {
802  
-                    return this._many1(function() {
803  
-                        return this._applyWithArgs("anySubList", s);
804  
-                    });
805  
-                }, function() {
  820
+                n = this._apply("anything");
  821
+                s = this._many(function() {
  822
+                    return this._applyWithArgs("exactly", " ");
  823
+                });
  824
+                this._pred(n == s["length"]);
  825
+                this._applyWithArgs("bullet1", t);
  826
+                p = this._apply("listItemContent");
  827
+                this._or(function() {
806 828
                     return function() {
807  
-                        this._or(function() {
808  
-                            return function() {
809  
-                                switch (this._apply("anything")) {
810  
-                                  case "\n":
811  
-                                    return this._not(function() {
812  
-                                        return this._not(function() {
813  
-                                            return this._applyWithArgs("apply", t);
814  
-                                        });
815  
-                                    });
816  
-                                  default:
817  
-                                    throw fail();
818  
-                                }
819  
-                            }.call(this);
820  
-                        }, function() {
821  
-                            return this._not(function() {
822  
-                                return this._not(function() {
823  
-                                    return this._apply("blockEnd");
824  
-                                });
825  
-                            });
826  
-                        });
827  
-                        return "";
  829
+                        switch (this._apply("anything")) {
  830
+                          case "\n":
  831
+                            return "\n";
  832
+                          default:
  833
+                            throw fail();
  834
+                        }
828 835
                     }.call(this);
  836
+                }, function() {
  837
+                    return this._apply("end");
829 838
                 });
830  
-                return function() {
831  
-                    if (cc) {
832  
-                        c = c.concat(cc);
833  
-                    } else {
834  
-                        undefined;
835  
-                    }
836  
-                    return [ t + "stItem", c ];
837  
-                }.call(this);
  839
+                b = this._many(function() {
  840
+                    return this._applyWithArgs("list1", n + 1);
  841
+                });
  842
+                return [ t + "listItem", p.concat(b) ];
838 843
             }.call(this);
839 844
         },
840 845
         list: function() {
841  
-            var $elf = this, _fromIdx = this.input.idx, t, s, c;
  846
+            var $elf = this, _fromIdx = this.input.idx;
  847
+            return this._applyWithArgs("list1", 0);
  848
+        },
  849
+        list1: function() {
  850
+            var $elf = this, _fromIdx = this.input.idx, n, s, b, ss;
842 851
             return function() {
843  
-                t = this._apply("anything");
  852
+                n = this._apply("anything");
844 853
                 this._not(function() {
845 854
                     return this._not(function() {
846  
-                        return s = this._applyWithArgs("apply", t);
  855
+                        return function() {
  856
+                            s = this._many(function() {
  857
+                                return this._apply("noNlSpace");
  858
+                            });
  859
+                            return b = this._apply("bullet");
  860
+                        }.call(this);
847 861
                     });
848 862
                 });
849  
-                c = this._many1(function() {
850  
-                    return this._applyWithArgs("listItem", t, s);
  863
+                this._pred(n <= s["length"]);
  864
+                ss = this._many1(function() {
  865
+                    return this._applyWithArgs("listItem", b, s["length"]);
  866
+                });
  867
+                this._many(function() {
  868
+                    return function() {
  869
+                        this._applyWithArgs("exactly", "\n");
  870
+                        return this._many(function() {
  871
+                            return this._apply("noNlSpace");
  872
+                        });
  873
+                    }.call(this);
851 874
                 });
852  
-                return [ t + "st", c ];
  875
+                return [ b + "list", ss ];
853 876
             }.call(this);
854 877
         },
855  
-        anyList: function() {
856  
-            var $elf = this, _fromIdx = this.input.idx;
857  
-            return this._or(function() {
858  
-                return this._applyWithArgs("list", "uli");
859  
-            }, function() {
860  
-                return this._applyWithArgs("list", "oli");
861  
-            });
862  
-        },
863 878
         extBlockStart: function() {
864 879
             var $elf = this, _fromIdx = this.input.idx, t, tt, c, cc;
865 880
             return function() {
@@ -953,15 +968,11 @@ if (global === ometajs_) {
953 968
             }.call(this);
954 969
         },
955 970
         allBlock: function() {
956  
-            var $elf = this, _fromIdx = this.input.idx, l;
  971
+            var $elf = this, _fromIdx = this.input.idx;
957 972
             return this._or(function() {
958 973
                 return this._apply("extBlock");
959 974
             }, function() {
960  
-                return function() {
961  
-                    l = this._apply("anyList");
962  
-                    this._apply("blockEnd");
963  
-                    return l;
964  
-                }.call(this);
  975
+                return this._apply("list");
965 976
             }, function() {
966 977
                 return this._apply("header");
967 978
             }, function() {
92  src/shmakowiki2bemjson.ometajs.js
@@ -35,66 +35,66 @@ if (global === ometajs_) {
35 35
         var $elf = this, _fromIdx = this.input.idx;
36 36
         return function() {
37 37
             switch (this._apply("anything")) {
38  
-              case "olistItem":
39  
-                return "olistItem";
40  
-              case "underline_":
41  
-                return "underline_";
42  
-              case "strike":
43  
-                return "strike";
44  
-              case "header4":
45  
-                return "header4";
46  
-              case "link_":
47  
-                return "link_";
48  
-              case "escaped":
49  
-                return "escaped";
50  
-              case "lineBreak":
51  
-                return "lineBreak";
  38
+              case "bold":
  39
+                return "bold";
  40
+              case "monospace":
  41
+                return "monospace";
52 42
               case "italic_":
53 43
                 return "italic_";
54  
-              case "bold_":
55  
-                return "bold_";
56  
-              case "underline":
57  
-                return "underline";
58  
-              case "header5":
59  
-                return "header5";
60  
-              case "subscript":
61  
-                return "subscript";
  44
+              case "link_":
  45
+                return "link_";
62 46
               case "link":
63 47
                 return "link";
  48
+              case "strike":
  49
+                return "strike";
  50
+              case "subscript":
  51
+                return "subscript";
  52
+              case "escaped":
  53
+                return "escaped";
64 54
               case "olist":
65 55
                 return "olist";
66  
-              case "superscript":
67  
-                return "superscript";
68  
-              case "monospace_":
69  
-                return "monospace_";
70  
-              case "header6":