Rename the tool to lucisv (Language Utility for Coding In SystemVerilog)
This commit is contained in:
1 parent
a284e33110
commit
eeaffafd56
188 files changed
+2825
-2802
No files matched your search
@@ -228,7 +228,7 @@ pub struct Parser<'a> {
|
||||
/// Parse a token stream, stopping at the first error.
|
||||
///
|
||||
/// `source` must be the exact text `tokens` were lexed from: the constructs
|
||||
/// vfmt keeps verbatim (`constraint`, `covergroup` — see
|
||||
/// lucisv keeps verbatim (`constraint`, `covergroup` — see
|
||||
/// `docs/features/classes/README.md`) copy their bytes out of it by span.
|
||||
pub fn parse(tokens: Vec<Token>, source: &str) -> PResult<SourceFile> {
|
||||
Parser::new(tokens, source, false).parse_source_file()
|
||||
@@ -720,7 +720,7 @@ impl<'a> Parser<'a> {
|
||||
// argument (`.value(x)`, `.name()`) and a `[lo:hi]` value range (a
|
||||
// `case ... inside` label). Both are recognized here, in the shared
|
||||
// element parse, because rejecting them in the lists that cannot
|
||||
// legally hold them would gain nothing — vfmt checks legality
|
||||
// legally hold them would gain nothing — lucisv checks legality
|
||||
// nowhere else either, and a wrong guess emits the same tokens.
|
||||
let expr = if self.cur().is_sym(".") && self.nth(1).kind == TokenKind::Ident {
|
||||
self.parse_named_arg()?
|
||||
@@ -902,7 +902,7 @@ impl<'a> Parser<'a> {
|
||||
/// expression or a port/parameter list. In an expression `` `A (b) `` may
|
||||
/// well be `` `A `` applied to the parenthesized value `(b)` — the answer
|
||||
/// depends on whether the macro was defined with formals, which lives in
|
||||
/// a file vfmt does not read (IEEE 1800 §22.5.1, and the analysis in
|
||||
/// a file lucisv does not read (IEEE 1800 §22.5.1, and the analysis in
|
||||
/// `docs/features/lexer-cleanup/README.md`). At item position there is no
|
||||
/// such ambiguity: neither reading is an item on its own.
|
||||
///
|
||||
@@ -925,7 +925,7 @@ impl<'a> Parser<'a> {
|
||||
self.bump(); // (
|
||||
self.skip_balanced("(", ")")?;
|
||||
// Verbatim, space included: the argument text is preprocessor
|
||||
// input vfmt does not model, and closing the gap would make the
|
||||
// input lucisv does not model, and closing the gap would make the
|
||||
// output's token text differ from the input's (`` `A (b) `` and
|
||||
// `` `A(b) `` are one token each, of different text) — which the
|
||||
// safety net rightly refuses.
|
||||
@@ -1156,7 +1156,7 @@ impl<'a> Parser<'a> {
|
||||
match kw.as_str() {
|
||||
"module" | "macromodule" => self.parse_module("endmodule").map(ItemKind::Module),
|
||||
// `interface class` is a class, not an interface (IEEE 1800
|
||||
// §8.26): a different construct that vfmt does not model, so it
|
||||
// §8.26): a different construct that lucisv does not model, so it
|
||||
// falls through to the unsupported-construct error below.
|
||||
"interface" if !self.nth(1).is_kw("class") => {
|
||||
self.parse_module("endinterface").map(ItemKind::Module)
|
||||
@@ -1574,7 +1574,7 @@ impl<'a> Parser<'a> {
|
||||
/// `constraint name { ... }`, kept as verbatim source.
|
||||
///
|
||||
/// The constraint language is a grammar of its own (`dist`, `->`,
|
||||
/// `solve ... before`, `inside`, `foreach`, `if`/`else`) that vfmt models
|
||||
/// `solve ... before`, `inside`, `foreach`, `if`/`else`) that lucisv models
|
||||
/// none of, and reflowing it has no payoff, so the block is copied out of
|
||||
/// the source by span. A prototype (`constraint c;`) has no braces.
|
||||
fn parse_constraint(&mut self) -> PResult<RawText> {
|
||||
@@ -1654,7 +1654,7 @@ impl<'a> Parser<'a> {
|
||||
///
|
||||
/// `assert property (@(posedge clk) a |-> ##[1:3] b) else $error("...");`
|
||||
/// — the property expression is a grammar of its own (`|->`, `##[1:3]`,
|
||||
/// `throughout`, `disable iff`, `$rose`) that vfmt models none of, and
|
||||
/// `throughout`, `disable iff`, `$rose`) that lucisv models none of, and
|
||||
/// there is no layout convention worth inventing for it, so the whole
|
||||
/// item is copied out of the source by span exactly as a `constraint` is.
|
||||
fn parse_concurrent_assertion(&mut self) -> PResult<RawText> {
|
||||
@@ -2024,7 +2024,7 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
|
||||
/// A clocking skew, as written: `#2`, `#1step`, `negedge`. Kept as text —
|
||||
/// it is a delay or an edge, never something vfmt re-lays out — so the
|
||||
/// it is a delay or an edge, never something lucisv re-lays out — so the
|
||||
/// printer writes back exactly what the source said. The `#(min:typ:max)`
|
||||
/// spelling is not supported; see the feature README's Assumptions.
|
||||
fn parse_clocking_skew(&mut self) -> PResult<String> {
|
||||
@@ -2643,7 +2643,7 @@ impl<'a> Parser<'a> {
|
||||
/// True when the cursor opens a `bind` directive (IEEE 1800 §23.11).
|
||||
///
|
||||
/// `bind` is deliberately *not* in the lexer's keyword table — the same
|
||||
/// call vfmt makes for `new`/`this`/`super` — so that `obj.bind()` keeps
|
||||
/// call lucisv makes for `new`/`this`/`super` — so that `obj.bind()` keeps
|
||||
/// parsing as the ordinary method call it is in existing testbenches.
|
||||
/// A directive is recognized from its shape instead: the word `bind`,
|
||||
/// then a target scope (a name, possibly a `.`-separated hierarchical
|
||||
@@ -4154,7 +4154,7 @@ impl<'a> Parser<'a> {
|
||||
// `with { ... }` (a `randomize` constraint block) are the two
|
||||
// postfix spellings of `with`; the delimiter tells them apart and
|
||||
// demanding one keeps the `with [range]` of a stream expression,
|
||||
// which vfmt does not model, out of this path.
|
||||
// which lucisv does not model, out of this path.
|
||||
|| (t.is_kw("with") && (self.nth(1).is_sym("(") || self.nth(1).is_sym("{")))
|
||||
}
|
||||
|
||||
@@ -4463,7 +4463,7 @@ impl<'a> Parser<'a> {
|
||||
// A bare `$` — the upper bound of a queue (`q[$]`,
|
||||
// `q[$-1]`, `int q[$]`). Kept an ordinary name, like
|
||||
// `new`/`this`/`super`: one leaf makes every position
|
||||
// work through the existing expression grammar, and vfmt
|
||||
// work through the existing expression grammar, and lucisv
|
||||
// checks legality nowhere else either.
|
||||
"$" => {
|
||||
self.bump();
|
||||
@@ -4508,7 +4508,7 @@ impl<'a> Parser<'a> {
|
||||
if self.cur().is_sym("}") {
|
||||
// `{}` — the empty queue/dynamic-array literal
|
||||
// (`q = {};`). Illegal as a Verilog concatenation,
|
||||
// but vfmt is not a legality checker.
|
||||
// but lucisv is not a legality checker.
|
||||
self.bump();
|
||||
return Ok(self.expr_at(start, ExprKind::Concat(Vec::new())));
|
||||
}
|
||||
@@ -5018,7 +5018,7 @@ mod tests {
|
||||
|
||||
/// The spaced reading is offered at item and statement position only. In
|
||||
/// an expression `` `A (b) `` may be `` `A `` applied to `(b)`, which
|
||||
/// depends on a `` `define`` vfmt never sees.
|
||||
/// depends on a `` `define`` lucisv never sees.
|
||||
#[test]
|
||||
fn a_spaced_macro_in_expression_position_is_still_a_call() {
|
||||
let file = parse_ok("module m;\nassign x = `A (b);\nendmodule");
|
||||
@@ -5327,11 +5327,14 @@ mod tests {
|
||||
// The handshake `docs/features/format-fences/README.md` asked for: a
|
||||
// same-line comment now has a byte offset, so a fence written there
|
||||
// can be located in the source.
|
||||
let src = "module m;\n wire a; // vfmt: off\nendmodule\n";
|
||||
let src = "module m;\n wire a; // lucisv: off\nendmodule\n";
|
||||
let file = parse_ok(src);
|
||||
let ItemKind::Module(m) = &file.items[0].kind else { panic!("expected a module") };
|
||||
let trailing = m.items[0].meta.trailing.as_ref().expect("a trailing comment");
|
||||
assert_eq!(&src[trailing.span.start as usize..trailing.span.end as usize], "// vfmt: off");
|
||||
assert_eq!(
|
||||
&src[trailing.span.start as usize..trailing.span.end as usize],
|
||||
"// lucisv: off"
|
||||
);
|
||||
assert_eq!((trailing.line, trailing.col), (2, 11));
|
||||
}
|
||||
|
||||
@@ -5479,7 +5482,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn both_arms_of_an_else_are_ordinary_elements_of_one_list() {
|
||||
// vfmt does not evaluate the condition: an `ifdef/`else pair simply
|
||||
// lucisv does not evaluate the condition: an `ifdef/`else pair simply
|
||||
// contributes every element of both arms, in source order.
|
||||
let src = "module m (\n`ifdef X\n input a\n`else\n input b\n`endif\n);\nendmodule\n";
|
||||
let file = parse_ok(src);
|
||||
|
||||
Reference in new issue
Block a user