| 1573 | } |
| 1574 | } |
| 1575 | addFeatures(...featureClasses) { |
| 1576 | for (const FeatureClass of featureClasses) { |
| 1577 | if (!FeatureClass.keyword) { |
| 1578 | throw new Error(`Feature class ${FeatureClass.name} must have a static 'keyword' property`); |
| 1579 | } |
| 1580 | if (!FeatureClass.parse) { |
| 1581 | throw new Error(`Feature class ${FeatureClass.name} must have a static 'parse' method`); |
| 1582 | } |
| 1583 | this.addFeature(FeatureClass.keyword, FeatureClass.parse); |
| 1584 | } |
| 1585 | } |
| 1586 | addFeature(keyword, definition) { |
| 1587 | var featureGrammarType = keyword + "Feature"; |
| 1588 | this.#grammar[featureGrammarType] = definition; |