diff --git a/Cargo.lock b/Cargo.lock index c8c7506..11b7cc7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -499,6 +499,17 @@ dependencies = [ "syn", ] +[[package]] +name = "rust-sitter-example" +version = "0.1.1" +dependencies = [ + "codemap", + "codemap-diagnostic", + "insta", + "rust-sitter", + "rust-sitter-tool", +] + [[package]] name = "rust-sitter-macro" version = "0.1.1" @@ -527,17 +538,6 @@ dependencies = [ "tree-sitter-cli", ] -[[package]] -name = "rust-sitter_example" -version = "0.1.1" -dependencies = [ - "codemap", - "codemap-diagnostic", - "insta", - "rust-sitter", - "rust-sitter-tool", -] - [[package]] name = "rustc-hash" version = "1.1.0" diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..1105f3b --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Shadaj Laddad + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/example/Cargo.toml b/example/Cargo.toml index fe98005..c4039bc 100644 --- a/example/Cargo.toml +++ b/example/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "rust-sitter_example" +name = "rust-sitter-example" version = "0.1.1" authors = ["Shadaj Laddad "] edition = "2021" diff --git a/macro/src/lib.rs b/macro/src/lib.rs index aee6759..92d9577 100644 --- a/macro/src/lib.rs +++ b/macro/src/lib.rs @@ -284,14 +284,18 @@ fn expand_grammar(input: ItemMod) -> ItemMod { ) }); - let match_cases: Vec = e.variants.iter().map(|v| { - let variant_path = format!("{}_{}", e.ident, v.ident); - let extract_ident = - Ident::new(&format!("extract_{}", variant_path), Span::call_site()); - syn::parse_quote! { - #variant_path => #extract_ident(node.child(0).unwrap(), source) - } - }).collect(); + let match_cases: Vec = e + .variants + .iter() + .map(|v| { + let variant_path = format!("{}_{}", e.ident, v.ident); + let extract_ident = + Ident::new(&format!("extract_{}", variant_path), Span::call_site()); + syn::parse_quote! { + #variant_path => #extract_ident(node.child(0).unwrap(), source) + } + }) + .collect(); e.attrs.retain(|a| !is_sitter_attr(a)); e.variants.iter_mut().for_each(|v| {