diff --git a/CHANGELOG.md b/CHANGELOG.md index cb56c02..f9c20d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,4 +2,5 @@ ## [Unreleased](https://github.com/dalance/sv-parser/compare/v0.1.4...Unreleased) - ReleaseDate +* [Fixed] cast/const_cast priority * [Added] unwrap_node macro diff --git a/sv-parser-parser/src/declarations/assertion_declarations.rs b/sv-parser-parser/src/declarations/assertion_declarations.rs index cc2c98f..b1cb7f2 100644 --- a/sv-parser-parser/src/declarations/assertion_declarations.rs +++ b/sv-parser-parser/src/declarations/assertion_declarations.rs @@ -710,12 +710,12 @@ pub(crate) fn data_type_or_implicit_sequence_formal_type( #[packrat_parser] pub(crate) fn sequence_expr(s: Span) -> IResult { alt(( - sequence_expr_cycle_delay_expr, + sequence_expr_binary, sequence_expr_expr_cycle_delay_expr, + sequence_expr_cycle_delay_expr, sequence_expr_throughout, terminated(sequence_expr_expression, peek(not(symbol("(")))), sequence_expr_instance, - sequence_expr_binary, sequence_expr_paren, sequence_expr_first_match, sequence_expr_clocking_event, diff --git a/sv-parser-parser/src/expressions/primaries.rs b/sv-parser-parser/src/expressions/primaries.rs index b8e3202..c3b3b1d 100644 --- a/sv-parser-parser/src/expressions/primaries.rs +++ b/sv-parser-parser/src/expressions/primaries.rs @@ -10,12 +10,12 @@ pub(crate) fn constant_primary(s: Span) -> IResult { map(constant_assignment_pattern_expression, |x| { ConstantPrimary::ConstantAssignmentPatternExpression(Box::new(x)) }), - map(primary_literal, |x| { - ConstantPrimary::PrimaryLiteral(Box::new(x)) - }), map(constant_cast, |x| { ConstantPrimary::ConstantCast(Box::new(x)) }), + map(primary_literal, |x| { + ConstantPrimary::PrimaryLiteral(Box::new(x)) + }), map( terminated(constant_function_call, peek(not(one_of("[")))), |x| ConstantPrimary::ConstantFunctionCall(Box::new(x)), @@ -164,8 +164,8 @@ pub(crate) fn primary(s: Span) -> IResult { map(assignment_pattern_expression, |x| { Primary::AssignmentPatternExpression(Box::new(x)) }), - map(primary_literal, |x| Primary::PrimaryLiteral(Box::new(x))), map(cast, |x| Primary::Cast(Box::new(x))), + map(primary_literal, |x| Primary::PrimaryLiteral(Box::new(x))), map(empty_unpacked_array_concatenation, |x| { Primary::EmptyUnpackedArrayConcatenation(Box::new(x)) }), diff --git a/sv-parser-parser/src/tests.rs b/sv-parser-parser/src/tests.rs index 9c00537..d7fd482 100644 --- a/sv-parser-parser/src/tests.rs +++ b/sv-parser-parser/src/tests.rs @@ -332,6 +332,13 @@ mod unit { ); test!(source_text, r##"`macro(A, B, logic, C)"##, Ok((_, _))); test!(source_text, r##"`macro(A, B, logic, a())"##, Ok((_, _))); + test!( + source_text, + r##"module ibex_cs_registers; + localparam logic [31:0] MISA_VALUE = 32'(RV32E); + endmodule"##, + Ok((_, _)) + ); } } @@ -15805,8 +15812,8 @@ mod spec { #[test] fn debug() { test!( - source_text, - r##"interface intf (); localparam TYPE DEFAULT = TYPE'(0); endinterface"##, + many1(module_item), + r##"sequence t2; (a ##[2:3] b) or (c ##[1:2] d); endsequence"##, Ok((_, _)) ); nom_tracable::cumulative_histogram(); diff --git a/sv-parser-syntaxtree/src/preprocessor/preprocessor.rs b/sv-parser-syntaxtree/src/preprocessor/preprocessor.rs index bb39e3d..bd8a856 100644 --- a/sv-parser-syntaxtree/src/preprocessor/preprocessor.rs +++ b/sv-parser-syntaxtree/src/preprocessor/preprocessor.rs @@ -6,4 +6,3 @@ use crate::*; pub struct PreprocessorText { pub nodes: (Vec,), } -