Index: trunk/extensions/VisualEditor/modules/parser/pegTokenizer.pegjs.txt |
— | — | @@ -981,7 +981,18 @@ |
982 | 982 | |
983 | 983 | list_char = [*#:;] |
984 | 984 | |
985 | | -/* split up table handling into individual tokens */ |
| 985 | +/** |
| 986 | + * Tables |
| 987 | + * |
| 988 | + * Table productions are geared to support independent parsing of fragments in |
| 989 | + * templates (the common table start / row / table end use case). The tokens |
| 990 | + * produced by these fragments then match up to a table while building the |
| 991 | + * DOM tree. For similar reasons, table rows do not emit explicit end tag |
| 992 | + * tokens. |
| 993 | + * |
| 994 | + * The separate table_lines production is faster than moving those productions |
| 995 | + * directly to block_lines. |
| 996 | + * */ |
986 | 997 | |
987 | 998 | table_lines |
988 | 999 | = & { return setFlag('table'); } |
— | — | @@ -993,7 +1004,7 @@ |
994 | 1005 | } |
995 | 1006 | / & { return clearFlag('table'); } |
996 | 1007 | |
997 | | -// Make sure this is only active at start-of-line! |
| 1008 | +// This production assumes start-of-line position! |
998 | 1009 | table_line |
999 | 1010 | = table_start_tag |
1000 | 1011 | / table_row_tag |
— | — | @@ -1024,8 +1035,6 @@ |
1025 | 1036 | } |
1026 | 1037 | |
1027 | 1038 | |
1028 | | -// Only add table rows directly to start-of-line productions, so we get |
1029 | | -// implicit rows! |
1030 | 1039 | table_row_tag |
1031 | 1040 | = //& { console.log("table row enter"); return true; } |
1032 | 1041 | "|-" |
— | — | @@ -1103,7 +1112,9 @@ |
1104 | 1113 | |
1105 | 1114 | |
1106 | 1115 | |
1107 | | -/* Tables, full-table version (no support for table fragments from templates) */ |
| 1116 | +/* Tables, full-table version (no support for table fragments from templates) |
| 1117 | + * Only left here for comparison purposes with the above productions. Remove |
| 1118 | + * when those work as intended! */ |
1108 | 1119 | table |
1109 | 1120 | = tas:table_start space* c:table_caption? b:table_body? te:table_end { |
1110 | 1121 | var res = {type: 'TAG', name: 'table'} |