(parser)
| 173 | } |
| 174 | |
| 175 | parseHyperscriptProgram(parser) { |
| 176 | var features = []; |
| 177 | if (parser.hasMore()) { |
| 178 | while (parser.currentToken().type !== "EOF") { |
| 179 | var keyword = parser.currentToken().value; |
| 180 | if (parser.featureStart(parser.currentToken()) || parser.currentToken().value === "(") { |
| 181 | try { |
| 182 | var feature = parser.requireElement("feature"); |
| 183 | features.push(feature); |
| 184 | parser.matchToken("end"); // optional end |
| 185 | } catch (e) { |
| 186 | if (e instanceof ParseRecoverySentinel) { |
| 187 | features.push(new FailedFeature(e.parseError, keyword)); |
| 188 | this.#syncToFeature(parser); |
| 189 | } else { |
| 190 | throw e; |
| 191 | } |
| 192 | } |
| 193 | } else if (parser.currentToken().value === "end") { |
| 194 | break; // scope terminator (e.g. behavior body) - leave for outer parser |
| 195 | } else { |
| 196 | // Unconsumed token between features - report and sync |
| 197 | try { |
| 198 | parser.raiseError(); |
| 199 | } catch (e) { |
| 200 | if (e instanceof ParseRecoverySentinel) { |
| 201 | features.push(new FailedFeature(e.parseError, keyword)); |
| 202 | this.#syncToFeature(parser); |
| 203 | } else { |
| 204 | throw e; |
| 205 | } |
| 206 | } |
| 207 | } |
| 208 | } |
| 209 | } |
| 210 | return new HyperscriptProgram(features); |
| 211 | } |
| 212 | |
| 213 | use(plugin) { |
| 214 | plugin(this) |
nothing calls this directly
no test coverage detected