#system-verilog #parse #directories #defines #return #list #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

#2897 in Parser implementations

Download history 188/week @ 2023-11-20 110/week @ 2023-11-27 65/week @ 2023-12-04 44/week @ 2023-12-11 79/week @ 2023-12-18 157/week @ 2023-12-25 73/week @ 2024-01-01 68/week @ 2024-01-08 44/week @ 2024-01-15 70/week @ 2024-01-22 108/week @ 2024-01-29 79/week @ 2024-02-05 92/week @ 2024-02-12 108/week @ 2024-02-19 96/week @ 2024-02-26 83/week @ 2024-03-04

395 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.1–3MB
~53K SLoC