Fix constant_mintypmax_expression priority

This commit is contained in:
dalance 2019-10-07 19:00:49 +09:00
parent ba89870178
commit c5c4640708
2 changed files with 12 additions and 5 deletions

View File

@ -16,6 +16,7 @@ pub(crate) fn constant_primary(s: Span) -> IResult<Span, ConstantPrimary> {
map(primary_literal, |x| { map(primary_literal, |x| {
ConstantPrimary::PrimaryLiteral(Box::new(x)) ConstantPrimary::PrimaryLiteral(Box::new(x))
}), }),
constant_primary_mintypmax_expression,
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)),
@ -32,7 +33,6 @@ pub(crate) fn constant_primary(s: Span) -> IResult<Span, ConstantPrimary> {
map(constant_let_expression, |x| { map(constant_let_expression, |x| {
ConstantPrimary::ConstantLetExpression(Box::new(x)) ConstantPrimary::ConstantLetExpression(Box::new(x))
}), }),
constant_primary_mintypmax_expression,
map(type_reference, |x| { map(type_reference, |x| {
ConstantPrimary::TypeReference(Box::new(x)) ConstantPrimary::TypeReference(Box::new(x))
}), }),

View File

@ -339,6 +339,13 @@ mod unit {
endmodule"##, endmodule"##,
Ok((_, _)) Ok((_, _))
); );
test!(
source_text,
r##"module ibex_cs_registers;
localparam logic [31:0] MISA_VALUE = (32'(RV32E));
endmodule"##,
Ok((_, _))
);
} }
} }
@ -15812,8 +15819,8 @@ mod spec {
#[test] #[test]
fn debug() { fn debug() {
test!( test!(
many1(module_item), source_text,
r##"sequence t2; (a ##[2:3] b) or (c ##[1:2] d); endsequence"##, r##"module ibex_cs_registers; localparam logic [31:0] MISA_VALUE = (32'(RV32E)); endmodule"##,
Ok((_, _)) Ok((_, _))
); );
nom_tracable::cumulative_histogram(); nom_tracable::cumulative_histogram();