Skip to content

Commit c498e02

Browse files
committed
crates/sel4: Merge bitfield-parser into sys
Signed-off-by: Nick Spinale <[email protected]>
1 parent c2b1240 commit c498e02

File tree

14 files changed

+13
-145
lines changed

14 files changed

+13
-145
lines changed

Diff for: Cargo.lock

+3-19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,6 @@ members = [
148148
"crates/sel4-synthetic-elf",
149149
"crates/sel4-test-harness",
150150
"crates/sel4/bitfield-ops",
151-
"crates/sel4/bitfield-parser",
152-
"crates/sel4/bitfield-parser/test",
153151
"crates/sel4/build-env",
154152
"crates/sel4/config",
155153
"crates/sel4/config/data",

Diff for: crates/sel4/bitfield-parser/Cargo.nix

-15
This file was deleted.

Diff for: crates/sel4/bitfield-parser/Cargo.toml

-22
This file was deleted.

Diff for: crates/sel4/bitfield-parser/test/Cargo.nix

-18
This file was deleted.

Diff for: crates/sel4/bitfield-parser/test/Cargo.toml

-22
This file was deleted.

Diff for: crates/sel4/bitfield-parser/test/src/main.rs

-38
This file was deleted.

Diff for: crates/sel4/sys/Cargo.nix

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ mk {
2020
inherit (versions)
2121
proc-macro2 quote prettyplease
2222
bindgen xmltree glob
23+
regex pest
2324
;
25+
pest_derive = versions.pest;
2426
syn = { version = versions.syn; features = [ "parsing" ]; };
2527
inherit (localCrates)
2628
sel4-build-env
27-
sel4-bitfield-parser
2829
sel4-config
2930
sel4-config-data
3031
;

Diff for: crates/sel4/sys/Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ sel4-config = { path = "../config" }
2525
[build-dependencies]
2626
bindgen = "0.70.1"
2727
glob = "0.3.0"
28+
pest = "2.4.1"
29+
pest_derive = "2.4.1"
2830
prettyplease = "0.2.25"
2931
proc-macro2 = "1.0.89"
3032
quote = "1.0.37"
31-
sel4-bitfield-parser = { path = "../bitfield-parser" }
33+
regex = "1.7.0"
3234
sel4-build-env = { path = "../build-env" }
3335
sel4-config = { path = "../config" }
3436
sel4-config-data = { path = "../config/data" }

Diff for: crates/sel4/sys/build/bf/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@ use proc_macro2::{Literal, TokenStream};
1111
use quote::{format_ident, quote};
1212
use syn::Ident;
1313

14+
mod parser;
1415
mod simplified;
16+
1517
use simplified::*;
1618

1719
pub fn generate_rust(
1820
blocklist_for_bindgen: &mut Vec<String>,
1921
bf_path: impl AsRef<Path>,
2022
) -> TokenStream {
2123
let text = fs::read_to_string(bf_path).unwrap();
22-
let file = sel4_bitfield_parser::parse(&text);
24+
let file = parser::parse(&text);
2325
let file = simplify(&file);
2426
let mut generator = BitfieldGenerator::new(blocklist_for_bindgen);
2527
for block in file.blocks.iter() {
File renamed without changes.

Diff for: crates/sel4/bitfield-parser/src/lib.rs renamed to crates/sel4/sys/build/bf/parser/mod.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub mod ast;
1313
use ast::*;
1414

1515
#[derive(Parser)]
16-
#[grammar = "grammar.pest"]
16+
#[grammar = "build/bf/parser/grammar.pest"]
1717
struct BitfieldParser;
1818

1919
pub fn parse(text: &str) -> File {
@@ -32,10 +32,6 @@ fn remove_comments(text: &str) -> String {
3232
}
3333

3434
impl File {
35-
pub fn parse_from_str(text: &str) -> Self {
36-
parse(text)
37-
}
38-
3935
fn parse(pair: Pair<Rule>) -> Self {
4036
assert_eq!(pair.as_rule(), Rule::file);
4137

Diff for: crates/sel4/sys/build/bf/simplified.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use std::collections::BTreeSet;
88
use std::ops::Range;
99

10-
use sel4_bitfield_parser::ast;
10+
use super::parser::ast;
1111

1212
pub fn simplify(orig: &ast::File) -> File {
1313
File::simplify(orig)

0 commit comments

Comments
 (0)