Skip to content

Commit

Permalink
0.4.0 (#4)
Browse files Browse the repository at this point in the history
* 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
FreeMasen authored Aug 28, 2019
1 parent bff9210 commit 4dbbfa3
Show file tree
Hide file tree
Showing 21 changed files with 3,129 additions and 3,557 deletions.
19 changes: 11 additions & 8 deletions .gitignore
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
36 changes: 24 additions & 12 deletions Cargo.toml
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"]
34 changes: 17 additions & 17 deletions README.md
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)
3 changes: 3 additions & 0 deletions crates/derive_as_concrete/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/target
**/*.rs.bk
Cargo.lock
14 changes: 14 additions & 0 deletions crates/derive_as_concrete/Cargo.toml
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
21 changes: 21 additions & 0 deletions crates/derive_as_concrete/src/lib.rs
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()
}
26 changes: 26 additions & 0 deletions run_es_parse.js
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));
Loading

0 comments on commit 4dbbfa3

Please sign in to comment.