Fix bugs
This commit is contained in:
parent
81b8ab7718
commit
377fa5bd42
@ -215,11 +215,27 @@ pub(crate) fn enum_name_declaration(s: Span) -> IResult<Span, EnumNameDeclaratio
|
||||
#[tracable_parser]
|
||||
#[packrat_parser]
|
||||
pub(crate) fn class_scope(s: Span) -> IResult<Span, ClassScope> {
|
||||
let (s, a) = class_type(s)?;
|
||||
let (s, a) = class_type_class_scope(s)?;
|
||||
let (s, b) = symbol("::")(s)?;
|
||||
Ok((s, ClassScope { nodes: (a, b) }))
|
||||
}
|
||||
|
||||
#[tracable_parser]
|
||||
#[packrat_parser]
|
||||
pub(crate) fn class_type_class_scope(s: Span) -> IResult<Span, ClassType> {
|
||||
let (s, a) = ps_class_identifier(s)?;
|
||||
let (s, b) = opt(parameter_value_assignment)(s)?;
|
||||
let (s, c) = many0(terminated(
|
||||
triple(
|
||||
symbol("::"),
|
||||
class_identifier,
|
||||
opt(parameter_value_assignment),
|
||||
),
|
||||
peek(symbol("::")),
|
||||
))(s)?;
|
||||
Ok((s, ClassType { nodes: (a, b, c) }))
|
||||
}
|
||||
|
||||
#[tracable_parser]
|
||||
#[packrat_parser]
|
||||
pub(crate) fn class_type(s: Span) -> IResult<Span, ClassType> {
|
||||
|
@ -87,7 +87,7 @@ pub(crate) fn tf_port_item(s: Span) -> IResult<Span, TfPortItem> {
|
||||
let (s, e) = opt(triple(
|
||||
port_identifier,
|
||||
many0(variable_dimension),
|
||||
opt(pair(symbol(":"), expression)),
|
||||
opt(pair(symbol("="), expression)),
|
||||
))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
@ -108,7 +108,7 @@ pub(crate) fn data_type_or_implicit_tf_port_item(s: Span) -> IResult<Span, DataT
|
||||
opt(triple(
|
||||
port_identifier,
|
||||
many0(variable_dimension),
|
||||
opt(pair(symbol(":"), expression)),
|
||||
opt(pair(symbol("="), expression)),
|
||||
)),
|
||||
alt((symbol(","), symbol(")"))),
|
||||
)),
|
||||
@ -122,7 +122,7 @@ pub(crate) fn data_type_or_implicit_tf_port_item(s: Span) -> IResult<Span, DataT
|
||||
opt(triple(
|
||||
port_identifier,
|
||||
many0(variable_dimension),
|
||||
opt(pair(symbol(":"), expression)),
|
||||
opt(pair(symbol("="), expression)),
|
||||
)),
|
||||
alt((symbol(","), symbol(")"))),
|
||||
)),
|
||||
|
@ -2469,17 +2469,17 @@ mod spec {
|
||||
r##"initial $display (p.ERR_OVERFLOW);"##,
|
||||
Ok((_, _))
|
||||
);
|
||||
//test!(
|
||||
// many1(module_item),
|
||||
// r##"class vector #(parameter width = 7, type T = int);
|
||||
// endclass
|
||||
test!(
|
||||
many1(module_item),
|
||||
r##"class vector #(parameter width = 7, type T = int);
|
||||
endclass
|
||||
|
||||
// vector #(3) v = new;
|
||||
// initial $display (vector #(3)::T'(3.45)); // Typecasting
|
||||
// initial $display ((v.T)'(3.45)); //ILLEGAL
|
||||
// initial $display (v.width);"##,
|
||||
// Ok((_, _))
|
||||
//);
|
||||
vector #(3) v = new;
|
||||
initial $display (vector #(3)::T'(3.45)); // Typecasting
|
||||
initial $display ((v.T)'(3.45)); //ILLEGAL
|
||||
initial $display (v.width);"##,
|
||||
Ok((_, _))
|
||||
);
|
||||
test!(
|
||||
many1(module_item),
|
||||
r##"Packet p = new;
|
||||
@ -2530,17 +2530,17 @@ mod spec {
|
||||
r##"Packet p = new(STARTUP, $random, $time);"##,
|
||||
Ok((_, _))
|
||||
);
|
||||
//test!(
|
||||
// many1(module_item),
|
||||
// r##"class c;
|
||||
// function new(int cmd = IDLE, bit[12:0] adrs = 0, int cmd_time );
|
||||
// command = cmd;
|
||||
// address = adrs;
|
||||
// time_requested = cmd_time;
|
||||
// endfunction
|
||||
// endclass"##,
|
||||
// Ok((_, _))
|
||||
//);
|
||||
test!(
|
||||
many1(module_item),
|
||||
r##"class c;
|
||||
function new(int cmd = IDLE, bit[12:0] adrs = 0, int cmd_time );
|
||||
command = cmd;
|
||||
address = adrs;
|
||||
time_requested = cmd_time;
|
||||
endfunction
|
||||
endclass"##,
|
||||
Ok((_, _))
|
||||
);
|
||||
//test!(
|
||||
// many1(module_item),
|
||||
// r##"class C; endclass
|
||||
@ -15503,7 +15503,7 @@ mod spec {
|
||||
fn debug() {
|
||||
test!(
|
||||
many1(module_item),
|
||||
r##"always_comb d <= #1ns b & c;"##,
|
||||
r##"function a(int cmd = IDLE, bit[12:0] adrs = 0, int cmd_time ); endfunction"##,
|
||||
Ok((_, _))
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user