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