Fix primary priority
This commit is contained in:
parent
ea9af9282e
commit
50d51bd2d2
@ -7,6 +7,9 @@ use crate::*;
|
|||||||
pub(crate) fn constant_primary(s: Span) -> IResult<Span, ConstantPrimary> {
|
pub(crate) fn constant_primary(s: Span) -> IResult<Span, ConstantPrimary> {
|
||||||
alt((
|
alt((
|
||||||
map(keyword("null"), |x| ConstantPrimary::Null(Box::new(x))),
|
map(keyword("null"), |x| ConstantPrimary::Null(Box::new(x))),
|
||||||
|
map(constant_assignment_pattern_expression, |x| {
|
||||||
|
ConstantPrimary::ConstantAssignmentPatternExpression(Box::new(x))
|
||||||
|
}),
|
||||||
map(primary_literal, |x| {
|
map(primary_literal, |x| {
|
||||||
ConstantPrimary::PrimaryLiteral(Box::new(x))
|
ConstantPrimary::PrimaryLiteral(Box::new(x))
|
||||||
}),
|
}),
|
||||||
@ -29,9 +32,6 @@ pub(crate) fn constant_primary(s: Span) -> IResult<Span, ConstantPrimary> {
|
|||||||
map(constant_cast, |x| {
|
map(constant_cast, |x| {
|
||||||
ConstantPrimary::ConstantCast(Box::new(x))
|
ConstantPrimary::ConstantCast(Box::new(x))
|
||||||
}),
|
}),
|
||||||
map(constant_assignment_pattern_expression, |x| {
|
|
||||||
ConstantPrimary::ConstantAssignmentPatternExpression(Box::new(x))
|
|
||||||
}),
|
|
||||||
map(type_reference, |x| {
|
map(type_reference, |x| {
|
||||||
ConstantPrimary::TypeReference(Box::new(x))
|
ConstantPrimary::TypeReference(Box::new(x))
|
||||||
}),
|
}),
|
||||||
@ -147,8 +147,11 @@ pub(crate) fn primary(s: Span) -> IResult<Span, Primary> {
|
|||||||
map(keyword("this"), |x| Primary::This(Box::new(x))),
|
map(keyword("this"), |x| Primary::This(Box::new(x))),
|
||||||
map(keyword("$"), |x| Primary::Dollar(Box::new(x))),
|
map(keyword("$"), |x| Primary::Dollar(Box::new(x))),
|
||||||
map(keyword("null"), |x| Primary::Null(Box::new(x))),
|
map(keyword("null"), |x| Primary::Null(Box::new(x))),
|
||||||
|
map(assignment_pattern_expression, |x| {
|
||||||
|
Primary::AssignmentPatternExpression(Box::new(x))
|
||||||
|
}),
|
||||||
map(primary_literal, |x| Primary::PrimaryLiteral(Box::new(x))),
|
map(primary_literal, |x| Primary::PrimaryLiteral(Box::new(x))),
|
||||||
primary_hierarchical,
|
terminated(primary_hierarchical, peek(none_of("("))),
|
||||||
map(empty_unpacked_array_concatenation, |x| {
|
map(empty_unpacked_array_concatenation, |x| {
|
||||||
Primary::EmptyUnpackedArrayConcatenation(Box::new(x))
|
Primary::EmptyUnpackedArrayConcatenation(Box::new(x))
|
||||||
}),
|
}),
|
||||||
@ -160,9 +163,6 @@ pub(crate) fn primary(s: Span) -> IResult<Span, Primary> {
|
|||||||
map(let_expression, |x| Primary::LetExpression(Box::new(x))),
|
map(let_expression, |x| Primary::LetExpression(Box::new(x))),
|
||||||
primary_mintypmax_expression,
|
primary_mintypmax_expression,
|
||||||
map(cast, |x| Primary::Cast(Box::new(x))),
|
map(cast, |x| Primary::Cast(Box::new(x))),
|
||||||
map(assignment_pattern_expression, |x| {
|
|
||||||
Primary::AssignmentPatternExpression(Box::new(x))
|
|
||||||
}),
|
|
||||||
map(streaming_concatenation, |x| {
|
map(streaming_concatenation, |x| {
|
||||||
Primary::StreamingConcatenation(Box::new(x))
|
Primary::StreamingConcatenation(Box::new(x))
|
||||||
}),
|
}),
|
||||||
|
@ -966,13 +966,12 @@ fn test_clause5() {
|
|||||||
r##"c = '{default:0}; // all elements of structure c are set to 0"##,
|
r##"c = '{default:0}; // all elements of structure c are set to 0"##,
|
||||||
Ok((_, _))
|
Ok((_, _))
|
||||||
);
|
);
|
||||||
//TODO
|
test!(
|
||||||
//test!(
|
module_item,
|
||||||
// module_item,
|
r##"d = ab'{int:1, shortreal:1.0}; // data type and default value for all
|
||||||
// r##"d = ab'{int:1, shortreal:1.0}; // data type and default value for all
|
// members of that type"##,
|
||||||
// // members of that type"##,
|
Ok((_, _))
|
||||||
// Ok((_, _))
|
);
|
||||||
//);
|
|
||||||
test!(
|
test!(
|
||||||
module_item,
|
module_item,
|
||||||
r##"ab abarr[1:0] = '{'{1, 1.0}, '{2, 2.0}};"##,
|
r##"ab abarr[1:0] = '{'{1, 1.0}, '{2, 2.0}};"##,
|
||||||
@ -1039,15 +1038,17 @@ fn test_clause5() {
|
|||||||
// to be the string cla."##,
|
// to be the string cla."##,
|
||||||
Ok((_, _))
|
Ok((_, _))
|
||||||
);
|
);
|
||||||
//TODO
|
test!(
|
||||||
//test!(
|
module_item,
|
||||||
// module_item,
|
r##"a = add (* mode = "cla" *) (b, c);"##,
|
||||||
// r##"a = add (* mode = "cla" *) (b, c);"##,
|
Ok((_, _))
|
||||||
// Ok((_, _))
|
);
|
||||||
//);
|
|
||||||
test!(
|
test!(
|
||||||
module_item,
|
module_item,
|
||||||
r##"a = b ? (* no_glitch *) c : d;"##,
|
r##"a = b ? (* no_glitch *) c : d;"##,
|
||||||
Ok((_, _))
|
Ok((_, _))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_debug() {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user