#system-verilog #verilog #filelist

sv-filelist-parser

A library to parse a SystemVerilog Filelist and return a list of files, include directories and defines

1 unstable release

0.1.3 May 12, 2022

#2258 in Parser implementations

Download history 119/week @ 2024-03-13 160/week @ 2024-03-20 119/week @ 2024-03-27 107/week @ 2024-04-03 122/week @ 2024-04-10 76/week @ 2024-04-17 105/week @ 2024-04-24 157/week @ 2024-05-01 95/week @ 2024-05-08 98/week @ 2024-05-15 105/week @ 2024-05-22 193/week @ 2024-05-29 134/week @ 2024-06-05 140/week @ 2024-06-12 62/week @ 2024-06-19 51/week @ 2024-06-26

402 downloads per month
Used in 2 crates (via svlint)

MIT license

12KB
226 lines

SystemVerilog Filelist Parser

A library in Rust to parse a SystemVerilog Filelist and return a list of files, include directories and defines.

Environment variables optionally enclosed in paranthesis or curly braces (i.e. $, $() or ${}) will be automatically substituted.

Example

use sv_filelist_parser;
let filelist = sv_filelist_parser::parse_file("testcase/files.f")
    .expect("Cannot read filelist");
for file in filelist.files {
    println!("{:?}", file);
}
for incdir in filelist.incdirs {
    println!("{:?}", incdir);
}
for (d, t) in filelist.defines {
    match t {
        None => println!("{:?}", d),
        Some(te) => println!("{:?}={:?}", d, te),
    };
}

lib.rs:

SystemVerilog Filelist Parser

A library in Rust to parse a SystemVerilog Filelist and return a list of files, include directories and defines.

Environment variables optionally enclosed in paranthesis or curly braces (i.e. $, $() or ${}) will be automatically substituted.

Example

use sv_filelist_parser;
let filelist = sv_filelist_parser::parse_file("testcase/files.f")
    .expect("Cannot read filelist");
for file in filelist.files {
    println!("{:?}", file);
}
for incdir in filelist.incdirs {
    println!("{:?}", incdir);
}
for (d, t) in filelist.defines {
    match t {
        None => println!("{:?}", d),
        Some(te) => println!("{:?}={:?}", d, te),
    };
}

Dependencies

~2–3MB
~53K SLoC