| @@ 180-218 (lines=39) @@ | ||
| 177 | return result0; |
|
| 178 | } |
|
| 179 | ||
| 180 | function parse__() { |
|
| 181 | var cacheKey = "_@" + pos; |
|
| 182 | var cachedResult = cache[cacheKey]; |
|
| 183 | if (cachedResult) { |
|
| 184 | pos = cachedResult.nextPos; |
|
| 185 | return cachedResult.result; |
|
| 186 | } |
|
| 187 | ||
| 188 | var result0, result1; |
|
| 189 | ||
| 190 | result0 = []; |
|
| 191 | if (input.charCodeAt(pos) === 32) { |
|
| 192 | result1 = " "; |
|
| 193 | pos++; |
|
| 194 | } else { |
|
| 195 | result1 = null; |
|
| 196 | if (reportFailures === 0) { |
|
| 197 | matchFailed("\" \""); |
|
| 198 | } |
|
| 199 | } |
|
| 200 | while (result1 !== null) { |
|
| 201 | result0.push(result1); |
|
| 202 | if (input.charCodeAt(pos) === 32) { |
|
| 203 | result1 = " "; |
|
| 204 | pos++; |
|
| 205 | } else { |
|
| 206 | result1 = null; |
|
| 207 | if (reportFailures === 0) { |
|
| 208 | matchFailed("\" \""); |
|
| 209 | } |
|
| 210 | } |
|
| 211 | } |
|
| 212 | ||
| 213 | cache[cacheKey] = { |
|
| 214 | nextPos: pos, |
|
| 215 | result: result0 |
|
| 216 | }; |
|
| 217 | return result0; |
|
| 218 | } |
|
| 219 | ||
| 220 | function parse_identifierName() { |
|
| 221 | var cacheKey = "identifierName@" + pos; |
|
| @@ 2111-2144 (lines=34) @@ | ||
| 2108 | return result0; |
|
| 2109 | } |
|
| 2110 | ||
| 2111 | function parse_lastChild() { |
|
| 2112 | var cacheKey = "lastChild@" + pos; |
|
| 2113 | var cachedResult = cache[cacheKey]; |
|
| 2114 | if (cachedResult) { |
|
| 2115 | pos = cachedResult.nextPos; |
|
| 2116 | return cachedResult.result; |
|
| 2117 | } |
|
| 2118 | ||
| 2119 | var result0; |
|
| 2120 | var pos0; |
|
| 2121 | ||
| 2122 | pos0 = pos; |
|
| 2123 | if (input.substr(pos, 11) === ":last-child") { |
|
| 2124 | result0 = ":last-child"; |
|
| 2125 | pos += 11; |
|
| 2126 | } else { |
|
| 2127 | result0 = null; |
|
| 2128 | if (reportFailures === 0) { |
|
| 2129 | matchFailed("\":last-child\""); |
|
| 2130 | } |
|
| 2131 | } |
|
| 2132 | if (result0 !== null) { |
|
| 2133 | result0 = (function(offset) { return nthLast(1); })(pos0); |
|
| 2134 | } |
|
| 2135 | if (result0 === null) { |
|
| 2136 | pos = pos0; |
|
| 2137 | } |
|
| 2138 | ||
| 2139 | cache[cacheKey] = { |
|
| 2140 | nextPos: pos, |
|
| 2141 | result: result0 |
|
| 2142 | }; |
|
| 2143 | return result0; |
|
| 2144 | } |
|
| 2145 | ||
| 2146 | function parse_nthChild() { |
|
| 2147 | var cacheKey = "nthChild@" + pos; |
|
| @@ 2076-2109 (lines=34) @@ | ||
| 2073 | return result0; |
|
| 2074 | } |
|
| 2075 | ||
| 2076 | function parse_firstChild() { |
|
| 2077 | var cacheKey = "firstChild@" + pos; |
|
| 2078 | var cachedResult = cache[cacheKey]; |
|
| 2079 | if (cachedResult) { |
|
| 2080 | pos = cachedResult.nextPos; |
|
| 2081 | return cachedResult.result; |
|
| 2082 | } |
|
| 2083 | ||
| 2084 | var result0; |
|
| 2085 | var pos0; |
|
| 2086 | ||
| 2087 | pos0 = pos; |
|
| 2088 | if (input.substr(pos, 12) === ":first-child") { |
|
| 2089 | result0 = ":first-child"; |
|
| 2090 | pos += 12; |
|
| 2091 | } else { |
|
| 2092 | result0 = null; |
|
| 2093 | if (reportFailures === 0) { |
|
| 2094 | matchFailed("\":first-child\""); |
|
| 2095 | } |
|
| 2096 | } |
|
| 2097 | if (result0 !== null) { |
|
| 2098 | result0 = (function(offset) { return nth(1); })(pos0); |
|
| 2099 | } |
|
| 2100 | if (result0 === null) { |
|
| 2101 | pos = pos0; |
|
| 2102 | } |
|
| 2103 | ||
| 2104 | cache[cacheKey] = { |
|
| 2105 | nextPos: pos, |
|
| 2106 | result: result0 |
|
| 2107 | }; |
|
| 2108 | return result0; |
|
| 2109 | } |
|
| 2110 | ||
| 2111 | function parse_lastChild() { |
|
| 2112 | var cacheKey = "lastChild@" + pos; |
|
| @@ 730-763 (lines=34) @@ | ||
| 727 | return result0; |
|
| 728 | } |
|
| 729 | ||
| 730 | function parse_wildcard() { |
|
| 731 | var cacheKey = "wildcard@" + pos; |
|
| 732 | var cachedResult = cache[cacheKey]; |
|
| 733 | if (cachedResult) { |
|
| 734 | pos = cachedResult.nextPos; |
|
| 735 | return cachedResult.result; |
|
| 736 | } |
|
| 737 | ||
| 738 | var result0; |
|
| 739 | var pos0; |
|
| 740 | ||
| 741 | pos0 = pos; |
|
| 742 | if (input.charCodeAt(pos) === 42) { |
|
| 743 | result0 = "*"; |
|
| 744 | pos++; |
|
| 745 | } else { |
|
| 746 | result0 = null; |
|
| 747 | if (reportFailures === 0) { |
|
| 748 | matchFailed("\"*\""); |
|
| 749 | } |
|
| 750 | } |
|
| 751 | if (result0 !== null) { |
|
| 752 | result0 = (function(offset, a) { return { type: 'wildcard', value: a }; })(pos0, result0); |
|
| 753 | } |
|
| 754 | if (result0 === null) { |
|
| 755 | pos = pos0; |
|
| 756 | } |
|
| 757 | ||
| 758 | cache[cacheKey] = { |
|
| 759 | nextPos: pos, |
|
| 760 | result: result0 |
|
| 761 | }; |
|
| 762 | return result0; |
|
| 763 | } |
|
| 764 | ||
| 765 | function parse_identifier() { |
|
| 766 | var cacheKey = "identifier@" + pos; |
|