Update syn, quote libs
This commit is contained in:
parent
de199e785a
commit
e934d7bdc5
@ -13,7 +13,7 @@ fn extract_attribute_arg_by_name(name: &str, attrs: &Vec<Attribute>) -> Option<S
|
||||
use syn::{Meta, Lit, MetaNameValue};
|
||||
attrs.iter().map(|attr| attr.interpret_meta()).find(|meta| {
|
||||
match meta {
|
||||
&Some(Meta::NameValue(MetaNameValue { ident, .. })) if ident.as_ref() == name => true,
|
||||
&Some(Meta::NameValue(MetaNameValue { ref ident, .. })) if ident == name => true,
|
||||
_ => false
|
||||
}
|
||||
}).and_then(|meta| {
|
||||
@ -28,20 +28,20 @@ fn extract_attribute_list(name: &str, attrs: &Vec<Attribute>) -> Option<Vec<(Ide
|
||||
use syn::{Meta, MetaList, NestedMeta};
|
||||
attrs.iter().find(|attr| {
|
||||
match attr.path.segments.iter().nth(0) {
|
||||
Some(segment) if segment.ident.as_ref() == name => true,
|
||||
Some(segment) if segment.ident == name => true,
|
||||
_ => false
|
||||
}
|
||||
}).and_then(|attr| {
|
||||
match attr.interpret_meta() {
|
||||
Some(Meta::List(MetaList { nested, .. })) => {
|
||||
Some(nested.iter().map(|nested_meta| match nested_meta {
|
||||
&NestedMeta::Meta(Meta::Word(ident)) => (ident, None),
|
||||
&NestedMeta::Meta(Meta::List(MetaList { ident, nested: ref nested2, .. })) => {
|
||||
&NestedMeta::Meta(Meta::Word(ref ident)) => (ident.clone(), None),
|
||||
&NestedMeta::Meta(Meta::List(MetaList { ref ident, nested: ref nested2, .. })) => {
|
||||
let own_args = nested2.iter().map(|nested_meta2| match nested_meta2 {
|
||||
&NestedMeta::Meta(Meta::Word(ident)) => ident,
|
||||
&NestedMeta::Meta(Meta::Word(ref ident)) => ident.clone(),
|
||||
_ => panic!("Bad format for doubly-nested attribute list")
|
||||
}).collect();
|
||||
(ident, Some(own_args))
|
||||
(ident.clone(), Some(own_args))
|
||||
},
|
||||
_ => panic!("Bad format for nested list")
|
||||
}).collect())
|
||||
@ -60,7 +60,7 @@ pub fn derive_programming_language_interface(input: TokenStream) -> TokenStream
|
||||
let language_name: String = extract_attribute_arg_by_name("LanguageName", attrs).expect("LanguageName is required");
|
||||
let file_ext = extract_attribute_arg_by_name("SourceFileExtension", attrs).expect("SourceFileExtension is required");
|
||||
let passes = extract_attribute_list("PipelineSteps", attrs).expect("PipelineSteps are required");
|
||||
let pass_idents = passes.iter().map(|x| x.0);
|
||||
let pass_idents = passes.iter().map(|x| x.0.clone());
|
||||
let doc_method: Option<String> = extract_attribute_arg_by_name("DocMethod", attrs);
|
||||
|
||||
//let pass_names: Vec<String> = passes.iter().map(|pass| pass.0.to_string()).collect();
|
||||
@ -79,7 +79,7 @@ pub fn derive_programming_language_interface(input: TokenStream) -> TokenStream
|
||||
}
|
||||
});
|
||||
|
||||
let tokens: quote::Tokens = quote! {
|
||||
let tokens = quote! {
|
||||
use schala_repl::PassDescriptor;
|
||||
impl ProgrammingLanguageInterface for #name {
|
||||
fn get_language_name(&self) -> String {
|
||||
|
Loading…
Reference in New Issue
Block a user