semantic_parser.js 576 B

1234567891011121314151617181920212223
  1. import { SemanticNodeFactory } from './semantic_node_factory.js';
  2. export class SemanticAbstractParser {
  3. constructor(type) {
  4. this.type = type;
  5. this.factory_ = new SemanticNodeFactory();
  6. }
  7. getFactory() {
  8. return this.factory_;
  9. }
  10. setFactory(factory) {
  11. this.factory_ = factory;
  12. }
  13. getType() {
  14. return this.type;
  15. }
  16. parseList(list) {
  17. const result = [];
  18. for (let i = 0, element; (element = list[i]); i++) {
  19. result.push(this.parse(element));
  20. }
  21. return result;
  22. }
  23. }