From 2e576c9c0c95dbd5676fb684bd50b1876f738d64 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Tue, 29 Jun 2021 19:42:17 -0600 Subject: friendship ended with clang, janky hand rolled bullshit is my new best friend --- src/main.rs | 17 +++++------------ src/parse.rs | 6 ++++++ 2 files changed, 11 insertions(+), 12 deletions(-) create mode 100644 src/parse.rs (limited to 'src') diff --git a/src/main.rs b/src/main.rs index ebc9d71..732805c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,9 +1,9 @@ use std::env::{current_dir, set_current_dir}; -use std::fs::{create_dir_all, metadata}; +use std::fs::{create_dir_all, metadata, read_to_string}; use std::path::Path; use std::process::Command; -use clang::{Clang, Index}; +mod parse; const TARGET_TAG: &str = "v3.1.5"; @@ -24,8 +24,6 @@ fn main() { "--quiet", "https://github.com/wxWidgets/wxWidgets.git", "orig", - "--depth", - "1", ]) .status() .unwrap(); @@ -66,12 +64,7 @@ fn main() { assert!(cargo_new.success()); } - let clang = Clang::new().unwrap(); - let index = Index::new(&clang, true, true); - - let mut root_header_parser = index.parser("orig/include/wx/wx.h"); - root_header_parser.keep_going(true); - root_header_parser.arguments(&["-Iorig/include", "-D"]); - let root_header = root_header_parser.parse().unwrap(); - println!("{}", root_header.get_entity().get_pretty_printer().print()); + let wx_h_text = read_to_string("orig/include/wx/wx.h").unwrap(); + let lib_root_h = parse::parse(&wx_h_text); + dbg!(lib_root_h); } diff --git a/src/parse.rs b/src/parse.rs new file mode 100644 index 0000000..e528f01 --- /dev/null +++ b/src/parse.rs @@ -0,0 +1,6 @@ +#[derive(Debug)] +pub struct FileItem; + +pub fn parse(file: &str) -> Vec { + todo!() +} -- cgit v1.2.3