Add tests and Fix bugs

This commit is contained in:
dalance 2019-08-12 01:29:25 +09:00
parent 6a3127951c
commit 81b8ab7718
5 changed files with 6783 additions and 379 deletions

View File

@ -81,16 +81,16 @@ A parser library for System Verilog.
| Clause | Exist | Pass | Clause | Exist | Pass | Clause | Exist | Pass | Clause | Exist | Pass | | Clause | Exist | Pass | Clause | Exist | Pass | Clause | Exist | Pass | Clause | Exist | Pass |
| ------ | ----- | ---- | ------ | ----- | ---- | ------ | ----- | ---- | ------ | ----- | ---- | | ------ | ----- | ---- | ------ | ----- | ---- | ------ | ----- | ---- | ------ | ----- | ---- |
| 3 | x | x | 13 | x | | 23 | | | 33 | | | | 3 | x | x | 13 | x | | 23 | x | | 33 | x | |
| 4 | x | x | 14 | x | | 24 | | | 34 | | | | 4 | x | x | 14 | x | | 24 | x | | 34 | x | |
| 5 | x | x | 15 | x | | 25 | | | 35 | | | | 5 | x | x | 15 | x | | 25 | x | | 35 | | |
| 6 | x | x | 16 | x | | 26 | | | 36 | | | | 6 | x | x | 16 | x | | 26 | x | | 36 | | |
| 7 | x | | 17 | | | 27 | | | 37 | | | | 7 | x | x | 17 | x | | 27 | x | | 37 | | |
| 8 | x | | 18 | | | 28 | | | 38 | | | | 8 | x | | 18 | x | | 28 | x | | 38 | | |
| 9 | x | | 19 | | | 29 | | | 39 | | | | 9 | x | | 19 | x | | 29 | x | | 39 | | |
| 10 | x | | 20 | | | 30 | | | 40 | | | | 10 | x | | 20 | x | | 30 | x | | 40 | | |
| 11 | x | | 21 | | | 31 | | | | | | | 11 | x | | 21 | x | | 31 | x | | | | |
| 12 | x | | 22 | | | 32 | | | | | | | 12 | x | | 22 | | | 32 | x | | | | |
## Missing entry of specification ## Missing entry of specification

View File

@ -147,6 +147,7 @@ pub(crate) fn variable_decl_assignment_variable(s: Span) -> IResult<Span, Variab
let (s, a) = variable_identifier(s)?; let (s, a) = variable_identifier(s)?;
let (s, b) = many0(variable_dimension)(s)?; let (s, b) = many0(variable_dimension)(s)?;
let (s, c) = opt(pair(symbol("="), expression))(s)?; let (s, c) = opt(pair(symbol("="), expression))(s)?;
let (s, _) = not(peek(symbol("=")))(s)?;
Ok(( Ok((
s, s,
VariableDeclAssignment::Variable(Box::new(VariableDeclAssignmentVariable { VariableDeclAssignment::Variable(Box::new(VariableDeclAssignmentVariable {
@ -164,6 +165,7 @@ pub(crate) fn variable_decl_assignment_dynamic_array(
let (s, b) = unsized_dimension(s)?; let (s, b) = unsized_dimension(s)?;
let (s, c) = many0(variable_dimension)(s)?; let (s, c) = many0(variable_dimension)(s)?;
let (s, d) = opt(pair(symbol("="), dynamic_array_new))(s)?; let (s, d) = opt(pair(symbol("="), dynamic_array_new))(s)?;
let (s, _) = not(peek(symbol("=")))(s)?;
Ok(( Ok((
s, s,
VariableDeclAssignment::DynamicArray(Box::new(VariableDeclAssignmentDynamicArray { VariableDeclAssignment::DynamicArray(Box::new(VariableDeclAssignmentDynamicArray {

View File

@ -66,10 +66,10 @@ pub(crate) fn delay2_mintypmax(s: Span) -> IResult<Span, Delay2> {
#[packrat_parser] #[packrat_parser]
pub(crate) fn delay_value(s: Span) -> IResult<Span, DelayValue> { pub(crate) fn delay_value(s: Span) -> IResult<Span, DelayValue> {
alt(( alt((
map(time_literal, |x| DelayValue::TimeLiteral(Box::new(x))),
map(unsigned_number, |x| DelayValue::UnsignedNumber(Box::new(x))), map(unsigned_number, |x| DelayValue::UnsignedNumber(Box::new(x))),
map(real_number, |x| DelayValue::RealNumber(Box::new(x))), map(real_number, |x| DelayValue::RealNumber(Box::new(x))),
map(ps_identifier, |x| DelayValue::PsIdentifier(Box::new(x))), map(ps_identifier, |x| DelayValue::PsIdentifier(Box::new(x))),
map(time_literal, |x| DelayValue::TimeLiteral(Box::new(x))),
map(keyword("1step"), |x| DelayValue::Step1(Box::new(x))), map(keyword("1step"), |x| DelayValue::Step1(Box::new(x))),
))(s) ))(s)
} }

View File

@ -309,7 +309,7 @@ pub(crate) fn class_constructor_declaration(s: Span) -> IResult<Span, ClassConst
symbol(";"), symbol(";"),
)))(s)?; )))(s)?;
let (s, h) = many0(function_statement_or_null)(s)?; let (s, h) = many0(function_statement_or_null)(s)?;
let (s, i) = keyword("end")(s)?; let (s, i) = keyword("endfunction")(s)?;
let (s, j) = opt(pair(symbol(":"), new))(s)?; let (s, j) = opt(pair(symbol(":"), new))(s)?;
Ok(( Ok((
s, s,

File diff suppressed because it is too large Load Diff