This commit is contained in:
@ -21,6 +21,7 @@ interface Stringable {
|
||||
}
|
||||
|
||||
export class GraphStream extends Transform {
|
||||
private _node_count = 0;
|
||||
private _path: string[] = [];
|
||||
private _state: (GraphStreamCommand | '')[] = [
|
||||
'',
|
||||
@ -33,6 +34,10 @@ export class GraphStream extends Transform {
|
||||
return this._path.join ('_');
|
||||
}
|
||||
|
||||
public get node_count (): number {
|
||||
return this._node_count;
|
||||
}
|
||||
|
||||
private get level (): string {
|
||||
return ' '.repeat (this._path.length);
|
||||
}
|
||||
@ -114,6 +119,7 @@ export class GraphStream extends Transform {
|
||||
case 'cn': // create node
|
||||
this.finish_node ();
|
||||
this.push (`${this.level}${this.path}_${instr.args[0]}`);
|
||||
this._node_count++;
|
||||
break;
|
||||
case 'at': // add attributes
|
||||
if ([
|
||||
|
Reference in New Issue
Block a user