summaryrefslogtreecommitdiffstats
path: root/llparse-frontend/test/fixtures/implementation/node/single.ts
blob: b24ef93cbe15ffd68a4ba2c99408fa9c5bc732cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { node } from '../../../../src/frontend';
import { Node } from './base';

export class Single extends Node<node.Single> {
  protected doBuild(out: string[]): void {
    const edges: string[] = [];
    for (const edge of this.ref.edges) {
      let str = `k${edge.key}${edge.noAdvance ? '-no_adv-' : ''}=` +
        `${edge.node.ref.id.name}`;
      if (edge.value !== undefined) {
        str += `:${edge.value}`;
      }
      edges.push(str);
    }
    out.push(this.format(edges.join(' ')));

    for (const edge of this.ref.edges) {
      const edgeNode = edge.node as Node<node.Node>;
      edgeNode.build(out);
    }
  }
}