Fix cast/const_cast priority
This commit is contained in:
parent
c776696a8f
commit
030068f36f
@ -2,4 +2,5 @@
|
|||||||
|
|
||||||
## [Unreleased](https://github.com/dalance/sv-parser/compare/v0.1.4...Unreleased) - ReleaseDate
|
## [Unreleased](https://github.com/dalance/sv-parser/compare/v0.1.4...Unreleased) - ReleaseDate
|
||||||
|
|
||||||
|
* [Fixed] cast/const_cast priority
|
||||||
* [Added] unwrap_node macro
|
* [Added] unwrap_node macro
|
||||||
|
@ -710,12 +710,12 @@ pub(crate) fn data_type_or_implicit_sequence_formal_type(
|
|||||||
#[packrat_parser]
|
#[packrat_parser]
|
||||||
pub(crate) fn sequence_expr(s: Span) -> IResult<Span, SequenceExpr> {
|
pub(crate) fn sequence_expr(s: Span) -> IResult<Span, SequenceExpr> {
|
||||||
alt((
|
alt((
|
||||||
sequence_expr_cycle_delay_expr,
|
sequence_expr_binary,
|
||||||
sequence_expr_expr_cycle_delay_expr,
|
sequence_expr_expr_cycle_delay_expr,
|
||||||
|
sequence_expr_cycle_delay_expr,
|
||||||
sequence_expr_throughout,
|
sequence_expr_throughout,
|
||||||
terminated(sequence_expr_expression, peek(not(symbol("(")))),
|
terminated(sequence_expr_expression, peek(not(symbol("(")))),
|
||||||
sequence_expr_instance,
|
sequence_expr_instance,
|
||||||
sequence_expr_binary,
|
|
||||||
sequence_expr_paren,
|
sequence_expr_paren,
|
||||||
sequence_expr_first_match,
|
sequence_expr_first_match,
|
||||||
sequence_expr_clocking_event,
|
sequence_expr_clocking_event,
|
||||||
|
@ -10,12 +10,12 @@ pub(crate) fn constant_primary(s: Span) -> IResult<Span, ConstantPrimary> {
|
|||||||
map(constant_assignment_pattern_expression, |x| {
|
map(constant_assignment_pattern_expression, |x| {
|
||||||
ConstantPrimary::ConstantAssignmentPatternExpression(Box::new(x))
|
ConstantPrimary::ConstantAssignmentPatternExpression(Box::new(x))
|
||||||
}),
|
}),
|
||||||
map(primary_literal, |x| {
|
|
||||||
ConstantPrimary::PrimaryLiteral(Box::new(x))
|
|
||||||
}),
|
|
||||||
map(constant_cast, |x| {
|
map(constant_cast, |x| {
|
||||||
ConstantPrimary::ConstantCast(Box::new(x))
|
ConstantPrimary::ConstantCast(Box::new(x))
|
||||||
}),
|
}),
|
||||||
|
map(primary_literal, |x| {
|
||||||
|
ConstantPrimary::PrimaryLiteral(Box::new(x))
|
||||||
|
}),
|
||||||
map(
|
map(
|
||||||
terminated(constant_function_call, peek(not(one_of("[")))),
|
terminated(constant_function_call, peek(not(one_of("[")))),
|
||||||
|x| ConstantPrimary::ConstantFunctionCall(Box::new(x)),
|
|x| ConstantPrimary::ConstantFunctionCall(Box::new(x)),
|
||||||
@ -164,8 +164,8 @@ pub(crate) fn primary(s: Span) -> IResult<Span, Primary> {
|
|||||||
map(assignment_pattern_expression, |x| {
|
map(assignment_pattern_expression, |x| {
|
||||||
Primary::AssignmentPatternExpression(Box::new(x))
|
Primary::AssignmentPatternExpression(Box::new(x))
|
||||||
}),
|
}),
|
||||||
map(primary_literal, |x| Primary::PrimaryLiteral(Box::new(x))),
|
|
||||||
map(cast, |x| Primary::Cast(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| {
|
map(empty_unpacked_array_concatenation, |x| {
|
||||||
Primary::EmptyUnpackedArrayConcatenation(Box::new(x))
|
Primary::EmptyUnpackedArrayConcatenation(Box::new(x))
|
||||||
}),
|
}),
|
||||||
|
@ -332,6 +332,13 @@ mod unit {
|
|||||||
);
|
);
|
||||||
test!(source_text, r##"`macro(A, B, logic, C)"##, Ok((_, _)));
|
test!(source_text, r##"`macro(A, B, logic, C)"##, Ok((_, _)));
|
||||||
test!(source_text, r##"`macro(A, B, logic, a())"##, 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]
|
#[test]
|
||||||
fn debug() {
|
fn debug() {
|
||||||
test!(
|
test!(
|
||||||
source_text,
|
many1(module_item),
|
||||||
r##"interface intf (); localparam TYPE DEFAULT = TYPE'(0); endinterface"##,
|
r##"sequence t2; (a ##[2:3] b) or (c ##[1:2] d); endsequence"##,
|
||||||
Ok((_, _))
|
Ok((_, _))
|
||||||
);
|
);
|
||||||
nom_tracable::cumulative_histogram();
|
nom_tracable::cumulative_histogram();
|
||||||
|
@ -6,4 +6,3 @@ use crate::*;
|
|||||||
pub struct PreprocessorText {
|
pub struct PreprocessorText {
|
||||||
pub nodes: (Vec<SourceDescription>,),
|
pub nodes: (Vec<SourceDescription>,),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user