Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elixirscript/elixir-estree
The ESTree Nodes and JavaScript AST to JavaScript Code Generator in Elixir
https://github.com/elixirscript/elixir-estree
Last synced: about 1 month ago
JSON representation
The ESTree Nodes and JavaScript AST to JavaScript Code Generator in Elixir
- Host: GitHub
- URL: https://github.com/elixirscript/elixir-estree
- Owner: elixirscript
- Created: 2015-02-17T21:18:51.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2019-07-29T15:18:53.000Z (over 5 years ago)
- Last Synced: 2024-09-16T17:48:16.363Z (3 months ago)
- Language: Elixir
- Homepage:
- Size: 177 KB
- Stars: 103
- Watchers: 8
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - A implementation of the SpiderMonkey Parser API in Elixir. (ECMAScript)
README
## Elixir-ESTree [![Documentation](https://img.shields.io/badge/docs-hexpm-blue.svg)](http://hexdocs.pm/estree/) [![Downloads](https://img.shields.io/hexpm/dt/estree.svg)](https://hex.pm/packages/estree) [![Build Status](https://travis-ci.org/elixirscript/elixir-estree.svg?branch=master)](https://travis-ci.org/elixirscript/elixir-estree)
Defines structs that represent the JavaScript AST nodes from the ESTree spec.
[ESTree Spec](https://github.com/estree/estree)
[JSX AST Spec](https://github.com/facebook/jsx)
Also includes a JavaScript AST to JavaScript code generator.
```elixir
alias ESTree.Tools.Builder
alias ESTree.Tools.Generatorast = Builder.array_expression([
Builder.literal(1),
Builder.identifier(:a)
])Generator.generate(ast)
# "[1, a]"#jsx ast and generation
ast = Builder.jsx_element(
Builder.jsx_opening_element(
Builder.jsx_identifier(
"Test"
)
),
[],
Builder.jsx_closing_element(
Builder.jsx_identifier(
"Test"
)
)
)
Generator.generate(ast)
# ""
```