-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* publish first beta of re-factor * not quite working tests * slowly through the testing * partially though expressions * more tests * slowly closer * es5 almost done * bump version * All but 2 strings es5 * unescaoe stuff * progress on es2015-script * remove error cycle * class body stuff * more progress * slowly closer * add logging, more work towrad es2015 * closer... * serialization working * actually working esprima support * Feature gated esprima and serde support * bump beta version * * bump out of beta * clean up root dir
- Loading branch information
Showing
21 changed files
with
3,129 additions
and
3,557 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 |
---|---|---|
@@ -1,8 +1,11 @@ | ||
/target | ||
**/*.rs.bk | ||
|
||
/target | ||
**/*.rs.bk | ||
Cargo.lock | ||
.vscode/settings.json | ||
/node_modules | ||
**/target | ||
**/*.rs.bk | ||
Cargo.lock | ||
.vscode/* | ||
/node_modules | ||
*.es.json | ||
*.rs.json | ||
*.js.json | ||
*.log | ||
package-lock.json | ||
*.ron |
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 |
---|---|---|
@@ -1,12 +1,24 @@ | ||
[package] | ||
name = "resast" | ||
version = "0.3.0" | ||
authors = ["rfm <[email protected]>"] | ||
edition = "2018" | ||
description = "Rusty-ECMAScript Abstract Syntax Tree" | ||
repository = "https://github.com/FreeMasen/resast" | ||
license = "MIT" | ||
keywords = ["JavaScript", "parsing", "JS", "ES", "ECMA"] | ||
categories = ["parsing", "text-processing", "web-programming"] | ||
|
||
[dependencies] | ||
[package] | ||
name = "resast" | ||
version = "0.4.0" | ||
authors = ["rfm <[email protected]>"] | ||
edition = "2018" | ||
description = "Rusty-ECMAScript Abstract Syntax Tree" | ||
repository = "https://github.com/FreeMasen/resast" | ||
license = "MIT" | ||
keywords = ["JavaScript", "parsing", "JS", "ES", "ECMA"] | ||
categories = ["parsing", "text-processing", "web-programming"] | ||
|
||
[dependencies] | ||
serde = { version = "1", optional = true } | ||
serde_derive = { version = "1", optional = true } | ||
|
||
[dev-dependencies] | ||
serde_json = "1" | ||
ressa = "0.7.0-beta-6" | ||
pretty_env_logger = "0.3" | ||
|
||
[features] | ||
default = [] | ||
serialization = ["serde", "serde_derive"] | ||
esprima = ["serialization"] |
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 |
---|---|---|
@@ -1,18 +1,18 @@ | ||
# RESAST | ||
> Rusty ECMAScript Abstract Syntax Tree | ||
[![crates.io](https://img.shields.io/crates/v/resast.svg)](https://crates.io/crates/resast) | ||
[![API Documentation on docs.rs](https://docs.rs/resast/badge.svg)](https://docs.rs/resast) | ||
[![last commit master](https://img.shields.io/github/last-commit/FreeMasen/resast.svg)](https://github.com/FreeMasen/resast/) | ||
|
||
## Contributing | ||
If you are interested in contributing to RESAST know that I would be happy for the help! | ||
|
||
Feel free to open issues and/or pull requests for anything that you see that might be an improvement. | ||
|
||
I do not work on this full time, please be patient if I am not able to respond quickly. | ||
|
||
Before starting on any work, please comment on an existing issue or open a new issue in order to reduce | ||
the chance that work would get duplicated. | ||
|
||
# RESAST | ||
> Rusty ECMAScript Abstract Syntax Tree | ||
[![crates.io](https://img.shields.io/crates/v/resast.svg)](https://crates.io/crates/resast) | ||
[![API Documentation on docs.rs](https://docs.rs/resast/badge.svg)](https://docs.rs/resast) | ||
[![last commit master](https://img.shields.io/github/last-commit/FreeMasen/resast.svg)](https://github.com/FreeMasen/resast/) | ||
|
||
## Contributing | ||
If you are interested in contributing to RESAST know that I would be happy for the help! | ||
|
||
Feel free to open issues and/or pull requests for anything that you see that might be an improvement. | ||
|
||
I do not work on this full time, please be patient if I am not able to respond quickly. | ||
|
||
Before starting on any work, please comment on an existing issue or open a new issue in order to reduce | ||
the chance that work would get duplicated. | ||
|
||
[check out the issues](https://github.com/FreeMasen/resast/issues) |
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,3 @@ | ||
/target | ||
**/*.rs.bk | ||
Cargo.lock |
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,14 @@ | ||
[package] | ||
name = "derive_as_concrete" | ||
version = "0.1.0" | ||
authors = ["rmasen"] | ||
edition = "2018" | ||
|
||
|
||
[dependencies] | ||
quote = "0.6" | ||
proc-macro2 = "0.4" | ||
syn = { version = "0.15", features = ["full"] } | ||
|
||
[lib] | ||
proc-macro = true |
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,21 @@ | ||
extern crate proc_macro; | ||
use proc_macro::TokenStream; | ||
use quote::quote; | ||
|
||
#[proc_macro_derive(AsConcrete)] | ||
pub fn as_concrete(input: TokenStream) -> TokenStream { | ||
let input = syn::parse(input).unwrap(); | ||
impl_as_concrete(&input) | ||
} | ||
|
||
fn impl_as_concrete(ast: &syn::DeriveInput) -> TokenStream { | ||
let name = &ast.ident; | ||
let gen = quote! { | ||
impl AsConcrete<#name> for #name { | ||
fn as_concrete(&self) -> #name { | ||
self.clone() | ||
} | ||
} | ||
}; | ||
gen.into() | ||
} |
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,26 @@ | ||
const esp = require('esprima'); | ||
const fs = require('fs'); | ||
async function main() { | ||
let js = process.argv[2]; | ||
console.error(js); | ||
return new Promise((r, j) => { | ||
fs.readFile(js, 'utf8', (err, content) => { | ||
if (err) return j(err); | ||
let parsed; | ||
if (js.endsWith('module.js')) { | ||
parsed = esp.parseModule(content); | ||
} else { | ||
parsed = esp.parseScript(content); | ||
} | ||
let json = JSON.stringify(parsed, (key, value) => { | ||
if (key === 'value' && value instanceof RegExp) { | ||
value = value.toString(); | ||
} | ||
return value; | ||
}, 4); | ||
return r(json); | ||
}); | ||
}) | ||
} | ||
|
||
main().then((json) => console.log(json)).catch(e => console.error(e)); |
Oops, something went wrong.