Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* implement an ast explorer * update docs deps * implement import as * For both relative and absolute imports * fix linker deps
- Loading branch information
Showing
31 changed files
with
10,921 additions
and
8,024 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,4 +37,7 @@ jspm_packages | |
|
||
# Optional REPL history | ||
.node_repl_history | ||
.idea/ | ||
.idea/ | ||
|
||
# AST Debug folder | ||
ast_view |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,2 @@ | ||
const print = require('./src/print'); | ||
module.exports = print; |
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,28 @@ | ||
// Print nodes like JSX elements | ||
"use strict"; | ||
|
||
function getValue(node) { | ||
if (node.value.length < 60) { | ||
return node.value; | ||
} | ||
|
||
return node.value.slice(0,60) + "..."; | ||
} | ||
|
||
function print(node) { | ||
if (!node.params.length) { | ||
return `<${node.Type} value="${getValue(node)}" />` | ||
} | ||
|
||
return `<${node.Type} value="${getValue(node)}" > | ||
${node.params.filter(Boolean).map(child => { | ||
const childStr = print(child); | ||
return childStr.split("\n").map(s => " " + s).join("\n"); | ||
}).join("\n")} | ||
</${node.Type}>`; | ||
|
||
}; | ||
|
||
module.exports = print; |
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.