Skip to content

Commit

Permalink
Prase the outer ASN type
Browse files Browse the repository at this point in the history
  • Loading branch information
kellerkindt committed Apr 27, 2020
1 parent 4a85108 commit c4da2ce
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions asn1rs-macros/src/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use std::str::FromStr;
use syn::export::TokenStream2;
use syn::parse::{Parse, ParseBuffer};
use syn::spanned::Spanned;
use syn::Item;
use syn::{parse_macro_input, AttributeArgs};
use syn::{parse_macro_input, AttributeArgs, Meta};
use syn::{Item, NestedMeta};
use tag::AttrTag;

pub(crate) fn parse(attr: TokenStream, item: TokenStream) -> TokenStream {
Expand All @@ -20,6 +20,19 @@ pub(crate) fn parse(attr: TokenStream, item: TokenStream) -> TokenStream {
let attributes = parse_macro_input!(attr as AttributeArgs);
let item = parse_macro_input!(item as Item);

let asn_type_decl = match attributes.get(0) {
None => panic!("Missing ASN attribute"),
Some(NestedMeta::Meta(Meta::Path(path))) => path
.segments
.iter()
.next()
.expect("Missing ASN Attribute in path")
.ident
.to_string()
.to_lowercase(),
_ => panic!("Invalid ASN Attribute type"),
};

let mut additional_impl: Vec<TokenStream2> = Vec::default();

let item = match item {
Expand Down

0 comments on commit c4da2ce

Please sign in to comment.