Skip to content

Commit

Permalink
feat: support parsing asm! args
Browse files Browse the repository at this point in the history
  • Loading branch information
calebcartwright committed Dec 29, 2021
1 parent 50bbb43 commit f935f0c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib.rs
Expand Up @@ -15,6 +15,7 @@ extern crate log;
// N.B. these crates are loaded from the sysroot, so they need extern crate.
extern crate rustc_ast;
extern crate rustc_ast_pretty;
extern crate rustc_builtin_macros;
extern crate rustc_data_structures;
extern crate rustc_errors;
extern crate rustc_expand;
Expand Down
11 changes: 11 additions & 0 deletions src/parse/macros/asm.rs
@@ -0,0 +1,11 @@
use rustc_ast::ast;
use rustc_builtin_macros::asm::{parse_asm_args, AsmArgs};

use crate::rewrite::RewriteContext;

#[allow(dead_code)]
pub(crate) fn parse_asm(context: &RewriteContext<'_>, mac: &ast::MacCall) -> Option<AsmArgs> {
let ts = mac.args.inner_tokens();
let mut parser = super::build_parser(context, ts);
parse_asm_args(&mut parser, context.parse_sess.inner(), mac.span(), false).ok()
}
1 change: 1 addition & 0 deletions src/parse/macros/mod.rs
Expand Up @@ -10,6 +10,7 @@ use rustc_span::Symbol;
use crate::macros::MacroArg;
use crate::rewrite::RewriteContext;

pub(crate) mod asm;
pub(crate) mod cfg_if;
pub(crate) mod lazy_static;

Expand Down

0 comments on commit f935f0c

Please sign in to comment.