Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 364 |
CRAP | |
0.00% |
0 / 9655 |
Grammar | |
0.00% |
0 / 1 |
|
0.00% |
0 / 364 |
7379372 | |
0.00% |
0 / 9655 |
initialize | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 10 |
|||
assert | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 3 |
|||
unreachable | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
startOffset | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
endOffset | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
tsrOffsets | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 6 |
|||
emitChunk | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 9 |
|||
isXMLTag | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 5 |
|||
maybeAnnotationOrExtensionTag | |
0.00% |
0 / 1 |
870 | |
0.00% |
0 / 99 |
|||
a0 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 5 |
|||
a1 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 5 |
|||
a2 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a3 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a4 | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 7 |
|||
a5 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a6 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
a7 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a8 | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 11 |
|||
a9 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a10 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a11 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a12 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
|||
a13 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a14 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a15 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a16 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a17 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a18 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a19 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 4 |
|||
a20 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a21 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a22 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 11 |
|||
a23 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a24 | |
0.00% |
0 / 1 |
30 | |
0.00% |
0 / 9 |
|||
a25 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a26 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 4 |
|||
a27 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a28 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a29 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 16 |
|||
a30 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a31 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 11 |
|||
a32 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a33 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a34 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a35 | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 11 |
|||
a36 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 3 |
|||
a37 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a38 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a39 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a40 | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 11 |
|||
a41 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a42 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a43 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a44 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
|||
a45 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a46 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a47 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a48 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a49 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a50 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a51 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a52 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
|||
a53 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
a54 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a55 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a56 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a57 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 7 |
|||
a58 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
a59 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a60 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a61 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a62 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a63 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
|||
a64 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
|||
a65 | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 13 |
|||
a66 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a67 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a68 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a69 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a70 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a71 | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 1 |
|||
a72 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a73 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a74 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
a75 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a76 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a77 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a78 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 7 |
|||
a79 | |
0.00% |
0 / 1 |
56 | |
0.00% |
0 / 20 |
|||
a80 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a81 | |
0.00% |
0 / 1 |
56 | |
0.00% |
0 / 11 |
|||
a82 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a83 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
|||
a84 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a85 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
|||
a86 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
|||
a87 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a88 | |
0.00% |
0 / 1 |
42 | |
0.00% |
0 / 34 |
|||
a89 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a90 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a91 | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 7 |
|||
a92 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a93 | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 4 |
|||
a94 | |
0.00% |
0 / 1 |
72 | |
0.00% |
0 / 12 |
|||
a95 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a96 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 5 |
|||
a97 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 2 |
|||
a98 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a99 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a100 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a101 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a102 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a103 | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 12 |
|||
a104 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a105 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a106 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
a107 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a108 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 9 |
|||
a109 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a110 | |
0.00% |
0 / 1 |
56 | |
0.00% |
0 / 23 |
|||
a111 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a112 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a113 | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 2 |
|||
a114 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
|||
a115 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
|||
a116 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 5 |
|||
a117 | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 1 |
|||
a118 | |
0.00% |
0 / 1 |
30 | |
0.00% |
0 / 12 |
|||
a119 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a120 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 5 |
|||
a121 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 10 |
|||
a122 | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 5 |
|||
a123 | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 2 |
|||
a124 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 9 |
|||
a125 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a126 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a127 | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 16 |
|||
a128 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 6 |
|||
a129 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 6 |
|||
a130 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 7 |
|||
a131 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a132 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a133 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a134 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
a135 | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 18 |
|||
a136 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
a137 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a138 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a139 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 4 |
|||
a140 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
|||
a141 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a142 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a143 | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 5 |
|||
a144 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a145 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a146 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a147 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a148 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a149 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a150 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a151 | |
0.00% |
0 / 1 |
56 | |
0.00% |
0 / 28 |
|||
a152 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
a153 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
a154 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a155 | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 8 |
|||
a156 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a157 | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 7 |
|||
a158 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a159 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
a160 | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 4 |
|||
a161 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a162 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a163 | |
0.00% |
0 / 1 |
420 | |
0.00% |
0 / 49 |
|||
a164 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
a165 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a166 | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 6 |
|||
a167 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a168 | |
0.00% |
0 / 1 |
30 | |
0.00% |
0 / 8 |
|||
a169 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 6 |
|||
a170 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a171 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
a172 | |
0.00% |
0 / 1 |
30 | |
0.00% |
0 / 8 |
|||
a173 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a174 | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 5 |
|||
a175 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a176 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 4 |
|||
a177 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 5 |
|||
a178 | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 3 |
|||
a179 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
a180 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a181 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a182 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a183 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a184 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 4 |
|||
a185 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a186 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
a187 | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
streamstart_async | |
0.00% |
0 / 1 |
132 | |
0.00% |
0 / 51 |
|||
parsestart | |
0.00% |
0 / 1 |
110 | |
0.00% |
0 / 31 |
|||
parsetable_start_tag | |
0.00% |
0 / 1 |
420 | |
0.00% |
0 / 77 |
|||
parseurl | |
0.00% |
0 / 1 |
1560 | |
0.00% |
0 / 169 |
|||
parserow_syntax_table_args | |
0.00% |
0 / 1 |
132 | |
0.00% |
0 / 44 |
|||
parsetable_attributes | |
0.00% |
0 / 1 |
156 | |
0.00% |
0 / 38 |
|||
parsegeneric_newline_attributes | |
0.00% |
0 / 1 |
72 | |
0.00% |
0 / 21 |
|||
parsetplarg_or_template_or_bust | |
0.00% |
0 / 1 |
132 | |
0.00% |
0 / 31 |
|||
parseextlink | |
0.00% |
0 / 1 |
812 | |
0.00% |
0 / 133 |
|||
parsetlb | |
0.00% |
0 / 1 |
72 | |
0.00% |
0 / 32 |
|||
parsenewlineToken | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 14 |
|||
parsespace | |
0.00% |
0 / 1 |
30 | |
0.00% |
0 / 14 |
|||
parsecomment | |
0.00% |
0 / 1 |
342 | |
0.00% |
0 / 64 |
|||
parsepipe | |
0.00% |
0 / 1 |
56 | |
0.00% |
0 / 20 |
|||
parseurl_protocol | |
0.00% |
0 / 1 |
380 | |
0.00% |
0 / 70 |
|||
parseipv6urladdr | |
0.00% |
0 / 1 |
132 | |
0.00% |
0 / 43 |
|||
discardinline_breaks | |
0.00% |
0 / 1 |
90 | |
0.00% |
0 / 39 |
|||
parseno_punctuation_char | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 14 |
|||
parsetplarg_or_template | |
0.00% |
0 / 1 |
110 | |
0.00% |
0 / 35 |
|||
parsehtmlentity | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 15 |
|||
parseoptional_spaces | |
0.00% |
0 / 1 |
56 | |
0.00% |
0 / 21 |
|||
discardpipe | |
0.00% |
0 / 1 |
56 | |
0.00% |
0 / 20 |
|||
parsetable_attribute | |
0.00% |
0 / 1 |
272 | |
0.00% |
0 / 68 |
|||
discardoptionalSpaceToken | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 15 |
|||
parsebroken_table_attribute_name_char | |
0.00% |
0 / 1 |
30 | |
0.00% |
0 / 18 |
|||
parsegeneric_newline_attribute | |
0.00% |
0 / 1 |
420 | |
0.00% |
0 / 76 |
|||
parseextlink_nonipv6url | |
0.00% |
0 / 1 |
42 | |
0.00% |
0 / 16 |
|||
discardspace | |
0.00% |
0 / 1 |
30 | |
0.00% |
0 / 14 |
|||
discardunispace | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 14 |
|||
parseinlineline | |
0.00% |
0 / 1 |
380 | |
0.00% |
0 / 72 |
|||
discardeof | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 14 |
|||
parseblock | |
0.00% |
0 / 1 |
650 | |
0.00% |
0 / 121 |
|||
discardnewline | |
0.00% |
0 / 1 |
56 | |
0.00% |
0 / 20 |
|||
parsetplarg_or_template_guarded | |
0.00% |
0 / 1 |
1806 | |
0.00% |
0 / 191 |
|||
parseraw_htmlentity | |
0.00% |
0 / 1 |
156 | |
0.00% |
0 / 48 |
|||
parseoptionalSpaceToken | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 15 |
|||
parsetable_attribute_name | |
0.00% |
0 / 1 |
930 | |
0.00% |
0 / 126 |
|||
parsetable_att_value | |
0.00% |
0 / 1 |
2256 | |
0.00% |
0 / 177 |
|||
discardspace_or_newline_or_solidus | |
0.00% |
0 / 1 |
72 | |
0.00% |
0 / 37 |
|||
parsegeneric_attribute_name | |
0.00% |
0 / 1 |
756 | |
0.00% |
0 / 104 |
|||
discardspace_or_newline | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 13 |
|||
parsegeneric_att_value | |
0.00% |
0 / 1 |
1980 | |
0.00% |
0 / 194 |
|||
parseextlink_nonipv6url_parameterized | |
0.00% |
0 / 1 |
650 | |
0.00% |
0 / 92 |
|||
parseurltext | |
0.00% |
0 / 1 |
462 | |
0.00% |
0 / 98 |
|||
parseinline_element | |
0.00% |
0 / 1 |
992 | |
0.00% |
0 / 154 |
|||
discardsof | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 14 |
|||
parseredirect | |
0.00% |
0 / 1 |
380 | |
0.00% |
0 / 72 |
|||
parsecomment_include_annotation | |
0.00% |
0 / 1 |
72 | |
0.00% |
0 / 22 |
|||
parseblock_line | |
0.00% |
0 / 1 |
552 | |
0.00% |
0 / 96 |
|||
parseblock_lines | |
0.00% |
0 / 1 |
156 | |
0.00% |
0 / 46 |
|||
discardeolf | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 13 |
|||
parseblock_tag | |
0.00% |
0 / 1 |
132 | |
0.00% |
0 / 36 |
|||
parseparagraph | |
0.00% |
0 / 1 |
110 | |
0.00% |
0 / 35 |
|||
parsesol | |
0.00% |
0 / 1 |
110 | |
0.00% |
0 / 30 |
|||
discardtplarg | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 13 |
|||
parsetemplate | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 13 |
|||
parsebroken_template | |
0.00% |
0 / 1 |
72 | |
0.00% |
0 / 26 |
|||
parsetplarg | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 13 |
|||
discardwikilink | |
0.00% |
0 / 1 |
56 | |
0.00% |
0 / 19 |
|||
parsedirective | |
0.00% |
0 / 1 |
272 | |
0.00% |
0 / 67 |
|||
discardxmlish_tag | |
0.00% |
0 / 1 |
156 | |
0.00% |
0 / 39 |
|||
parsetable_attribute_preprocessor_text_single | |
0.00% |
0 / 1 |
380 | |
0.00% |
0 / 63 |
|||
parsetable_attribute_preprocessor_text_double | |
0.00% |
0 / 1 |
380 | |
0.00% |
0 / 63 |
|||
parsetable_attribute_preprocessor_text | |
0.00% |
0 / 1 |
420 | |
0.00% |
0 / 65 |
|||
parseless_than | |
0.00% |
0 / 1 |
42 | |
0.00% |
0 / 28 |
|||
parseattribute_preprocessor_text_single | |
0.00% |
0 / 1 |
552 | |
0.00% |
0 / 78 |
|||
parseattribute_preprocessor_text_double | |
0.00% |
0 / 1 |
552 | |
0.00% |
0 / 78 |
|||
parseattribute_preprocessor_text | |
0.00% |
0 / 1 |
600 | |
0.00% |
0 / 80 |
|||
parseautolink | |
0.00% |
0 / 1 |
156 | |
0.00% |
0 / 45 |
|||
parsebehavior_switch | |
0.00% |
0 / 1 |
132 | |
0.00% |
0 / 40 |
|||
parsetext_char | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 13 |
|||
parsexmlish_tag | |
0.00% |
0 / 1 |
156 | |
0.00% |
0 / 39 |
|||
parselang_variant_or_tpl | |
0.00% |
0 / 1 |
2450 | |
0.00% |
0 / 222 |
|||
parsewikilink | |
0.00% |
0 / 1 |
56 | |
0.00% |
0 / 19 |
|||
parsequote | |
0.00% |
0 / 1 |
132 | |
0.00% |
0 / 39 |
|||
parseredirect_word | |
0.00% |
0 / 1 |
306 | |
0.00% |
0 / 74 |
|||
parseinclude_limits | |
0.00% |
0 / 1 |
380 | |
0.00% |
0 / 71 |
|||
parseannotation_tag | |
0.00% |
0 / 1 |
90 | |
0.00% |
0 / 33 |
|||
parseheading | |
0.00% |
0 / 1 |
702 | |
0.00% |
0 / 117 |
|||
parselist_item | |
0.00% |
0 / 1 |
72 | |
0.00% |
0 / 22 |
|||
parsehr | |
0.00% |
0 / 1 |
342 | |
0.00% |
0 / 66 |
|||
parsetable_line | |
0.00% |
0 / 1 |
210 | |
0.00% |
0 / 49 |
|||
parsexmlish_tag_opened | |
0.00% |
0 / 1 |
506 | |
0.00% |
0 / 77 |
|||
parseempty_line_with_comments | |
0.00% |
0 / 1 |
272 | |
0.00% |
0 / 65 |
|||
parsesol_prefix | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 20 |
|||
discardtplarg_preproc | |
0.00% |
0 / 1 |
1332 | |
0.00% |
0 / 136 |
|||
parsetemplate_preproc | |
0.00% |
0 / 1 |
2352 | |
0.00% |
0 / 176 |
|||
parsetplarg_preproc | |
0.00% |
0 / 1 |
1332 | |
0.00% |
0 / 136 |
|||
discardwikilink_preproc | |
0.00% |
0 / 1 |
342 | |
0.00% |
0 / 65 |
|||
discardbroken_wikilink | |
0.00% |
0 / 1 |
306 | |
0.00% |
0 / 63 |
|||
parseextension_annotation_tag | |
0.00% |
0 / 1 |
110 | |
0.00% |
0 / 39 |
|||
parsetvar_old_syntax_closing_HACK | |
0.00% |
0 / 1 |
56 | |
0.00% |
0 / 30 |
|||
parseautourl | |
0.00% |
0 / 1 |
1560 | |
0.00% |
0 / 181 |
|||
parseautoref | |
0.00% |
0 / 1 |
380 | |
0.00% |
0 / 62 |
|||
parseisbn | |
0.00% |
0 / 1 |
930 | |
0.00% |
0 / 115 |
|||
discardbehavior_text | |
0.00% |
0 / 1 |
156 | |
0.00% |
0 / 43 |
|||
parselang_variant | |
0.00% |
0 / 1 |
56 | |
0.00% |
0 / 19 |
|||
parsewikilink_preproc | |
0.00% |
0 / 1 |
342 | |
0.00% |
0 / 65 |
|||
parsebroken_wikilink | |
0.00% |
0 / 1 |
306 | |
0.00% |
0 / 63 |
|||
parsedtdd | |
0.00% |
0 / 1 |
420 | |
0.00% |
0 / 93 |
|||
parsehacky_dl_uses | |
0.00% |
0 / 1 |
552 | |
0.00% |
0 / 79 |
|||
parseli | |
0.00% |
0 / 1 |
210 | |
0.00% |
0 / 46 |
|||
discardsol | |
0.00% |
0 / 1 |
132 | |
0.00% |
0 / 33 |
|||
parsetable_content_line | |
0.00% |
0 / 1 |
182 | |
0.00% |
0 / 40 |
|||
parsetable_end_tag | |
0.00% |
0 / 1 |
110 | |
0.00% |
0 / 45 |
|||
parsetag_name | |
0.00% |
0 / 1 |
42 | |
0.00% |
0 / 21 |
|||
parsenewline | |
0.00% |
0 / 1 |
56 | |
0.00% |
0 / 20 |
|||
parsetemplate_param_value | |
0.00% |
0 / 1 |
56 | |
0.00% |
0 / 21 |
|||
discardnl_comment_space | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 13 |
|||
parsenl_comment_space | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 13 |
|||
parsetemplate_param | |
0.00% |
0 / 1 |
306 | |
0.00% |
0 / 74 |
|||
parsewikilink_preprocessor_text | |
0.00% |
0 / 1 |
756 | |
0.00% |
0 / 91 |
|||
parsewikilink_content | |
0.00% |
0 / 1 |
132 | |
0.00% |
0 / 40 |
|||
parsespace_or_nbsp | |
0.00% |
0 / 1 |
72 | |
0.00% |
0 / 43 |
|||
discardend_of_word | |
0.00% |
0 / 1 |
30 | |
0.00% |
0 / 21 |
|||
parsespace_or_nbsp_or_dash | |
0.00% |
0 / 1 |
30 | |
0.00% |
0 / 17 |
|||
discardtext_char | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 13 |
|||
parselang_variant_preproc | |
0.00% |
0 / 1 |
756 | |
0.00% |
0 / 124 |
|||
parsebroken_lang_variant | |
0.00% |
0 / 1 |
72 | |
0.00% |
0 / 25 |
|||
discardlist_char | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 13 |
|||
parselist_char | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 13 |
|||
parseinlineline_break_on_colon | |
0.00% |
0 / 1 |
42 | |
0.00% |
0 / 16 |
|||
discardcomment_space_eolf | |
0.00% |
0 / 1 |
90 | |
0.00% |
0 / 32 |
|||
discardempty_line_with_comments | |
0.00% |
0 / 1 |
272 | |
0.00% |
0 / 65 |
|||
discardsol_prefix | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 20 |
|||
discardcomment_include_annotation | |
0.00% |
0 / 1 |
72 | |
0.00% |
0 / 22 |
|||
parsetable_heading_tags | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 13 |
|||
parsetable_row_tag | |
0.00% |
0 / 1 |
380 | |
0.00% |
0 / 73 |
|||
parsetable_data_tags | |
0.00% |
0 / 1 |
240 | |
0.00% |
0 / 61 |
|||
parsetable_caption_tag | |
0.00% |
0 / 1 |
240 | |
0.00% |
0 / 56 |
|||
parsetemplate_param_text | |
0.00% |
0 / 1 |
132 | |
0.00% |
0 / 31 |
|||
discardnewlineToken | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 14 |
|||
discardcomment_space | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 13 |
|||
parsecomment_space | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 13 |
|||
parsetemplate_param_name | |
0.00% |
0 / 1 |
72 | |
0.00% |
0 / 28 |
|||
parselink_text | |
0.00% |
0 / 1 |
42 | |
0.00% |
0 / 16 |
|||
parseunispace | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 14 |
|||
parseopt_lang_variant_flags | |
0.00% |
0 / 1 |
132 | |
0.00% |
0 / 39 |
|||
parselang_variant_text | |
0.00% |
0 / 1 |
156 | |
0.00% |
0 / 33 |
|||
parselang_variant_option_list | |
0.00% |
0 / 1 |
380 | |
0.00% |
0 / 76 |
|||
discardcomment | |
0.00% |
0 / 1 |
342 | |
0.00% |
0 / 64 |
|||
discardinclude_limits | |
0.00% |
0 / 1 |
380 | |
0.00% |
0 / 71 |
|||
discardannotation_tag | |
0.00% |
0 / 1 |
90 | |
0.00% |
0 / 33 |
|||
parsetable_heading_tags_parameterized | |
0.00% |
0 / 1 |
306 | |
0.00% |
0 / 58 |
|||
parsetable_data_tag | |
0.00% |
0 / 1 |
182 | |
0.00% |
0 / 49 |
|||
parsetds | |
0.00% |
0 / 1 |
210 | |
0.00% |
0 / 54 |
|||
parsenested_block_in_table | |
0.00% |
0 / 1 |
462 | |
0.00% |
0 / 76 |
|||
parsenested_block | |
0.00% |
0 / 1 |
90 | |
0.00% |
0 / 34 |
|||
parselink_text_parameterized | |
0.00% |
0 / 1 |
1332 | |
0.00% |
0 / 129 |
|||
parselang_variant_flags | |
0.00% |
0 / 1 |
506 | |
0.00% |
0 / 78 |
|||
parselang_variant_option | |
0.00% |
0 / 1 |
1980 | |
0.00% |
0 / 168 |
|||
discardbogus_lang_variant_option | |
0.00% |
0 / 1 |
56 | |
0.00% |
0 / 18 |
|||
parsetable_heading_tag | |
0.00% |
0 / 1 |
156 | |
0.00% |
0 / 47 |
|||
parsepipe_pipe | |
0.00% |
0 / 1 |
72 | |
0.00% |
0 / 20 |
|||
discardrow_syntax_table_args | |
0.00% |
0 / 1 |
132 | |
0.00% |
0 / 44 |
|||
parsefull_table_in_link_caption | |
0.00% |
0 / 1 |
90 | |
0.00% |
0 / 34 |
|||
parselang_variant_flag | |
0.00% |
0 / 1 |
342 | |
0.00% |
0 / 73 |
|||
parselang_variant_name | |
0.00% |
0 / 1 |
182 | |
0.00% |
0 / 43 |
|||
parselang_variant_nowiki | |
0.00% |
0 / 1 |
132 | |
0.00% |
0 / 37 |
|||
parselang_variant_text_no_semi | |
0.00% |
0 / 1 |
42 | |
0.00% |
0 / 16 |
|||
parselang_variant_text_no_semi_or_arrow | |
0.00% |
0 / 1 |
42 | |
0.00% |
0 / 16 |
|||
discardlang_variant_text | |
0.00% |
0 / 1 |
156 | |
0.00% |
0 / 33 |
|||
parsefull_table_in_link_caption_parameterized | |
0.00% |
0 / 1 |
600 | |
0.00% |
0 / 77 |
|||
discardnowiki | |
0.00% |
0 / 1 |
90 | |
0.00% |
0 / 33 |
|||
parsenowiki_text | |
0.00% |
0 / 1 |
56 | |
0.00% |
0 / 21 |
|||
parsenowiki | |
0.00% |
0 / 1 |
90 | |
0.00% |
0 / 33 |
|||
parse | |
0.00% |
0 / 1 |
306 | |
0.00% |
0 / 41 |
<?php | |
/* | |
* DO NOT EDIT MANUALLY. | |
* File generated from Grammar.pegphp with `composer regen-tokenizer`. | |
*/ | |
namespace Wikimedia\Parsoid\Wt2Html; | |
use Wikimedia\Parsoid\Config\Env; | |
use Wikimedia\Parsoid\Config\SiteConfig; | |
use Wikimedia\Parsoid\Core\DomSourceRange; | |
use Wikimedia\Parsoid\NodeData\DataParsoid; | |
use Wikimedia\Parsoid\Tokens\CommentTk; | |
use Wikimedia\Parsoid\Tokens\EndTagTk; | |
use Wikimedia\Parsoid\Tokens\EOFTk; | |
use Wikimedia\Parsoid\Tokens\KV; | |
use Wikimedia\Parsoid\Tokens\KVSourceRange; | |
use Wikimedia\Parsoid\Tokens\NlTk; | |
use Wikimedia\Parsoid\Tokens\SelfclosingTagTk; | |
use Wikimedia\Parsoid\Tokens\SourceRange; | |
use Wikimedia\Parsoid\Tokens\TagTk; | |
use Wikimedia\Parsoid\Tokens\Token; | |
use Wikimedia\Parsoid\Utils\TokenUtils; | |
use Wikimedia\Parsoid\Utils\Utils; | |
use Wikimedia\Parsoid\Utils\PHPUtils; | |
use Wikimedia\Parsoid\Utils\WTUtils; | |
use Wikimedia\Parsoid\Wikitext\Consts; | |
class Grammar extends \Wikimedia\WikiPEG\PEGParserBase { | |
// initializer | |
/** @var Env */ | |
private $env; | |
/** @var SiteConfig */ | |
private $siteConfig; | |
/** @var array */ | |
private $pipelineOpts; | |
/** @var int */ | |
private $pipelineOffset; | |
private $extTags; | |
private $startTime; | |
/** @var string */ | |
private $reUrltextLookahead; | |
/** @var string */ | |
private $urltextPlainSegment = ''; | |
/** @var bool */ | |
private $urltextFoundAutolink = false; | |
protected function initialize() { | |
$this->env = $this->options['env']; | |
$this->siteConfig = $this->env->getSiteConfig(); | |
$tokenizer = $this->options['pegTokenizer']; | |
$this->pipelineOpts = $tokenizer->getOptions(); | |
// FIXME: inTemplate option may not always be set in | |
// standalone tokenizers user by some pipelines handlers. | |
$this->pipelineOffset = $this->options['pipelineOffset'] ?? 0; | |
$this->extTags = $this->siteConfig->getExtensionTagNameMap(); | |
// Non-greedy text_char sequence: stop at ampersand, double-underscore, | |
// magic link prefix or protocol | |
$this->reUrltextLookahead = '!(?:' . | |
'([^-\'<[{\n\r:;\]}|\!=&]*?)' . | |
'(?:__|$|[-\'<[{\n\r:;\]}|\!=&]|(RFC|PMID|ISBN|' . | |
'(?i)' . $this->siteConfig->getProtocolsRegex( true ) . | |
')))!A'; | |
} | |
private $prevOffset = 0; | |
private $headingIndex = 0; | |
private function assert( $condition, $text ) { | |
if ( !$condition ) { | |
throw new \Exception( "Grammar.pegphp assertion failure: $text" ); | |
} | |
} | |
private function unreachable() { | |
throw new \Exception( "Grammar.pegphp: this should be unreachable" ); | |
} | |
// Some shorthands for legibility | |
private function startOffset() { | |
return $this->savedPos; | |
} | |
private function endOffset() { | |
return $this->currPos; | |
} | |
private function tsrOffsets( $flag = 'default' ): SourceRange { | |
switch ( $flag ) { | |
case 'start': | |
return new SourceRange( $this->savedPos, $this->savedPos ); | |
case 'end': | |
return new SourceRange( $this->currPos, $this->currPos ); | |
default: | |
return new SourceRange( $this->savedPos, $this->currPos ); | |
} | |
} | |
/* | |
* Emit a chunk of tokens to our consumers. Once this has been done, the | |
* current expression can return an empty list (true). | |
*/ | |
private function emitChunk( $tokens ) { | |
// FIXME: We don't expect nulls here, but looks like | |
// hack from I1c695ab6cdd3655e98877c175ddbabdee9dc44b7 | |
// introduces them. Work around it for now! | |
if ( !$tokens ) { | |
return []; | |
} | |
// Shift tsr of all tokens by the pipeline offset | |
TokenUtils::shiftTokenTSR( $tokens, $this->pipelineOffset ); | |
$this->env->log( 'trace/peg', $this->options['pipelineId'] ?? '0', '----> ', $tokens ); | |
$i = null; | |
$n = count( $tokens ); | |
// Enforce parsing resource limits | |
for ( $i = 0; $i < $n; $i++ ) { | |
TokenizerUtils::enforceParserResourceLimits( $this->env, $tokens[ $i ] ); | |
} | |
return $tokens; | |
} | |
/* ------------------------------------------------------------------------ | |
* Extension tags should be parsed with higher priority than anything else. | |
* | |
* The trick we use is to strip out the content inside a matching tag-pair | |
* and not tokenize it. The content, if it needs to parsed (for example, | |
* for <ref>, <*include*> tags), is parsed in a fresh tokenizer context | |
* which means any error correction that needs to happen is restricted to | |
* the scope of the extension content and doesn't spill over to the higher | |
* level. Ex: <math><!--foo</math>. | |
* | |
* IGNORE: {{ this just balances the blocks in this comment for pegjs | |
* | |
* This trick also lets us prevent extension content (that don't accept WT) | |
* from being parsed as wikitext (Ex: <math>\frac{foo\frac{bar}}</math>) | |
* We don't want the "}}" being treated as a template closing tag and | |
* closing outer templates. | |
* --------------------------------------------------------------------- */ | |
private function isXMLTag( string $name, bool $block ): bool { | |
$lName = mb_strtolower( $name ); | |
return $block ? | |
TokenUtils::isWikitextBlockTag( $lName ) : | |
isset( Consts::$HTML['HTML5Tags'][$lName] ) | |
|| isset( Consts::$HTML['OlderHTMLTags'][$lName] ); | |
} | |
private function maybeAnnotationOrExtensionTag( Token $t, ?bool $end, array $attribs, SourceRange $tsr ) { | |
$tagName = mb_strtolower( $t->getName() ); | |
$isAnnotationTag = $this->siteConfig->isAnnotationTag( $tagName ); | |
if ( !$isAnnotationTag ) { | |
$pipepos = strpos( $tagName, '|' ); | |
if ( $pipepos ) { | |
$strBeforePipe = substr( $tagName, 0, $pipepos ); | |
$isAnnotationTag = $this->siteConfig->isAnnotationTag( $strBeforePipe ); | |
if ( $isAnnotationTag ) { | |
$attribs = [ new KV( "name", substr( $tagName, $pipepos + 1, strlen( $tagName ) - $pipepos - 1 ) ) ]; | |
$tagName = $strBeforePipe; | |
} | |
} | |
} | |
if ( $isAnnotationTag ) { | |
$metaAttrs = [ new KV( 'typeof', 'mw:Annotation/' . $tagName . ($end ? '/End' : '') ) ]; | |
if ( count( $attribs ) > 0 ) { | |
$attrMap = []; | |
foreach ( $attribs as $attr ) { | |
// If the key or the value is not a string, we replace it by the thing that generated it and | |
// consider that wikitext as a raw string instead. | |
$k = is_string( $attr->k ) ? $attr->k : $attr->ksrc; | |
$v = is_string( $attr->v ) ? $attr->v : $attr->vsrc; | |
$attrMap[$k] = $v; | |
} | |
$datamw = []; | |
// Possible follow-up in T295168 for attribute sanitation | |
$datamw['attrs'] = $attrMap; | |
array_push( $metaAttrs, new KV( 'data-mw', PHPUtils::jsonEncode( $datamw ) ) ); | |
} | |
$dp = new DataParsoid(); | |
$dp->tsr = $tsr; | |
$this->env->hasAnnotations = true; | |
// FIXME: Suppress annotation meta tokens from template pipelines | |
// since they may not have TSR values and won't get recognized as | |
// annotation ranges. Without TSR, they might end up stuck in | |
// fosterable positions and cause havoc on edits by breaking selser. | |
if ( empty( $this->pipelineOpts['inTemplate'] ) ) { | |
return [ new SelfclosingTagTk ( 'meta', $metaAttrs, $dp ) ]; | |
} else { | |
return []; | |
} | |
} | |
$isInstalledExt = isset( $this->extTags[$tagName] ); | |
$isIncludeTag = WTUtils::isIncludeTag( $tagName ); | |
// Extensions have higher precedence when they shadow html tags. | |
if ( !( $isInstalledExt || $isIncludeTag ) ) { | |
return $t; | |
} | |
$dp = $t->dataAttribs; | |
$skipPos = $this->currPos; | |
switch ( get_class( $t ) ) { | |
case EndTagTk::class: | |
if ( $isIncludeTag ) { | |
return $t; | |
} | |
// Similar to TagTk, we rely on the sanitizer to convert to text | |
// where necessary and emit tokens to ease the wikitext escaping | |
// code. However, extension tags that shadow html tags will see | |
// their unmatched end tags dropped while tree building, since | |
// the sanitizer will let them through. | |
return $t; // not text() | |
case SelfclosingTagTk::class: | |
$dp->src = $dp->tsr->substr( $this->input ); | |
$dp->extTagOffsets = new DomSourceRange( | |
$dp->tsr->start, $dp->tsr->end, | |
$dp->tsr->length(), 0 | |
); | |
if ( $isIncludeTag ) { | |
return $t; | |
} | |
break; | |
case TagTk::class: | |
$endTagRE = '~.*?(</' . preg_quote( $tagName, '~' ) . '\s*>)~iusA'; | |
$tagContentFound = preg_match( $endTagRE, $this->input, $tagContent, 0, $dp->tsr->start ); | |
if ( !$tagContentFound ) { | |
$dp->src = $dp->tsr->substr( $this->input ); | |
$dp->extTagOffsets = new DomSourceRange( | |
$dp->tsr->start, $dp->tsr->end, | |
$dp->tsr->length(), 0 | |
); | |
if ( $isIncludeTag ) { | |
return $t; | |
} else { | |
// This is undefined behaviour. The old parser currently | |
// returns text here (see core commit 674e8388cba), | |
// whereas this results in unclosed | |
// extension tags that shadow html tags falling back to | |
// their html equivalent. The sanitizer will take care | |
// of converting to text where necessary. We do this to | |
// simplify `hasWikitextTokens` when escaping wikitext, | |
// which wants these as tokens because it's otherwise | |
// lacking in context. | |
return $t; // not text() | |
} | |
} | |
$extSrc = $tagContent[0]; | |
$extEndOffset = $dp->tsr->start + strlen( $extSrc ); | |
$extEndTagWidth = strlen( $tagContent[1] ); | |
if ( !empty( $this->pipelineOpts['inTemplate'] ) ) { | |
// Support 1-level of nesting in extensions tags while | |
// tokenizing in templates to support the #tag parser function. | |
// | |
// It's necessary to permit this broadly in templates because | |
// there's no way to distinguish whether the nesting happened | |
// while expanding the #tag parser function, or just a general | |
// syntax errors. In other words, | |
// | |
// hi<ref>ho<ref>hi</ref>ho</ref> | |
// | |
// and | |
// | |
// hi{{#tag:ref|ho<ref>hi</ref>ho}} | |
// | |
// found in template are returned indistinguishably after a | |
// preprocessing request, though the old parser renders them | |
// differently. #tag in template is probably a common enough | |
// use case that we want to accept these false positives, | |
// though another approach could be to drop this code here, and | |
// invoke a native #tag handler and forgo those in templates. | |
// | |
// Expand `extSrc` as long as there is a <tagName> found in the | |
// extension source body. | |
$startTagRE = '~<' . preg_quote( $tagName, '~' ) . '([^/>]|/(?!>))*>~i'; | |
$s = substr( $extSrc, $dp->tsr->end - $dp->tsr->start ); | |
while ( strlen( $s ) ) { | |
if ( !preg_match( $startTagRE, $s ) ) { | |
break; | |
} | |
if ( !preg_match( $endTagRE, $this->input, $tagContent, 0, $extEndOffset ) ) { | |
break; | |
} | |
$s = $tagContent[0]; | |
$extEndOffset += strlen( $s ); | |
$extEndTagWidth = strlen( $tagContent[1] ); | |
$extSrc .= $s; | |
} | |
} | |
// Extension content source | |
$dp->src = $extSrc; | |
$dp->extTagOffsets = new DomSourceRange( | |
$dp->tsr->start, $extEndOffset, | |
$dp->tsr->length(), $extEndTagWidth | |
); | |
$skipPos = $dp->extTagOffsets->innerEnd(); | |
// If the xml-tag is a known installed (not native) extension, | |
// skip the end-tag as well. | |
if ( $isInstalledExt ) { | |
$skipPos = $dp->extTagOffsets->end; | |
} | |
break; | |
default: | |
$this->unreachable(); | |
} | |
$this->currPos = $skipPos; | |
if ( $isInstalledExt ) { | |
// update tsr->end to span the start and end tags. | |
$dp->tsr->end = $this->endOffset(); // was just modified above | |
return new SelfclosingTagTk( 'extension', [ | |
new KV( 'typeof', 'mw:Extension' ), | |
new KV( 'name', $tagName ), | |
new KV( 'about', $this->env->newAboutId() ), | |
new KV( 'source', $dp->src ), | |
new KV( 'options', $t->attribs ) | |
], $dp | |
); | |
} elseif ( $isIncludeTag ) { | |
// Parse ext-content, strip eof, and shift tsr | |
$extContent = $dp->extTagOffsets->stripTags( $dp->src ); | |
$tokenizer = new PegTokenizer( $this->env ); | |
$tokenizer->setSourceOffsets( new SourceRange( $dp->extTagOffsets->innerStart(), $dp->extTagOffsets->innerEnd() ) ); | |
$extContentToks = $tokenizer->tokenizeSync( $extContent ); | |
if ( $dp->extTagOffsets->closeWidth > 0 ) { | |
TokenUtils::stripEOFTkFromTokens( $extContentToks ); | |
} | |
array_unshift( $extContentToks, $t ); | |
return $extContentToks; | |
} else { | |
$this->unreachable(); | |
} | |
} | |
// cache init | |
protected $cache = []; | |
// expectations | |
protected $expectations = [ | |
0 => ["type" => "end", "description" => "end of input"], | |
1 => ["type" => "other", "description" => "start"], | |
2 => ["type" => "other", "description" => "table_start_tag"], | |
3 => ["type" => "class", "value" => "['{]", "description" => "['{]"], | |
4 => ["type" => "literal", "value" => "&", "description" => "\"&\""], | |
5 => ["type" => "other", "description" => "table_attributes"], | |
6 => ["type" => "other", "description" => "generic_newline_attributes"], | |
7 => ["type" => "any", "description" => "any character"], | |
8 => ["type" => "other", "description" => "extlink"], | |
9 => ["type" => "other", "description" => "tlb"], | |
10 => ["type" => "class", "value" => "[ \\t]", "description" => "[ \\t]"], | |
11 => ["type" => "literal", "value" => "<!--", "description" => "\"<!--\""], | |
12 => ["type" => "literal", "value" => "-->", "description" => "\"-->\""], | |
13 => ["type" => "literal", "value" => "|", "description" => "\"|\""], | |
14 => ["type" => "literal", "value" => "{{!}}", "description" => "\"{{!}}\""], | |
15 => ["type" => "literal", "value" => "//", "description" => "\"//\""], | |
16 => ["type" => "class", "value" => "[A-Za-z]", "description" => "[A-Za-z]"], | |
17 => ["type" => "class", "value" => "[-A-Za-z0-9+.]", "description" => "[-A-Za-z0-9+.]"], | |
18 => ["type" => "literal", "value" => ":", "description" => "\":\""], | |
19 => ["type" => "literal", "value" => "[", "description" => "\"[\""], | |
20 => ["type" => "class", "value" => "[0-9A-Fa-f:.]", "description" => "[0-9A-Fa-f:.]"], | |
21 => ["type" => "literal", "value" => "]", "description" => "\"]\""], | |
22 => ["type" => "class", "value" => "[^ \\]\\[\\r\\n\"'<>\\x00-\\x20\\x7f&\\u00A0\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000{]", "description" => "[^ \\]\\[\\r\\n\"'<>\\x00-\\x20\\x7f&\\u00A0\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000{]"], | |
23 => ["type" => "literal", "value" => "=", "description" => "\"=\""], | |
24 => ["type" => "class", "value" => "[\\0/=>]", "description" => "[\\0/=>]"], | |
25 => ["type" => "class", "value" => "[ \\u00A0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000]", "description" => "[ \\u00A0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000]"], | |
26 => ["type" => "literal", "value" => "\x0a", "description" => "\"\\n\""], | |
27 => ["type" => "literal", "value" => "\x0d\x0a", "description" => "\"\\r\\n\""], | |
28 => ["type" => "literal", "value" => "{", "description" => "\"{\""], | |
29 => ["type" => "class", "value" => "[#0-9a-zA-Z\u{5e8}\u{5dc}\u{5de}\u{631}\u{644}\u{645}]", "description" => "[#0-9a-zA-Z\u{5e8}\u{5dc}\u{5de}\u{631}\u{644}\u{645}]"], | |
30 => ["type" => "literal", "value" => ";", "description" => "\";\""], | |
31 => ["type" => "class", "value" => "[\"'=]", "description" => "[\"'=]"], | |
32 => ["type" => "class", "value" => "[^ \\t\\r\\n\\0/=><&{}\\-!|\\[]", "description" => "[^ \\t\\r\\n\\0/=><&{}\\-!|\\[]"], | |
33 => ["type" => "literal", "value" => "'", "description" => "\"'\""], | |
34 => ["type" => "literal", "value" => "\"", "description" => "\"\\\"\""], | |
35 => ["type" => "literal", "value" => "/", "description" => "\"/\""], | |
36 => ["type" => "class", "value" => "[^ \\t\\r\\n\\0/=><&{}\\-!|]", "description" => "[^ \\t\\r\\n\\0/=><&{}\\-!|]"], | |
37 => ["type" => "class", "value" => "[ \\t\\n\\r\\x0c]", "description" => "[ \\t\\n\\r\\x0c]"], | |
38 => ["type" => "class", "value" => "[^<[{\\n\\r|!\\]}\\-\\t&=\"' \\u00A0\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000]", "description" => "[^<[{\\n\\r|!\\]}\\-\\t&=\"' \\u00A0\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000]"], | |
39 => ["type" => "class", "value" => "[&|{\\-!}=]", "description" => "[&|{\\-!}=]"], | |
40 => ["type" => "class", "value" => "[']", "description" => "[']"], | |
41 => ["type" => "literal", "value" => "[[", "description" => "\"[[\""], | |
42 => ["type" => "literal", "value" => "<", "description" => "\"<\""], | |
43 => ["type" => "literal", "value" => "{{", "description" => "\"{{\""], | |
44 => ["type" => "class", "value" => "[^{}&<\\-!\\['\\r\\n|]", "description" => "[^{}&<\\-!\\['\\r\\n|]"], | |
45 => ["type" => "class", "value" => "[{}&<\\-!\\[]", "description" => "[{}&<\\-!\\[]"], | |
46 => ["type" => "class", "value" => "[^{}&<\\-!\\[\"\\r\\n|]", "description" => "[^{}&<\\-!\\[\"\\r\\n|]"], | |
47 => ["type" => "class", "value" => "[^{}&<\\-!\\[ \\t\\n\\r\\x0c|]", "description" => "[^{}&<\\-!\\[ \\t\\n\\r\\x0c|]"], | |
48 => ["type" => "class", "value" => "[^{}&<\\-|/'>]", "description" => "[^{}&<\\-|/'>]"], | |
49 => ["type" => "class", "value" => "[{}&\\-|/]", "description" => "[{}&\\-|/]"], | |
50 => ["type" => "class", "value" => "[^{}&<\\-|/\">]", "description" => "[^{}&<\\-|/\">]"], | |
51 => ["type" => "class", "value" => "[^{}&<\\-|/ \\t\\n\\r\\x0c>]", "description" => "[^{}&<\\-|/ \\t\\n\\r\\x0c>]"], | |
52 => ["type" => "literal", "value" => "__", "description" => "\"__\""], | |
53 => ["type" => "class", "value" => "[^-'<[{\\n\\r:;\\]}|!=]", "description" => "[^-'<[{\\n\\r:;\\]}|!=]"], | |
54 => ["type" => "literal", "value" => "-", "description" => "\"-\""], | |
55 => ["type" => "literal", "value" => "''", "description" => "\"''\""], | |
56 => ["type" => "class", "value" => "[ \\t\\n\\r\\0\\x0b]", "description" => "[ \\t\\n\\r\\0\\x0b]"], | |
57 => ["type" => "literal", "value" => "----", "description" => "\"----\""], | |
58 => ["type" => "literal", "value" => ">", "description" => "\">\""], | |
59 => ["type" => "literal", "value" => "{{{", "description" => "\"{{{\""], | |
60 => ["type" => "literal", "value" => "}}}", "description" => "\"}}}\""], | |
61 => ["type" => "literal", "value" => "}}", "description" => "\"}}\""], | |
62 => ["type" => "literal", "value" => "]]", "description" => "\"]]\""], | |
63 => ["type" => "literal", "value" => "/>", "description" => "\"/>\""], | |
64 => ["type" => "literal", "value" => "RFC", "description" => "\"RFC\""], | |
65 => ["type" => "literal", "value" => "PMID", "description" => "\"PMID\""], | |
66 => ["type" => "class", "value" => "[0-9]", "description" => "[0-9]"], | |
67 => ["type" => "literal", "value" => "ISBN", "description" => "\"ISBN\""], | |
68 => ["type" => "class", "value" => "[xX]", "description" => "[xX]"], | |
69 => ["type" => "literal", "value" => "}", "description" => "\"}\""], | |
70 => ["type" => "class", "value" => "[^\\t\\n\\v />\\0]", "description" => "[^\\t\\n\\v />\\0]"], | |
71 => ["type" => "class", "value" => "[^<[{\\n\\r\\t|!\\]}{ &\\-]", "description" => "[^<[{\\n\\r\\t|!\\]}{ &\\-]"], | |
72 => ["type" => "class", "value" => "[!<\\-\\}\\]\\n\\r]", "description" => "[!<\\-\\}\\]\\n\\r]"], | |
73 => ["type" => "literal", "value" => "-{", "description" => "\"-{\""], | |
74 => ["type" => "literal", "value" => "}-", "description" => "\"}-\""], | |
75 => ["type" => "class", "value" => "[*#:;]", "description" => "[*#:;]"], | |
76 => ["type" => "literal", "value" => "+", "description" => "\"+\""], | |
77 => ["type" => "literal", "value" => "!", "description" => "\"!\""], | |
78 => ["type" => "literal", "value" => "!!", "description" => "\"!!\""], | |
79 => ["type" => "literal", "value" => "=>", "description" => "\"=>\""], | |
80 => ["type" => "literal", "value" => "||", "description" => "\"||\""], | |
81 => ["type" => "literal", "value" => "{{!}}{{!}}", "description" => "\"{{!}}{{!}}\""], | |
82 => ["type" => "class", "value" => "[-+A-Z]", "description" => "[-+A-Z]"], | |
83 => ["type" => "class", "value" => "[^{}|;]", "description" => "[^{}|;]"], | |
84 => ["type" => "class", "value" => "[a-z]", "description" => "[a-z]"], | |
85 => ["type" => "class", "value" => "[-a-zA-Z]", "description" => "[-a-zA-Z]"], | |
]; | |
// actions | |
private function a0() { | |
$this->startTime = null; | |
if ( $this->env->profiling() ) { | |
$profile = $this->env->getCurrentProfile(); | |
$this->startTime = microtime( true ); | |
} | |
return true; | |
} | |
private function a1($t) { | |
if ( $this->env->profiling() ) { | |
$profile = $this->env->getCurrentProfile(); | |
$profile->bumpTimeUse( | |
'PEG', 1000 * ( microtime( true ) - $this->startTime ), 'PEG' ); | |
} | |
return true; | |
} | |
private function a2($t) { | |
return $t; | |
} | |
private function a3() { | |
// "tlb" matches "block" matches "sol" matches "newlineToken" | |
// But, "tlb" is prefixed with a !eof clause, so, we should only | |
// get here on eof. So, safe to unconditionally terminate the | |
// generator loop here. | |
return false; | |
} | |
private function a4($t, $n) { | |
if ( count( $t ) ) { | |
$ret = TokenizerUtils::flattenIfArray( $t ); | |
} else { | |
$ret = []; | |
} | |
if ( count( $n ) ) { | |
PHPUtils::pushArray($ret, $n); | |
} | |
$ret[] = new EOFTk(); | |
return $ret; | |
} | |
private function a5($sc) { | |
return $this->endOffset(); | |
} | |
private function a6($sc, $startPos, $b, $p) { | |
$this->unreachable(); | |
} | |
private function a7($sc, $startPos, $b, $p, $ta) { | |
return $this->endOffset(); | |
} | |
private function a8($sc, $startPos, $b, $p, $ta, $tsEndPos, $s2) { | |
$coms = TokenizerUtils::popComments( $ta ); | |
if ( $coms ) { | |
$tsEndPos = $coms['commentStartPos']; | |
} | |
$dp = new DataParsoid; | |
$dp->tsr = new SourceRange( $startPos, $tsEndPos ); | |
if ( $p !== '|' ) { | |
// Variation from default | |
$dp->startTagSrc = $b . $p; | |
} | |
return array_merge( $sc, | |
[ new TagTk( 'table', $ta, $dp ) ], | |
$coms ? $coms['buf'] : [], | |
$s2 ); | |
} | |
private function a9($proto, $addr, $he) { | |
return $he; | |
} | |
private function a10($proto, $addr, $r) { | |
return $r; | |
} | |
private function a11($proto, $addr, $c) { | |
return $c; | |
} | |
private function a12($proto, $addr, $path) { | |
return $addr !== '' || count( $path ) > 0; | |
} | |
private function a13($proto, $addr, $path) { | |
return TokenizerUtils::flattenString( array_merge( [ $proto, $addr ], $path ) ); | |
} | |
private function a14($as, $s, $p) { | |
return [ $as, $s, $p ]; | |
} | |
private function a15($b) { | |
return $b; | |
} | |
private function a16($r) { | |
return TokenizerUtils::flattenIfArray( $r ); | |
} | |
private function a17() { | |
return $this->endOffset(); | |
} | |
private function a18($p0, $addr, $target) { | |
return $this->endOffset(); | |
} | |
private function a19($p0, $addr, $target, $p1) { | |
// Protocol must be valid and there ought to be at least one | |
// post-protocol character. So strip last char off target | |
// before testing protocol. | |
$flat = TokenizerUtils::flattenString( [ $addr, $target ] ); | |
if ( is_array( $flat ) ) { | |
// There are templates present, alas. | |
return count( $flat ) > 0; | |
} | |
return Utils::isProtocolValid( substr( $flat, 0, -1 ), $this->env ); | |
} | |
private function a20($p0, $addr, $target, $p1, $sp) { | |
return $this->endOffset(); | |
} | |
private function a21($p0, $addr, $target, $p1, $sp, $p2, $content) { | |
return $this->endOffset(); | |
} | |
private function a22($p0, $addr, $target, $p1, $sp, $p2, $content, $p3) { | |
$tsr1 = new SourceRange( $p0, $p1 ); | |
$tsr2 = new SourceRange( $p2, $p3 ); | |
$dp = new DataParsoid; | |
$dp->tsr = $this->tsrOffsets(); | |
$dp->extLinkContentOffsets = $tsr2; | |
return [ | |
new SelfclosingTagTk( | |
'extlink', | |
[ | |
new KV( 'href', TokenizerUtils::flattenString( [ $addr, $target ] ), $tsr1->expandTsrV() ), | |
new KV( 'mw:content', $content ?? '', $tsr2->expandTsrV() ), | |
new KV( 'spaces', $sp ) | |
], | |
$dp | |
) | |
]; | |
} | |
private function a23($r) { | |
return $r; | |
} | |
private function a24($b) { | |
// Clear the tokenizer's backtracking cache after matching each | |
// toplevelblock. There won't be any backtracking as a document is just a | |
// sequence of toplevelblocks, so the cache for previous toplevelblocks | |
// will never be needed. | |
$end = $this->startOffset(); | |
for ( ; $this->prevOffset < $end; $this->prevOffset++ ) { | |
unset( $this->cache[$this->prevOffset] ); | |
} | |
$tokens = null; | |
if ( is_array( $b ) && count( $b ) ) { | |
$tokens = TokenizerUtils::flattenIfArray( $b ); | |
} elseif ( is_string( $b ) ) { | |
$tokens = [ $b ]; | |
} | |
// Emit tokens for this toplevelblock. This feeds a chunk to the parser pipeline. | |
return $this->emitChunk( $tokens ); | |
} | |
private function a25() { | |
return [ new NlTk( $this->tsrOffsets() ) ]; | |
} | |
private function a26($c) { | |
// WARNING(T279451): This encoding is important for the choice of key | |
// in WTUtils::fosterCommentData | |
$data = WTUtils::encodeComment( $c ); | |
$dp = new DataParsoid; | |
$dp->tsr = $this->tsrOffsets(); | |
return [ new CommentTk( $data, $dp ) ]; | |
} | |
private function a27($p) { | |
return Utils::isProtocolValid( $p, $this->env ); | |
} | |
private function a28($p) { | |
return $p; | |
} | |
private function a29($annOrExtTag, $h, $extlink, $intemplate, &$preproc, $equal, $table, $templateArg, $tableCellArg, $semicolon, $arrow, $linkdesc, $colon, &$th) { | |
return TokenizerUtils::inlineBreaks( $this->input, $this->endOffset(), [ | |
'annOrExtTag' => $annOrExtTag, | |
'h' => $h, | |
'extlink' => $extlink, | |
'intemplate' => $intemplate, | |
'preproc' => $preproc, | |
'equal' => $equal, | |
'table' => $table, | |
'templateArg' => $templateArg, | |
'tableCellArg' => $tableCellArg, | |
'semicolon' => $semicolon, | |
'arrow' => $arrow, | |
'linkdesc' => $linkdesc, | |
'colon' => $colon, | |
'th' => $th | |
], $this->env ); | |
} | |
private function a30($t) { | |
return $t; | |
} | |
private function a31($cc) { | |
// if this is an invalid entity, don't tag it with 'mw:Entity' | |
// note that some entities (like ∾̳) decode to 2 codepoints! | |
if ( mb_strlen( $cc ) > 2 /* decoded entity would be 1-2 codepoints */ ) { | |
return $cc; | |
} | |
$dpStart = new DataParsoid; | |
$dpStart->src = $this->text(); | |
$dpStart->srcContent = $cc; | |
$dpStart->tsr = $this->tsrOffsets( 'start' ); | |
$dpEnd = new DataParsoid; | |
$dpEnd->tsr = $this->tsrOffsets( 'end' ); | |
return [ | |
// If this changes, the nowiki extension's toDOM will need to follow suit | |
new TagTk( 'span', [ new KV( 'typeof', 'mw:Entity' ) ], $dpStart ), | |
$cc, | |
new EndTagTk( 'span', [], $dpEnd ) | |
]; | |
} | |
private function a32($s) { | |
return $this->endOffset(); | |
} | |
private function a33($s, $namePos0, $name) { | |
return $this->endOffset(); | |
} | |
private function a34($s, $namePos0, $name, $namePos, $v) { | |
return $v; | |
} | |
private function a35($s, $namePos0, $name, $namePos, $vd) { | |
// NB: Keep in sync w/ generic_newline_attribute | |
$res = null; | |
// Encapsulate protected attributes. | |
if ( gettype( $name ) === 'string' ) { | |
$name = TokenizerUtils::protectAttrs( $name ); | |
} | |
$nameSO = new SourceRange( $namePos0, $namePos ); | |
if ( $vd !== null ) { | |
$res = new KV( $name, $vd['value'], $nameSO->join( $vd['srcOffsets'] ) ); | |
$res->vsrc = $vd['srcOffsets']->substr( $this->input ); | |
} else { | |
$res = new KV( $name, '', $nameSO->expandTsrK() ); | |
} | |
if ( is_array( $name ) ) { | |
$res->ksrc = $nameSO->substr( $this->input ); | |
} | |
return $res; | |
} | |
private function a36($s) { | |
if ( $s !== '' ) { | |
return [ $s ]; | |
} else { | |
return []; | |
} | |
} | |
private function a37($c) { | |
return new KV( $c, '' ); | |
} | |
private function a38($namePos0, $name) { | |
return $this->endOffset(); | |
} | |
private function a39($namePos0, $name, $namePos, $v) { | |
return $v; | |
} | |
private function a40($namePos0, $name, $namePos, $vd) { | |
// NB: Keep in sync w/ table_attibute | |
$res = null; | |
// Encapsulate protected attributes. | |
if ( is_string( $name ) ) { | |
$name = TokenizerUtils::protectAttrs( $name ); | |
} | |
$nameSO = new SourceRange( $namePos0, $namePos ); | |
if ( $vd !== null ) { | |
$res = new KV( $name, $vd['value'], $nameSO->join( $vd['srcOffsets'] ) ); | |
$res->vsrc = $vd['srcOffsets']->substr( $this->input ); | |
} else { | |
$res = new KV( $name, '', $nameSO->expandTsrK() ); | |
} | |
if ( is_array( $name ) ) { | |
$res->ksrc = $nameSO->substr( $this->input ); | |
} | |
return $res; | |
} | |
private function a41($s) { | |
return $s; | |
} | |
private function a42($c) { | |
return TokenizerUtils::flattenStringlist( $c ); | |
} | |
private function a43() { | |
return $this->endOffset() === $this->inputLength; | |
} | |
private function a44($r, $cil, $bl) { | |
return array_merge( [ $r ], $cil, $bl ?: [] ); | |
} | |
private function a45($c) { | |
return $c; | |
} | |
private function a46($rs) { | |
return $rs; | |
} | |
private function a47($a) { | |
return $a; | |
} | |
private function a48($a, $b) { | |
return [ $a, $b ]; | |
} | |
private function a49($m) { | |
return Utils::decodeWtEntities( $m ); | |
} | |
private function a50($q, $ill) { | |
return $ill; | |
} | |
private function a51($q, $t) { | |
return $t; | |
} | |
private function a52($q, $r) { | |
return count( $r ) > 0 || $q !== ''; | |
} | |
private function a53($q, $r) { | |
array_unshift( $r, $q ); | |
return TokenizerUtils::flattenString( $r ); | |
} | |
private function a54($s, $t, $q) { | |
return TokenizerUtils::getAttrVal( $t, $this->startOffset() + strlen( $s ), $this->endOffset() - strlen( $q ) ); | |
} | |
private function a55($s, $t) { | |
return TokenizerUtils::getAttrVal( $t, $this->startOffset() + strlen( $s ), $this->endOffset() ); | |
} | |
private function a56($r) { | |
return TokenizerUtils::flattenString( $r ); | |
} | |
private function a57() { | |
if ( preg_match( $this->reUrltextLookahead, $this->input, $m, 0, $this->currPos ) ) { | |
$plain = $m[1]; | |
$this->urltextPlainSegment = $plain; | |
$this->urltextFoundAutolink = ( $m[2] ?? '' ) !== ''; | |
return (bool)strlen( $plain ); | |
} else { | |
$this->urltextFoundAutolink = false; | |
return false; | |
} | |
} | |
private function a58() { | |
$this->currPos += strlen( $this->urltextPlainSegment ); | |
return $this->urltextPlainSegment; | |
} | |
private function a59() { | |
return $this->urltextFoundAutolink; | |
} | |
private function a60($al) { | |
return $al; | |
} | |
private function a61($he) { | |
return $he; | |
} | |
private function a62($bs) { | |
return $bs; | |
} | |
private function a63() { | |
return $this->endOffset() === 0 && !$this->pipelineOffset; | |
} | |
private function a64($rw, $sp, $c, $wl) { | |
return count( $wl ) === 1 && $wl[0] instanceof Token; | |
} | |
private function a65($rw, $sp, $c, $wl) { | |
$link = $wl[0]; | |
if ( $sp ) { | |
$rw .= $sp; | |
} | |
if ( $c ) { | |
$rw .= $c; | |
} | |
// Build a redirect token | |
$dp = new DataParsoid; | |
$dp->src = $rw; | |
$dp->tsr = $this->tsrOffsets(); | |
$dp->linkTk = $link; | |
$redirect = new SelfclosingTagTk( 'mw:redirect', | |
// Put 'href' into attributes so it gets template-expanded | |
[ $link->getAttributeKV( 'href' ) ], | |
$dp | |
); | |
return $redirect; | |
} | |
private function a66($st, $tl) { | |
return $tl; | |
} | |
private function a67($st, $bt, $stl) { | |
return array_merge( $bt, $stl ); | |
} | |
private function a68($st, $bts) { | |
return $bts; | |
} | |
private function a69($st, $r) { | |
return array_merge( $st, $r ); | |
} | |
private function a70($s, $os, $so) { | |
return array_merge( $os, $so ); | |
} | |
private function a71($s, $s2, $bl) { | |
return array_merge( $s, $s2 ?: [], is_array( $bl ) ? $bl : [ $bl ] ); | |
} | |
private function a72($tag) { | |
return $tag; | |
} | |
private function a73($s1, $s2, $c) { | |
return array_merge( $s1, $s2, $c ); | |
} | |
private function a74(&$preproc, $t) { | |
$preproc = null; | |
return $t; | |
} | |
private function a75($v) { | |
return $v; | |
} | |
private function a76($e) { | |
return $e; | |
} | |
private function a77() { | |
return Utils::isUniWord(Utils::lastUniChar( $this->input, $this->endOffset() ) ); | |
} | |
private function a78($bs) { | |
if ( $this->siteConfig->isMagicWord( $bs ) ) { | |
$dp = new DataParsoid; | |
$dp->tsr = $this->tsrOffsets(); | |
$dp->src = $bs; | |
$dp->magicSrc = $bs; | |
return [ | |
new SelfclosingTagTk( 'behavior-switch', [ new KV( 'word', $bs ) ], $dp ) | |
]; | |
} else { | |
return [ $bs ]; | |
} | |
} | |
private function a79($quotes) { | |
// sequences of four or more than five quotes are assumed to start | |
// with some number of plain-text apostrophes. | |
$plainticks = 0; | |
$result = []; | |
if ( strlen( $quotes ) === 4 ) { | |
$plainticks = 1; | |
} elseif ( strlen( $quotes ) > 5 ) { | |
$plainticks = strlen( $quotes ) - 5; | |
} | |
if ( $plainticks > 0 ) { | |
$result[] = substr( $quotes, 0, $plainticks ); | |
} | |
// mw-quote token will be consumed in token transforms | |
$tsr = $this->tsrOffsets(); | |
$tsr->start += $plainticks; | |
$dp = new DataParsoid; | |
$dp->tsr = $tsr; | |
$mwq = new SelfclosingTagTk( 'mw-quote', | |
[ new KV( 'value', substr( $quotes, $plainticks ) ) ], | |
$dp ); | |
if ( strlen( $quotes ) > 2 ) { | |
$mwq->addAttribute( 'isSpace_1', $tsr->start > 0 && substr( $this->input, $tsr->start - 1, 1 ) === ' '); | |
$mwq->addAttribute( 'isSpace_2', $tsr->start > 1 && substr( $this->input, $tsr->start - 2, 1 ) === ' '); | |
} | |
$result[] = $mwq; | |
return $result; | |
} | |
private function a80($rw) { | |
return preg_match( $this->env->getSiteConfig()->getMagicWordMatcher( 'redirect' ), $rw ); | |
} | |
private function a81($il, $sol_il) { | |
$il = $il[0]; | |
$lname = mb_strtolower( $il->getName() ); | |
if ( !WTUtils::isIncludeTag( $lname ) ) { return false; } | |
// Preserve SOL where necessary (for onlyinclude and noinclude) | |
// Note that this only works because we encounter <*include*> tags in | |
// the toplevel content and we rely on the php preprocessor to expand | |
// templates, so we shouldn't ever be tokenizing inInclude. | |
// Last line should be empty (except for comments) | |
if ( $lname !== 'includeonly' && $sol_il && $il instanceof TagTk ) { | |
$dp = $il->dataAttribs; | |
$inclContent = $dp->extTagOffsets->stripTags( $dp->src ); | |
$nlpos = strrpos( $inclContent, "\n" ); | |
$last = $nlpos === false ? $inclContent : substr( $inclContent, $nlpos + 1 ); | |
if ( !preg_match( '/^(<!--([^-]|-(?!->))*-->)*$/D', $last ) ) { | |
return false; | |
} | |
} | |
return true; | |
} | |
private function a82($il, $sol_il) { | |
return $il; | |
} | |
private function a83($annToken) { | |
return ( $annToken instanceof Token && $annToken->getName() !== 'extension' ); | |
} | |
private function a84($annToken) { | |
return $annToken; | |
} | |
private function a85($s, $ill) { | |
return $ill ?: []; | |
} | |
private function a86($s, $ce) { | |
return $ce || strlen( $s ) > 2; | |
} | |
private function a87($s, $ce) { | |
return $this->endOffset(); | |
} | |
private function a88($s, $ce, $endTPos, $spc) { | |
$c = null; | |
$e = null; | |
$level = null; | |
if ( $ce ) { | |
$c = $ce[0]; | |
$e = $ce[1]; | |
$level = min( strlen( $s ), strlen( $e ) ); | |
} else { | |
// split up equal signs into two equal parts, with at least | |
// one character in the middle. | |
$level = (int)floor( ( strlen( $s ) - 1 ) / 2 ); | |
$c = [ str_repeat( '=', strlen( $s ) - 2 * $level ) ]; | |
$s = $e = str_repeat( '=', $level ); | |
} | |
$level = min( 6, $level ); | |
// convert surplus equals into text | |
if ( strlen( $s ) > $level ) { | |
$extras1 = substr( $s, 0, strlen( $s ) - $level ); | |
if ( is_string( $c[0] ) ) { | |
$c[0] = $extras1 . $c[0]; | |
} else { | |
array_unshift( $c, $extras1 ); | |
} | |
} | |
if ( strlen( $e ) > $level ) { | |
$extras2 = substr( $e, 0, strlen( $e ) - $level ); | |
$lastElem = PHPUtils::lastItem( $c ); | |
if ( is_string( $lastElem ) ) { | |
$c[count( $c ) - 1] .= $extras2; | |
} else { | |
$c[] = $extras2; | |
} | |
} | |
$tagDP = new DataParsoid; | |
$tagDP->tsr = $this->tsrOffsets( 'start' ); | |
$tagDP->tsr->end += $level; | |
// Match the old parser's behavior by (a) making headingIndex part of tokenizer | |
// state(don't reuse pipeline!) and (b) assigning the index when | |
// ==*== is tokenized, even if we're inside a template argument | |
// or other context which won't end up putting the heading | |
// on the output page. T213468/T214538 | |
$this->headingIndex++; | |
$tagDP->getTemp()->headingIndex = $this->headingIndex; | |
$res = [ new TagTk( 'h' . $level, [], $tagDP ) ]; | |
PHPUtils::pushArray( $res, $c ); | |
$endTagDP = new DataParsoid; | |
$endTagDP->tsr = new SourceRange( $endTPos - $level, $endTPos ); | |
$res[] = new EndTagTk( 'h' . $level, [], $endTagDP ); | |
$res[] = $spc; | |
return $res; | |
} | |
private function a89($d) { | |
return null; | |
} | |
private function a90($d) { | |
return true; | |
} | |
private function a91($d, $lineContent) { | |
$dataAttribs = new DataParsoid; | |
$dataAttribs->tsr = $this->tsrOffsets(); | |
if ( $lineContent !== null ) { | |
$dataAttribs->lineContent = $lineContent; | |
} | |
if ( strlen( $d ) > 0 ) { | |
$dataAttribs->extra_dashes = strlen( $d ); | |
} | |
return new SelfclosingTagTk( 'hr', [], $dataAttribs ); | |
} | |
private function a92($tl) { | |
return $tl; | |
} | |
private function a93($end, $name, $annOrExtTag, $isBlock) { | |
if ( $annOrExtTag ) { | |
return WTUtils::isAnnOrExtTag( $this->env, $name ); | |
} else { | |
// Only enforce ascii alpha first char for non-extension tags. | |
// See tag_name above for the details. | |
return preg_match( '/^[A-Za-z]/', $name ) && | |
$this->isXMLTag( $name, $isBlock ); | |
} | |
} | |
private function a94($end, $name, $annOrExtTag, $isBlock, $attribs, $selfclose) { | |
$lcName = mb_strtolower( $name ); | |
// Extension tags don't necessarily have the same semantics as html tags, | |
// so don't treat them as void elements. | |
$isVoidElt = Utils::isVoidElement( $lcName ) && !$annOrExtTag; | |
// Support </br> | |
if ( $lcName === 'br' && $end ) { | |
$end = null; | |
} | |
$tsr = $this->tsrOffsets(); | |
$tsr->start--; // For "<" matched at the start of xmlish_tag rule | |
$res = TokenizerUtils::buildXMLTag( $name, $lcName, $attribs, $end, !!$selfclose || $isVoidElt, $tsr ); | |
// change up data-attribs in one scenario | |
// void-elts that aren't self-closed ==> useful for accurate RT-ing | |
if ( !$selfclose && $isVoidElt ) { | |
unset( $res->dataAttribs->selfClose ); | |
$res->dataAttribs->noClose = true; | |
} | |
$met = $this->maybeAnnotationOrExtensionTag( $res, $end, $attribs, $tsr ); | |
return is_array( $met ) ? $met : [ $met ]; | |
} | |
private function a95($sp) { | |
return $this->endOffset(); | |
} | |
private function a96($sp, $p, $c) { | |
$dp = new DataParsoid; | |
$dp->tsr = new SourceRange( $p, $this->endOffset() ); | |
$dp->tokens = TokenizerUtils::flattenIfArray( $c ); | |
return [ | |
$sp, | |
new SelfclosingTagTk( 'meta', [ new KV( 'typeof', 'mw:EmptyLine' ) ], $dp ) | |
]; | |
} | |
private function a97() { | |
// Use the sol flag only at the start of the input | |
// Flag should always be an actual boolean (not falsy or undefined) | |
$this->assert( is_bool( $this->options['sol'] ), 'sol should be boolean' ); | |
return $this->endOffset() === 0 && $this->options['sol']; | |
} | |
private function a98() { | |
return []; | |
} | |
private function a99($p, $target) { | |
return $this->endOffset(); | |
} | |
private function a100($p, $target, $p0, $v) { | |
return $this->endOffset(); | |
} | |
private function a101($p, $target, $p0, $v, $p1) { | |
// empty argument | |
return [ 'tokens' => $v, 'srcOffsets' => new SourceRange( $p0, $p1 ) ]; | |
} | |
private function a102($p, $target, $r) { | |
return $r; | |
} | |
private function a103($p, $target, $params) { | |
$kvs = []; | |
if ( $target === null ) { | |
$target = [ 'tokens' => '', 'srcOffsets' => new SourceRange( $p, $p ) ]; | |
} | |
// Insert target as first positional attribute, so that it can be | |
// generically expanded. The TemplateHandler then needs to shift it out | |
// again. | |
$kvs[] = new KV( TokenizerUtils::flattenIfArray( $target['tokens'] ), '', $target['srcOffsets']->expandTsrK() ); | |
foreach ( $params as $o ) { | |
$s = $o['srcOffsets']; | |
$kvs[] = new KV( '', TokenizerUtils::flattenIfArray( $o['tokens'] ), $s->expandTsrV() ); | |
} | |
$dp = new DataParsoid; | |
$dp->tsr = $this->tsrOffsets(); | |
$dp->src = $this->text(); | |
$obj = new SelfclosingTagTk( 'templatearg', $kvs, $dp ); | |
return $obj; | |
} | |
private function a104($leadWS, $target) { | |
return $this->endOffset(); | |
} | |
private function a105($leadWS, $target, $p0, $v) { | |
return $this->endOffset(); | |
} | |
private function a106($leadWS, $target, $p0, $v, $p) { | |
// empty argument | |
$tsr0 = new SourceRange( $p0, $p ); | |
return new KV( '', TokenizerUtils::flattenIfArray( $v ), $tsr0->expandTsrV() ); | |
} | |
private function a107($leadWS, $target, $r) { | |
return $r; | |
} | |
private function a108($leadWS, $target, $params, $trailWS) { | |
// Insert target as first positional attribute, so that it can be | |
// generically expanded. The TemplateHandler then needs to shift it out | |
// again. | |
array_unshift( $params, new KV( TokenizerUtils::flattenIfArray( $target['tokens'] ), '', $target['srcOffsets']->expandTsrK() ) ); | |
$dp = new DataParsoid; | |
$dp->tsr = $this->tsrOffsets(); | |
$dp->src = $this->text(); | |
$tmp = $dp->getTemp(); | |
$tmp->leadWS = $leadWS; | |
$tmp->trailWS = $trailWS; | |
$obj = new SelfclosingTagTk( 'template', $params, $dp ); | |
return $obj; | |
} | |
private function a109($spos, $target) { | |
return $this->endOffset(); | |
} | |
private function a110($spos, $target, $tpos, $lcs) { | |
$pipeTrick = count( $lcs ) === 1 && count( $lcs[0]->v ) === 0; | |
$textTokens = []; | |
if ( $target === null || $pipeTrick ) { | |
$textTokens[] = '[['; | |
if ( $target ) { | |
$textTokens[] = $target; | |
} | |
foreach ( $lcs as $a ) { | |
// a is a mw:maybeContent attribute | |
$textTokens[] = '|'; | |
if ( count( $a->v ) > 0 ) { | |
$textTokens[] = $a->v; | |
} | |
} | |
$textTokens[] = ']]'; | |
return $textTokens; | |
} | |
$obj = new SelfclosingTagTk( 'wikilink' ); | |
$tsr = new SourceRange( $spos, $tpos ); | |
$hrefKV = new KV( 'href', $target, $tsr->expandTsrV() ); | |
$hrefKV->vsrc = $tsr->substr( $this->input ); | |
// XXX: Point to object with path, revision and input information | |
// obj.source = input; | |
$obj->attribs[] = $hrefKV; | |
$obj->attribs = array_merge( $obj->attribs, $lcs ); | |
$dp = new DataParsoid; | |
$dp->tsr = $this->tsrOffsets(); | |
$dp->src = $this->text(); | |
$obj->dataAttribs = $dp; | |
return [ $obj ]; | |
} | |
private function a111(&$preproc) { | |
$preproc = null; return true; | |
} | |
private function a112(&$preproc, $a) { | |
return $a; | |
} | |
private function a113($extToken) { | |
return !$extToken || $extToken[0]->getName() === 'extension' || | |
($extToken[0]->getName() === 'meta' && preg_match( WTUtils::ANNOTATION_META_TYPE_REGEXP, $extToken[0]->getAttribute( 'typeof' ) ) > 0); | |
} | |
private function a114($extToken) { | |
return !$extToken ? '' : $extToken[0]; | |
} | |
private function a115() { | |
return $this->env->hasAnnotations && $this->siteConfig->isAnnotationTag( 'tvar' ); | |
} | |
private function a116() { | |
$metaAttrs = [ new KV( 'typeof', 'mw:Annotation/tvar/End' ) ]; | |
$dp = new DataParsoid(); | |
$dp->tsr = $this->tsrOffsets(); | |
$dp->tsr->start--; // For "<" matched at the start of xmlish_tag rule | |
return [ new SelfclosingTagTk ( 'meta', $metaAttrs, $dp ) ]; | |
} | |
private function a117($proto, $addr, $rhe) { | |
return $rhe === '<' || $rhe === '>' || $rhe === "\u{A0}"; | |
} | |
private function a118($proto, $addr, $path) { | |
// as in Parser.php::makeFreeExternalLink, we're going to | |
// yank trailing punctuation out of this match. | |
$url = TokenizerUtils::flattenStringlist( array_merge( [ $proto, $addr ], $path ) ); | |
// only need to look at last element; HTML entities are strip-proof. | |
$last = PHPUtils::lastItem( $url ); | |
$trim = 0; | |
if ( is_string( $last ) ) { | |
$strip = TokenizerUtils::getAutoUrlTerminatingChars( in_array( '(', $path, true ) ); | |
$trim = strspn( strrev( $last ), $strip ); | |
$url[ count( $url |