Package Exports
- lively.ast
- lively.ast/dist/lively.ast.js
- lively.ast/dist/lively.ast_no-deps.js
- lively.ast/lib/nodes.js
- lively.ast/lib/parser.js
- lively.ast/lib/stringify.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (lively.ast) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
lively.ast 
Parsing JS code into ASTs and tools to query and transform these trees.
API
main interface
ast.printAstast.compareAstast.pathToNodeast.stringifyast.parseast.parseFunctionast.fuzzyParseast.nodesAtast.withMozillaAstDo
Visitors
ast.MozillaAST.BaseVisitorast.MozillaAST.PrinterVisitorast.MozillaAST.ComparisonVisitorast.MozillaAST.ScopeVisitor
query ast nodes
ast.query.knownGlobalsast.query.scopesast.query.nodesAtIndexast.query.scopesAtIndexast.query.scopeAtIndexast.query.scopesAtPosast.query.nodesInScopeOfast.query.topLevelDeclsAndRefsast.query.findGlobalVarRefsast.query.findNodesIncludingLinesast.query.findReferencesAndDeclsInScopeast.query.findDeclarationClosestToIndex
transform asts
ast.transform.replaceast.transform.replaceTopLevelVarDeclAndUsageForCapturingast.transform.oneDeclaratorPerVarDeclast.transform.oneDeclaratorForVarsInDestructoringast.transform.returnLastStatementast.transform.wrapInFunction
comment parsing
ast.comments.extractComments
code categorizer, scan code for known constructs
ast.codeCategorizer.findDecls
Usage
node.js
var ast = require('lively.ast'),
parsed = ast.parse("1 + 2");
ast.printAst(parsed);
// =>
// :Program
// \-.body[0]:ExpressionStatement
// \-.body[0].expression:BinaryExpression
// |-.body[0].expression.left:Literal
// \-.body[0].expression.right:Literal
...browser
HTML: <script src="dist/lively.ast.bundle.js"></script>
JS: like above
Development
build dist
npm run build
Testing
npm test
LICENSE
MIT