From c5c4640708d84fd1afd2364efc194b9cdb003bb2 Mon Sep 17 00:00:00 2001 From: dalance Date: Mon, 7 Oct 2019 19:00:49 +0900 Subject: [PATCH] Fix constant_mintypmax_expression priority --- sv-parser-parser/src/expressions/primaries.rs | 2 +- sv-parser-parser/src/tests.rs | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/sv-parser-parser/src/expressions/primaries.rs b/sv-parser-parser/src/expressions/primaries.rs index c3b3b1d..466c62c 100644 --- a/sv-parser-parser/src/expressions/primaries.rs +++ b/sv-parser-parser/src/expressions/primaries.rs @@ -16,6 +16,7 @@ pub(crate) fn constant_primary(s: Span) -> IResult { map(primary_literal, |x| { ConstantPrimary::PrimaryLiteral(Box::new(x)) }), + constant_primary_mintypmax_expression, map( terminated(constant_function_call, peek(not(one_of("[")))), |x| ConstantPrimary::ConstantFunctionCall(Box::new(x)), @@ -32,7 +33,6 @@ pub(crate) fn constant_primary(s: Span) -> IResult { map(constant_let_expression, |x| { ConstantPrimary::ConstantLetExpression(Box::new(x)) }), - constant_primary_mintypmax_expression, map(type_reference, |x| { ConstantPrimary::TypeReference(Box::new(x)) }), diff --git a/sv-parser-parser/src/tests.rs b/sv-parser-parser/src/tests.rs index d7fd482..6513391 100644 --- a/sv-parser-parser/src/tests.rs +++ b/sv-parser-parser/src/tests.rs @@ -339,6 +339,13 @@ mod unit { endmodule"##, Ok((_, _)) ); + test!( + source_text, + r##"module ibex_cs_registers; + localparam logic [31:0] MISA_VALUE = (32'(RV32E)); + endmodule"##, + Ok((_, _)) + ); } } @@ -15812,9 +15819,9 @@ mod spec { #[test] fn debug() { test!( - many1(module_item), - r##"sequence t2; (a ##[2:3] b) or (c ##[1:2] d); endsequence"##, - Ok((_, _)) - ); + source_text, + r##"module ibex_cs_registers; localparam logic [31:0] MISA_VALUE = (32'(RV32E)); endmodule"##, + Ok((_, _)) + ); nom_tracable::cumulative_histogram(); }