Fix bugs
This commit is contained in:
parent
b08195b68a
commit
71644e960f
@ -6,6 +6,8 @@
|
||||
* [Fixed] randomize_call bug
|
||||
* [Fixed] parameter override by class type bug
|
||||
* [Fixed] hierarchical this bug
|
||||
* [Fixed] hierarchical delay value bug
|
||||
* [Fixed] const class new bug
|
||||
|
||||
## [v0.3.6](https://github.com/dalance/sv-parser/compare/v0.3.5...v0.3.6) - 2019-11-05
|
||||
|
||||
|
@ -70,6 +70,10 @@ pub(crate) fn delay_value(s: Span) -> IResult<Span, DelayValue> {
|
||||
map(time_literal, |x| DelayValue::TimeLiteral(Box::new(x))),
|
||||
map(real_number, |x| DelayValue::RealNumber(Box::new(x))),
|
||||
map(unsigned_number, |x| DelayValue::UnsignedNumber(Box::new(x))),
|
||||
// BNF-WA
|
||||
map(hierarchical_identifier, |x| {
|
||||
DelayValue::HierarchicalIdentifier(Box::new(x))
|
||||
}),
|
||||
map(ps_identifier, |x| DelayValue::PsIdentifier(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
@ -100,7 +100,9 @@ pub(crate) fn class_property_const(s: Span) -> IResult<Span, ClassProperty> {
|
||||
let (s, b) = many0(class_item_qualifier)(s)?;
|
||||
let (s, c) = data_type(s)?;
|
||||
let (s, d) = const_identifier(s)?;
|
||||
let (s, e) = opt(pair(symbol("="), constant_expression))(s)?;
|
||||
// BNF-WA
|
||||
//let (s, e) = opt(pair(symbol("="), constant_expression))(s)?;
|
||||
let (s, e) = opt(pair(symbol("="), class_property_const_expression))(s)?;
|
||||
let (s, f) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
@ -110,6 +112,21 @@ pub(crate) fn class_property_const(s: Span) -> IResult<Span, ClassProperty> {
|
||||
))
|
||||
}
|
||||
|
||||
#[tracable_parser]
|
||||
#[packrat_parser]
|
||||
pub(crate) fn class_property_const_expression(
|
||||
s: Span,
|
||||
) -> IResult<Span, ClassPropertyConstExpression> {
|
||||
alt((
|
||||
map(constant_expression, |x| {
|
||||
ClassPropertyConstExpression::ConstantExpression(Box::new(x))
|
||||
}),
|
||||
map(class_new, |x| {
|
||||
ClassPropertyConstExpression::ClassNew(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
#[tracable_parser]
|
||||
#[packrat_parser]
|
||||
pub(crate) fn class_method(s: Span) -> IResult<Span, ClassMethod> {
|
||||
|
@ -378,6 +378,16 @@ mod unit {
|
||||
r##"class a; function a b(); return this.a.b(); endfunction endclass"##,
|
||||
Ok((_, _))
|
||||
);
|
||||
test!(
|
||||
source_text,
|
||||
r##"class a; const local a b = new("a"); endclass"##,
|
||||
Ok((_, _))
|
||||
);
|
||||
test!(
|
||||
source_text,
|
||||
r##"module a; initial begin #a.b; end endmodule"##,
|
||||
Ok((_, _))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -15838,7 +15848,7 @@ mod spec {
|
||||
fn debug() {
|
||||
test!(
|
||||
source_text,
|
||||
r##"module a; initial begin this.a.b(); end endmodule"##,
|
||||
r##"module a; initial begin #a.b; end endmodule"##,
|
||||
Ok((_, _))
|
||||
);
|
||||
nom_tracable::cumulative_histogram();
|
||||
|
@ -52,6 +52,7 @@ pub enum DelayValue {
|
||||
UnsignedNumber(Box<UnsignedNumber>),
|
||||
RealNumber(Box<RealNumber>),
|
||||
PsIdentifier(Box<PsIdentifier>),
|
||||
HierarchicalIdentifier(Box<HierarchicalIdentifier>),
|
||||
TimeLiteral(Box<TimeLiteral>),
|
||||
Step1(Box<Keyword>),
|
||||
}
|
||||
|
@ -57,11 +57,17 @@ pub struct ClassPropertyConst {
|
||||
Vec<ClassItemQualifier>,
|
||||
DataType,
|
||||
ConstIdentifier,
|
||||
Option<(Symbol, ConstantExpression)>,
|
||||
Option<(Symbol, ClassPropertyConstExpression)>,
|
||||
Symbol,
|
||||
),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Node)]
|
||||
pub enum ClassPropertyConstExpression {
|
||||
ConstantExpression(Box<ConstantExpression>),
|
||||
ClassNew(Box<ClassNew>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Node)]
|
||||
pub enum ClassMethod {
|
||||
Task(Box<ClassMethodTask>),
|
||||
|
Loading…
x
Reference in New Issue
Block a user