Skip to content

Instantly share code, notes, and snippets.

@yasu-n
Created September 13, 2018 14:45
Show Gist options
  • Save yasu-n/a6a1751a9f606261424ba8bbd332b463 to your computer and use it in GitHub Desktop.
Save yasu-n/a6a1751a9f606261424ba8bbd332b463 to your computer and use it in GitHub Desktop.
show ast using rustic-ap-syntax
extern crate syntax;
use syntax::with_globals;
use syntax::parse::*;
use syntax::source_map::*;
use std::path::Path;
fn main() {
syntax::with_globals (|| {
let args: Vec<String> = std::env::args().collect();
let p = Path::new(&args[1]);
let s = ParseSess::new(FilePathMapping::empty());
let r = parse_crate_from_file(&p, &s);
println!("{:#?}", r);
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment