#verilog #system-verilog #filelist

verilog-filelist-parser

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

3 releases

0.1.2 Feb 20, 2020
0.1.1 Feb 7, 2020
0.1.0 Feb 2, 2020

#31 in #system-verilog

MIT license

12KB
217 lines

Verilog Filelist Parser

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

Environment variables represented with paranthesis or curly braces (i.e. $() or ${}) will be automatically substituted.

Example

use verilog_filelist_parser;
let filelist = verilog_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:

Verilog Filelist Parser

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

Environment variables represented with paranthesis or curly braces (i.e. $() or ${}) will be automatically substituted.

Example

use verilog_filelist_parser;
let filelist = verilog_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.2–3MB
~54K SLoC