-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into wip/sb/change-password-in-settings
- Loading branch information
Showing
910 changed files
with
15,552 additions
and
6,529 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Ast } from './tree' | ||
|
||
/// Returns a GraphViz graph illustrating parent/child relationships in the given subtree. | ||
export function graphParentPointers(ast: Ast) { | ||
const sanitize = (id: string) => id.replace('ast:', '').replace(/[^A-Za-z0-9]/g, '') | ||
const parentToChild = new Array<{ parent: string; child: string }>() | ||
const childToParent = new Array<{ child: string; parent: string }>() | ||
ast.visitRecursiveAst((ast) => { | ||
for (const child of ast.children()) { | ||
if (child instanceof Ast) | ||
parentToChild.push({ child: sanitize(child.id), parent: sanitize(ast.id) }) | ||
} | ||
const parent = ast.parentId | ||
if (parent) childToParent.push({ child: sanitize(ast.id), parent: sanitize(parent) }) | ||
}) | ||
let result = 'digraph parentPointers {\n' | ||
for (const { parent, child } of parentToChild) result += `${parent} -> ${child};\n` | ||
for (const { child, parent } of childToParent) | ||
result += `${child} -> ${parent} [weight=0; color=red; style=dotted];\n` | ||
result += '}\n' | ||
return result | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.