Change AST structure
This commit is contained in:
parent
bba6c7cbf3
commit
5419b44cf8
@ -1,4 +1,4 @@
|
||||
#![recursion_limit = "128"]
|
||||
#![recursion_limit = "256"]
|
||||
pub mod ast;
|
||||
pub mod parser;
|
||||
|
||||
|
@ -9,8 +9,8 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum AssertionItem {
|
||||
Concurrent(ConcurrentAssertionItem),
|
||||
Immediate(DeferredImmediateAssetionItem),
|
||||
Concurrent(Box<ConcurrentAssertionItem>),
|
||||
Immediate(Box<DeferredImmediateAssetionItem>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -23,22 +23,22 @@ pub struct DeferredImmediateAssetionItem {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ProceduralAssertionStatement {
|
||||
Concurrent(ConcurrentAssertionStatement),
|
||||
Immediate(ImmediateAssetionStatement),
|
||||
Checker(CheckerInstantiation),
|
||||
Concurrent(Box<ConcurrentAssertionStatement>),
|
||||
Immediate(Box<ImmediateAssetionStatement>),
|
||||
Checker(Box<CheckerInstantiation>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ImmediateAssetionStatement {
|
||||
Simple(SimpleImmediateAssertionStatement),
|
||||
Deferred(DeferredImmediateAssertionStatement),
|
||||
Simple(Box<SimpleImmediateAssertionStatement>),
|
||||
Deferred(Box<DeferredImmediateAssertionStatement>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum SimpleImmediateAssertionStatement {
|
||||
Assert(SimpleImmediateAssertStatement),
|
||||
Assume(SimpleImmediateAssumeStatement),
|
||||
Cover(SimpleImmediateCoverStatement),
|
||||
Assert(Box<SimpleImmediateAssertStatement>),
|
||||
Assume(Box<SimpleImmediateAssumeStatement>),
|
||||
Cover(Box<SimpleImmediateCoverStatement>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -58,9 +58,9 @@ pub struct SimpleImmediateCoverStatement {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum DeferredImmediateAssertionStatement {
|
||||
Assert(DeferredImmediateAssertStatement),
|
||||
Assume(DeferredImmediateAssumeStatement),
|
||||
Cover(DeferredImmediateCoverStatement),
|
||||
Assert(Box<DeferredImmediateAssertStatement>),
|
||||
Assume(Box<DeferredImmediateAssumeStatement>),
|
||||
Cover(Box<DeferredImmediateCoverStatement>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -80,8 +80,8 @@ pub struct DeferredImmediateCoverStatement {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum AssertTiming {
|
||||
Zero(Symbol),
|
||||
Final(Keyword),
|
||||
Zero(Box<Symbol>),
|
||||
Final(Box<Keyword>),
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -89,9 +89,11 @@ pub enum AssertTiming {
|
||||
#[parser]
|
||||
pub fn assertion_item(s: Span) -> IResult<Span, AssertionItem> {
|
||||
alt((
|
||||
map(concurrent_assertion_item, |x| AssertionItem::Concurrent(x)),
|
||||
map(concurrent_assertion_item, |x| {
|
||||
AssertionItem::Concurrent(Box::new(x))
|
||||
}),
|
||||
map(deferred_immediate_assertion_item, |x| {
|
||||
AssertionItem::Immediate(x)
|
||||
AssertionItem::Immediate(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -107,13 +109,13 @@ pub fn deferred_immediate_assertion_item(s: Span) -> IResult<Span, DeferredImmed
|
||||
pub fn procedural_assertion_statement(s: Span) -> IResult<Span, ProceduralAssertionStatement> {
|
||||
alt((
|
||||
map(concurrent_assertion_statement, |x| {
|
||||
ProceduralAssertionStatement::Concurrent(x)
|
||||
ProceduralAssertionStatement::Concurrent(Box::new(x))
|
||||
}),
|
||||
map(immediate_assertion_statement, |x| {
|
||||
ProceduralAssertionStatement::Immediate(x)
|
||||
ProceduralAssertionStatement::Immediate(Box::new(x))
|
||||
}),
|
||||
map(checker_instantiation, |x| {
|
||||
ProceduralAssertionStatement::Checker(x)
|
||||
ProceduralAssertionStatement::Checker(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -122,10 +124,10 @@ pub fn procedural_assertion_statement(s: Span) -> IResult<Span, ProceduralAssert
|
||||
pub fn immediate_assertion_statement(s: Span) -> IResult<Span, ImmediateAssetionStatement> {
|
||||
alt((
|
||||
map(simple_immediate_assertion_statement, |x| {
|
||||
ImmediateAssetionStatement::Simple(x)
|
||||
ImmediateAssetionStatement::Simple(Box::new(x))
|
||||
}),
|
||||
map(deferred_immediate_assertion_statement, |x| {
|
||||
ImmediateAssetionStatement::Deferred(x)
|
||||
ImmediateAssetionStatement::Deferred(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -136,13 +138,13 @@ pub fn simple_immediate_assertion_statement(
|
||||
) -> IResult<Span, SimpleImmediateAssertionStatement> {
|
||||
alt((
|
||||
map(simple_immediate_assert_statement, |x| {
|
||||
SimpleImmediateAssertionStatement::Assert(x)
|
||||
SimpleImmediateAssertionStatement::Assert(Box::new(x))
|
||||
}),
|
||||
map(simple_immediate_assume_statement, |x| {
|
||||
SimpleImmediateAssertionStatement::Assume(x)
|
||||
SimpleImmediateAssertionStatement::Assume(Box::new(x))
|
||||
}),
|
||||
map(simple_immediate_cover_statement, |x| {
|
||||
SimpleImmediateAssertionStatement::Cover(x)
|
||||
SimpleImmediateAssertionStatement::Cover(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -177,13 +179,13 @@ pub fn deferred_immediate_assertion_statement(
|
||||
) -> IResult<Span, DeferredImmediateAssertionStatement> {
|
||||
alt((
|
||||
map(deferred_immediate_assert_statement, |x| {
|
||||
DeferredImmediateAssertionStatement::Assert(x)
|
||||
DeferredImmediateAssertionStatement::Assert(Box::new(x))
|
||||
}),
|
||||
map(deferred_immediate_assume_statement, |x| {
|
||||
DeferredImmediateAssertionStatement::Assume(x)
|
||||
DeferredImmediateAssertionStatement::Assume(Box::new(x))
|
||||
}),
|
||||
map(deferred_immediate_cover_statement, |x| {
|
||||
DeferredImmediateAssertionStatement::Cover(x)
|
||||
DeferredImmediateAssertionStatement::Cover(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -239,8 +241,8 @@ pub fn deferred_immediate_cover_statement(
|
||||
#[parser]
|
||||
pub fn assert_timing(s: Span) -> IResult<Span, AssertTiming> {
|
||||
alt((
|
||||
map(symbol("#0"), |x| AssertTiming::Zero(x)),
|
||||
map(keyword("final"), |x| AssertTiming::Final(x)),
|
||||
map(symbol("#0"), |x| AssertTiming::Zero(Box::new(x))),
|
||||
map(keyword("final"), |x| AssertTiming::Final(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
|
@ -10,9 +10,9 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum CaseStatement {
|
||||
Normal(CaseStatementNormal),
|
||||
Matches(CaseStatementMatches),
|
||||
Inside(CaseStatementInside),
|
||||
Normal(Box<CaseStatementNormal>),
|
||||
Matches(Box<CaseStatementMatches>),
|
||||
Inside(Box<CaseStatementInside>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -55,9 +55,9 @@ pub struct CaseStatementInside {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum CaseKeyword {
|
||||
Case(Keyword),
|
||||
Casez(Keyword),
|
||||
Casex(Keyword),
|
||||
Case(Box<Keyword>),
|
||||
Casez(Box<Keyword>),
|
||||
Casex(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -67,8 +67,8 @@ pub struct CaseExpression {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum CaseItem {
|
||||
NonDefault(CaseItemNondefault),
|
||||
Default(CaseItemDefault),
|
||||
NonDefault(Box<CaseItemNondefault>),
|
||||
Default(Box<CaseItemDefault>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -83,8 +83,8 @@ pub struct CaseItemDefault {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum CasePatternItem {
|
||||
NonDefault(CasePatternItemNondefault),
|
||||
Default(CaseItemDefault),
|
||||
NonDefault(Box<CasePatternItemNondefault>),
|
||||
Default(Box<CaseItemDefault>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -99,8 +99,8 @@ pub struct CasePatternItemNondefault {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum CaseInsideItem {
|
||||
NonDefault(CaseInsideItemNondefault),
|
||||
Default(CaseItemDefault),
|
||||
NonDefault(Box<CaseInsideItemNondefault>),
|
||||
Default(Box<CaseItemDefault>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -154,9 +154,9 @@ pub fn case_statement_normal(s: Span) -> IResult<Span, CaseStatement> {
|
||||
let (s, f) = keyword("endcase")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CaseStatement::Normal(CaseStatementNormal {
|
||||
CaseStatement::Normal(Box::new(CaseStatementNormal {
|
||||
nodes: (a, b, c, d, e, f),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -171,9 +171,9 @@ pub fn case_statement_matches(s: Span) -> IResult<Span, CaseStatement> {
|
||||
let (s, g) = keyword("endcase")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CaseStatement::Matches(CaseStatementMatches {
|
||||
CaseStatement::Matches(Box::new(CaseStatementMatches {
|
||||
nodes: (a, b, c, d, e, f, g),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -188,18 +188,18 @@ pub fn case_statement_inside(s: Span) -> IResult<Span, CaseStatement> {
|
||||
let (s, g) = keyword("endcase")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CaseStatement::Inside(CaseStatementInside {
|
||||
CaseStatement::Inside(Box::new(CaseStatementInside {
|
||||
nodes: (a, b, c, d, e, f, g),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn case_keyword(s: Span) -> IResult<Span, CaseKeyword> {
|
||||
alt((
|
||||
map(keyword("casez"), |x| CaseKeyword::Casez(x)),
|
||||
map(keyword("casex"), |x| CaseKeyword::Casex(x)),
|
||||
map(keyword("case"), |x| CaseKeyword::Case(x)),
|
||||
map(keyword("casez"), |x| CaseKeyword::Casez(Box::new(x))),
|
||||
map(keyword("casex"), |x| CaseKeyword::Casex(Box::new(x))),
|
||||
map(keyword("case"), |x| CaseKeyword::Case(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -213,7 +213,7 @@ pub fn case_expression(s: Span) -> IResult<Span, CaseExpression> {
|
||||
pub fn case_item(s: Span) -> IResult<Span, CaseItem> {
|
||||
alt((
|
||||
case_item_nondefault,
|
||||
map(case_item_default, |x| CaseItem::Default(x)),
|
||||
map(case_item_default, |x| CaseItem::Default(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -224,7 +224,7 @@ pub fn case_item_nondefault(s: Span) -> IResult<Span, CaseItem> {
|
||||
let (s, c) = statement_or_null(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CaseItem::NonDefault(CaseItemNondefault { nodes: (a, b, c) }),
|
||||
CaseItem::NonDefault(Box::new(CaseItemNondefault { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -240,7 +240,7 @@ pub fn case_item_default(s: Span) -> IResult<Span, CaseItemDefault> {
|
||||
pub fn case_pattern_item(s: Span) -> IResult<Span, CasePatternItem> {
|
||||
alt((
|
||||
case_pattern_item_nondefault,
|
||||
map(case_item_default, |x| CasePatternItem::Default(x)),
|
||||
map(case_item_default, |x| CasePatternItem::Default(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -252,9 +252,9 @@ pub fn case_pattern_item_nondefault(s: Span) -> IResult<Span, CasePatternItem> {
|
||||
let (s, d) = statement_or_null(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CasePatternItem::NonDefault(CasePatternItemNondefault {
|
||||
CasePatternItem::NonDefault(Box::new(CasePatternItemNondefault {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -262,7 +262,7 @@ pub fn case_pattern_item_nondefault(s: Span) -> IResult<Span, CasePatternItem> {
|
||||
pub fn case_inside_item(s: Span) -> IResult<Span, CaseInsideItem> {
|
||||
alt((
|
||||
case_inside_item_nondefault,
|
||||
map(case_item_default, |x| CaseInsideItem::Default(x)),
|
||||
map(case_item_default, |x| CaseInsideItem::Default(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -273,7 +273,7 @@ pub fn case_inside_item_nondefault(s: Span) -> IResult<Span, CaseInsideItem> {
|
||||
let (s, c) = statement_or_null(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CaseInsideItem::NonDefault(CaseInsideItemNondefault { nodes: (a, b, c) }),
|
||||
CaseInsideItem::NonDefault(Box::new(CaseInsideItemNondefault { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -10,8 +10,8 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ClockingDeclaration {
|
||||
Local(ClockingDeclarationLocal),
|
||||
Global(ClockingDeclarationGlobal),
|
||||
Local(Box<ClockingDeclarationLocal>),
|
||||
Global(Box<ClockingDeclarationGlobal>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -48,8 +48,8 @@ pub struct ClockingDeclarationGlobal {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ClockingEvent {
|
||||
Identifier(ClockingEventIdentifier),
|
||||
Expression(ClockingEventExpression),
|
||||
Identifier(Box<ClockingEventIdentifier>),
|
||||
Expression(Box<ClockingEventExpression>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -64,9 +64,9 @@ pub struct ClockingEventExpression {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ClockingItem {
|
||||
Default(ClockingItemDefault),
|
||||
Direction(ClockingItemDirection),
|
||||
Assertion(ClockingItemAssertion),
|
||||
Default(Box<ClockingItemDefault>),
|
||||
Direction(Box<ClockingItemDirection>),
|
||||
Assertion(Box<ClockingItemAssertion>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -86,9 +86,9 @@ pub struct ClockingItemAssertion {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum DefaultSkew {
|
||||
Input(DefaultSkewInput),
|
||||
Output(DefaultSkewOutput),
|
||||
InputOutput(DefaultSkewInputOutput),
|
||||
Input(Box<DefaultSkewInput>),
|
||||
Output(Box<DefaultSkewOutput>),
|
||||
InputOutput(Box<DefaultSkewInputOutput>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -108,10 +108,10 @@ pub struct DefaultSkewInputOutput {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ClockingDirection {
|
||||
Input(ClockingDirectionInput),
|
||||
Output(ClockingDirectionOutput),
|
||||
InputOutput(ClockingDirectionInputOutput),
|
||||
Inout(Keyword),
|
||||
Input(Box<ClockingDirectionInput>),
|
||||
Output(Box<ClockingDirectionOutput>),
|
||||
InputOutput(Box<ClockingDirectionInputOutput>),
|
||||
Inout(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -141,8 +141,8 @@ pub struct ClockingDeclAssign {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ClockingSkew {
|
||||
Edge(ClockingSkewEdge),
|
||||
DelayControl(DelayControl),
|
||||
Edge(Box<ClockingSkewEdge>),
|
||||
DelayControl(Box<DelayControl>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -157,9 +157,9 @@ pub struct ClockingDrive {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum CycleDelay {
|
||||
Integral(CycleDelayIntegral),
|
||||
Identifier(CycleDelayIdentifier),
|
||||
Expression(CycleDelayExpression),
|
||||
Integral(Box<CycleDelayIntegral>),
|
||||
Identifier(Box<CycleDelayIdentifier>),
|
||||
Expression(Box<CycleDelayExpression>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -205,9 +205,9 @@ pub fn clocking_declaration_local(s: Span) -> IResult<Span, ClockingDeclaration>
|
||||
let (s, h) = opt(pair(symbol(":"), clocking_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ClockingDeclaration::Local(ClockingDeclarationLocal {
|
||||
ClockingDeclaration::Local(Box::new(ClockingDeclarationLocal {
|
||||
nodes: (a, b, c, d, e, f, g, h),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -228,9 +228,9 @@ pub fn clocking_declaration_global(s: Span) -> IResult<Span, ClockingDeclaration
|
||||
let (s, g) = opt(pair(symbol(":"), clocking_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ClockingDeclaration::Global(ClockingDeclarationGlobal {
|
||||
ClockingDeclaration::Global(Box::new(ClockingDeclarationGlobal {
|
||||
nodes: (a, b, c, d, e, f, g),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -245,7 +245,7 @@ pub fn clocking_event_identifier(s: Span) -> IResult<Span, ClockingEvent> {
|
||||
let (s, b) = identifier(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ClockingEvent::Identifier(ClockingEventIdentifier { nodes: (a, b) }),
|
||||
ClockingEvent::Identifier(Box::new(ClockingEventIdentifier { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -255,7 +255,7 @@ pub fn clocking_event_expression(s: Span) -> IResult<Span, ClockingEvent> {
|
||||
let (s, b) = paren(event_expression)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ClockingEvent::Expression(ClockingEventExpression { nodes: (a, b) }),
|
||||
ClockingEvent::Expression(Box::new(ClockingEventExpression { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ pub fn clocking_item_default(s: Span) -> IResult<Span, ClockingItem> {
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ClockingItem::Default(ClockingItemDefault { nodes: (a, b, c) }),
|
||||
ClockingItem::Default(Box::new(ClockingItemDefault { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -286,7 +286,7 @@ pub fn clocking_item_direction(s: Span) -> IResult<Span, ClockingItem> {
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ClockingItem::Direction(ClockingItemDirection { nodes: (a, b, c) }),
|
||||
ClockingItem::Direction(Box::new(ClockingItemDirection { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -296,7 +296,7 @@ pub fn clocking_item_assertion(s: Span) -> IResult<Span, ClockingItem> {
|
||||
let (s, b) = assertion_item_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ClockingItem::Assertion(ClockingItemAssertion { nodes: (a, b) }),
|
||||
ClockingItem::Assertion(Box::new(ClockingItemAssertion { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -313,14 +313,20 @@ pub fn default_skew(s: Span) -> IResult<Span, DefaultSkew> {
|
||||
pub fn default_skew_input(s: Span) -> IResult<Span, DefaultSkew> {
|
||||
let (s, a) = keyword("input")(s)?;
|
||||
let (s, b) = clocking_skew(s)?;
|
||||
Ok((s, DefaultSkew::Input(DefaultSkewInput { nodes: (a, b) })))
|
||||
Ok((
|
||||
s,
|
||||
DefaultSkew::Input(Box::new(DefaultSkewInput { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn default_skew_output(s: Span) -> IResult<Span, DefaultSkew> {
|
||||
let (s, a) = keyword("output")(s)?;
|
||||
let (s, b) = clocking_skew(s)?;
|
||||
Ok((s, DefaultSkew::Output(DefaultSkewOutput { nodes: (a, b) })))
|
||||
Ok((
|
||||
s,
|
||||
DefaultSkew::Output(Box::new(DefaultSkewOutput { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
@ -331,9 +337,9 @@ pub fn default_skew_input_output(s: Span) -> IResult<Span, DefaultSkew> {
|
||||
let (s, d) = clocking_skew(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DefaultSkew::InputOutput(DefaultSkewInputOutput {
|
||||
DefaultSkew::InputOutput(Box::new(DefaultSkewInputOutput {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -353,7 +359,7 @@ pub fn clocking_direction_input(s: Span) -> IResult<Span, ClockingDirection> {
|
||||
let (s, b) = opt(clocking_skew)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ClockingDirection::Input(ClockingDirectionInput { nodes: (a, b) }),
|
||||
ClockingDirection::Input(Box::new(ClockingDirectionInput { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -363,7 +369,7 @@ pub fn clocking_direction_output(s: Span) -> IResult<Span, ClockingDirection> {
|
||||
let (s, b) = opt(clocking_skew)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ClockingDirection::Output(ClockingDirectionOutput { nodes: (a, b) }),
|
||||
ClockingDirection::Output(Box::new(ClockingDirectionOutput { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -375,16 +381,16 @@ pub fn clocking_direction_input_output(s: Span) -> IResult<Span, ClockingDirecti
|
||||
let (s, d) = opt(clocking_skew)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ClockingDirection::InputOutput(ClockingDirectionInputOutput {
|
||||
ClockingDirection::InputOutput(Box::new(ClockingDirectionInputOutput {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn clocking_direction_inout(s: Span) -> IResult<Span, ClockingDirection> {
|
||||
let (s, a) = keyword("inout")(s)?;
|
||||
Ok((s, ClockingDirection::Inout(a)))
|
||||
Ok((s, ClockingDirection::Inout(Box::new(a))))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
@ -404,7 +410,7 @@ pub fn clocking_decl_assign(s: Span) -> IResult<Span, ClockingDeclAssign> {
|
||||
pub fn clocking_skew(s: Span) -> IResult<Span, ClockingSkew> {
|
||||
alt((
|
||||
clocking_skew_edge,
|
||||
map(delay_control, |x| ClockingSkew::DelayControl(x)),
|
||||
map(delay_control, |x| ClockingSkew::DelayControl(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -412,7 +418,10 @@ pub fn clocking_skew(s: Span) -> IResult<Span, ClockingSkew> {
|
||||
pub fn clocking_skew_edge(s: Span) -> IResult<Span, ClockingSkew> {
|
||||
let (s, a) = edge_identifier(s)?;
|
||||
let (s, b) = opt(delay_control)(s)?;
|
||||
Ok((s, ClockingSkew::Edge(ClockingSkewEdge { nodes: (a, b) })))
|
||||
Ok((
|
||||
s,
|
||||
ClockingSkew::Edge(Box::new(ClockingSkewEdge { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
@ -444,7 +453,7 @@ pub fn cycle_delay_integral(s: Span) -> IResult<Span, CycleDelay> {
|
||||
let (s, b) = integral_number(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CycleDelay::Integral(CycleDelayIntegral { nodes: (a, b) }),
|
||||
CycleDelay::Integral(Box::new(CycleDelayIntegral { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -454,7 +463,7 @@ pub fn cycle_delay_identifier(s: Span) -> IResult<Span, CycleDelay> {
|
||||
let (s, b) = identifier(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CycleDelay::Identifier(CycleDelayIdentifier { nodes: (a, b) }),
|
||||
CycleDelay::Identifier(Box::new(CycleDelayIdentifier { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -464,7 +473,7 @@ pub fn cycle_delay_expression(s: Span) -> IResult<Span, CycleDelay> {
|
||||
let (s, b) = paren(expression)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CycleDelay::Expression(CycleDelayExpression { nodes: (a, b) }),
|
||||
CycleDelay::Expression(Box::new(CycleDelayExpression { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -22,9 +22,9 @@ pub struct ConditionalStatement {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum UniquePriority {
|
||||
Unique(Keyword),
|
||||
Unique0(Keyword),
|
||||
Priority(Keyword),
|
||||
Unique(Box<Keyword>),
|
||||
Unique0(Box<Keyword>),
|
||||
Priority(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -34,8 +34,8 @@ pub struct CondPredicate {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ExpressionOrCondPattern {
|
||||
Expression(Expression),
|
||||
CondPattern(CondPattern),
|
||||
Expression(Box<Expression>),
|
||||
CondPattern(Box<CondPattern>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -70,9 +70,11 @@ pub fn conditional_statement(s: Span) -> IResult<Span, ConditionalStatement> {
|
||||
#[parser]
|
||||
pub fn unique_priority(s: Span) -> IResult<Span, UniquePriority> {
|
||||
alt((
|
||||
map(keyword("unique0"), |x| UniquePriority::Unique0(x)),
|
||||
map(keyword("unique"), |x| UniquePriority::Unique(x)),
|
||||
map(keyword("priority"), |x| UniquePriority::Priority(x)),
|
||||
map(keyword("unique0"), |x| UniquePriority::Unique0(Box::new(x))),
|
||||
map(keyword("unique"), |x| UniquePriority::Unique(Box::new(x))),
|
||||
map(keyword("priority"), |x| {
|
||||
UniquePriority::Priority(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -85,8 +87,12 @@ pub fn cond_predicate(s: Span) -> IResult<Span, CondPredicate> {
|
||||
#[parser]
|
||||
pub fn expression_or_cond_pattern(s: Span) -> IResult<Span, ExpressionOrCondPattern> {
|
||||
alt((
|
||||
map(expression, |x| ExpressionOrCondPattern::Expression(x)),
|
||||
map(cond_pattern, |x| ExpressionOrCondPattern::CondPattern(x)),
|
||||
map(expression, |x| {
|
||||
ExpressionOrCondPattern::Expression(Box::new(x))
|
||||
}),
|
||||
map(cond_pattern, |x| {
|
||||
ExpressionOrCondPattern::CondPattern(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,8 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ContinuousAssign {
|
||||
Net(ContinuousAssignNet),
|
||||
Variable(ContinuousAssignVariable),
|
||||
Net(Box<ContinuousAssignNet>),
|
||||
Variable(Box<ContinuousAssignVariable>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -70,9 +70,9 @@ pub fn continuous_assign_net(s: Span) -> IResult<Span, ContinuousAssign> {
|
||||
|
||||
Ok((
|
||||
s,
|
||||
ContinuousAssign::Net(ContinuousAssignNet {
|
||||
ContinuousAssign::Net(Box::new(ContinuousAssignNet {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -85,9 +85,9 @@ pub fn continuous_assign_variable(s: Span) -> IResult<Span, ContinuousAssign> {
|
||||
|
||||
Ok((
|
||||
s,
|
||||
ContinuousAssign::Variable(ContinuousAssignVariable {
|
||||
ContinuousAssign::Variable(Box::new(ContinuousAssignVariable {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -9,12 +9,12 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum LoopStatement {
|
||||
Forever(LoopStatementForever),
|
||||
Repeat(LoopStatementRepeat),
|
||||
While(LoopStatementWhile),
|
||||
For(LoopStatementFor),
|
||||
DoWhile(LoopStatementDoWhile),
|
||||
Foreach(LoopStatementForeach),
|
||||
Forever(Box<LoopStatementForever>),
|
||||
Repeat(Box<LoopStatementRepeat>),
|
||||
While(Box<LoopStatementWhile>),
|
||||
For(Box<LoopStatementFor>),
|
||||
DoWhile(Box<LoopStatementDoWhile>),
|
||||
Foreach(Box<LoopStatementForeach>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -63,8 +63,8 @@ pub struct LoopStatementForeach {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ForInitialization {
|
||||
ListOfVariableAssignments(ListOfVariableAssignments),
|
||||
Declaration(ForInitializationDeclaration),
|
||||
ListOfVariableAssignments(Box<ListOfVariableAssignments>),
|
||||
Declaration(Box<ForInitializationDeclaration>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -93,9 +93,9 @@ pub struct ForStep {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ForStepAssignment {
|
||||
OperatorAssignment(OperatorAssignment),
|
||||
IncOrDecExpression(IncOrDecExpression),
|
||||
FunctionSubroutineCall(FunctionSubroutineCall),
|
||||
OperatorAssignment(Box<OperatorAssignment>),
|
||||
IncOrDecExpression(Box<IncOrDecExpression>),
|
||||
FunctionSubroutineCall(Box<FunctionSubroutineCall>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -123,7 +123,7 @@ pub fn loop_statement_forever(s: Span) -> IResult<Span, LoopStatement> {
|
||||
let (s, b) = statement_or_null(s)?;
|
||||
Ok((
|
||||
s,
|
||||
LoopStatement::Forever(LoopStatementForever { nodes: (a, b) }),
|
||||
LoopStatement::Forever(Box::new(LoopStatementForever { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ pub fn loop_statement_repeat(s: Span) -> IResult<Span, LoopStatement> {
|
||||
let (s, c) = statement_or_null(s)?;
|
||||
Ok((
|
||||
s,
|
||||
LoopStatement::Repeat(LoopStatementRepeat { nodes: (a, b, c) }),
|
||||
LoopStatement::Repeat(Box::new(LoopStatementRepeat { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ pub fn loop_statement_while(s: Span) -> IResult<Span, LoopStatement> {
|
||||
let (s, c) = statement_or_null(s)?;
|
||||
Ok((
|
||||
s,
|
||||
LoopStatement::While(LoopStatementWhile { nodes: (a, b, c) }),
|
||||
LoopStatement::While(Box::new(LoopStatementWhile { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -160,7 +160,10 @@ pub fn loop_statement_for(s: Span) -> IResult<Span, LoopStatement> {
|
||||
opt(for_step),
|
||||
)))(s)?;
|
||||
let (s, c) = statement_or_null(s)?;
|
||||
Ok((s, LoopStatement::For(LoopStatementFor { nodes: (a, b, c) })))
|
||||
Ok((
|
||||
s,
|
||||
LoopStatement::For(Box::new(LoopStatementFor { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
@ -172,9 +175,9 @@ pub fn loop_statement_do_while(s: Span) -> IResult<Span, LoopStatement> {
|
||||
let (s, e) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
LoopStatement::DoWhile(LoopStatementDoWhile {
|
||||
LoopStatement::DoWhile(Box::new(LoopStatementDoWhile {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -188,7 +191,7 @@ pub fn loop_statement_foreach(s: Span) -> IResult<Span, LoopStatement> {
|
||||
let (s, c) = statement(s)?;
|
||||
Ok((
|
||||
s,
|
||||
LoopStatement::Foreach(LoopStatementForeach { nodes: (a, b, c) }),
|
||||
LoopStatement::Foreach(Box::new(LoopStatementForeach { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -196,7 +199,7 @@ pub fn loop_statement_foreach(s: Span) -> IResult<Span, LoopStatement> {
|
||||
pub fn for_initialization(s: Span) -> IResult<Span, ForInitialization> {
|
||||
alt((
|
||||
map(list_of_variable_assignments, |x| {
|
||||
ForInitialization::ListOfVariableAssignments(x)
|
||||
ForInitialization::ListOfVariableAssignments(Box::new(x))
|
||||
}),
|
||||
for_initialization_declaration,
|
||||
))(s)
|
||||
@ -207,7 +210,7 @@ pub fn for_initialization_declaration(s: Span) -> IResult<Span, ForInitializatio
|
||||
let (s, a) = list(symbol(","), for_variable_declaration)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ForInitialization::Declaration(ForInitializationDeclaration { nodes: (a,) }),
|
||||
ForInitialization::Declaration(Box::new(ForInitializationDeclaration { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -238,13 +241,13 @@ pub fn for_step(s: Span) -> IResult<Span, ForStep> {
|
||||
pub fn for_step_assignment(s: Span) -> IResult<Span, ForStepAssignment> {
|
||||
alt((
|
||||
map(operator_assignment, |x| {
|
||||
ForStepAssignment::OperatorAssignment(x)
|
||||
ForStepAssignment::OperatorAssignment(Box::new(x))
|
||||
}),
|
||||
map(inc_or_dec_expression, |x| {
|
||||
ForStepAssignment::IncOrDecExpression(x)
|
||||
ForStepAssignment::IncOrDecExpression(Box::new(x))
|
||||
}),
|
||||
map(function_subroutine_call, |x| {
|
||||
ForStepAssignment::FunctionSubroutineCall(x)
|
||||
ForStepAssignment::FunctionSubroutineCall(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
@ -10,8 +10,8 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ActionBlock {
|
||||
StatementOrNull(StatementOrNull),
|
||||
Else(ActionBlockElse),
|
||||
StatementOrNull(Box<StatementOrNull>),
|
||||
Else(Box<ActionBlockElse>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -45,9 +45,9 @@ pub struct ParBlock {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum JoinKeyword {
|
||||
Join(Keyword),
|
||||
JoinAny(Keyword),
|
||||
JoinNone(Keyword),
|
||||
Join(Box<Keyword>),
|
||||
JoinAny(Box<Keyword>),
|
||||
JoinNone(Box<Keyword>),
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -55,7 +55,9 @@ pub enum JoinKeyword {
|
||||
#[parser]
|
||||
pub fn action_block(s: Span) -> IResult<Span, ActionBlock> {
|
||||
alt((
|
||||
map(statement_or_null, |x| ActionBlock::StatementOrNull(x)),
|
||||
map(statement_or_null, |x| {
|
||||
ActionBlock::StatementOrNull(Box::new(x))
|
||||
}),
|
||||
action_block_else,
|
||||
))(s)
|
||||
}
|
||||
@ -65,7 +67,10 @@ pub fn action_block_else(s: Span) -> IResult<Span, ActionBlock> {
|
||||
let (s, a) = opt(statement)(s)?;
|
||||
let (s, b) = keyword("else")(s)?;
|
||||
let (s, c) = statement_or_null(s)?;
|
||||
Ok((s, ActionBlock::Else(ActionBlockElse { nodes: (a, b, c) })))
|
||||
Ok((
|
||||
s,
|
||||
ActionBlock::Else(Box::new(ActionBlockElse { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
@ -103,8 +108,8 @@ pub fn par_block(s: Span) -> IResult<Span, ParBlock> {
|
||||
#[parser]
|
||||
pub fn join_keyword(s: Span) -> IResult<Span, JoinKeyword> {
|
||||
alt((
|
||||
map(keyword("join_any"), |x| JoinKeyword::JoinAny(x)),
|
||||
map(keyword("join_none"), |x| JoinKeyword::JoinNone(x)),
|
||||
map(keyword("join"), |x| JoinKeyword::Join(x)),
|
||||
map(keyword("join_any"), |x| JoinKeyword::JoinAny(Box::new(x))),
|
||||
map(keyword("join_none"), |x| JoinKeyword::JoinNone(Box::new(x))),
|
||||
map(keyword("join"), |x| JoinKeyword::Join(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ use nom_packrat::packrat_parser;
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum Pattern {
|
||||
Variable(Box<PatternVariable>),
|
||||
Asterisk(Symbol),
|
||||
Asterisk(Box<Symbol>),
|
||||
ConstantExpression(Box<ConstantExpression>),
|
||||
Tagged(Box<PatternTagged>),
|
||||
List(Box<PatternList>),
|
||||
@ -40,10 +40,10 @@ pub struct PatternIdentifierList {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum AssignmentPattern {
|
||||
List(AssignmentPatternList),
|
||||
Structure(AssignmentPatternStructure),
|
||||
Array(AssignmentPatternArray),
|
||||
Repeat(AssignmentPatternRepeat),
|
||||
List(Box<AssignmentPatternList>),
|
||||
Structure(Box<AssignmentPatternStructure>),
|
||||
Array(Box<AssignmentPatternArray>),
|
||||
Repeat(Box<AssignmentPatternRepeat>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -68,20 +68,20 @@ pub struct AssignmentPatternRepeat {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum StructurePatternKey {
|
||||
MemberIdentifier(MemberIdentifier),
|
||||
AssignmentPatternKey(AssignmentPatternKey),
|
||||
MemberIdentifier(Box<MemberIdentifier>),
|
||||
AssignmentPatternKey(Box<AssignmentPatternKey>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ArrayPatternKey {
|
||||
ConstantExpression(ConstantExpression),
|
||||
AssignmentPatternKey(AssignmentPatternKey),
|
||||
ConstantExpression(Box<ConstantExpression>),
|
||||
AssignmentPatternKey(Box<AssignmentPatternKey>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum AssignmentPatternKey {
|
||||
SimpleType(SimpleType),
|
||||
Default(Keyword),
|
||||
SimpleType(Box<SimpleType>),
|
||||
Default(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -91,10 +91,10 @@ pub struct AssignmentPatternExpression {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum AssignmentPatternExpressionType {
|
||||
PsTypeIdentifier(PsTypeIdentifier),
|
||||
PsParameterIdentifier(PsParameterIdentifier),
|
||||
IntegerAtomType(IntegerAtomType),
|
||||
TypeReference(TypeReference),
|
||||
PsTypeIdentifier(Box<PsTypeIdentifier>),
|
||||
PsParameterIdentifier(Box<PsParameterIdentifier>),
|
||||
IntegerAtomType(Box<IntegerAtomType>),
|
||||
TypeReference(Box<TypeReference>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -118,7 +118,7 @@ pub struct AssignmentPatternVariableLvalue {
|
||||
pub fn pattern(s: Span) -> IResult<Span, Pattern> {
|
||||
alt((
|
||||
pattern_variable,
|
||||
map(symbol(".*"), |x| Pattern::Asterisk(x)),
|
||||
map(symbol(".*"), |x| Pattern::Asterisk(Box::new(x))),
|
||||
map(constant_expression, |x| {
|
||||
Pattern::ConstantExpression(Box::new(x))
|
||||
}),
|
||||
@ -182,7 +182,7 @@ pub fn assignment_pattern_list(s: Span) -> IResult<Span, AssignmentPattern> {
|
||||
let (s, a) = apostrophe_brace(list(symbol(","), expression))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
AssignmentPattern::List(AssignmentPatternList { nodes: (a,) }),
|
||||
AssignmentPattern::List(Box::new(AssignmentPatternList { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -194,7 +194,7 @@ pub fn assignment_pattern_structure(s: Span) -> IResult<Span, AssignmentPattern>
|
||||
))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
AssignmentPattern::Structure(AssignmentPatternStructure { nodes: (a,) }),
|
||||
AssignmentPattern::Structure(Box::new(AssignmentPatternStructure { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ pub fn assignment_pattern_array(s: Span) -> IResult<Span, AssignmentPattern> {
|
||||
))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
AssignmentPattern::Array(AssignmentPatternArray { nodes: (a,) }),
|
||||
AssignmentPattern::Array(Box::new(AssignmentPatternArray { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -218,7 +218,7 @@ pub fn assignment_pattern_repeat(s: Span) -> IResult<Span, AssignmentPattern> {
|
||||
))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
AssignmentPattern::Repeat(AssignmentPatternRepeat { nodes: (a,) }),
|
||||
AssignmentPattern::Repeat(Box::new(AssignmentPatternRepeat { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -226,10 +226,10 @@ pub fn assignment_pattern_repeat(s: Span) -> IResult<Span, AssignmentPattern> {
|
||||
pub fn structure_pattern_key(s: Span) -> IResult<Span, StructurePatternKey> {
|
||||
alt((
|
||||
map(member_identifier, |x| {
|
||||
StructurePatternKey::MemberIdentifier(x)
|
||||
StructurePatternKey::MemberIdentifier(Box::new(x))
|
||||
}),
|
||||
map(assignment_pattern_key, |x| {
|
||||
StructurePatternKey::AssignmentPatternKey(x)
|
||||
StructurePatternKey::AssignmentPatternKey(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -238,10 +238,10 @@ pub fn structure_pattern_key(s: Span) -> IResult<Span, StructurePatternKey> {
|
||||
pub fn array_pattern_key(s: Span) -> IResult<Span, ArrayPatternKey> {
|
||||
alt((
|
||||
map(constant_expression, |x| {
|
||||
ArrayPatternKey::ConstantExpression(x)
|
||||
ArrayPatternKey::ConstantExpression(Box::new(x))
|
||||
}),
|
||||
map(assignment_pattern_key, |x| {
|
||||
ArrayPatternKey::AssignmentPatternKey(x)
|
||||
ArrayPatternKey::AssignmentPatternKey(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -249,8 +249,12 @@ pub fn array_pattern_key(s: Span) -> IResult<Span, ArrayPatternKey> {
|
||||
#[parser]
|
||||
pub fn assignment_pattern_key(s: Span) -> IResult<Span, AssignmentPatternKey> {
|
||||
alt((
|
||||
map(simple_type, |x| AssignmentPatternKey::SimpleType(x)),
|
||||
map(keyword("default"), |x| AssignmentPatternKey::Default(x)),
|
||||
map(simple_type, |x| {
|
||||
AssignmentPatternKey::SimpleType(Box::new(x))
|
||||
}),
|
||||
map(keyword("default"), |x| {
|
||||
AssignmentPatternKey::Default(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -268,16 +272,16 @@ pub fn assignment_pattern_expression_type(
|
||||
) -> IResult<Span, AssignmentPatternExpressionType> {
|
||||
alt((
|
||||
map(ps_type_identifier, |x| {
|
||||
AssignmentPatternExpressionType::PsTypeIdentifier(x)
|
||||
AssignmentPatternExpressionType::PsTypeIdentifier(Box::new(x))
|
||||
}),
|
||||
map(ps_parameter_identifier, |x| {
|
||||
AssignmentPatternExpressionType::PsParameterIdentifier(x)
|
||||
AssignmentPatternExpressionType::PsParameterIdentifier(Box::new(x))
|
||||
}),
|
||||
map(integer_atom_type, |x| {
|
||||
AssignmentPatternExpressionType::IntegerAtomType(x)
|
||||
AssignmentPatternExpressionType::IntegerAtomType(Box::new(x))
|
||||
}),
|
||||
map(type_reference, |x| {
|
||||
AssignmentPatternExpressionType::TypeReference(x)
|
||||
AssignmentPatternExpressionType::TypeReference(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
@ -18,10 +18,10 @@ pub struct AlwaysConstruct {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum AlwaysKeyword {
|
||||
Always(Keyword),
|
||||
AlwaysComb(Keyword),
|
||||
AlwaysLatch(Keyword),
|
||||
AlwaysFf(Keyword),
|
||||
Always(Box<Keyword>),
|
||||
AlwaysComb(Box<Keyword>),
|
||||
AlwaysLatch(Box<Keyword>),
|
||||
AlwaysFf(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -31,10 +31,10 @@ pub struct FinalConstruct {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum BlockingAssignment {
|
||||
Variable(BlockingAssignmentVariable),
|
||||
NonrangeVariable(BlockingAssignmentNonrangeVariable),
|
||||
HierarchicalVariable(BlockingAssignmentHierarchicalVariable),
|
||||
OperatorAssignment(OperatorAssignment),
|
||||
Variable(Box<BlockingAssignmentVariable>),
|
||||
NonrangeVariable(Box<BlockingAssignmentNonrangeVariable>),
|
||||
HierarchicalVariable(Box<BlockingAssignmentHierarchicalVariable>),
|
||||
OperatorAssignment(Box<OperatorAssignment>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -80,12 +80,12 @@ pub struct NonblockingAssignment {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ProceduralContinuousAssignment {
|
||||
Assign(ProceduralContinuousAssignmentAssign),
|
||||
Deassign(ProceduralContinuousAssignmentDeassign),
|
||||
ForceVariable(ProceduralContinuousAssignmentForceVariable),
|
||||
ForceNet(ProceduralContinuousAssignmentForceNet),
|
||||
ReleaseVariable(ProceduralContinuousAssignmentReleaseVariable),
|
||||
ReleaseNet(ProceduralContinuousAssignmentReleaseNet),
|
||||
Assign(Box<ProceduralContinuousAssignmentAssign>),
|
||||
Deassign(Box<ProceduralContinuousAssignmentDeassign>),
|
||||
ForceVariable(Box<ProceduralContinuousAssignmentForceVariable>),
|
||||
ForceNet(Box<ProceduralContinuousAssignmentForceNet>),
|
||||
ReleaseVariable(Box<ProceduralContinuousAssignmentReleaseVariable>),
|
||||
ReleaseNet(Box<ProceduralContinuousAssignmentReleaseNet>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -142,10 +142,16 @@ pub fn always_construct(s: Span) -> IResult<Span, AlwaysConstruct> {
|
||||
#[parser]
|
||||
pub fn always_keyword(s: Span) -> IResult<Span, AlwaysKeyword> {
|
||||
alt((
|
||||
map(keyword("always_comb"), |x| AlwaysKeyword::AlwaysComb(x)),
|
||||
map(keyword("always_latch"), |x| AlwaysKeyword::AlwaysLatch(x)),
|
||||
map(keyword("always_ff"), |x| AlwaysKeyword::AlwaysFf(x)),
|
||||
map(keyword("always"), |x| AlwaysKeyword::Always(x)),
|
||||
map(keyword("always_comb"), |x| {
|
||||
AlwaysKeyword::AlwaysComb(Box::new(x))
|
||||
}),
|
||||
map(keyword("always_latch"), |x| {
|
||||
AlwaysKeyword::AlwaysLatch(Box::new(x))
|
||||
}),
|
||||
map(keyword("always_ff"), |x| {
|
||||
AlwaysKeyword::AlwaysFf(Box::new(x))
|
||||
}),
|
||||
map(keyword("always"), |x| AlwaysKeyword::Always(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -163,7 +169,7 @@ pub fn blocking_assignment(s: Span) -> IResult<Span, BlockingAssignment> {
|
||||
blocking_assignment_nonrange_variable,
|
||||
blocking_assignment_hierarchical_variable,
|
||||
map(operator_assignment, |x| {
|
||||
BlockingAssignment::OperatorAssignment(x)
|
||||
BlockingAssignment::OperatorAssignment(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -176,9 +182,9 @@ pub fn blocking_assignment_variable(s: Span) -> IResult<Span, BlockingAssignment
|
||||
let (s, d) = expression(s)?;
|
||||
Ok((
|
||||
s,
|
||||
BlockingAssignment::Variable(BlockingAssignmentVariable {
|
||||
BlockingAssignment::Variable(Box::new(BlockingAssignmentVariable {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -189,9 +195,9 @@ pub fn blocking_assignment_nonrange_variable(s: Span) -> IResult<Span, BlockingA
|
||||
let (s, c) = dynamic_array_new(s)?;
|
||||
Ok((
|
||||
s,
|
||||
BlockingAssignment::NonrangeVariable(BlockingAssignmentNonrangeVariable {
|
||||
BlockingAssignment::NonrangeVariable(Box::new(BlockingAssignmentNonrangeVariable {
|
||||
nodes: (a, b, c),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -204,9 +210,11 @@ pub fn blocking_assignment_hierarchical_variable(s: Span) -> IResult<Span, Block
|
||||
let (s, e) = class_new(s)?;
|
||||
Ok((
|
||||
s,
|
||||
BlockingAssignment::HierarchicalVariable(BlockingAssignmentHierarchicalVariable {
|
||||
BlockingAssignment::HierarchicalVariable(Box::new(
|
||||
BlockingAssignmentHierarchicalVariable {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
},
|
||||
)),
|
||||
))
|
||||
}
|
||||
|
||||
@ -271,9 +279,9 @@ pub fn procedural_continuous_assignment_assign(
|
||||
let (s, b) = variable_assignment(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ProceduralContinuousAssignment::Assign(ProceduralContinuousAssignmentAssign {
|
||||
ProceduralContinuousAssignment::Assign(Box::new(ProceduralContinuousAssignmentAssign {
|
||||
nodes: (a, b),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -285,9 +293,9 @@ pub fn procedural_continuous_assignment_deassign(
|
||||
let (s, b) = variable_lvalue(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ProceduralContinuousAssignment::Deassign(ProceduralContinuousAssignmentDeassign {
|
||||
nodes: (a, b),
|
||||
}),
|
||||
ProceduralContinuousAssignment::Deassign(Box::new(
|
||||
ProceduralContinuousAssignmentDeassign { nodes: (a, b) },
|
||||
)),
|
||||
))
|
||||
}
|
||||
|
||||
@ -299,9 +307,9 @@ pub fn procedural_continuous_assignment_force_variable(
|
||||
let (s, b) = variable_assignment(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ProceduralContinuousAssignment::ForceVariable(
|
||||
ProceduralContinuousAssignment::ForceVariable(Box::new(
|
||||
ProceduralContinuousAssignmentForceVariable { nodes: (a, b) },
|
||||
),
|
||||
)),
|
||||
))
|
||||
}
|
||||
|
||||
@ -313,9 +321,9 @@ pub fn procedural_continuous_assignment_force_net(
|
||||
let (s, b) = net_assignment(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ProceduralContinuousAssignment::ForceNet(ProceduralContinuousAssignmentForceNet {
|
||||
nodes: (a, b),
|
||||
}),
|
||||
ProceduralContinuousAssignment::ForceNet(Box::new(
|
||||
ProceduralContinuousAssignmentForceNet { nodes: (a, b) },
|
||||
)),
|
||||
))
|
||||
}
|
||||
|
||||
@ -327,9 +335,9 @@ pub fn procedural_continuous_assignment_release_variable(
|
||||
let (s, b) = variable_lvalue(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ProceduralContinuousAssignment::ReleaseVariable(
|
||||
ProceduralContinuousAssignment::ReleaseVariable(Box::new(
|
||||
ProceduralContinuousAssignmentReleaseVariable { nodes: (a, b) },
|
||||
),
|
||||
)),
|
||||
))
|
||||
}
|
||||
|
||||
@ -341,9 +349,9 @@ pub fn procedural_continuous_assignment_release_net(
|
||||
let (s, b) = net_lvalue(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ProceduralContinuousAssignment::ReleaseNet(ProceduralContinuousAssignmentReleaseNet {
|
||||
nodes: (a, b),
|
||||
}),
|
||||
ProceduralContinuousAssignment::ReleaseNet(Box::new(
|
||||
ProceduralContinuousAssignmentReleaseNet { nodes: (a, b) },
|
||||
)),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -41,8 +41,8 @@ pub struct RsRule {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum RsProductionList {
|
||||
Prod(RsProductionListProd),
|
||||
Join(RsProductionListJoin),
|
||||
Prod(Box<RsProductionListProd>),
|
||||
Join(Box<RsProductionListJoin>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -64,9 +64,9 @@ pub struct RsProductionListJoin {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum WeightSpecification {
|
||||
IntegralNumber(IntegralNumber),
|
||||
PsIdentifier(PsIdentifier),
|
||||
Expression(WeightSpecificationExpression),
|
||||
IntegralNumber(Box<IntegralNumber>),
|
||||
PsIdentifier(Box<PsIdentifier>),
|
||||
Expression(Box<WeightSpecificationExpression>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -81,11 +81,11 @@ pub struct RsCodeBlock {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum RsProd {
|
||||
ProductionItem(ProductionItem),
|
||||
RsCodeBlock(RsCodeBlock),
|
||||
RsIfElse(RsIfElse),
|
||||
RsRepeat(RsRepeat),
|
||||
RsCase(RsCase),
|
||||
ProductionItem(Box<ProductionItem>),
|
||||
RsCodeBlock(Box<RsCodeBlock>),
|
||||
RsIfElse(Box<RsIfElse>),
|
||||
RsRepeat(Box<RsRepeat>),
|
||||
RsCase(Box<RsCase>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -121,8 +121,8 @@ pub struct RsCase {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum RsCaseItem {
|
||||
NonDefault(RsCaseItemNondefault),
|
||||
Default(RsCaseItemDefault),
|
||||
NonDefault(Box<RsCaseItemNondefault>),
|
||||
Default(Box<RsCaseItemDefault>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -195,7 +195,7 @@ pub fn rs_production_list_prod(s: Span) -> IResult<Span, RsProductionList> {
|
||||
let (s, b) = many0(rs_prod)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
RsProductionList::Prod(RsProductionListProd { nodes: (a, b) }),
|
||||
RsProductionList::Prod(Box::new(RsProductionListProd { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -209,17 +209,21 @@ pub fn rs_production_list_join(s: Span) -> IResult<Span, RsProductionList> {
|
||||
let (s, f) = many0(production_item)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
RsProductionList::Join(RsProductionListJoin {
|
||||
RsProductionList::Join(Box::new(RsProductionListJoin {
|
||||
nodes: (a, b, c, d, e, f),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn weight_specification(s: Span) -> IResult<Span, WeightSpecification> {
|
||||
alt((
|
||||
map(integral_number, |x| WeightSpecification::IntegralNumber(x)),
|
||||
map(ps_identifier, |x| WeightSpecification::PsIdentifier(x)),
|
||||
map(integral_number, |x| {
|
||||
WeightSpecification::IntegralNumber(Box::new(x))
|
||||
}),
|
||||
map(ps_identifier, |x| {
|
||||
WeightSpecification::PsIdentifier(Box::new(x))
|
||||
}),
|
||||
weight_specification_expression,
|
||||
))(s)
|
||||
}
|
||||
@ -229,7 +233,7 @@ pub fn weight_specification_expression(s: Span) -> IResult<Span, WeightSpecifica
|
||||
let (s, a) = paren(expression)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
WeightSpecification::Expression(WeightSpecificationExpression { nodes: (a,) }),
|
||||
WeightSpecification::Expression(Box::new(WeightSpecificationExpression { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -242,11 +246,11 @@ pub fn rs_code_block(s: Span) -> IResult<Span, RsCodeBlock> {
|
||||
#[parser]
|
||||
pub fn rs_prod(s: Span) -> IResult<Span, RsProd> {
|
||||
alt((
|
||||
map(production_item, |x| RsProd::ProductionItem(x)),
|
||||
map(rs_code_block, |x| RsProd::RsCodeBlock(x)),
|
||||
map(rs_if_else, |x| RsProd::RsIfElse(x)),
|
||||
map(rs_repeat, |x| RsProd::RsRepeat(x)),
|
||||
map(rs_case, |x| RsProd::RsCase(x)),
|
||||
map(production_item, |x| RsProd::ProductionItem(Box::new(x))),
|
||||
map(rs_code_block, |x| RsProd::RsCodeBlock(Box::new(x))),
|
||||
map(rs_if_else, |x| RsProd::RsIfElse(Box::new(x))),
|
||||
map(rs_repeat, |x| RsProd::RsRepeat(Box::new(x))),
|
||||
map(rs_case, |x| RsProd::RsCase(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -307,9 +311,9 @@ pub fn rs_case_item_nondefault(s: Span) -> IResult<Span, RsCaseItem> {
|
||||
let (s, d) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
RsCaseItem::NonDefault(RsCaseItemNondefault {
|
||||
RsCaseItem::NonDefault(Box::new(RsCaseItemNondefault {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -321,8 +325,8 @@ pub fn rs_case_item_default(s: Span) -> IResult<Span, RsCaseItem> {
|
||||
let (s, d) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
RsCaseItem::Default(RsCaseItemDefault {
|
||||
RsCaseItem::Default(Box::new(RsCaseItemDefault {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
@ -10,8 +10,8 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum StatementOrNull {
|
||||
Statement(Statement),
|
||||
Attribute(StatementOrNullAttribute),
|
||||
Statement(Box<Statement>),
|
||||
Attribute(Box<StatementOrNullAttribute>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -59,8 +59,8 @@ pub struct FunctionStatement {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum FunctionStatementOrNull {
|
||||
Statement(FunctionStatement),
|
||||
Attribute(FunctionStatementOrNullAttribute),
|
||||
Statement(Box<FunctionStatement>),
|
||||
Attribute(Box<FunctionStatementOrNullAttribute>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -78,7 +78,7 @@ pub struct VariableIdentifierList {
|
||||
#[parser]
|
||||
pub fn statement_or_null(s: Span) -> IResult<Span, StatementOrNull> {
|
||||
alt((
|
||||
map(statement, |x| StatementOrNull::Statement(x)),
|
||||
map(statement, |x| StatementOrNull::Statement(Box::new(x))),
|
||||
statement_or_null_attribute,
|
||||
))(s)
|
||||
}
|
||||
@ -89,7 +89,7 @@ pub fn statement_or_null_attribute(s: Span) -> IResult<Span, StatementOrNull> {
|
||||
let (s, b) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
StatementOrNull::Attribute(StatementOrNullAttribute { nodes: (a, b) }),
|
||||
StatementOrNull::Attribute(Box::new(StatementOrNullAttribute { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ pub fn function_statement(s: Span) -> IResult<Span, FunctionStatement> {
|
||||
pub fn function_statement_or_null(s: Span) -> IResult<Span, FunctionStatementOrNull> {
|
||||
alt((
|
||||
map(function_statement, |x| {
|
||||
FunctionStatementOrNull::Statement(x)
|
||||
FunctionStatementOrNull::Statement(Box::new(x))
|
||||
}),
|
||||
function_statement_or_null_attribute,
|
||||
))(s)
|
||||
@ -183,7 +183,9 @@ pub fn function_statement_or_null_attribute(s: Span) -> IResult<Span, FunctionSt
|
||||
let (s, b) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
FunctionStatementOrNull::Attribute(FunctionStatementOrNullAttribute { nodes: (a, b) }),
|
||||
FunctionStatementOrNull::Attribute(Box::new(FunctionStatementOrNullAttribute {
|
||||
nodes: (a, b),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -9,8 +9,8 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum SubroutineCallStatement {
|
||||
SubroutineCall((SubroutineCall, Symbol)),
|
||||
Function(SubroutineCallStatementFunction),
|
||||
SubroutineCall(Box<(SubroutineCall, Symbol)>),
|
||||
Function(Box<SubroutineCallStatementFunction>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -24,7 +24,7 @@ pub struct SubroutineCallStatementFunction {
|
||||
pub fn subroutine_call_statement(s: Span) -> IResult<Span, SubroutineCallStatement> {
|
||||
alt((
|
||||
map(pair(subroutine_call, symbol(";")), |x| {
|
||||
SubroutineCallStatement::SubroutineCall(x)
|
||||
SubroutineCallStatement::SubroutineCall(Box::new(x))
|
||||
}),
|
||||
subroutine_call_statement_function,
|
||||
))(s)
|
||||
@ -38,9 +38,9 @@ pub fn subroutine_call_statement_function(s: Span) -> IResult<Span, SubroutineCa
|
||||
let (s, d) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
SubroutineCallStatement::Function(SubroutineCallStatementFunction {
|
||||
SubroutineCallStatement::Function(Box::new(SubroutineCallStatementFunction {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -14,9 +14,9 @@ pub struct ProceduralTimingControlStatement {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum DelayOrEventControl {
|
||||
Delay(DelayControl),
|
||||
Event(EventControl),
|
||||
Repeat(DelayOrEventControlRepeat),
|
||||
Delay(Box<DelayControl>),
|
||||
Event(Box<EventControl>),
|
||||
Repeat(Box<DelayOrEventControlRepeat>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -26,8 +26,8 @@ pub struct DelayOrEventControlRepeat {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum DelayControl {
|
||||
Delay(DelayControlDelay),
|
||||
Mintypmax(DelayControlMintypmax),
|
||||
Delay(Box<DelayControlDelay>),
|
||||
Mintypmax(Box<DelayControlMintypmax>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -42,11 +42,11 @@ pub struct DelayControlMintypmax {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum EventControl {
|
||||
EventIdentifier(EventControlEventIdentifier),
|
||||
EventExpression(EventControlEventExpression),
|
||||
Asterisk(EventControlAsterisk),
|
||||
ParenAsterisk(EventControlParenAsterisk),
|
||||
SequenceIdentifier(EventControlSequenceIdentifier),
|
||||
EventIdentifier(Box<EventControlEventIdentifier>),
|
||||
EventExpression(Box<EventControlEventExpression>),
|
||||
Asterisk(Box<EventControlAsterisk>),
|
||||
ParenAsterisk(Box<EventControlParenAsterisk>),
|
||||
SequenceIdentifier(Box<EventControlSequenceIdentifier>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -114,16 +114,16 @@ pub struct EventExpressionParen {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ProceduralTimingControl {
|
||||
DelayControl(DelayControl),
|
||||
EventControl(EventControl),
|
||||
CycleDelay(CycleDelay),
|
||||
DelayControl(Box<DelayControl>),
|
||||
EventControl(Box<EventControl>),
|
||||
CycleDelay(Box<CycleDelay>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum JumpStatement {
|
||||
Return(JumpStatementReturn),
|
||||
Break(JumpStatementBreak),
|
||||
Continue(JumpStatementContinue),
|
||||
Return(Box<JumpStatementReturn>),
|
||||
Break(Box<JumpStatementBreak>),
|
||||
Continue(Box<JumpStatementContinue>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -143,9 +143,9 @@ pub struct JumpStatementContinue {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum WaitStatement {
|
||||
Wait(WaitStatementWait),
|
||||
Fork(WaitStatementFork),
|
||||
Order(WaitStatementOrder),
|
||||
Wait(Box<WaitStatementWait>),
|
||||
Fork(Box<WaitStatementFork>),
|
||||
Order(Box<WaitStatementOrder>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -169,8 +169,8 @@ pub struct WaitStatementOrder {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum EventTrigger {
|
||||
Named(EventTriggerNamed),
|
||||
Nonblocking(EventTriggerNonblocking),
|
||||
Named(Box<EventTriggerNamed>),
|
||||
Nonblocking(Box<EventTriggerNonblocking>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -190,9 +190,9 @@ pub struct EventTriggerNonblocking {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum DisableStatement {
|
||||
Task(DisableStatementTask),
|
||||
Block(DisableStatementBlock),
|
||||
Fork(DisableStatementFork),
|
||||
Task(Box<DisableStatementTask>),
|
||||
Block(Box<DisableStatementBlock>),
|
||||
Fork(Box<DisableStatementFork>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -224,8 +224,8 @@ pub fn procedural_timing_control_statement(
|
||||
#[parser]
|
||||
pub fn delay_or_event_control(s: Span) -> IResult<Span, DelayOrEventControl> {
|
||||
alt((
|
||||
map(delay_control, |x| DelayOrEventControl::Delay(x)),
|
||||
map(event_control, |x| DelayOrEventControl::Event(x)),
|
||||
map(delay_control, |x| DelayOrEventControl::Delay(Box::new(x))),
|
||||
map(event_control, |x| DelayOrEventControl::Event(Box::new(x))),
|
||||
delay_or_event_control_repeat,
|
||||
))(s)
|
||||
}
|
||||
@ -237,7 +237,7 @@ pub fn delay_or_event_control_repeat(s: Span) -> IResult<Span, DelayOrEventContr
|
||||
let (s, c) = event_control(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DelayOrEventControl::Repeat(DelayOrEventControlRepeat { nodes: (a, b, c) }),
|
||||
DelayOrEventControl::Repeat(Box::new(DelayOrEventControlRepeat { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -250,7 +250,10 @@ pub fn delay_control(s: Span) -> IResult<Span, DelayControl> {
|
||||
pub fn delay_control_delay(s: Span) -> IResult<Span, DelayControl> {
|
||||
let (s, a) = symbol("#")(s)?;
|
||||
let (s, b) = delay_value(s)?;
|
||||
Ok((s, DelayControl::Delay(DelayControlDelay { nodes: (a, b) })))
|
||||
Ok((
|
||||
s,
|
||||
DelayControl::Delay(Box::new(DelayControlDelay { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
@ -259,7 +262,7 @@ pub fn delay_control_mintypmax(s: Span) -> IResult<Span, DelayControl> {
|
||||
let (s, b) = paren(mintypmax_expression)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DelayControl::Mintypmax(DelayControlMintypmax { nodes: (a, b) }),
|
||||
DelayControl::Mintypmax(Box::new(DelayControlMintypmax { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -280,7 +283,7 @@ pub fn event_control_event_identifier(s: Span) -> IResult<Span, EventControl> {
|
||||
let (s, b) = hierarchical_event_identifier(s)?;
|
||||
Ok((
|
||||
s,
|
||||
EventControl::EventIdentifier(EventControlEventIdentifier { nodes: (a, b) }),
|
||||
EventControl::EventIdentifier(Box::new(EventControlEventIdentifier { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -290,7 +293,7 @@ pub fn event_control_event_expression(s: Span) -> IResult<Span, EventControl> {
|
||||
let (s, b) = paren(event_expression)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
EventControl::EventExpression(EventControlEventExpression { nodes: (a, b) }),
|
||||
EventControl::EventExpression(Box::new(EventControlEventExpression { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -299,7 +302,7 @@ pub fn event_control_asterisk(s: Span) -> IResult<Span, EventControl> {
|
||||
let (s, a) = symbol("@*")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
EventControl::Asterisk(EventControlAsterisk { nodes: (a,) }),
|
||||
EventControl::Asterisk(Box::new(EventControlAsterisk { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -309,7 +312,7 @@ pub fn event_control_paren_asterisk(s: Span) -> IResult<Span, EventControl> {
|
||||
let (s, b) = paren(symbol("*"))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
EventControl::ParenAsterisk(EventControlParenAsterisk { nodes: (a, b) }),
|
||||
EventControl::ParenAsterisk(Box::new(EventControlParenAsterisk { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -319,7 +322,9 @@ pub fn event_control_sequence_identifier(s: Span) -> IResult<Span, EventControl>
|
||||
let (s, b) = ps_or_hierarchical_sequence_identifier(s)?;
|
||||
Ok((
|
||||
s,
|
||||
EventControl::SequenceIdentifier(EventControlSequenceIdentifier { nodes: (a, b) }),
|
||||
EventControl::SequenceIdentifier(Box::new(EventControlSequenceIdentifier {
|
||||
nodes: (a, b),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -389,9 +394,15 @@ pub fn event_expression_paren(s: Span) -> IResult<Span, EventExpression> {
|
||||
#[parser]
|
||||
pub fn procedural_timing_control(s: Span) -> IResult<Span, ProceduralTimingControl> {
|
||||
alt((
|
||||
map(delay_control, |x| ProceduralTimingControl::DelayControl(x)),
|
||||
map(event_control, |x| ProceduralTimingControl::EventControl(x)),
|
||||
map(cycle_delay, |x| ProceduralTimingControl::CycleDelay(x)),
|
||||
map(delay_control, |x| {
|
||||
ProceduralTimingControl::DelayControl(Box::new(x))
|
||||
}),
|
||||
map(event_control, |x| {
|
||||
ProceduralTimingControl::EventControl(Box::new(x))
|
||||
}),
|
||||
map(cycle_delay, |x| {
|
||||
ProceduralTimingControl::CycleDelay(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -411,7 +422,7 @@ pub fn jump_statement_return(s: Span) -> IResult<Span, JumpStatement> {
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
JumpStatement::Return(JumpStatementReturn { nodes: (a, b, c) }),
|
||||
JumpStatement::Return(Box::new(JumpStatementReturn { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -421,7 +432,7 @@ pub fn jump_statement_break(s: Span) -> IResult<Span, JumpStatement> {
|
||||
let (s, b) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
JumpStatement::Break(JumpStatementBreak { nodes: (a, b) }),
|
||||
JumpStatement::Break(Box::new(JumpStatementBreak { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -431,7 +442,7 @@ pub fn jump_statement_continue(s: Span) -> IResult<Span, JumpStatement> {
|
||||
let (s, b) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
JumpStatement::Continue(JumpStatementContinue { nodes: (a, b) }),
|
||||
JumpStatement::Continue(Box::new(JumpStatementContinue { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -451,7 +462,7 @@ pub fn wait_statement_wait(s: Span) -> IResult<Span, WaitStatement> {
|
||||
let (s, c) = statement_or_null(s)?;
|
||||
Ok((
|
||||
s,
|
||||
WaitStatement::Wait(WaitStatementWait { nodes: (a, b, c) }),
|
||||
WaitStatement::Wait(Box::new(WaitStatementWait { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -462,7 +473,7 @@ pub fn wait_statement_fork(s: Span) -> IResult<Span, WaitStatement> {
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
WaitStatement::Fork(WaitStatementFork { nodes: (a, b, c) }),
|
||||
WaitStatement::Fork(Box::new(WaitStatementFork { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -473,7 +484,7 @@ pub fn wait_statement_order(s: Span) -> IResult<Span, WaitStatement> {
|
||||
let (s, c) = action_block(s)?;
|
||||
Ok((
|
||||
s,
|
||||
WaitStatement::Order(WaitStatementOrder { nodes: (a, b, c) }),
|
||||
WaitStatement::Order(Box::new(WaitStatementOrder { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -489,7 +500,7 @@ pub fn event_trigger_named(s: Span) -> IResult<Span, EventTrigger> {
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
EventTrigger::Named(EventTriggerNamed { nodes: (a, b, c) }),
|
||||
EventTrigger::Named(Box::new(EventTriggerNamed { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -501,9 +512,9 @@ pub fn event_trigger_nonblocking(s: Span) -> IResult<Span, EventTrigger> {
|
||||
let (s, d) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
EventTrigger::Nonblocking(EventTriggerNonblocking {
|
||||
EventTrigger::Nonblocking(Box::new(EventTriggerNonblocking {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -523,7 +534,7 @@ pub fn disable_statement_task(s: Span) -> IResult<Span, DisableStatement> {
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DisableStatement::Task(DisableStatementTask { nodes: (a, b, c) }),
|
||||
DisableStatement::Task(Box::new(DisableStatementTask { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -534,7 +545,7 @@ pub fn disable_statement_block(s: Span) -> IResult<Span, DisableStatement> {
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DisableStatement::Block(DisableStatementBlock { nodes: (a, b, c) }),
|
||||
DisableStatement::Block(Box::new(DisableStatementBlock { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -545,6 +556,6 @@ pub fn disable_statement_fork(s: Span) -> IResult<Span, DisableStatement> {
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DisableStatement::Fork(DisableStatementFork { nodes: (a, b, c) }),
|
||||
DisableStatement::Fork(Box::new(DisableStatementFork { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
@ -10,8 +10,8 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ConcurrentAssertionItem {
|
||||
Statement(ConcurrentAssertionItemStatement),
|
||||
CheckerInstantiation(CheckerInstantiation),
|
||||
Statement(Box<ConcurrentAssertionItemStatement>),
|
||||
CheckerInstantiation(Box<CheckerInstantiation>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -24,11 +24,11 @@ pub struct ConcurrentAssertionItemStatement {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ConcurrentAssertionStatement {
|
||||
AssertPropertyStatement(AssertPropertyStatement),
|
||||
AssumePropertyStatement(AssumePropertyStatement),
|
||||
CoverPropertyStatement(CoverPropertyStatement),
|
||||
CoverSequenceStatement(CoverSequenceStatement),
|
||||
RestrictPropertyStatement(RestrictPropertyStatement),
|
||||
AssertPropertyStatement(Box<AssertPropertyStatement>),
|
||||
AssumePropertyStatement(Box<AssumePropertyStatement>),
|
||||
CoverPropertyStatement(Box<CoverPropertyStatement>),
|
||||
CoverSequenceStatement(Box<CoverSequenceStatement>),
|
||||
RestrictPropertyStatement(Box<RestrictPropertyStatement>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -80,8 +80,8 @@ pub struct PropertyInstance {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PropertyListOfArguments {
|
||||
Ordered(PropertyListOfArgumentsOrdered),
|
||||
Named(PropertyListOfArgumentsNamed),
|
||||
Ordered(Box<PropertyListOfArgumentsOrdered>),
|
||||
Named(Box<PropertyListOfArgumentsNamed>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -99,15 +99,15 @@ pub struct PropertyListOfArgumentsNamed {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PropertyActualArg {
|
||||
PropertyExpr(PropertyExpr),
|
||||
SequenceActualArg(SequenceActualArg),
|
||||
PropertyExpr(Box<PropertyExpr>),
|
||||
SequenceActualArg(Box<SequenceActualArg>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum AssertionItemDeclaration {
|
||||
PropertyDeclaration(PropertyDeclaration),
|
||||
SequenceDeclaration(SequenceDeclaration),
|
||||
LetDeclaration(LetDeclaration),
|
||||
PropertyDeclaration(Box<PropertyDeclaration>),
|
||||
SequenceDeclaration(Box<SequenceDeclaration>),
|
||||
LetDeclaration(Box<LetDeclaration>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -144,13 +144,13 @@ pub struct PropertyPortItem {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PropertyLvarPortDirection {
|
||||
Input(Keyword),
|
||||
Input(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PropertyFormalType {
|
||||
SequenceFormalType(SequenceFormalType),
|
||||
Property(Keyword),
|
||||
SequenceFormalType(Box<SequenceFormalType>),
|
||||
Property(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -164,9 +164,9 @@ pub struct PropertySpec {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PropertyExpr {
|
||||
SequenceExpr(SequenceExpr),
|
||||
Strong(PropertyExprStrong),
|
||||
Weak(PropertyExprWeak),
|
||||
SequenceExpr(Box<SequenceExpr>),
|
||||
Strong(Box<PropertyExprStrong>),
|
||||
Weak(Box<PropertyExprWeak>),
|
||||
Paren(Box<PropertyExprParen>),
|
||||
Not(Box<PropertyExprNot>),
|
||||
Or(Box<PropertyExprOr>),
|
||||
@ -367,8 +367,8 @@ pub struct PropertyExprClockingEvent {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PropertyCaseItem {
|
||||
Nondefault(PropertyCaseItemNondefault),
|
||||
Default(PropertyCaseItemDefault),
|
||||
Nondefault(Box<PropertyCaseItemNondefault>),
|
||||
Default(Box<PropertyCaseItemDefault>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -415,23 +415,23 @@ pub struct SequencePortItem {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum SequenceLvarPortDirection {
|
||||
Input(Keyword),
|
||||
Inout(Keyword),
|
||||
Output(Keyword),
|
||||
Input(Box<Keyword>),
|
||||
Inout(Box<Keyword>),
|
||||
Output(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum SequenceFormalType {
|
||||
DataTypeOrImplicit(DataTypeOrImplicit),
|
||||
Sequence(Keyword),
|
||||
Untyped(Keyword),
|
||||
DataTypeOrImplicit(Box<DataTypeOrImplicit>),
|
||||
Sequence(Box<Keyword>),
|
||||
Untyped(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum SequenceExpr {
|
||||
CycleDelayExpr(Box<SequenceExprCycleDelayExpr>),
|
||||
ExprCycleDelayExpr(Box<SequenceExprExprCycleDelayExpr>),
|
||||
Expression(SequenceExprExpression),
|
||||
Expression(Box<SequenceExprExpression>),
|
||||
Instance(Box<SequenceExprInstance>),
|
||||
Paren(Box<SequenceExprParen>),
|
||||
And(Box<SequenceExprAnd>),
|
||||
@ -520,10 +520,10 @@ pub struct SequenceExprClockingEvent {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum CycleDelayRange {
|
||||
Primary(CycleDelayRangePrimary),
|
||||
Expression(CycleDelayRangeExpression),
|
||||
Asterisk(CycleDelayRangeAsterisk),
|
||||
Plus(CycleDelayRangePlus),
|
||||
Primary(Box<CycleDelayRangePrimary>),
|
||||
Expression(Box<CycleDelayRangeExpression>),
|
||||
Asterisk(Box<CycleDelayRangeAsterisk>),
|
||||
Plus(Box<CycleDelayRangePlus>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -553,9 +553,9 @@ pub struct SequenceMethodCall {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum SequenceMatchItem {
|
||||
OperatorAssignment(OperatorAssignment),
|
||||
IncOrDecExpression(IncOrDecExpression),
|
||||
SubroutineCall(SubroutineCall),
|
||||
OperatorAssignment(Box<OperatorAssignment>),
|
||||
IncOrDecExpression(Box<IncOrDecExpression>),
|
||||
SubroutineCall(Box<SubroutineCall>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -568,8 +568,8 @@ pub struct SequenceInstance {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum SequenceListOfArguments {
|
||||
Ordered(SequenceListOfArgumentsOrdered),
|
||||
Named(SequenceListOfArgumentsNamed),
|
||||
Ordered(Box<SequenceListOfArgumentsOrdered>),
|
||||
Named(Box<SequenceListOfArgumentsNamed>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -587,15 +587,15 @@ pub struct SequenceListOfArgumentsNamed {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum SequenceActualArg {
|
||||
EventExpression(EventExpression),
|
||||
SequenceExpr(SequenceExpr),
|
||||
EventExpression(Box<EventExpression>),
|
||||
SequenceExpr(Box<SequenceExpr>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum BooleanAbbrev {
|
||||
ConsecutiveRepetition(ConsecutiveRepetition),
|
||||
NonConsecutiveRepetition(NonConsecutiveRepetition),
|
||||
GotoRepetition(GotoRepetition),
|
||||
ConsecutiveRepetition(Box<ConsecutiveRepetition>),
|
||||
NonConsecutiveRepetition(Box<NonConsecutiveRepetition>),
|
||||
GotoRepetition(Box<GotoRepetition>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -605,9 +605,9 @@ pub struct SequenceAbbrev {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ConsecutiveRepetition {
|
||||
Expression(ConsecutiveRepetitionExpression),
|
||||
Asterisk(ConsecutiveRepetitionAsterisk),
|
||||
Plus(ConsecutiveRepetitionPlus),
|
||||
Expression(Box<ConsecutiveRepetitionExpression>),
|
||||
Asterisk(Box<ConsecutiveRepetitionAsterisk>),
|
||||
Plus(Box<ConsecutiveRepetitionPlus>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -637,14 +637,14 @@ pub struct GotoRepetition {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ConstOrRangeExpression {
|
||||
ConstantExpression(ConstantExpression),
|
||||
CycleDelayConstRangeExpression(CycleDelayConstRangeExpression),
|
||||
ConstantExpression(Box<ConstantExpression>),
|
||||
CycleDelayConstRangeExpression(Box<CycleDelayConstRangeExpression>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum CycleDelayConstRangeExpression {
|
||||
Binary(CycleDelayConstRangeExpressionBinary),
|
||||
Dollar(CycleDelayConstRangeExpressionDollar),
|
||||
Binary(Box<CycleDelayConstRangeExpressionBinary>),
|
||||
Dollar(Box<CycleDelayConstRangeExpressionDollar>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -674,7 +674,7 @@ pub fn concurrent_assertion_item(s: Span) -> IResult<Span, ConcurrentAssertionIt
|
||||
alt((
|
||||
concurrent_assertion_item_statement,
|
||||
map(checker_instantiation, |x| {
|
||||
ConcurrentAssertionItem::CheckerInstantiation(x)
|
||||
ConcurrentAssertionItem::CheckerInstantiation(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -685,7 +685,9 @@ pub fn concurrent_assertion_item_statement(s: Span) -> IResult<Span, ConcurrentA
|
||||
let (s, b) = concurrent_assertion_statement(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConcurrentAssertionItem::Statement(ConcurrentAssertionItemStatement { nodes: (a, b) }),
|
||||
ConcurrentAssertionItem::Statement(Box::new(ConcurrentAssertionItemStatement {
|
||||
nodes: (a, b),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -693,19 +695,19 @@ pub fn concurrent_assertion_item_statement(s: Span) -> IResult<Span, ConcurrentA
|
||||
pub fn concurrent_assertion_statement(s: Span) -> IResult<Span, ConcurrentAssertionStatement> {
|
||||
alt((
|
||||
map(assert_property_statement, |x| {
|
||||
ConcurrentAssertionStatement::AssertPropertyStatement(x)
|
||||
ConcurrentAssertionStatement::AssertPropertyStatement(Box::new(x))
|
||||
}),
|
||||
map(assume_property_statement, |x| {
|
||||
ConcurrentAssertionStatement::AssumePropertyStatement(x)
|
||||
ConcurrentAssertionStatement::AssumePropertyStatement(Box::new(x))
|
||||
}),
|
||||
map(cover_property_statement, |x| {
|
||||
ConcurrentAssertionStatement::CoverPropertyStatement(x)
|
||||
ConcurrentAssertionStatement::CoverPropertyStatement(Box::new(x))
|
||||
}),
|
||||
map(cover_sequence_statement, |x| {
|
||||
ConcurrentAssertionStatement::CoverSequenceStatement(x)
|
||||
ConcurrentAssertionStatement::CoverSequenceStatement(Box::new(x))
|
||||
}),
|
||||
map(restrict_property_statement, |x| {
|
||||
ConcurrentAssertionStatement::RestrictPropertyStatement(x)
|
||||
ConcurrentAssertionStatement::RestrictPropertyStatement(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -822,7 +824,9 @@ pub fn property_list_of_arguments_ordered(s: Span) -> IResult<Span, PropertyList
|
||||
)))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PropertyListOfArguments::Ordered(PropertyListOfArgumentsOrdered { nodes: (a, b) }),
|
||||
PropertyListOfArguments::Ordered(Box::new(PropertyListOfArgumentsOrdered {
|
||||
nodes: (a, b),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -834,16 +838,18 @@ pub fn property_list_of_arguments_named(s: Span) -> IResult<Span, PropertyListOf
|
||||
)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PropertyListOfArguments::Named(PropertyListOfArgumentsNamed { nodes: (a,) }),
|
||||
PropertyListOfArguments::Named(Box::new(PropertyListOfArgumentsNamed { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn property_actual_arg(s: Span) -> IResult<Span, PropertyActualArg> {
|
||||
alt((
|
||||
map(property_expr, |x| PropertyActualArg::PropertyExpr(x)),
|
||||
map(property_expr, |x| {
|
||||
PropertyActualArg::PropertyExpr(Box::new(x))
|
||||
}),
|
||||
map(sequence_actual_arg, |x| {
|
||||
PropertyActualArg::SequenceActualArg(x)
|
||||
PropertyActualArg::SequenceActualArg(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -852,13 +858,13 @@ pub fn property_actual_arg(s: Span) -> IResult<Span, PropertyActualArg> {
|
||||
pub fn assertion_item_declaration(s: Span) -> IResult<Span, AssertionItemDeclaration> {
|
||||
alt((
|
||||
map(property_declaration, |x| {
|
||||
AssertionItemDeclaration::PropertyDeclaration(x)
|
||||
AssertionItemDeclaration::PropertyDeclaration(Box::new(x))
|
||||
}),
|
||||
map(sequence_declaration, |x| {
|
||||
AssertionItemDeclaration::SequenceDeclaration(x)
|
||||
AssertionItemDeclaration::SequenceDeclaration(Box::new(x))
|
||||
}),
|
||||
map(let_declaration, |x| {
|
||||
AssertionItemDeclaration::LetDeclaration(x)
|
||||
AssertionItemDeclaration::LetDeclaration(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -907,16 +913,18 @@ pub fn property_port_item(s: Span) -> IResult<Span, PropertyPortItem> {
|
||||
#[parser]
|
||||
pub fn property_lvar_port_direction(s: Span) -> IResult<Span, PropertyLvarPortDirection> {
|
||||
let (s, a) = keyword("input")(s)?;
|
||||
Ok((s, PropertyLvarPortDirection::Input(a)))
|
||||
Ok((s, PropertyLvarPortDirection::Input(Box::new(a))))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn property_formal_type(s: Span) -> IResult<Span, PropertyFormalType> {
|
||||
alt((
|
||||
map(sequence_formal_type, |x| {
|
||||
PropertyFormalType::SequenceFormalType(x)
|
||||
PropertyFormalType::SequenceFormalType(Box::new(x))
|
||||
}),
|
||||
map(keyword("property"), |x| {
|
||||
PropertyFormalType::Property(Box::new(x))
|
||||
}),
|
||||
map(keyword("property"), |x| PropertyFormalType::Property(x)),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -936,7 +944,7 @@ pub fn property_spec(s: Span) -> IResult<Span, PropertySpec> {
|
||||
pub fn property_expr(s: Span) -> IResult<Span, PropertyExpr> {
|
||||
alt((
|
||||
alt((
|
||||
map(sequence_expr, |x| PropertyExpr::SequenceExpr(x)),
|
||||
map(sequence_expr, |x| PropertyExpr::SequenceExpr(Box::new(x))),
|
||||
property_expr_strong,
|
||||
property_expr_weak,
|
||||
property_expr_paren,
|
||||
@ -981,7 +989,7 @@ pub fn property_expr_strong(s: Span) -> IResult<Span, PropertyExpr> {
|
||||
let (s, b) = paren(sequence_expr)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PropertyExpr::Strong(PropertyExprStrong { nodes: (a, b) }),
|
||||
PropertyExpr::Strong(Box::new(PropertyExprStrong { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -991,7 +999,7 @@ pub fn property_expr_weak(s: Span) -> IResult<Span, PropertyExpr> {
|
||||
let (s, b) = paren(sequence_expr)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PropertyExpr::Strong(PropertyExprStrong { nodes: (a, b) }),
|
||||
PropertyExpr::Strong(Box::new(PropertyExprStrong { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1316,9 +1324,9 @@ pub fn property_case_item_nondefault(s: Span) -> IResult<Span, PropertyCaseItem>
|
||||
let (s, d) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PropertyCaseItem::Nondefault(PropertyCaseItemNondefault {
|
||||
PropertyCaseItem::Nondefault(Box::new(PropertyCaseItemNondefault {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1330,9 +1338,9 @@ pub fn property_case_item_default(s: Span) -> IResult<Span, PropertyCaseItem> {
|
||||
let (s, d) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PropertyCaseItem::Default(PropertyCaseItemDefault {
|
||||
PropertyCaseItem::Default(Box::new(PropertyCaseItemDefault {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1380,9 +1388,15 @@ pub fn sequence_port_item(s: Span) -> IResult<Span, SequencePortItem> {
|
||||
#[parser]
|
||||
pub fn sequence_lvar_port_direction(s: Span) -> IResult<Span, SequenceLvarPortDirection> {
|
||||
alt((
|
||||
map(keyword("input"), |x| SequenceLvarPortDirection::Input(x)),
|
||||
map(keyword("inout"), |x| SequenceLvarPortDirection::Inout(x)),
|
||||
map(keyword("output"), |x| SequenceLvarPortDirection::Output(x)),
|
||||
map(keyword("input"), |x| {
|
||||
SequenceLvarPortDirection::Input(Box::new(x))
|
||||
}),
|
||||
map(keyword("inout"), |x| {
|
||||
SequenceLvarPortDirection::Inout(Box::new(x))
|
||||
}),
|
||||
map(keyword("output"), |x| {
|
||||
SequenceLvarPortDirection::Output(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -1390,10 +1404,14 @@ pub fn sequence_lvar_port_direction(s: Span) -> IResult<Span, SequenceLvarPortDi
|
||||
pub fn sequence_formal_type(s: Span) -> IResult<Span, SequenceFormalType> {
|
||||
alt((
|
||||
map(data_type_or_implicit, |x| {
|
||||
SequenceFormalType::DataTypeOrImplicit(x)
|
||||
SequenceFormalType::DataTypeOrImplicit(Box::new(x))
|
||||
}),
|
||||
map(keyword("sequence"), |x| {
|
||||
SequenceFormalType::Sequence(Box::new(x))
|
||||
}),
|
||||
map(keyword("untyped"), |x| {
|
||||
SequenceFormalType::Untyped(Box::new(x))
|
||||
}),
|
||||
map(keyword("sequence"), |x| SequenceFormalType::Sequence(x)),
|
||||
map(keyword("untyped"), |x| SequenceFormalType::Untyped(x)),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -1446,7 +1464,7 @@ pub fn sequence_expr_expression(s: Span) -> IResult<Span, SequenceExpr> {
|
||||
let (s, b) = opt(boolean_abbrev)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
SequenceExpr::Expression(SequenceExprExpression { nodes: (a, b) }),
|
||||
SequenceExpr::Expression(Box::new(SequenceExprExpression { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1567,7 +1585,7 @@ pub fn cycle_delay_range_primary(s: Span) -> IResult<Span, CycleDelayRange> {
|
||||
let (s, b) = constant_primary(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CycleDelayRange::Primary(CycleDelayRangePrimary { nodes: (a, b) }),
|
||||
CycleDelayRange::Primary(Box::new(CycleDelayRangePrimary { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1577,7 +1595,7 @@ pub fn cycle_delay_range_expression(s: Span) -> IResult<Span, CycleDelayRange> {
|
||||
let (s, b) = bracket(cycle_delay_const_range_expression)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CycleDelayRange::Expression(CycleDelayRangeExpression { nodes: (a, b) }),
|
||||
CycleDelayRange::Expression(Box::new(CycleDelayRangeExpression { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1587,7 +1605,7 @@ pub fn cycle_delay_range_asterisk(s: Span) -> IResult<Span, CycleDelayRange> {
|
||||
let (s, b) = bracket(symbol("*"))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CycleDelayRange::Asterisk(CycleDelayRangeAsterisk { nodes: (a, b) }),
|
||||
CycleDelayRange::Asterisk(Box::new(CycleDelayRangeAsterisk { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1597,7 +1615,7 @@ pub fn cycle_delay_range_plus(s: Span) -> IResult<Span, CycleDelayRange> {
|
||||
let (s, b) = bracket(symbol("+"))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CycleDelayRange::Plus(CycleDelayRangePlus { nodes: (a, b) }),
|
||||
CycleDelayRange::Plus(Box::new(CycleDelayRangePlus { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1613,12 +1631,14 @@ pub fn sequence_method_call(s: Span) -> IResult<Span, SequenceMethodCall> {
|
||||
pub fn sequence_match_item(s: Span) -> IResult<Span, SequenceMatchItem> {
|
||||
alt((
|
||||
map(operator_assignment, |x| {
|
||||
SequenceMatchItem::OperatorAssignment(x)
|
||||
SequenceMatchItem::OperatorAssignment(Box::new(x))
|
||||
}),
|
||||
map(inc_or_dec_expression, |x| {
|
||||
SequenceMatchItem::IncOrDecExpression(x)
|
||||
SequenceMatchItem::IncOrDecExpression(Box::new(x))
|
||||
}),
|
||||
map(subroutine_call, |x| {
|
||||
SequenceMatchItem::SubroutineCall(Box::new(x))
|
||||
}),
|
||||
map(subroutine_call, |x| SequenceMatchItem::SubroutineCall(x)),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -1648,7 +1668,9 @@ pub fn sequence_list_of_arguments_ordered(s: Span) -> IResult<Span, SequenceList
|
||||
)))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
SequenceListOfArguments::Ordered(SequenceListOfArgumentsOrdered { nodes: (a, b) }),
|
||||
SequenceListOfArguments::Ordered(Box::new(SequenceListOfArgumentsOrdered {
|
||||
nodes: (a, b),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1660,15 +1682,19 @@ pub fn sequence_list_of_arguments_named(s: Span) -> IResult<Span, SequenceListOf
|
||||
)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
SequenceListOfArguments::Named(SequenceListOfArgumentsNamed { nodes: (a,) }),
|
||||
SequenceListOfArguments::Named(Box::new(SequenceListOfArgumentsNamed { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn sequence_actual_arg(s: Span) -> IResult<Span, SequenceActualArg> {
|
||||
alt((
|
||||
map(event_expression, |x| SequenceActualArg::EventExpression(x)),
|
||||
map(sequence_expr, |x| SequenceActualArg::SequenceExpr(x)),
|
||||
map(event_expression, |x| {
|
||||
SequenceActualArg::EventExpression(Box::new(x))
|
||||
}),
|
||||
map(sequence_expr, |x| {
|
||||
SequenceActualArg::SequenceExpr(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -1676,12 +1702,14 @@ pub fn sequence_actual_arg(s: Span) -> IResult<Span, SequenceActualArg> {
|
||||
pub fn boolean_abbrev(s: Span) -> IResult<Span, BooleanAbbrev> {
|
||||
alt((
|
||||
map(consecutive_repetition, |x| {
|
||||
BooleanAbbrev::ConsecutiveRepetition(x)
|
||||
BooleanAbbrev::ConsecutiveRepetition(Box::new(x))
|
||||
}),
|
||||
map(non_consecutive_repetition, |x| {
|
||||
BooleanAbbrev::NonConsecutiveRepetition(x)
|
||||
BooleanAbbrev::NonConsecutiveRepetition(Box::new(x))
|
||||
}),
|
||||
map(goto_repetition, |x| {
|
||||
BooleanAbbrev::GotoRepetition(Box::new(x))
|
||||
}),
|
||||
map(goto_repetition, |x| BooleanAbbrev::GotoRepetition(x)),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -1705,7 +1733,9 @@ pub fn consecutive_repetition_expression(s: Span) -> IResult<Span, ConsecutiveRe
|
||||
let (s, a) = bracket(pair(symbol("*"), const_or_range_expression))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConsecutiveRepetition::Expression(ConsecutiveRepetitionExpression { nodes: (a,) }),
|
||||
ConsecutiveRepetition::Expression(Box::new(ConsecutiveRepetitionExpression {
|
||||
nodes: (a,),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1714,7 +1744,7 @@ pub fn consecutive_repetition_asterisk(s: Span) -> IResult<Span, ConsecutiveRepe
|
||||
let (s, a) = bracket(symbol("*"))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConsecutiveRepetition::Asterisk(ConsecutiveRepetitionAsterisk { nodes: (a,) }),
|
||||
ConsecutiveRepetition::Asterisk(Box::new(ConsecutiveRepetitionAsterisk { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1723,7 +1753,7 @@ pub fn consecutive_repetition_plus(s: Span) -> IResult<Span, ConsecutiveRepetiti
|
||||
let (s, a) = bracket(symbol("+"))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConsecutiveRepetition::Plus(ConsecutiveRepetitionPlus { nodes: (a,) }),
|
||||
ConsecutiveRepetition::Plus(Box::new(ConsecutiveRepetitionPlus { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1743,10 +1773,10 @@ pub fn goto_repetition(s: Span) -> IResult<Span, GotoRepetition> {
|
||||
pub fn const_or_range_expression(s: Span) -> IResult<Span, ConstOrRangeExpression> {
|
||||
alt((
|
||||
map(constant_expression, |x| {
|
||||
ConstOrRangeExpression::ConstantExpression(x)
|
||||
ConstOrRangeExpression::ConstantExpression(Box::new(x))
|
||||
}),
|
||||
map(cycle_delay_const_range_expression, |x| {
|
||||
ConstOrRangeExpression::CycleDelayConstRangeExpression(x)
|
||||
ConstOrRangeExpression::CycleDelayConstRangeExpression(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -1770,9 +1800,9 @@ pub fn cycle_delay_const_range_expression_binary(
|
||||
let (s, c) = constant_expression(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CycleDelayConstRangeExpression::Binary(CycleDelayConstRangeExpressionBinary {
|
||||
CycleDelayConstRangeExpression::Binary(Box::new(CycleDelayConstRangeExpressionBinary {
|
||||
nodes: (a, b, c),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1785,9 +1815,9 @@ pub fn cycle_delay_const_range_expression_dollar(
|
||||
let (s, c) = symbol("$")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CycleDelayConstRangeExpression::Dollar(CycleDelayConstRangeExpressionDollar {
|
||||
CycleDelayConstRangeExpression::Dollar(Box::new(CycleDelayConstRangeExpressionDollar {
|
||||
nodes: (a, b, c),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -8,10 +8,10 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum BlockItemDeclaration {
|
||||
Data(BlockItemDeclarationData),
|
||||
LocalParameter(BlockItemDeclarationLocalParameter),
|
||||
Parameter(BlockItemDeclarationParameter),
|
||||
Let(BlockItemDeclarationLet),
|
||||
Data(Box<BlockItemDeclarationData>),
|
||||
LocalParameter(Box<BlockItemDeclarationLocalParameter>),
|
||||
Parameter(Box<BlockItemDeclarationParameter>),
|
||||
Let(Box<BlockItemDeclarationLet>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -52,7 +52,7 @@ pub fn block_item_declaration_data(s: Span) -> IResult<Span, BlockItemDeclaratio
|
||||
let (s, b) = data_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
BlockItemDeclaration::Data(BlockItemDeclarationData { nodes: (a, b) }),
|
||||
BlockItemDeclaration::Data(Box::new(BlockItemDeclarationData { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -63,9 +63,9 @@ pub fn block_item_declaration_local_parameter(s: Span) -> IResult<Span, BlockIte
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
BlockItemDeclaration::LocalParameter(BlockItemDeclarationLocalParameter {
|
||||
BlockItemDeclaration::LocalParameter(Box::new(BlockItemDeclarationLocalParameter {
|
||||
nodes: (a, b, c),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -76,7 +76,9 @@ pub fn block_item_declaration_parameter(s: Span) -> IResult<Span, BlockItemDecla
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
BlockItemDeclaration::Parameter(BlockItemDeclarationParameter { nodes: (a, b, c) }),
|
||||
BlockItemDeclaration::Parameter(Box::new(BlockItemDeclarationParameter {
|
||||
nodes: (a, b, c),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -86,6 +88,6 @@ pub fn block_item_declaration_let(s: Span) -> IResult<Span, BlockItemDeclaration
|
||||
let (s, b) = let_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
BlockItemDeclaration::Let(BlockItemDeclarationLet { nodes: (a, b) }),
|
||||
BlockItemDeclaration::Let(Box::new(BlockItemDeclarationLet { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
@ -24,8 +24,8 @@ pub struct CovergroupDeclaration {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum CoverageSpecOrOption {
|
||||
Spec(CoverageSpecOrOptionSpec),
|
||||
Option(CoverageSpecOrOptionOption),
|
||||
Spec(Box<CoverageSpecOrOptionSpec>),
|
||||
Option(Box<CoverageSpecOrOptionOption>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -40,8 +40,8 @@ pub struct CoverageSpecOrOptionOption {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum CoverageOption {
|
||||
Option(CoverageOptionOption),
|
||||
TypeOption(CoverageOptionTypeOption),
|
||||
Option(Box<CoverageOptionOption>),
|
||||
TypeOption(Box<CoverageOptionTypeOption>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -62,15 +62,15 @@ pub struct CoverageOptionTypeOption {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum CoverageSpec {
|
||||
CoverPoint(CoverPoint),
|
||||
CoverCross(CoverCross),
|
||||
CoverPoint(Box<CoverPoint>),
|
||||
CoverCross(Box<CoverCross>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum CoverageEvent {
|
||||
ClockingEvent(ClockingEvent),
|
||||
Sample(CoverageEventSample),
|
||||
At(CoverageEventAt),
|
||||
ClockingEvent(Box<ClockingEvent>),
|
||||
Sample(Box<CoverageEventSample>),
|
||||
At(Box<CoverageEventAt>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -86,8 +86,8 @@ pub struct CoverageEventAt {
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum BlockEventExpression {
|
||||
Or(Box<BlockEventExpressionOr>),
|
||||
Begin(BlockEventExpressionBegin),
|
||||
End(BlockEventExpressionEnd),
|
||||
Begin(Box<BlockEventExpressionBegin>),
|
||||
End(Box<BlockEventExpressionEnd>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -107,9 +107,9 @@ pub struct BlockEventExpressionEnd {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum HierarchicalBtfIdentifier {
|
||||
HierarchicalTfIdentifier(HierarchicalTfIdentifier),
|
||||
HierarchicalBlockIdentifier(HierarchicalBlockIdentifier),
|
||||
Method(HierarchicalBtfIdentifierMethod),
|
||||
HierarchicalTfIdentifier(Box<HierarchicalTfIdentifier>),
|
||||
HierarchicalBlockIdentifier(Box<HierarchicalBlockIdentifier>),
|
||||
Method(Box<HierarchicalBtfIdentifierMethod>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -119,8 +119,8 @@ pub struct HierarchicalBtfIdentifierMethod {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum HierarchicalIdentifierOrClassScope {
|
||||
HierarchicalIdentifier((HierarchicalIdentifier, Symbol)),
|
||||
ClassScope(ClassScope),
|
||||
HierarchicalIdentifier(Box<(HierarchicalIdentifier, Symbol)>),
|
||||
ClassScope(Box<ClassScope>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -136,8 +136,8 @@ pub struct CoverPoint {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum BinsOrEmpty {
|
||||
NonEmpty(BinsOrEmptyNonEmpty),
|
||||
Empty(Symbol),
|
||||
NonEmpty(Box<BinsOrEmptyNonEmpty>),
|
||||
Empty(Box<Symbol>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -147,13 +147,13 @@ pub struct BinsOrEmptyNonEmpty {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum BinsOrOptions {
|
||||
CoverageOption(CoverageOption),
|
||||
Covergroup(BinsOrOptionsCovergroup),
|
||||
CoverPoint(BinsOrOptionsCoverPoint),
|
||||
SetCovergroup(BinsOrOptionsSetCovergroup),
|
||||
TransList(BinsOrOptionsTransList),
|
||||
Default(BinsOrOptionsDefault),
|
||||
DefaultSequence(BinsOrOptionsDefaultSequence),
|
||||
CoverageOption(Box<CoverageOption>),
|
||||
Covergroup(Box<BinsOrOptionsCovergroup>),
|
||||
CoverPoint(Box<BinsOrOptionsCoverPoint>),
|
||||
SetCovergroup(Box<BinsOrOptionsSetCovergroup>),
|
||||
TransList(Box<BinsOrOptionsTransList>),
|
||||
Default(Box<BinsOrOptionsDefault>),
|
||||
DefaultSequence(Box<BinsOrOptionsDefaultSequence>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -242,9 +242,9 @@ pub struct BinsOrOptionsDefaultSequence {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum BinsKeyword {
|
||||
Bins(Keyword),
|
||||
IllegalBins(Keyword),
|
||||
IgnoreBins(Keyword),
|
||||
Bins(Box<Keyword>),
|
||||
IllegalBins(Box<Keyword>),
|
||||
IgnoreBins(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -259,10 +259,10 @@ pub struct TransSet {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum TransRangeList {
|
||||
TransItem(TransItem),
|
||||
Asterisk(TransRangeListAsterisk),
|
||||
Arrow(TransRangeListArrow),
|
||||
Equal(TransRangeListEqual),
|
||||
TransItem(Box<TransItem>),
|
||||
Asterisk(Box<TransRangeListAsterisk>),
|
||||
Arrow(Box<TransRangeListArrow>),
|
||||
Equal(Box<TransRangeListEqual>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -287,8 +287,8 @@ pub struct TransItem {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum RepeatRange {
|
||||
CovergroupExpression(CovergroupExpression),
|
||||
Binary(RepeatRangeBinary),
|
||||
CovergroupExpression(Box<CovergroupExpression>),
|
||||
Binary(Box<RepeatRangeBinary>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -314,14 +314,14 @@ pub struct ListOfCrossItems {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum CrossItem {
|
||||
CoverPointIdentifier(CoverPointIdentifier),
|
||||
VariableIdentifier(VariableIdentifier),
|
||||
CoverPointIdentifier(Box<CoverPointIdentifier>),
|
||||
VariableIdentifier(Box<VariableIdentifier>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum CrossBody {
|
||||
NonEmpty(CrossBodyNonEmpty),
|
||||
Empty(Symbol),
|
||||
NonEmpty(Box<CrossBodyNonEmpty>),
|
||||
Empty(Box<Symbol>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -331,14 +331,14 @@ pub struct CrossBodyNonEmpty {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum CrossBodyItem {
|
||||
FunctionDeclaration(FunctionDeclaration),
|
||||
BinsSelectionOrOption((BinsSelectionOrOption, Symbol)),
|
||||
FunctionDeclaration(Box<FunctionDeclaration>),
|
||||
BinsSelectionOrOption(Box<(BinsSelectionOrOption, Symbol)>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum BinsSelectionOrOption {
|
||||
Coverage(BinsSelectionOrOptionCoverage),
|
||||
Bins(BinsSelectionOrOptionBins),
|
||||
Coverage(Box<BinsSelectionOrOptionCoverage>),
|
||||
Bins(Box<BinsSelectionOrOptionBins>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -364,14 +364,14 @@ pub struct BinsSelection {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum SelectExpression {
|
||||
SelectCondition(SelectCondition),
|
||||
Not(SelectExpressionNot),
|
||||
SelectCondition(Box<SelectCondition>),
|
||||
Not(Box<SelectExpressionNot>),
|
||||
And(Box<SelectExpressionAnd>),
|
||||
Or(Box<SelectExpressionOr>),
|
||||
Paren(Box<SelectExpressionParen>),
|
||||
With(Box<SelectExpressionWith>),
|
||||
CrossIdentifier(CrossIdentifier),
|
||||
CrossSet(SelectExpressionCrossSet),
|
||||
CrossIdentifier(Box<CrossIdentifier>),
|
||||
CrossSet(Box<SelectExpressionCrossSet>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -423,8 +423,8 @@ pub struct SelectCondition {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum BinsExpression {
|
||||
VariableIdentifier(VariableIdentifier),
|
||||
CoverPoint(BinsExpressionCoverPoint),
|
||||
VariableIdentifier(Box<VariableIdentifier>),
|
||||
CoverPoint(Box<BinsExpressionCoverPoint>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -439,8 +439,8 @@ pub struct CovergroupRangeList {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum CovergroupValueRange {
|
||||
CovergroupExpression(CovergroupExpression),
|
||||
Binary(CovergroupValueRangeBinary),
|
||||
CovergroupExpression(Box<CovergroupExpression>),
|
||||
Binary(Box<CovergroupValueRangeBinary>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -504,7 +504,7 @@ pub fn coverage_spec_or_option_spec(s: Span) -> IResult<Span, CoverageSpecOrOpti
|
||||
let (s, b) = coverage_spec(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CoverageSpecOrOption::Spec(CoverageSpecOrOptionSpec { nodes: (a, b) }),
|
||||
CoverageSpecOrOption::Spec(Box::new(CoverageSpecOrOptionSpec { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -515,7 +515,7 @@ pub fn coverage_spec_or_option_option(s: Span) -> IResult<Span, CoverageSpecOrOp
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CoverageSpecOrOption::Option(CoverageSpecOrOptionOption { nodes: (a, b, c) }),
|
||||
CoverageSpecOrOption::Option(Box::new(CoverageSpecOrOptionOption { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -533,9 +533,9 @@ pub fn coverage_option_option(s: Span) -> IResult<Span, CoverageOption> {
|
||||
let (s, e) = expression(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CoverageOption::Option(CoverageOptionOption {
|
||||
CoverageOption::Option(Box::new(CoverageOptionOption {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -548,24 +548,26 @@ pub fn coverage_option_type_option(s: Span) -> IResult<Span, CoverageOption> {
|
||||
let (s, e) = constant_expression(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CoverageOption::TypeOption(CoverageOptionTypeOption {
|
||||
CoverageOption::TypeOption(Box::new(CoverageOptionTypeOption {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn coverage_spec(s: Span) -> IResult<Span, CoverageSpec> {
|
||||
alt((
|
||||
map(cover_point, |x| CoverageSpec::CoverPoint(x)),
|
||||
map(cover_cross, |x| CoverageSpec::CoverCross(x)),
|
||||
map(cover_point, |x| CoverageSpec::CoverPoint(Box::new(x))),
|
||||
map(cover_cross, |x| CoverageSpec::CoverCross(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn coverage_event(s: Span) -> IResult<Span, CoverageEvent> {
|
||||
alt((
|
||||
map(clocking_event, |x| CoverageEvent::ClockingEvent(x)),
|
||||
map(clocking_event, |x| {
|
||||
CoverageEvent::ClockingEvent(Box::new(x))
|
||||
}),
|
||||
coverage_event_sample,
|
||||
coverage_event_at,
|
||||
))(s)
|
||||
@ -579,9 +581,9 @@ pub fn coverage_event_sample(s: Span) -> IResult<Span, CoverageEvent> {
|
||||
let (s, d) = paren(opt(tf_port_list))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CoverageEvent::Sample(CoverageEventSample {
|
||||
CoverageEvent::Sample(Box::new(CoverageEventSample {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -589,7 +591,10 @@ pub fn coverage_event_sample(s: Span) -> IResult<Span, CoverageEvent> {
|
||||
pub fn coverage_event_at(s: Span) -> IResult<Span, CoverageEvent> {
|
||||
let (s, a) = symbol("@@")(s)?;
|
||||
let (s, b) = paren(block_event_expression)(s)?;
|
||||
Ok((s, CoverageEvent::At(CoverageEventAt { nodes: (a, b) })))
|
||||
Ok((
|
||||
s,
|
||||
CoverageEvent::At(Box::new(CoverageEventAt { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
@ -618,7 +623,7 @@ pub fn block_event_expression_begin(s: Span) -> IResult<Span, BlockEventExpressi
|
||||
let (s, b) = hierarchical_btf_identifier(s)?;
|
||||
Ok((
|
||||
s,
|
||||
BlockEventExpression::Begin(BlockEventExpressionBegin { nodes: (a, b) }),
|
||||
BlockEventExpression::Begin(Box::new(BlockEventExpressionBegin { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -628,7 +633,7 @@ pub fn block_event_expression_end(s: Span) -> IResult<Span, BlockEventExpression
|
||||
let (s, b) = hierarchical_btf_identifier(s)?;
|
||||
Ok((
|
||||
s,
|
||||
BlockEventExpression::End(BlockEventExpressionEnd { nodes: (a, b) }),
|
||||
BlockEventExpression::End(Box::new(BlockEventExpressionEnd { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -636,10 +641,10 @@ pub fn block_event_expression_end(s: Span) -> IResult<Span, BlockEventExpression
|
||||
pub fn hierarchical_btf_identifier(s: Span) -> IResult<Span, HierarchicalBtfIdentifier> {
|
||||
alt((
|
||||
map(hierarchical_tf_identifier, |x| {
|
||||
HierarchicalBtfIdentifier::HierarchicalTfIdentifier(x)
|
||||
HierarchicalBtfIdentifier::HierarchicalTfIdentifier(Box::new(x))
|
||||
}),
|
||||
map(hierarchical_block_identifier, |x| {
|
||||
HierarchicalBtfIdentifier::HierarchicalBlockIdentifier(x)
|
||||
HierarchicalBtfIdentifier::HierarchicalBlockIdentifier(Box::new(x))
|
||||
}),
|
||||
hierarchical_btf_identifier_method,
|
||||
))(s)
|
||||
@ -651,7 +656,9 @@ pub fn hierarchical_btf_identifier_method(s: Span) -> IResult<Span, Hierarchical
|
||||
let (s, b) = method_identifier(s)?;
|
||||
Ok((
|
||||
s,
|
||||
HierarchicalBtfIdentifier::Method(HierarchicalBtfIdentifierMethod { nodes: (a, b) }),
|
||||
HierarchicalBtfIdentifier::Method(Box::new(HierarchicalBtfIdentifierMethod {
|
||||
nodes: (a, b),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -661,10 +668,10 @@ pub fn hierarchical_identifier_or_class_scope(
|
||||
) -> IResult<Span, HierarchicalIdentifierOrClassScope> {
|
||||
alt((
|
||||
map(pair(hierarchical_identifier, symbol(".")), |x| {
|
||||
HierarchicalIdentifierOrClassScope::HierarchicalIdentifier(x)
|
||||
HierarchicalIdentifierOrClassScope::HierarchicalIdentifier(Box::new(x))
|
||||
}),
|
||||
map(class_scope, |x| {
|
||||
HierarchicalIdentifierOrClassScope::ClassScope(x)
|
||||
HierarchicalIdentifierOrClassScope::ClassScope(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -692,7 +699,7 @@ pub fn cover_point(s: Span) -> IResult<Span, CoverPoint> {
|
||||
pub fn bins_or_empty(s: Span) -> IResult<Span, BinsOrEmpty> {
|
||||
alt((
|
||||
bins_or_empty_non_empty,
|
||||
map(symbol(";"), |x| BinsOrEmpty::Empty(x)),
|
||||
map(symbol(";"), |x| BinsOrEmpty::Empty(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -704,14 +711,16 @@ pub fn bins_or_empty_non_empty(s: Span) -> IResult<Span, BinsOrEmpty> {
|
||||
))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
BinsOrEmpty::NonEmpty(BinsOrEmptyNonEmpty { nodes: (a,) }),
|
||||
BinsOrEmpty::NonEmpty(Box::new(BinsOrEmptyNonEmpty { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn bins_or_options(s: Span) -> IResult<Span, BinsOrOptions> {
|
||||
alt((
|
||||
map(coverage_option, |x| BinsOrOptions::CoverageOption(x)),
|
||||
map(coverage_option, |x| {
|
||||
BinsOrOptions::CoverageOption(Box::new(x))
|
||||
}),
|
||||
bins_or_options_covergroup,
|
||||
bins_or_options_cover_point,
|
||||
bins_or_options_set_covergroup,
|
||||
@ -733,9 +742,9 @@ pub fn bins_or_options_covergroup(s: Span) -> IResult<Span, BinsOrOptions> {
|
||||
let (s, h) = opt(pair(keyword("iff"), paren(expression)))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
BinsOrOptions::Covergroup(BinsOrOptionsCovergroup {
|
||||
BinsOrOptions::Covergroup(Box::new(BinsOrOptionsCovergroup {
|
||||
nodes: (a, b, c, d, e, f, g, h),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -758,9 +767,9 @@ pub fn bins_or_options_cover_point(s: Span) -> IResult<Span, BinsOrOptions> {
|
||||
let (s, i) = opt(pair(keyword("iff"), paren(expression)))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
BinsOrOptions::CoverPoint(BinsOrOptionsCoverPoint {
|
||||
BinsOrOptions::CoverPoint(Box::new(BinsOrOptionsCoverPoint {
|
||||
nodes: (a, b, c, d, e, f, g, h, i),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -775,9 +784,9 @@ pub fn bins_or_options_set_covergroup(s: Span) -> IResult<Span, BinsOrOptions> {
|
||||
let (s, g) = opt(pair(keyword("iff"), paren(expression)))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
BinsOrOptions::SetCovergroup(BinsOrOptionsSetCovergroup {
|
||||
BinsOrOptions::SetCovergroup(Box::new(BinsOrOptionsSetCovergroup {
|
||||
nodes: (a, b, c, d, e, f, g),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -792,9 +801,9 @@ pub fn bins_or_options_trans_list(s: Span) -> IResult<Span, BinsOrOptions> {
|
||||
let (s, g) = opt(pair(keyword("iff"), paren(expression)))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
BinsOrOptions::TransList(BinsOrOptionsTransList {
|
||||
BinsOrOptions::TransList(Box::new(BinsOrOptionsTransList {
|
||||
nodes: (a, b, c, d, e, f, g),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -808,9 +817,9 @@ pub fn bins_or_options_default(s: Span) -> IResult<Span, BinsOrOptions> {
|
||||
let (s, f) = opt(pair(keyword("iff"), paren(expression)))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
BinsOrOptions::Default(BinsOrOptionsDefault {
|
||||
BinsOrOptions::Default(Box::new(BinsOrOptionsDefault {
|
||||
nodes: (a, b, c, d, e, f),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -824,18 +833,22 @@ pub fn bins_or_options_default_sequence(s: Span) -> IResult<Span, BinsOrOptions>
|
||||
let (s, f) = opt(pair(keyword("iff"), paren(expression)))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
BinsOrOptions::DefaultSequence(BinsOrOptionsDefaultSequence {
|
||||
BinsOrOptions::DefaultSequence(Box::new(BinsOrOptionsDefaultSequence {
|
||||
nodes: (a, b, c, d, e, f),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn bins_keyword(s: Span) -> IResult<Span, BinsKeyword> {
|
||||
alt((
|
||||
map(keyword("bins"), |x| BinsKeyword::Bins(x)),
|
||||
map(keyword("illegal_bins"), |x| BinsKeyword::IllegalBins(x)),
|
||||
map(keyword("ignore_bins"), |x| BinsKeyword::IgnoreBins(x)),
|
||||
map(keyword("bins"), |x| BinsKeyword::Bins(Box::new(x))),
|
||||
map(keyword("illegal_bins"), |x| {
|
||||
BinsKeyword::IllegalBins(Box::new(x))
|
||||
}),
|
||||
map(keyword("ignore_bins"), |x| {
|
||||
BinsKeyword::IgnoreBins(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -854,7 +867,7 @@ pub fn trans_set(s: Span) -> IResult<Span, TransSet> {
|
||||
#[parser]
|
||||
pub fn trans_range_list(s: Span) -> IResult<Span, TransRangeList> {
|
||||
alt((
|
||||
map(trans_item, |x| TransRangeList::TransItem(x)),
|
||||
map(trans_item, |x| TransRangeList::TransItem(Box::new(x))),
|
||||
trans_range_list_asterisk,
|
||||
trans_range_list_arrow,
|
||||
trans_range_list_equal,
|
||||
@ -867,7 +880,7 @@ pub fn trans_range_list_asterisk(s: Span) -> IResult<Span, TransRangeList> {
|
||||
let (s, b) = bracket(pair(symbol("*"), repeat_range))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
TransRangeList::Asterisk(TransRangeListAsterisk { nodes: (a, b) }),
|
||||
TransRangeList::Asterisk(Box::new(TransRangeListAsterisk { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -877,7 +890,7 @@ pub fn trans_range_list_arrow(s: Span) -> IResult<Span, TransRangeList> {
|
||||
let (s, b) = bracket(pair(symbol("->"), repeat_range))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
TransRangeList::Arrow(TransRangeListArrow { nodes: (a, b) }),
|
||||
TransRangeList::Arrow(Box::new(TransRangeListArrow { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -887,7 +900,7 @@ pub fn trans_range_list_equal(s: Span) -> IResult<Span, TransRangeList> {
|
||||
let (s, b) = bracket(pair(symbol("="), repeat_range))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
TransRangeList::Equal(TransRangeListEqual { nodes: (a, b) }),
|
||||
TransRangeList::Equal(Box::new(TransRangeListEqual { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -901,7 +914,7 @@ pub fn trans_item(s: Span) -> IResult<Span, TransItem> {
|
||||
pub fn repeat_range(s: Span) -> IResult<Span, RepeatRange> {
|
||||
alt((
|
||||
map(covergroup_expression, |x| {
|
||||
RepeatRange::CovergroupExpression(x)
|
||||
RepeatRange::CovergroupExpression(Box::new(x))
|
||||
}),
|
||||
repeat_range_binary,
|
||||
))(s)
|
||||
@ -914,7 +927,7 @@ pub fn repeat_range_binary(s: Span) -> IResult<Span, RepeatRange> {
|
||||
let (s, c) = covergroup_expression(s)?;
|
||||
Ok((
|
||||
s,
|
||||
RepeatRange::Binary(RepeatRangeBinary { nodes: (a, b, c) }),
|
||||
RepeatRange::Binary(Box::new(RepeatRangeBinary { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -944,9 +957,11 @@ pub fn list_of_cross_items(s: Span) -> IResult<Span, ListOfCrossItems> {
|
||||
pub fn cross_item(s: Span) -> IResult<Span, CrossItem> {
|
||||
alt((
|
||||
map(cover_point_identifier, |x| {
|
||||
CrossItem::CoverPointIdentifier(x)
|
||||
CrossItem::CoverPointIdentifier(Box::new(x))
|
||||
}),
|
||||
map(variable_identifier, |x| {
|
||||
CrossItem::VariableIdentifier(Box::new(x))
|
||||
}),
|
||||
map(variable_identifier, |x| CrossItem::VariableIdentifier(x)),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -954,24 +969,27 @@ pub fn cross_item(s: Span) -> IResult<Span, CrossItem> {
|
||||
pub fn cross_body(s: Span) -> IResult<Span, CrossBody> {
|
||||
alt((
|
||||
cross_body_non_empty,
|
||||
map(symbol(";"), |x| CrossBody::Empty(x)),
|
||||
map(symbol(";"), |x| CrossBody::Empty(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn cross_body_non_empty(s: Span) -> IResult<Span, CrossBody> {
|
||||
let (s, a) = brace(many0(pair(cross_body_item, symbol(";"))))(s)?;
|
||||
Ok((s, CrossBody::NonEmpty(CrossBodyNonEmpty { nodes: (a,) })))
|
||||
Ok((
|
||||
s,
|
||||
CrossBody::NonEmpty(Box::new(CrossBodyNonEmpty { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn cross_body_item(s: Span) -> IResult<Span, CrossBodyItem> {
|
||||
alt((
|
||||
map(function_declaration, |x| {
|
||||
CrossBodyItem::FunctionDeclaration(x)
|
||||
CrossBodyItem::FunctionDeclaration(Box::new(x))
|
||||
}),
|
||||
map(pair(bins_selection_or_option, symbol(";")), |x| {
|
||||
CrossBodyItem::BinsSelectionOrOption(x)
|
||||
CrossBodyItem::BinsSelectionOrOption(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -990,7 +1008,7 @@ pub fn bins_selection_or_option_coverage(s: Span) -> IResult<Span, BinsSelection
|
||||
let (s, b) = coverage_option(s)?;
|
||||
Ok((
|
||||
s,
|
||||
BinsSelectionOrOption::Coverage(BinsSelectionOrOptionCoverage { nodes: (a, b) }),
|
||||
BinsSelectionOrOption::Coverage(Box::new(BinsSelectionOrOptionCoverage { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1000,7 +1018,7 @@ pub fn bins_selection_or_option_bins(s: Span) -> IResult<Span, BinsSelectionOrOp
|
||||
let (s, b) = bins_selection(s)?;
|
||||
Ok((
|
||||
s,
|
||||
BinsSelectionOrOption::Bins(BinsSelectionOrOptionBins { nodes: (a, b) }),
|
||||
BinsSelectionOrOption::Bins(Box::new(BinsSelectionOrOptionBins { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1022,13 +1040,17 @@ pub fn bins_selection(s: Span) -> IResult<Span, BinsSelection> {
|
||||
#[parser]
|
||||
pub fn select_expression(s: Span) -> IResult<Span, SelectExpression> {
|
||||
alt((
|
||||
map(select_condition, |x| SelectExpression::SelectCondition(x)),
|
||||
map(select_condition, |x| {
|
||||
SelectExpression::SelectCondition(Box::new(x))
|
||||
}),
|
||||
select_expression_not,
|
||||
select_expression_and,
|
||||
select_expression_or,
|
||||
select_expression_paren,
|
||||
select_expression_with,
|
||||
map(cross_identifier, |x| SelectExpression::CrossIdentifier(x)),
|
||||
map(cross_identifier, |x| {
|
||||
SelectExpression::CrossIdentifier(Box::new(x))
|
||||
}),
|
||||
select_expression_cross_set,
|
||||
))(s)
|
||||
}
|
||||
@ -1039,7 +1061,7 @@ pub fn select_expression_not(s: Span) -> IResult<Span, SelectExpression> {
|
||||
let (s, b) = select_condition(s)?;
|
||||
Ok((
|
||||
s,
|
||||
SelectExpression::Not(SelectExpressionNot { nodes: (a, b) }),
|
||||
SelectExpression::Not(Box::new(SelectExpressionNot { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1094,7 +1116,7 @@ pub fn select_expression_cross_set(s: Span) -> IResult<Span, SelectExpression> {
|
||||
let (s, b) = opt(pair(keyword("matches"), integer_covergroup_expression))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
SelectExpression::CrossSet(SelectExpressionCrossSet { nodes: (a, b) }),
|
||||
SelectExpression::CrossSet(Box::new(SelectExpressionCrossSet { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1110,7 +1132,7 @@ pub fn select_condition(s: Span) -> IResult<Span, SelectCondition> {
|
||||
pub fn bins_expression(s: Span) -> IResult<Span, BinsExpression> {
|
||||
alt((
|
||||
map(variable_identifier, |x| {
|
||||
BinsExpression::VariableIdentifier(x)
|
||||
BinsExpression::VariableIdentifier(Box::new(x))
|
||||
}),
|
||||
bins_expression_cover_point,
|
||||
))(s)
|
||||
@ -1122,7 +1144,7 @@ pub fn bins_expression_cover_point(s: Span) -> IResult<Span, BinsExpression> {
|
||||
let (s, b) = opt(pair(symbol("."), bin_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
BinsExpression::CoverPoint(BinsExpressionCoverPoint { nodes: (a, b) }),
|
||||
BinsExpression::CoverPoint(Box::new(BinsExpressionCoverPoint { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1136,7 +1158,7 @@ pub fn covergroup_range_list(s: Span) -> IResult<Span, CovergroupRangeList> {
|
||||
pub fn covergroup_value_range(s: Span) -> IResult<Span, CovergroupValueRange> {
|
||||
alt((
|
||||
map(covergroup_expression, |x| {
|
||||
CovergroupValueRange::CovergroupExpression(x)
|
||||
CovergroupValueRange::CovergroupExpression(Box::new(x))
|
||||
}),
|
||||
covergroup_value_range_binary,
|
||||
))(s)
|
||||
@ -1151,7 +1173,7 @@ pub fn covergroup_value_range_binary(s: Span) -> IResult<Span, CovergroupValueRa
|
||||
))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CovergroupValueRange::Binary(CovergroupValueRangeBinary { nodes: (a,) }),
|
||||
CovergroupValueRange::Binary(Box::new(CovergroupValueRangeBinary { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -37,8 +37,8 @@ pub struct ParamAssignment {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum SpecparamAssignment {
|
||||
Mintypmax(SpecparamAssignmentMintypmax),
|
||||
PulseControlSpecparam(PulseControlSpecparam),
|
||||
Mintypmax(Box<SpecparamAssignmentMintypmax>),
|
||||
PulseControlSpecparam(Box<PulseControlSpecparam>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -53,8 +53,8 @@ pub struct TypeAssignment {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PulseControlSpecparam {
|
||||
WithoutDescriptor(PulseControlSpecparamWithoutDescriptor),
|
||||
WithDescriptor(PulseControlSpecparamWithDescriptor),
|
||||
WithoutDescriptor(Box<PulseControlSpecparamWithoutDescriptor>),
|
||||
WithDescriptor(Box<PulseControlSpecparamWithDescriptor>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -95,9 +95,9 @@ pub struct LimitValue {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum VariableDeclAssignment {
|
||||
Variable(VariableDeclAssignmentVariable),
|
||||
DynamicArray(VariableDeclAssignmentDynamicArray),
|
||||
Class(VariableDeclAssignmentClass),
|
||||
Variable(Box<VariableDeclAssignmentVariable>),
|
||||
DynamicArray(Box<VariableDeclAssignmentDynamicArray>),
|
||||
Class(Box<VariableDeclAssignmentClass>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -126,8 +126,8 @@ pub struct VariableDeclAssignmentClass {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ClassNew {
|
||||
Argument(ClassNewArgument),
|
||||
Expression(ClassNewExpression),
|
||||
Argument(Box<ClassNewArgument>),
|
||||
Expression(Box<ClassNewExpression>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -176,7 +176,7 @@ pub fn specparam_assignment(s: Span) -> IResult<Span, SpecparamAssignment> {
|
||||
alt((
|
||||
specparam_assignment_mintypmax,
|
||||
map(pulse_control_specparam, |x| {
|
||||
SpecparamAssignment::PulseControlSpecparam(x)
|
||||
SpecparamAssignment::PulseControlSpecparam(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -188,7 +188,7 @@ pub fn specparam_assignment_mintypmax(s: Span) -> IResult<Span, SpecparamAssignm
|
||||
let (s, c) = constant_mintypmax_expression(s)?;
|
||||
Ok((
|
||||
s,
|
||||
SpecparamAssignment::Mintypmax(SpecparamAssignmentMintypmax { nodes: (a, b, c) }),
|
||||
SpecparamAssignment::Mintypmax(Box::new(SpecparamAssignmentMintypmax { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -217,9 +217,9 @@ pub fn pulse_control_specparam_without_descriptor(s: Span) -> IResult<Span, Puls
|
||||
))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PulseControlSpecparam::WithoutDescriptor(PulseControlSpecparamWithoutDescriptor {
|
||||
nodes: (a, b, c),
|
||||
}),
|
||||
PulseControlSpecparam::WithoutDescriptor(Box::new(
|
||||
PulseControlSpecparamWithoutDescriptor { nodes: (a, b, c) },
|
||||
)),
|
||||
))
|
||||
}
|
||||
|
||||
@ -236,9 +236,9 @@ pub fn pulse_control_specparam_with_descriptor(s: Span) -> IResult<Span, PulseCo
|
||||
))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PulseControlSpecparam::WithDescriptor(PulseControlSpecparamWithDescriptor {
|
||||
PulseControlSpecparam::WithDescriptor(Box::new(PulseControlSpecparamWithDescriptor {
|
||||
nodes: (a, b, c, d, e, f),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -276,7 +276,9 @@ pub fn variable_decl_assignment_variable(s: Span) -> IResult<Span, VariableDeclA
|
||||
let (s, c) = opt(pair(symbol("="), expression))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
VariableDeclAssignment::Variable(VariableDeclAssignmentVariable { nodes: (a, b, c) }),
|
||||
VariableDeclAssignment::Variable(Box::new(VariableDeclAssignmentVariable {
|
||||
nodes: (a, b, c),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -288,9 +290,9 @@ pub fn variable_decl_assignment_dynamic_array(s: Span) -> IResult<Span, Variable
|
||||
let (s, d) = opt(pair(symbol("="), dynamic_array_new))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
VariableDeclAssignment::DynamicArray(VariableDeclAssignmentDynamicArray {
|
||||
VariableDeclAssignment::DynamicArray(Box::new(VariableDeclAssignmentDynamicArray {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -300,7 +302,7 @@ pub fn variable_decl_assignment_class(s: Span) -> IResult<Span, VariableDeclAssi
|
||||
let (s, b) = opt(pair(symbol("="), class_new))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
VariableDeclAssignment::Class(VariableDeclAssignmentClass { nodes: (a, b) }),
|
||||
VariableDeclAssignment::Class(Box::new(VariableDeclAssignmentClass { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -314,7 +316,10 @@ pub fn class_new_argument(s: Span) -> IResult<Span, ClassNew> {
|
||||
let (s, a) = opt(class_scope)(s)?;
|
||||
let (s, b) = keyword("new")(s)?;
|
||||
let (s, c) = opt(paren(list_of_arguments))(s)?;
|
||||
Ok((s, ClassNew::Argument(ClassNewArgument { nodes: (a, b, c) })))
|
||||
Ok((
|
||||
s,
|
||||
ClassNew::Argument(Box::new(ClassNewArgument { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
@ -323,7 +328,7 @@ pub fn class_new_expression(s: Span) -> IResult<Span, ClassNew> {
|
||||
let (s, b) = expression(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ClassNew::Expression(ClassNewExpression { nodes: (a, b) }),
|
||||
ClassNew::Expression(Box::new(ClassNewExpression { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -9,8 +9,8 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum UnpackedDimension {
|
||||
Range(UnpackedDimensionRange),
|
||||
Expression(UnpackedDimensionExpression),
|
||||
Range(Box<UnpackedDimensionRange>),
|
||||
Expression(Box<UnpackedDimensionExpression>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -25,8 +25,8 @@ pub struct UnpackedDimensionExpression {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PackedDimension {
|
||||
Range(PackedDimensionRange),
|
||||
UnsizedDimension(UnsizedDimension),
|
||||
Range(Box<PackedDimensionRange>),
|
||||
UnsizedDimension(Box<UnsizedDimension>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -36,8 +36,8 @@ pub struct PackedDimensionRange {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum AssociativeDimension {
|
||||
DataType(AssociativeDimensionDataType),
|
||||
Asterisk(AssociativeDimensionAsterisk),
|
||||
DataType(Box<AssociativeDimensionDataType>),
|
||||
Asterisk(Box<AssociativeDimensionAsterisk>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -52,10 +52,10 @@ pub struct AssociativeDimensionAsterisk {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum VariableDimension {
|
||||
UnsizedDimension(UnsizedDimension),
|
||||
UnpackedDimension(UnpackedDimension),
|
||||
AssociativeDimension(AssociativeDimension),
|
||||
QueueDimension(QueueDimension),
|
||||
UnsizedDimension(Box<UnsizedDimension>),
|
||||
UnpackedDimension(Box<UnpackedDimension>),
|
||||
AssociativeDimension(Box<AssociativeDimension>),
|
||||
QueueDimension(Box<QueueDimension>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -80,7 +80,7 @@ pub fn unpacked_dimension_range(s: Span) -> IResult<Span, UnpackedDimension> {
|
||||
let (s, a) = bracket(constant_range)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
UnpackedDimension::Range(UnpackedDimensionRange { nodes: (a,) }),
|
||||
UnpackedDimension::Range(Box::new(UnpackedDimensionRange { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ pub fn unpacked_dimension_expression(s: Span) -> IResult<Span, UnpackedDimension
|
||||
let (s, a) = bracket(constant_expression)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
UnpackedDimension::Expression(UnpackedDimensionExpression { nodes: (a,) }),
|
||||
UnpackedDimension::Expression(Box::new(UnpackedDimensionExpression { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -97,7 +97,9 @@ pub fn unpacked_dimension_expression(s: Span) -> IResult<Span, UnpackedDimension
|
||||
pub fn packed_dimension(s: Span) -> IResult<Span, PackedDimension> {
|
||||
alt((
|
||||
packed_dimension_range,
|
||||
map(unsized_dimension, |x| PackedDimension::UnsizedDimension(x)),
|
||||
map(unsized_dimension, |x| {
|
||||
PackedDimension::UnsizedDimension(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -106,7 +108,7 @@ pub fn packed_dimension_range(s: Span) -> IResult<Span, PackedDimension> {
|
||||
let (s, a) = bracket(constant_range)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PackedDimension::Range(PackedDimensionRange { nodes: (a,) }),
|
||||
PackedDimension::Range(Box::new(PackedDimensionRange { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -123,7 +125,7 @@ pub fn associative_dimension_data_type(s: Span) -> IResult<Span, AssociativeDime
|
||||
let (s, a) = bracket(data_type)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
AssociativeDimension::DataType(AssociativeDimensionDataType { nodes: (a,) }),
|
||||
AssociativeDimension::DataType(Box::new(AssociativeDimensionDataType { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -132,7 +134,7 @@ pub fn associative_dimension_asterisk(s: Span) -> IResult<Span, AssociativeDimen
|
||||
let (s, a) = bracket(symbol("*"))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
AssociativeDimension::Asterisk(AssociativeDimensionAsterisk { nodes: (a,) }),
|
||||
AssociativeDimension::Asterisk(Box::new(AssociativeDimensionAsterisk { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -140,15 +142,17 @@ pub fn associative_dimension_asterisk(s: Span) -> IResult<Span, AssociativeDimen
|
||||
pub fn variable_dimension(s: Span) -> IResult<Span, VariableDimension> {
|
||||
alt((
|
||||
map(unsized_dimension, |x| {
|
||||
VariableDimension::UnsizedDimension(x)
|
||||
VariableDimension::UnsizedDimension(Box::new(x))
|
||||
}),
|
||||
map(unpacked_dimension, |x| {
|
||||
VariableDimension::UnpackedDimension(x)
|
||||
VariableDimension::UnpackedDimension(Box::new(x))
|
||||
}),
|
||||
map(associative_dimension, |x| {
|
||||
VariableDimension::AssociativeDimension(x)
|
||||
VariableDimension::AssociativeDimension(Box::new(x))
|
||||
}),
|
||||
map(queue_dimension, |x| {
|
||||
VariableDimension::QueueDimension(Box::new(x))
|
||||
}),
|
||||
map(queue_dimension, |x| VariableDimension::QueueDimension(x)),
|
||||
))(s)
|
||||
}
|
||||
|
||||
|
@ -9,8 +9,8 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum Delay3 {
|
||||
Single(Delay3Single),
|
||||
Mintypmax(Delay3Mintypmax),
|
||||
Single(Box<Delay3Single>),
|
||||
Mintypmax(Box<Delay3Mintypmax>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -35,8 +35,8 @@ pub struct Delay3Mintypmax {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum Delay2 {
|
||||
Single(Delay2Single),
|
||||
Mintypmax(Delay2Mintypmax),
|
||||
Single(Box<Delay2Single>),
|
||||
Mintypmax(Box<Delay2Mintypmax>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -54,11 +54,11 @@ pub struct Delay2Mintypmax {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum DelayValue {
|
||||
UnsignedNumber(UnsignedNumber),
|
||||
RealNumber(RealNumber),
|
||||
PsIdentifier(PsIdentifier),
|
||||
TimeLiteral(TimeLiteral),
|
||||
Step1(Keyword),
|
||||
UnsignedNumber(Box<UnsignedNumber>),
|
||||
RealNumber(Box<RealNumber>),
|
||||
PsIdentifier(Box<PsIdentifier>),
|
||||
TimeLiteral(Box<TimeLiteral>),
|
||||
Step1(Box<Keyword>),
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -72,7 +72,7 @@ pub fn delay3(s: Span) -> IResult<Span, Delay3> {
|
||||
pub fn delay3_single(s: Span) -> IResult<Span, Delay3> {
|
||||
let (s, a) = symbol("#")(s)?;
|
||||
let (s, b) = delay_value(s)?;
|
||||
Ok((s, Delay3::Single(Delay3Single { nodes: (a, b) })))
|
||||
Ok((s, Delay3::Single(Box::new(Delay3Single { nodes: (a, b) }))))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
@ -86,7 +86,10 @@ pub fn delay3_mintypmax(s: Span) -> IResult<Span, Delay3> {
|
||||
opt(pair(symbol(","), mintypmax_expression)),
|
||||
)),
|
||||
))(s)?;
|
||||
Ok((s, Delay3::Mintypmax(Delay3Mintypmax { nodes: (a, b) })))
|
||||
Ok((
|
||||
s,
|
||||
Delay3::Mintypmax(Box::new(Delay3Mintypmax { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
@ -98,7 +101,7 @@ pub fn delay2(s: Span) -> IResult<Span, Delay2> {
|
||||
pub fn delay2_single(s: Span) -> IResult<Span, Delay2> {
|
||||
let (s, a) = symbol("#")(s)?;
|
||||
let (s, b) = delay_value(s)?;
|
||||
Ok((s, Delay2::Single(Delay2Single { nodes: (a, b) })))
|
||||
Ok((s, Delay2::Single(Box::new(Delay2Single { nodes: (a, b) }))))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
@ -108,16 +111,19 @@ pub fn delay2_mintypmax(s: Span) -> IResult<Span, Delay2> {
|
||||
mintypmax_expression,
|
||||
opt(pair(symbol(","), mintypmax_expression)),
|
||||
))(s)?;
|
||||
Ok((s, Delay2::Mintypmax(Delay2Mintypmax { nodes: (a, b) })))
|
||||
Ok((
|
||||
s,
|
||||
Delay2::Mintypmax(Box::new(Delay2Mintypmax { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn delay_value(s: Span) -> IResult<Span, DelayValue> {
|
||||
alt((
|
||||
map(unsigned_number, |x| DelayValue::UnsignedNumber(x)),
|
||||
map(real_number, |x| DelayValue::RealNumber(x)),
|
||||
map(ps_identifier, |x| DelayValue::PsIdentifier(x)),
|
||||
map(time_literal, |x| DelayValue::TimeLiteral(x)),
|
||||
map(keyword("1step"), |x| DelayValue::Step1(x)),
|
||||
map(unsigned_number, |x| DelayValue::UnsignedNumber(Box::new(x))),
|
||||
map(real_number, |x| DelayValue::RealNumber(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))),
|
||||
))(s)
|
||||
}
|
||||
|
@ -10,8 +10,8 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum FunctionDataTypeOrImplicit {
|
||||
DataTypeOrVoid(DataTypeOrVoid),
|
||||
ImplicitDataType(ImplicitDataType),
|
||||
DataTypeOrVoid(Box<DataTypeOrVoid>),
|
||||
ImplicitDataType(Box<ImplicitDataType>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -21,8 +21,8 @@ pub struct FunctionDeclaration {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum FunctionBodyDeclaration {
|
||||
WithoutPort(FunctionBodyDeclarationWithoutPort),
|
||||
WithPort(FunctionBodyDeclarationWithPort),
|
||||
WithoutPort(Box<FunctionBodyDeclarationWithoutPort>),
|
||||
WithPort(Box<FunctionBodyDeclarationWithPort>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -56,8 +56,8 @@ pub struct FunctionBodyDeclarationWithPort {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum InterfaceIdentifierOrClassScope {
|
||||
InterfaceIdentifier((InterfaceIdentifier, Symbol)),
|
||||
ClassScope(ClassScope),
|
||||
InterfaceIdentifier(Box<(InterfaceIdentifier, Symbol)>),
|
||||
ClassScope(Box<ClassScope>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -72,10 +72,10 @@ pub struct FunctionPrototype {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum DpiImportExport {
|
||||
ImportFunction(DpiImportExportImportFunction),
|
||||
ImportTask(DpiImportExportImportTask),
|
||||
ExportFunction(DpiImportExportExportFunction),
|
||||
ExportTask(DpiImportExportExportTask),
|
||||
ImportFunction(Box<DpiImportExportImportFunction>),
|
||||
ImportTask(Box<DpiImportExportImportTask>),
|
||||
ExportFunction(Box<DpiImportExportExportFunction>),
|
||||
ExportTask(Box<DpiImportExportExportTask>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -128,19 +128,19 @@ pub struct DpiImportExportExportTask {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum DpiSpecString {
|
||||
DpiC(Keyword),
|
||||
Dpi(Keyword),
|
||||
DpiC(Box<Keyword>),
|
||||
Dpi(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum DpiFunctionImportProperty {
|
||||
Context(Keyword),
|
||||
Pure(Keyword),
|
||||
Context(Box<Keyword>),
|
||||
Pure(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum DpiTaskImportProperty {
|
||||
Context(Keyword),
|
||||
Context(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -159,10 +159,10 @@ pub struct DpiTaskProto {
|
||||
pub fn function_data_type_or_implicit(s: Span) -> IResult<Span, FunctionDataTypeOrImplicit> {
|
||||
alt((
|
||||
map(data_type_or_void, |x| {
|
||||
FunctionDataTypeOrImplicit::DataTypeOrVoid(x)
|
||||
FunctionDataTypeOrImplicit::DataTypeOrVoid(Box::new(x))
|
||||
}),
|
||||
map(implicit_data_type, |x| {
|
||||
FunctionDataTypeOrImplicit::ImplicitDataType(x)
|
||||
FunctionDataTypeOrImplicit::ImplicitDataType(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -195,9 +195,9 @@ pub fn function_body_declaration_without_port(s: Span) -> IResult<Span, Function
|
||||
let (s, h) = opt(pair(symbol(":"), function_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
FunctionBodyDeclaration::WithoutPort(FunctionBodyDeclarationWithoutPort {
|
||||
FunctionBodyDeclaration::WithoutPort(Box::new(FunctionBodyDeclarationWithoutPort {
|
||||
nodes: (a, b, c, d, e, f, g, h),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -214,9 +214,9 @@ pub fn function_body_declaration_with_port(s: Span) -> IResult<Span, FunctionBod
|
||||
let (s, i) = opt(pair(symbol(":"), function_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
FunctionBodyDeclaration::WithPort(FunctionBodyDeclarationWithPort {
|
||||
FunctionBodyDeclaration::WithPort(Box::new(FunctionBodyDeclarationWithPort {
|
||||
nodes: (a, b, c, d, e, f, g, h, i),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -226,10 +226,10 @@ pub fn interface_identifier_or_class_scope(
|
||||
) -> IResult<Span, InterfaceIdentifierOrClassScope> {
|
||||
alt((
|
||||
map(pair(interface_identifier, symbol(".")), |x| {
|
||||
InterfaceIdentifierOrClassScope::InterfaceIdentifier(x)
|
||||
InterfaceIdentifierOrClassScope::InterfaceIdentifier(Box::new(x))
|
||||
}),
|
||||
map(class_scope, |x| {
|
||||
InterfaceIdentifierOrClassScope::ClassScope(x)
|
||||
InterfaceIdentifierOrClassScope::ClassScope(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -268,9 +268,9 @@ pub fn dpi_import_export_import_function(s: Span) -> IResult<Span, DpiImportExpo
|
||||
let (s, f) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DpiImportExport::ImportFunction(DpiImportExportImportFunction {
|
||||
DpiImportExport::ImportFunction(Box::new(DpiImportExportImportFunction {
|
||||
nodes: (a, b, c, d, e, f),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -284,9 +284,9 @@ pub fn dpi_import_export_import_task(s: Span) -> IResult<Span, DpiImportExport>
|
||||
let (s, f) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DpiImportExport::ImportTask(DpiImportExportImportTask {
|
||||
DpiImportExport::ImportTask(Box::new(DpiImportExportImportTask {
|
||||
nodes: (a, b, c, d, e, f),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -300,9 +300,9 @@ pub fn dpi_import_export_export_function(s: Span) -> IResult<Span, DpiImportExpo
|
||||
let (s, f) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DpiImportExport::ExportFunction(DpiImportExportExportFunction {
|
||||
DpiImportExport::ExportFunction(Box::new(DpiImportExportExportFunction {
|
||||
nodes: (a, b, c, d, e, f),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -316,17 +316,17 @@ pub fn dpi_import_export_export_task(s: Span) -> IResult<Span, DpiImportExport>
|
||||
let (s, f) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DpiImportExport::ExportTask(DpiImportExportExportTask {
|
||||
DpiImportExport::ExportTask(Box::new(DpiImportExportExportTask {
|
||||
nodes: (a, b, c, d, e, f),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn dpi_spec_string(s: Span) -> IResult<Span, DpiSpecString> {
|
||||
alt((
|
||||
map(keyword("DPI-C"), |x| DpiSpecString::DpiC(x)),
|
||||
map(keyword("DPI"), |x| DpiSpecString::Dpi(x)),
|
||||
map(keyword("DPI-C"), |x| DpiSpecString::DpiC(Box::new(x))),
|
||||
map(keyword("DPI"), |x| DpiSpecString::Dpi(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -334,16 +334,18 @@ pub fn dpi_spec_string(s: Span) -> IResult<Span, DpiSpecString> {
|
||||
pub fn dpi_function_import_property(s: Span) -> IResult<Span, DpiFunctionImportProperty> {
|
||||
alt((
|
||||
map(keyword("context"), |x| {
|
||||
DpiFunctionImportProperty::Context(x)
|
||||
DpiFunctionImportProperty::Context(Box::new(x))
|
||||
}),
|
||||
map(keyword("pure"), |x| {
|
||||
DpiFunctionImportProperty::Pure(Box::new(x))
|
||||
}),
|
||||
map(keyword("pure"), |x| DpiFunctionImportProperty::Pure(x)),
|
||||
))(s)
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn dpi_task_import_property(s: Span) -> IResult<Span, DpiTaskImportProperty> {
|
||||
let (s, a) = keyword("context")(s)?;
|
||||
Ok((s, DpiTaskImportProperty::Context(a)))
|
||||
Ok((s, DpiTaskImportProperty::Context(Box::new(a))))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
|
@ -22,9 +22,9 @@ pub struct ModportItem {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ModportPortsDeclaraton {
|
||||
Simple(ModportPortsDeclaratonSimple),
|
||||
Tf(ModportPortsDeclaratonTf),
|
||||
Clocking(ModportPortsDeclaratonClocking),
|
||||
Simple(Box<ModportPortsDeclaratonSimple>),
|
||||
Tf(Box<ModportPortsDeclaratonTf>),
|
||||
Clocking(Box<ModportPortsDeclaratonClocking>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -54,8 +54,8 @@ pub struct ModportSimplePortsDeclaration {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ModportSimplePort {
|
||||
Ordered(ModportSimplePortOrdered),
|
||||
Named(ModportSimplePortNamed),
|
||||
Ordered(Box<ModportSimplePortOrdered>),
|
||||
Named(Box<ModportSimplePortNamed>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -75,14 +75,14 @@ pub struct ModportTfPortsDeclaration {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ModportTfPort {
|
||||
MethodPrototype(MethodPrototype),
|
||||
TfIdentifier(TfIdentifier),
|
||||
MethodPrototype(Box<MethodPrototype>),
|
||||
TfIdentifier(Box<TfIdentifier>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ImportExport {
|
||||
Import(Keyword),
|
||||
Export(Keyword),
|
||||
Import(Box<Keyword>),
|
||||
Export(Box<Keyword>),
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -117,7 +117,7 @@ pub fn modport_ports_declaration_simple(s: Span) -> IResult<Span, ModportPortsDe
|
||||
let (s, b) = modport_simple_ports_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ModportPortsDeclaraton::Simple(ModportPortsDeclaratonSimple { nodes: (a, b) }),
|
||||
ModportPortsDeclaraton::Simple(Box::new(ModportPortsDeclaratonSimple { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ pub fn modport_ports_declaration_tf(s: Span) -> IResult<Span, ModportPortsDeclar
|
||||
let (s, b) = modport_tf_ports_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ModportPortsDeclaraton::Tf(ModportPortsDeclaratonTf { nodes: (a, b) }),
|
||||
ModportPortsDeclaraton::Tf(Box::new(ModportPortsDeclaratonTf { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -137,7 +137,9 @@ pub fn modport_ports_declaration_clocking(s: Span) -> IResult<Span, ModportPorts
|
||||
let (s, b) = modport_clocking_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ModportPortsDeclaraton::Clocking(ModportPortsDeclaratonClocking { nodes: (a, b) }),
|
||||
ModportPortsDeclaraton::Clocking(Box::new(ModportPortsDeclaratonClocking {
|
||||
nodes: (a, b),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -165,7 +167,7 @@ pub fn modport_simple_port_ordered(s: Span) -> IResult<Span, ModportSimplePort>
|
||||
let (s, a) = port_identifier(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ModportSimplePort::Ordered(ModportSimplePortOrdered { nodes: (a,) }),
|
||||
ModportSimplePort::Ordered(Box::new(ModportSimplePortOrdered { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -176,7 +178,7 @@ pub fn modport_simple_port_named(s: Span) -> IResult<Span, ModportSimplePort> {
|
||||
let (s, c) = paren(opt(expression))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ModportSimplePort::Named(ModportSimplePortNamed { nodes: (a, b, c) }),
|
||||
ModportSimplePort::Named(Box::new(ModportSimplePortNamed { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -190,15 +192,17 @@ pub fn modport_tf_ports_declaration(s: Span) -> IResult<Span, ModportTfPortsDecl
|
||||
#[parser]
|
||||
pub fn modport_tf_port(s: Span) -> IResult<Span, ModportTfPort> {
|
||||
alt((
|
||||
map(method_prototype, |x| ModportTfPort::MethodPrototype(x)),
|
||||
map(tf_identifier, |x| ModportTfPort::TfIdentifier(x)),
|
||||
map(method_prototype, |x| {
|
||||
ModportTfPort::MethodPrototype(Box::new(x))
|
||||
}),
|
||||
map(tf_identifier, |x| ModportTfPort::TfIdentifier(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn import_export(s: Span) -> IResult<Span, ImportExport> {
|
||||
alt((
|
||||
map(keyword("import"), |x| ImportExport::Import(x)),
|
||||
map(keyword("export"), |x| ImportExport::Export(x)),
|
||||
map(keyword("import"), |x| ImportExport::Import(Box::new(x))),
|
||||
map(keyword("export"), |x| ImportExport::Export(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
@ -43,8 +43,8 @@ pub struct LetPortItem {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum LetFormalType {
|
||||
DataTypeOrImplicit(DataTypeOrImplicit),
|
||||
Untyped(Keyword),
|
||||
DataTypeOrImplicit(Box<DataTypeOrImplicit>),
|
||||
Untyped(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -58,8 +58,8 @@ pub struct LetExpression {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum LetListOfArguments {
|
||||
Ordered(LetListOfArgumentsOrdered),
|
||||
Named(LetListOfArgumentsNamed),
|
||||
Ordered(Box<LetListOfArgumentsOrdered>),
|
||||
Named(Box<LetListOfArgumentsNamed>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -129,9 +129,9 @@ pub fn let_port_item(s: Span) -> IResult<Span, LetPortItem> {
|
||||
pub fn let_formal_type(s: Span) -> IResult<Span, LetFormalType> {
|
||||
alt((
|
||||
map(data_type_or_implicit, |x| {
|
||||
LetFormalType::DataTypeOrImplicit(x)
|
||||
LetFormalType::DataTypeOrImplicit(Box::new(x))
|
||||
}),
|
||||
map(keyword("untyped"), |x| LetFormalType::Untyped(x)),
|
||||
map(keyword("untyped"), |x| LetFormalType::Untyped(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ pub fn let_list_of_arguments_ordered(s: Span) -> IResult<Span, LetListOfArgument
|
||||
)))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
LetListOfArguments::Ordered(LetListOfArgumentsOrdered { nodes: (a, b) }),
|
||||
LetListOfArguments::Ordered(Box::new(LetListOfArgumentsOrdered { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ pub fn let_list_of_arguments_named(s: Span) -> IResult<Span, LetListOfArguments>
|
||||
)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
LetListOfArguments::Named(LetListOfArgumentsNamed { nodes: (a,) }),
|
||||
LetListOfArguments::Named(Box::new(LetListOfArgumentsNamed { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,8 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum LocalParameterDeclaration {
|
||||
Param(LocalParameterDeclarationParam),
|
||||
Type(LocalParameterDeclarationType),
|
||||
Param(Box<LocalParameterDeclarationParam>),
|
||||
Type(Box<LocalParameterDeclarationType>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -24,8 +24,8 @@ pub struct LocalParameterDeclarationType {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ParameterDeclaration {
|
||||
Param(ParameterDeclarationParam),
|
||||
Type(ParameterDeclarationType),
|
||||
Param(Box<ParameterDeclarationParam>),
|
||||
Type(Box<ParameterDeclarationType>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -65,7 +65,9 @@ pub fn local_parameter_declaration_param(s: Span) -> IResult<Span, LocalParamete
|
||||
let (s, c) = list_of_param_assignments(s)?;
|
||||
Ok((
|
||||
s,
|
||||
LocalParameterDeclaration::Param(LocalParameterDeclarationParam { nodes: (a, b, c) }),
|
||||
LocalParameterDeclaration::Param(Box::new(LocalParameterDeclarationParam {
|
||||
nodes: (a, b, c),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -76,7 +78,9 @@ pub fn local_parameter_declaration_type(s: Span) -> IResult<Span, LocalParameter
|
||||
let (s, c) = list_of_type_assignments(s)?;
|
||||
Ok((
|
||||
s,
|
||||
LocalParameterDeclaration::Type(LocalParameterDeclarationType { nodes: (a, b, c) }),
|
||||
LocalParameterDeclaration::Type(Box::new(LocalParameterDeclarationType {
|
||||
nodes: (a, b, c),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -92,7 +96,7 @@ pub fn parameter_declaration_param(s: Span) -> IResult<Span, ParameterDeclaratio
|
||||
let (s, c) = list_of_param_assignments(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ParameterDeclaration::Param(ParameterDeclarationParam { nodes: (a, b, c) }),
|
||||
ParameterDeclaration::Param(Box::new(ParameterDeclarationParam { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -103,7 +107,7 @@ pub fn parameter_declaration_type(s: Span) -> IResult<Span, ParameterDeclaration
|
||||
let (s, c) = list_of_type_assignments(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ParameterDeclaration::Type(ParameterDeclarationType { nodes: (a, b, c) }),
|
||||
ParameterDeclaration::Type(Box::new(ParameterDeclarationType { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -14,24 +14,24 @@ pub enum CastingType {
|
||||
SimpleType(Box<SimpleType>),
|
||||
ConstantPrimary(Box<ConstantPrimary>),
|
||||
Signing(Box<Signing>),
|
||||
String(Keyword),
|
||||
Const(Keyword),
|
||||
String(Box<Keyword>),
|
||||
Const(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum DataType {
|
||||
Vector(DataTypeVector),
|
||||
Atom(DataTypeAtom),
|
||||
NonIntegerType(NonIntegerType),
|
||||
Vector(Box<DataTypeVector>),
|
||||
Atom(Box<DataTypeAtom>),
|
||||
NonIntegerType(Box<NonIntegerType>),
|
||||
StructUnion(Box<DataTypeStructUnion>),
|
||||
Enum(DataTypeEnum),
|
||||
String(Keyword),
|
||||
Chandle(Keyword),
|
||||
Virtual(DataTypeVirtual),
|
||||
Type(DataTypeType),
|
||||
ClassType(ClassType),
|
||||
Event(Keyword),
|
||||
PsCovergroupIdentifier(PsCovergroupIdentifier),
|
||||
Enum(Box<DataTypeEnum>),
|
||||
String(Box<Keyword>),
|
||||
Chandle(Box<Keyword>),
|
||||
Virtual(Box<DataTypeVirtual>),
|
||||
Type(Box<DataTypeType>),
|
||||
ClassType(Box<ClassType>),
|
||||
Event(Box<Keyword>),
|
||||
PsCovergroupIdentifier(Box<PsCovergroupIdentifier>),
|
||||
TypeReference(Box<TypeReference>),
|
||||
}
|
||||
|
||||
@ -97,8 +97,8 @@ pub struct DataTypeType {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum DataTypeOrImplicit {
|
||||
DataType(DataType),
|
||||
ImplicitDataType(ImplicitDataType),
|
||||
DataType(Box<DataType>),
|
||||
ImplicitDataType(Box<ImplicitDataType>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -108,9 +108,9 @@ pub struct ImplicitDataType {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum EnumBaseType {
|
||||
Atom(EnumBaseTypeAtom),
|
||||
Vector(EnumBaseTypeVector),
|
||||
Type(EnumBaseTypeType),
|
||||
Atom(Box<EnumBaseTypeAtom>),
|
||||
Vector(Box<EnumBaseTypeVector>),
|
||||
Type(Box<EnumBaseTypeType>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -153,55 +153,55 @@ pub struct ClassType {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum IntegerType {
|
||||
IntegerVectorType(IntegerVectorType),
|
||||
IntegerAtomType(IntegerAtomType),
|
||||
IntegerVectorType(Box<IntegerVectorType>),
|
||||
IntegerAtomType(Box<IntegerAtomType>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum IntegerAtomType {
|
||||
Byte(Keyword),
|
||||
Shortint(Keyword),
|
||||
Int(Keyword),
|
||||
Longint(Keyword),
|
||||
Integer(Keyword),
|
||||
Time(Keyword),
|
||||
Byte(Box<Keyword>),
|
||||
Shortint(Box<Keyword>),
|
||||
Int(Box<Keyword>),
|
||||
Longint(Box<Keyword>),
|
||||
Integer(Box<Keyword>),
|
||||
Time(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum IntegerVectorType {
|
||||
Bit(Keyword),
|
||||
Logic(Keyword),
|
||||
Reg(Keyword),
|
||||
Bit(Box<Keyword>),
|
||||
Logic(Box<Keyword>),
|
||||
Reg(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum NonIntegerType {
|
||||
Shortreal(Keyword),
|
||||
Real(Keyword),
|
||||
Realtime(Keyword),
|
||||
Shortreal(Box<Keyword>),
|
||||
Real(Box<Keyword>),
|
||||
Realtime(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum NetType {
|
||||
Supply0(Keyword),
|
||||
Supply1(Keyword),
|
||||
Tri(Keyword),
|
||||
Triand(Keyword),
|
||||
Trior(Keyword),
|
||||
Trireg(Keyword),
|
||||
Tri0(Keyword),
|
||||
Tri1(Keyword),
|
||||
Uwire(Keyword),
|
||||
Wire(Keyword),
|
||||
Wand(Keyword),
|
||||
Wor(Keyword),
|
||||
Supply0(Box<Keyword>),
|
||||
Supply1(Box<Keyword>),
|
||||
Tri(Box<Keyword>),
|
||||
Triand(Box<Keyword>),
|
||||
Trior(Box<Keyword>),
|
||||
Trireg(Box<Keyword>),
|
||||
Tri0(Box<Keyword>),
|
||||
Tri1(Box<Keyword>),
|
||||
Uwire(Box<Keyword>),
|
||||
Wire(Box<Keyword>),
|
||||
Wand(Box<Keyword>),
|
||||
Wor(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum NetPortType {
|
||||
DataType(NetPortTypeDataType),
|
||||
NetTypeIdentifier(NetTypeIdentifier),
|
||||
Interconnect(NetPortTypeInterconnect),
|
||||
DataType(Box<NetPortTypeDataType>),
|
||||
NetTypeIdentifier(Box<NetTypeIdentifier>),
|
||||
Interconnect(Box<NetPortTypeInterconnect>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -221,8 +221,8 @@ pub struct VariablePortType {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum VarDataType {
|
||||
DataType(DataType),
|
||||
Var(VarDataTypeVar),
|
||||
DataType(Box<DataType>),
|
||||
Var(Box<VarDataTypeVar>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -232,16 +232,16 @@ pub struct VarDataTypeVar {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum Signing {
|
||||
Signed(Keyword),
|
||||
Unsigned(Keyword),
|
||||
Signed(Box<Keyword>),
|
||||
Unsigned(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum SimpleType {
|
||||
IntegerType(IntegerType),
|
||||
NonIntegerType(NonIntegerType),
|
||||
PsTypeIdentifier(PsTypeIdentifier),
|
||||
PsParameterIdentifier(PsParameterIdentifier),
|
||||
IntegerType(Box<IntegerType>),
|
||||
NonIntegerType(Box<NonIntegerType>),
|
||||
PsTypeIdentifier(Box<PsTypeIdentifier>),
|
||||
PsParameterIdentifier(Box<PsParameterIdentifier>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -257,21 +257,21 @@ pub struct StructUnionMember {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum DataTypeOrVoid {
|
||||
DataType(DataType),
|
||||
Void(Keyword),
|
||||
DataType(Box<DataType>),
|
||||
Void(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum StructUnion {
|
||||
Struct(Keyword),
|
||||
Union(Keyword),
|
||||
UnionTagged((Keyword, Keyword)),
|
||||
Struct(Box<Keyword>),
|
||||
Union(Box<Keyword>),
|
||||
UnionTagged(Box<(Keyword, Keyword)>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum TypeReference {
|
||||
Expression(TypeReferenceExpression),
|
||||
DataType(TypeReferenceDataType),
|
||||
Expression(Box<TypeReferenceExpression>),
|
||||
DataType(Box<TypeReferenceDataType>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -292,8 +292,8 @@ pub fn casting_type(s: Span) -> IResult<Span, CastingType> {
|
||||
alt((
|
||||
map(simple_type, |x| CastingType::SimpleType(Box::new(x))),
|
||||
map(signing, |x| CastingType::Signing(Box::new(x))),
|
||||
map(keyword("string"), |x| CastingType::String(x)),
|
||||
map(keyword("const"), |x| CastingType::Const(x)),
|
||||
map(keyword("string"), |x| CastingType::String(Box::new(x))),
|
||||
map(keyword("const"), |x| CastingType::Const(Box::new(x))),
|
||||
map(constant_primary, |x| {
|
||||
CastingType::ConstantPrimary(Box::new(x))
|
||||
}),
|
||||
@ -305,17 +305,17 @@ pub fn data_type(s: Span) -> IResult<Span, DataType> {
|
||||
alt((
|
||||
data_type_vector,
|
||||
data_type_atom,
|
||||
map(non_integer_type, |x| DataType::NonIntegerType(x)),
|
||||
map(non_integer_type, |x| DataType::NonIntegerType(Box::new(x))),
|
||||
data_type_struct_union,
|
||||
data_type_enum,
|
||||
map(keyword("string"), |x| DataType::String(x)),
|
||||
map(keyword("chandle"), |x| DataType::Chandle(x)),
|
||||
map(keyword("string"), |x| DataType::String(Box::new(x))),
|
||||
map(keyword("chandle"), |x| DataType::Chandle(Box::new(x))),
|
||||
data_type_virtual,
|
||||
data_type_type,
|
||||
map(class_type, |x| DataType::ClassType(x)),
|
||||
map(keyword("event"), |x| DataType::Chandle(x)),
|
||||
map(class_type, |x| DataType::ClassType(Box::new(x))),
|
||||
map(keyword("event"), |x| DataType::Chandle(Box::new(x))),
|
||||
map(ps_covergroup_identifier, |x| {
|
||||
DataType::PsCovergroupIdentifier(x)
|
||||
DataType::PsCovergroupIdentifier(Box::new(x))
|
||||
}),
|
||||
map(type_reference, |x| DataType::TypeReference(Box::new(x))),
|
||||
))(s)
|
||||
@ -326,14 +326,17 @@ pub fn data_type_vector(s: Span) -> IResult<Span, DataType> {
|
||||
let (s, a) = integer_vector_type(s)?;
|
||||
let (s, b) = opt(signing)(s)?;
|
||||
let (s, c) = many0(packed_dimension)(s)?;
|
||||
Ok((s, DataType::Vector(DataTypeVector { nodes: (a, b, c) })))
|
||||
Ok((
|
||||
s,
|
||||
DataType::Vector(Box::new(DataTypeVector { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn data_type_atom(s: Span) -> IResult<Span, DataType> {
|
||||
let (s, a) = integer_atom_type(s)?;
|
||||
let (s, b) = opt(signing)(s)?;
|
||||
Ok((s, DataType::Atom(DataTypeAtom { nodes: (a, b) })))
|
||||
Ok((s, DataType::Atom(Box::new(DataTypeAtom { nodes: (a, b) }))))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
@ -364,9 +367,9 @@ pub fn data_type_enum(s: Span) -> IResult<Span, DataType> {
|
||||
let (s, d) = many0(packed_dimension)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DataType::Enum(DataTypeEnum {
|
||||
DataType::Enum(Box::new(DataTypeEnum {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -379,9 +382,9 @@ pub fn data_type_virtual(s: Span) -> IResult<Span, DataType> {
|
||||
let (s, e) = opt(pair(symbol("."), modport_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DataType::Virtual(DataTypeVirtual {
|
||||
DataType::Virtual(Box::new(DataTypeVirtual {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -396,15 +399,18 @@ pub fn data_type_type(s: Span) -> IResult<Span, DataType> {
|
||||
let (s, a) = opt(package_scope_or_class_scope)(s)?;
|
||||
let (s, b) = type_identifier(s)?;
|
||||
let (s, c) = many0(packed_dimension)(s)?;
|
||||
Ok((s, DataType::Type(DataTypeType { nodes: (a, b, c) })))
|
||||
Ok((
|
||||
s,
|
||||
DataType::Type(Box::new(DataTypeType { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn data_type_or_implicit(s: Span) -> IResult<Span, DataTypeOrImplicit> {
|
||||
alt((
|
||||
map(data_type, |x| DataTypeOrImplicit::DataType(x)),
|
||||
map(data_type, |x| DataTypeOrImplicit::DataType(Box::new(x))),
|
||||
map(implicit_data_type, |x| {
|
||||
DataTypeOrImplicit::ImplicitDataType(x)
|
||||
DataTypeOrImplicit::ImplicitDataType(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -429,7 +435,10 @@ pub fn enum_base_type(s: Span) -> IResult<Span, EnumBaseType> {
|
||||
pub fn enum_base_type_atom(s: Span) -> IResult<Span, EnumBaseType> {
|
||||
let (s, a) = integer_atom_type(s)?;
|
||||
let (s, b) = opt(signing)(s)?;
|
||||
Ok((s, EnumBaseType::Atom(EnumBaseTypeAtom { nodes: (a, b) })))
|
||||
Ok((
|
||||
s,
|
||||
EnumBaseType::Atom(Box::new(EnumBaseTypeAtom { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
@ -439,7 +448,7 @@ pub fn enum_base_type_vector(s: Span) -> IResult<Span, EnumBaseType> {
|
||||
let (s, c) = opt(packed_dimension)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
EnumBaseType::Vector(EnumBaseTypeVector { nodes: (a, b, c) }),
|
||||
EnumBaseType::Vector(Box::new(EnumBaseTypeVector { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -447,7 +456,10 @@ pub fn enum_base_type_vector(s: Span) -> IResult<Span, EnumBaseType> {
|
||||
pub fn enum_base_type_type(s: Span) -> IResult<Span, EnumBaseType> {
|
||||
let (s, a) = type_identifier(s)?;
|
||||
let (s, b) = opt(packed_dimension)(s)?;
|
||||
Ok((s, EnumBaseType::Type(EnumBaseTypeType { nodes: (a, b) })))
|
||||
Ok((
|
||||
s,
|
||||
EnumBaseType::Type(Box::new(EnumBaseTypeType { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
@ -484,56 +496,70 @@ pub fn class_type(s: Span) -> IResult<Span, ClassType> {
|
||||
#[parser]
|
||||
pub fn integer_type(s: Span) -> IResult<Span, IntegerType> {
|
||||
alt((
|
||||
map(integer_vector_type, |x| IntegerType::IntegerVectorType(x)),
|
||||
map(integer_atom_type, |x| IntegerType::IntegerAtomType(x)),
|
||||
map(integer_vector_type, |x| {
|
||||
IntegerType::IntegerVectorType(Box::new(x))
|
||||
}),
|
||||
map(integer_atom_type, |x| {
|
||||
IntegerType::IntegerAtomType(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn integer_atom_type(s: Span) -> IResult<Span, IntegerAtomType> {
|
||||
alt((
|
||||
map(keyword("byte"), |x| IntegerAtomType::Byte(x)),
|
||||
map(keyword("shortint"), |x| IntegerAtomType::Shortint(x)),
|
||||
map(keyword("int"), |x| IntegerAtomType::Int(x)),
|
||||
map(keyword("longint"), |x| IntegerAtomType::Longint(x)),
|
||||
map(keyword("integer"), |x| IntegerAtomType::Integer(x)),
|
||||
map(keyword("time"), |x| IntegerAtomType::Time(x)),
|
||||
map(keyword("byte"), |x| IntegerAtomType::Byte(Box::new(x))),
|
||||
map(keyword("shortint"), |x| {
|
||||
IntegerAtomType::Shortint(Box::new(x))
|
||||
}),
|
||||
map(keyword("int"), |x| IntegerAtomType::Int(Box::new(x))),
|
||||
map(keyword("longint"), |x| {
|
||||
IntegerAtomType::Longint(Box::new(x))
|
||||
}),
|
||||
map(keyword("integer"), |x| {
|
||||
IntegerAtomType::Integer(Box::new(x))
|
||||
}),
|
||||
map(keyword("time"), |x| IntegerAtomType::Time(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn integer_vector_type(s: Span) -> IResult<Span, IntegerVectorType> {
|
||||
alt((
|
||||
map(keyword("bit"), |x| IntegerVectorType::Bit(x)),
|
||||
map(keyword("logic"), |x| IntegerVectorType::Logic(x)),
|
||||
map(keyword("reg"), |x| IntegerVectorType::Reg(x)),
|
||||
map(keyword("bit"), |x| IntegerVectorType::Bit(Box::new(x))),
|
||||
map(keyword("logic"), |x| IntegerVectorType::Logic(Box::new(x))),
|
||||
map(keyword("reg"), |x| IntegerVectorType::Reg(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn non_integer_type(s: Span) -> IResult<Span, NonIntegerType> {
|
||||
alt((
|
||||
map(keyword("shortreal"), |x| NonIntegerType::Shortreal(x)),
|
||||
map(keyword("realtime"), |x| NonIntegerType::Realtime(x)),
|
||||
map(keyword("real"), |x| NonIntegerType::Real(x)),
|
||||
map(keyword("shortreal"), |x| {
|
||||
NonIntegerType::Shortreal(Box::new(x))
|
||||
}),
|
||||
map(keyword("realtime"), |x| {
|
||||
NonIntegerType::Realtime(Box::new(x))
|
||||
}),
|
||||
map(keyword("real"), |x| NonIntegerType::Real(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn net_type(s: Span) -> IResult<Span, NetType> {
|
||||
alt((
|
||||
map(keyword("supply0"), |x| NetType::Supply0(x)),
|
||||
map(keyword("supply1"), |x| NetType::Supply1(x)),
|
||||
map(keyword("triand"), |x| NetType::Triand(x)),
|
||||
map(keyword("trior"), |x| NetType::Trior(x)),
|
||||
map(keyword("trireg"), |x| NetType::Trireg(x)),
|
||||
map(keyword("tri0"), |x| NetType::Tri0(x)),
|
||||
map(keyword("tri1"), |x| NetType::Tri1(x)),
|
||||
map(keyword("tri"), |x| NetType::Tri(x)),
|
||||
map(keyword("uwire"), |x| NetType::Uwire(x)),
|
||||
map(keyword("wire"), |x| NetType::Wire(x)),
|
||||
map(keyword("wand"), |x| NetType::Wand(x)),
|
||||
map(keyword("wor"), |x| NetType::Wor(x)),
|
||||
map(keyword("supply0"), |x| NetType::Supply0(Box::new(x))),
|
||||
map(keyword("supply1"), |x| NetType::Supply1(Box::new(x))),
|
||||
map(keyword("triand"), |x| NetType::Triand(Box::new(x))),
|
||||
map(keyword("trior"), |x| NetType::Trior(Box::new(x))),
|
||||
map(keyword("trireg"), |x| NetType::Trireg(Box::new(x))),
|
||||
map(keyword("tri0"), |x| NetType::Tri0(Box::new(x))),
|
||||
map(keyword("tri1"), |x| NetType::Tri1(Box::new(x))),
|
||||
map(keyword("tri"), |x| NetType::Tri(Box::new(x))),
|
||||
map(keyword("uwire"), |x| NetType::Uwire(Box::new(x))),
|
||||
map(keyword("wire"), |x| NetType::Wire(Box::new(x))),
|
||||
map(keyword("wand"), |x| NetType::Wand(Box::new(x))),
|
||||
map(keyword("wor"), |x| NetType::Wor(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -541,7 +567,9 @@ pub fn net_type(s: Span) -> IResult<Span, NetType> {
|
||||
pub fn net_port_type(s: Span) -> IResult<Span, NetPortType> {
|
||||
alt((
|
||||
net_port_type_data_type,
|
||||
map(net_type_identifier, |x| NetPortType::NetTypeIdentifier(x)),
|
||||
map(net_type_identifier, |x| {
|
||||
NetPortType::NetTypeIdentifier(Box::new(x))
|
||||
}),
|
||||
net_port_type_interconnect,
|
||||
))(s)
|
||||
}
|
||||
@ -552,7 +580,7 @@ pub fn net_port_type_data_type(s: Span) -> IResult<Span, NetPortType> {
|
||||
let (s, b) = data_type_or_implicit(s)?;
|
||||
Ok((
|
||||
s,
|
||||
NetPortType::DataType(NetPortTypeDataType { nodes: (a, b) }),
|
||||
NetPortType::DataType(Box::new(NetPortTypeDataType { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -562,7 +590,7 @@ pub fn net_port_type_interconnect(s: Span) -> IResult<Span, NetPortType> {
|
||||
let (s, b) = implicit_data_type(s)?;
|
||||
Ok((
|
||||
s,
|
||||
NetPortType::Interconnect(NetPortTypeInterconnect { nodes: (a, b) }),
|
||||
NetPortType::Interconnect(Box::new(NetPortTypeInterconnect { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -575,7 +603,7 @@ pub fn variable_port_type(s: Span) -> IResult<Span, VariablePortType> {
|
||||
#[parser]
|
||||
pub fn var_data_type(s: Span) -> IResult<Span, VarDataType> {
|
||||
alt((
|
||||
map(data_type, |x| VarDataType::DataType(x)),
|
||||
map(data_type, |x| VarDataType::DataType(Box::new(x))),
|
||||
var_data_type_var,
|
||||
))(s)
|
||||
}
|
||||
@ -584,14 +612,17 @@ pub fn var_data_type(s: Span) -> IResult<Span, VarDataType> {
|
||||
pub fn var_data_type_var(s: Span) -> IResult<Span, VarDataType> {
|
||||
let (s, a) = keyword("var")(s)?;
|
||||
let (s, b) = data_type_or_implicit(s)?;
|
||||
Ok((s, VarDataType::Var(VarDataTypeVar { nodes: (a, b) })))
|
||||
Ok((
|
||||
s,
|
||||
VarDataType::Var(Box::new(VarDataTypeVar { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn signing(s: Span) -> IResult<Span, Signing> {
|
||||
alt((
|
||||
map(keyword("signed"), |x| Signing::Signed(x)),
|
||||
map(keyword("unsigned"), |x| Signing::Unsigned(x)),
|
||||
map(keyword("signed"), |x| Signing::Signed(Box::new(x))),
|
||||
map(keyword("unsigned"), |x| Signing::Unsigned(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -599,11 +630,15 @@ pub fn signing(s: Span) -> IResult<Span, Signing> {
|
||||
#[parser]
|
||||
pub fn simple_type(s: Span) -> IResult<Span, SimpleType> {
|
||||
alt((
|
||||
map(integer_type, |x| SimpleType::IntegerType(x)),
|
||||
map(non_integer_type, |x| SimpleType::NonIntegerType(x)),
|
||||
map(ps_type_identifier, |x| SimpleType::PsTypeIdentifier(x)),
|
||||
map(integer_type, |x| SimpleType::IntegerType(Box::new(x))),
|
||||
map(non_integer_type, |x| {
|
||||
SimpleType::NonIntegerType(Box::new(x))
|
||||
}),
|
||||
map(ps_type_identifier, |x| {
|
||||
SimpleType::PsTypeIdentifier(Box::new(x))
|
||||
}),
|
||||
map(ps_parameter_identifier, |x| {
|
||||
SimpleType::PsParameterIdentifier(x)
|
||||
SimpleType::PsParameterIdentifier(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -626,19 +661,19 @@ pub fn struct_union_member(s: Span) -> IResult<Span, StructUnionMember> {
|
||||
#[parser]
|
||||
pub fn data_type_or_void(s: Span) -> IResult<Span, DataTypeOrVoid> {
|
||||
alt((
|
||||
map(data_type, |x| DataTypeOrVoid::DataType(x)),
|
||||
map(keyword("void"), |x| DataTypeOrVoid::Void(x)),
|
||||
map(data_type, |x| DataTypeOrVoid::DataType(Box::new(x))),
|
||||
map(keyword("void"), |x| DataTypeOrVoid::Void(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn struct_union(s: Span) -> IResult<Span, StructUnion> {
|
||||
alt((
|
||||
map(keyword("struct"), |x| StructUnion::Struct(x)),
|
||||
map(keyword("struct"), |x| StructUnion::Struct(Box::new(x))),
|
||||
map(pair(keyword("union"), keyword("tagged")), |x| {
|
||||
StructUnion::UnionTagged(x)
|
||||
StructUnion::UnionTagged(Box::new(x))
|
||||
}),
|
||||
map(keyword("union"), |x| StructUnion::Union(x)),
|
||||
map(keyword("union"), |x| StructUnion::Union(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -653,7 +688,7 @@ pub fn type_reference_expression(s: Span) -> IResult<Span, TypeReference> {
|
||||
let (s, b) = paren(expression)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
TypeReference::Expression(TypeReferenceExpression { nodes: (a, b) }),
|
||||
TypeReference::Expression(Box::new(TypeReferenceExpression { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -663,7 +698,7 @@ pub fn type_reference_data_type(s: Span) -> IResult<Span, TypeReference> {
|
||||
let (s, b) = paren(data_type)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
TypeReference::DataType(TypeReferenceDataType { nodes: (a, b) }),
|
||||
TypeReference::DataType(Box::new(TypeReferenceDataType { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -14,8 +14,8 @@ pub struct InoutDeclaration {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum InputDeclaration {
|
||||
Net(InputDeclarationNet),
|
||||
Variable(InputDeclarationVariable),
|
||||
Net(Box<InputDeclarationNet>),
|
||||
Variable(Box<InputDeclarationVariable>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -30,8 +30,8 @@ pub struct InputDeclarationVariable {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum OutputDeclaration {
|
||||
Net(OutputDeclarationNet),
|
||||
Variable(OutputDeclarationVariable),
|
||||
Net(Box<OutputDeclarationNet>),
|
||||
Variable(Box<OutputDeclarationVariable>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -80,7 +80,7 @@ pub fn input_declaration_net(s: Span) -> IResult<Span, InputDeclaration> {
|
||||
let (s, c) = list_of_port_identifiers(s)?;
|
||||
Ok((
|
||||
s,
|
||||
InputDeclaration::Net(InputDeclarationNet { nodes: (a, b, c) }),
|
||||
InputDeclaration::Net(Box::new(InputDeclarationNet { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ pub fn input_declaration_variable(s: Span) -> IResult<Span, InputDeclaration> {
|
||||
let (s, c) = list_of_variable_identifiers(s)?;
|
||||
Ok((
|
||||
s,
|
||||
InputDeclaration::Variable(InputDeclarationVariable { nodes: (a, b, c) }),
|
||||
InputDeclaration::Variable(Box::new(InputDeclarationVariable { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ pub fn output_declaration_net(s: Span) -> IResult<Span, OutputDeclaration> {
|
||||
let (s, c) = list_of_port_identifiers(s)?;
|
||||
Ok((
|
||||
s,
|
||||
OutputDeclaration::Net(OutputDeclarationNet { nodes: (a, b, c) }),
|
||||
OutputDeclaration::Net(Box::new(OutputDeclarationNet { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ pub fn output_declaration_variable(s: Span) -> IResult<Span, OutputDeclaration>
|
||||
let (s, c) = list_of_variable_identifiers(s)?;
|
||||
Ok((
|
||||
s,
|
||||
OutputDeclaration::Variable(OutputDeclarationVariable { nodes: (a, b, c) }),
|
||||
OutputDeclaration::Variable(Box::new(OutputDeclarationVariable { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -144,14 +144,14 @@ pub fn implicit_var(s: Span) -> IResult<Span, VariablePortType> {
|
||||
Ok((
|
||||
s,
|
||||
VariablePortType {
|
||||
nodes: (VarDataType::Var(VarDataTypeVar {
|
||||
nodes: (VarDataType::Var(Box::new(VarDataTypeVar {
|
||||
nodes: (
|
||||
a,
|
||||
DataTypeOrImplicit::ImplicitDataType(ImplicitDataType {
|
||||
DataTypeOrImplicit::ImplicitDataType(Box::new(ImplicitDataType {
|
||||
nodes: (None, vec![]),
|
||||
}),
|
||||
})),
|
||||
),
|
||||
}),),
|
||||
})),),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
@ -8,12 +8,12 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum DriveStrength {
|
||||
Strength01(DriveStrength01),
|
||||
Strength10(DriveStrength10),
|
||||
Strength0z(DriveStrength0z),
|
||||
Strength1z(DriveStrength1z),
|
||||
Strengthz0(DriveStrengthz0),
|
||||
Strengthz1(DriveStrengthz1),
|
||||
Strength01(Box<DriveStrength01>),
|
||||
Strength10(Box<DriveStrength10>),
|
||||
Strength0z(Box<DriveStrength0z>),
|
||||
Strength1z(Box<DriveStrength1z>),
|
||||
Strengthz0(Box<DriveStrengthz0>),
|
||||
Strengthz1(Box<DriveStrengthz1>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -48,25 +48,25 @@ pub struct DriveStrengthz0 {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum Strength0 {
|
||||
Supply0(Keyword),
|
||||
Strong0(Keyword),
|
||||
Pull0(Keyword),
|
||||
Weak0(Keyword),
|
||||
Supply0(Box<Keyword>),
|
||||
Strong0(Box<Keyword>),
|
||||
Pull0(Box<Keyword>),
|
||||
Weak0(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum Strength1 {
|
||||
Supply1(Keyword),
|
||||
Strong1(Keyword),
|
||||
Pull1(Keyword),
|
||||
Weak1(Keyword),
|
||||
Supply1(Box<Keyword>),
|
||||
Strong1(Box<Keyword>),
|
||||
Pull1(Box<Keyword>),
|
||||
Weak1(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ChargeStrength {
|
||||
Small(ChargeStrengthSmall),
|
||||
Medium(ChargeStrengthMedium),
|
||||
Large(ChargeStrengthLarge),
|
||||
Small(Box<ChargeStrengthSmall>),
|
||||
Medium(Box<ChargeStrengthMedium>),
|
||||
Large(Box<ChargeStrengthLarge>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -103,7 +103,7 @@ pub fn drive_strength01(s: Span) -> IResult<Span, DriveStrength> {
|
||||
let (s, a) = paren(triple(strength0, symbol(","), strength1))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DriveStrength::Strength01(DriveStrength01 { nodes: (a,) }),
|
||||
DriveStrength::Strength01(Box::new(DriveStrength01 { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ pub fn drive_strength10(s: Span) -> IResult<Span, DriveStrength> {
|
||||
let (s, a) = paren(triple(strength1, symbol(","), strength0))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DriveStrength::Strength10(DriveStrength10 { nodes: (a,) }),
|
||||
DriveStrength::Strength10(Box::new(DriveStrength10 { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ pub fn drive_strength0z(s: Span) -> IResult<Span, DriveStrength> {
|
||||
let (s, a) = paren(triple(strength0, symbol(","), keyword("highz1")))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DriveStrength::Strength0z(DriveStrength0z { nodes: (a,) }),
|
||||
DriveStrength::Strength0z(Box::new(DriveStrength0z { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ pub fn drive_strength1z(s: Span) -> IResult<Span, DriveStrength> {
|
||||
let (s, a) = paren(triple(strength1, symbol(","), keyword("highz0")))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DriveStrength::Strength1z(DriveStrength1z { nodes: (a,) }),
|
||||
DriveStrength::Strength1z(Box::new(DriveStrength1z { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ pub fn drive_strengthz1(s: Span) -> IResult<Span, DriveStrength> {
|
||||
let (s, a) = paren(triple(keyword("highz0"), symbol(","), strength1))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DriveStrength::Strengthz1(DriveStrengthz1 { nodes: (a,) }),
|
||||
DriveStrength::Strengthz1(Box::new(DriveStrengthz1 { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -148,27 +148,27 @@ pub fn drive_strengthz0(s: Span) -> IResult<Span, DriveStrength> {
|
||||
let (s, a) = paren(triple(keyword("highz1"), symbol(","), strength0))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DriveStrength::Strengthz0(DriveStrengthz0 { nodes: (a,) }),
|
||||
DriveStrength::Strengthz0(Box::new(DriveStrengthz0 { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn strength0(s: Span) -> IResult<Span, Strength0> {
|
||||
alt((
|
||||
map(keyword("supply0"), |x| Strength0::Supply0(x)),
|
||||
map(keyword("strong0"), |x| Strength0::Strong0(x)),
|
||||
map(keyword("pull0"), |x| Strength0::Pull0(x)),
|
||||
map(keyword("weak0"), |x| Strength0::Weak0(x)),
|
||||
map(keyword("supply0"), |x| Strength0::Supply0(Box::new(x))),
|
||||
map(keyword("strong0"), |x| Strength0::Strong0(Box::new(x))),
|
||||
map(keyword("pull0"), |x| Strength0::Pull0(Box::new(x))),
|
||||
map(keyword("weak0"), |x| Strength0::Weak0(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn strength1(s: Span) -> IResult<Span, Strength1> {
|
||||
alt((
|
||||
map(keyword("supply1"), |x| Strength1::Supply1(x)),
|
||||
map(keyword("strong1"), |x| Strength1::Strong1(x)),
|
||||
map(keyword("pull1"), |x| Strength1::Pull1(x)),
|
||||
map(keyword("weak1"), |x| Strength1::Weak1(x)),
|
||||
map(keyword("supply1"), |x| Strength1::Supply1(Box::new(x))),
|
||||
map(keyword("strong1"), |x| Strength1::Strong1(Box::new(x))),
|
||||
map(keyword("pull1"), |x| Strength1::Pull1(Box::new(x))),
|
||||
map(keyword("weak1"), |x| Strength1::Weak1(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ pub fn charge_strength_small(s: Span) -> IResult<Span, ChargeStrength> {
|
||||
let (s, a) = paren(keyword("small"))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ChargeStrength::Small(ChargeStrengthSmall { nodes: (a,) }),
|
||||
ChargeStrength::Small(Box::new(ChargeStrengthSmall { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ pub fn charge_strength_medium(s: Span) -> IResult<Span, ChargeStrength> {
|
||||
let (s, a) = paren(keyword("medium"))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ChargeStrength::Medium(ChargeStrengthMedium { nodes: (a,) }),
|
||||
ChargeStrength::Medium(Box::new(ChargeStrengthMedium { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ pub fn charge_strength_large(s: Span) -> IResult<Span, ChargeStrength> {
|
||||
let (s, a) = paren(keyword("large"))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ChargeStrength::Large(ChargeStrengthLarge { nodes: (a,) }),
|
||||
ChargeStrength::Large(Box::new(ChargeStrengthLarge { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -15,8 +15,8 @@ pub struct TaskDeclaration {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum TaskBodyDeclaration {
|
||||
WithoutPort(TaskBodyDeclarationWithoutPort),
|
||||
WithPort(TaskBodyDeclarationWithPort),
|
||||
WithoutPort(Box<TaskBodyDeclarationWithoutPort>),
|
||||
WithPort(Box<TaskBodyDeclarationWithPort>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -48,8 +48,8 @@ pub struct TaskBodyDeclarationWithPort {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum TfItemDeclaration {
|
||||
BlockItemDeclaration(BlockItemDeclaration),
|
||||
TfPortDeclaration(TfPortDeclaration),
|
||||
BlockItemDeclaration(Box<BlockItemDeclaration>),
|
||||
TfPortDeclaration(Box<TfPortDeclaration>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -74,8 +74,8 @@ pub struct TfPortItem {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum TfPortDirection {
|
||||
PortDirection(PortDirection),
|
||||
ConstRef((Keyword, Keyword)),
|
||||
PortDirection(Box<PortDirection>),
|
||||
ConstRef(Box<(Keyword, Keyword)>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -124,9 +124,9 @@ pub fn task_body_declaration_without_port(s: Span) -> IResult<Span, TaskBodyDecl
|
||||
let (s, g) = opt(pair(symbol(":"), task_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
TaskBodyDeclaration::WithoutPort(TaskBodyDeclarationWithoutPort {
|
||||
TaskBodyDeclaration::WithoutPort(Box::new(TaskBodyDeclarationWithoutPort {
|
||||
nodes: (a, b, c, d, e, f, g),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -142,9 +142,9 @@ pub fn task_body_declaration_with_port(s: Span) -> IResult<Span, TaskBodyDeclara
|
||||
let (s, h) = opt(pair(symbol(":"), task_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
TaskBodyDeclaration::WithPort(TaskBodyDeclarationWithPort {
|
||||
TaskBodyDeclaration::WithPort(Box::new(TaskBodyDeclarationWithPort {
|
||||
nodes: (a, b, c, d, e, f, g, h),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -152,10 +152,10 @@ pub fn task_body_declaration_with_port(s: Span) -> IResult<Span, TaskBodyDeclara
|
||||
pub fn tf_item_declaration(s: Span) -> IResult<Span, TfItemDeclaration> {
|
||||
alt((
|
||||
map(block_item_declaration, |x| {
|
||||
TfItemDeclaration::BlockItemDeclaration(x)
|
||||
TfItemDeclaration::BlockItemDeclaration(Box::new(x))
|
||||
}),
|
||||
map(tf_port_declaration, |x| {
|
||||
TfItemDeclaration::TfPortDeclaration(x)
|
||||
TfItemDeclaration::TfPortDeclaration(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -188,9 +188,11 @@ pub fn tf_port_item(s: Span) -> IResult<Span, TfPortItem> {
|
||||
#[parser]
|
||||
pub fn tf_port_direction(s: Span) -> IResult<Span, TfPortDirection> {
|
||||
alt((
|
||||
map(port_direction, |x| TfPortDirection::PortDirection(x)),
|
||||
map(port_direction, |x| {
|
||||
TfPortDirection::PortDirection(Box::new(x))
|
||||
}),
|
||||
map(pair(keyword("const"), keyword("ref")), |x| {
|
||||
TfPortDirection::ConstRef(x)
|
||||
TfPortDirection::ConstRef(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
@ -10,10 +10,10 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum DataDeclaration {
|
||||
Variable(DataDeclarationVariable),
|
||||
TypeDeclaration(TypeDeclaration),
|
||||
PackageImportDeclaration(PackageImportDeclaration),
|
||||
NetTypeDeclaration(NetTypeDeclaration),
|
||||
Variable(Box<DataDeclarationVariable>),
|
||||
TypeDeclaration(Box<TypeDeclaration>),
|
||||
PackageImportDeclaration(Box<PackageImportDeclaration>),
|
||||
NetTypeDeclaration(Box<NetTypeDeclaration>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -40,8 +40,8 @@ pub struct PackageImportDeclaration {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PackageImportItem {
|
||||
Identifier(PackageImportItemIdentifier),
|
||||
Asterisk(PackageImportItemAsterisk),
|
||||
Identifier(Box<PackageImportItemIdentifier>),
|
||||
Asterisk(Box<PackageImportItemAsterisk>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -56,8 +56,8 @@ pub struct PackageImportItemAsterisk {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PackageExportDeclaration {
|
||||
Asterisk(PackageExportDeclarationAsterisk),
|
||||
Item(PackageExportDeclarationItem),
|
||||
Asterisk(Box<PackageExportDeclarationAsterisk>),
|
||||
Item(Box<PackageExportDeclarationItem>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -77,9 +77,9 @@ pub struct GenvarDeclaration {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum NetDeclaration {
|
||||
NetType(NetDeclarationNetType),
|
||||
NetTypeIdentifier(NetDeclarationNetTypeIdentifier),
|
||||
Interconnect(NetDeclarationInterconnect),
|
||||
NetType(Box<NetDeclarationNetType>),
|
||||
NetTypeIdentifier(Box<NetDeclarationNetTypeIdentifier>),
|
||||
Interconnect(Box<NetDeclarationInterconnect>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -97,14 +97,14 @@ pub struct NetDeclarationNetType {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum Strength {
|
||||
Drive(DriveStrength),
|
||||
Charge(ChargeStrength),
|
||||
Drive(Box<DriveStrength>),
|
||||
Charge(Box<ChargeStrength>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum VectorScalar {
|
||||
Vectored(Keyword),
|
||||
Scalared(Keyword),
|
||||
Vectored(Box<Keyword>),
|
||||
Scalared(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -132,9 +132,9 @@ pub struct NetDeclarationInterconnect {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum TypeDeclaration {
|
||||
DataType(TypeDeclarationDataType),
|
||||
Interface(TypeDeclarationInterface),
|
||||
Reserved(TypeDeclarationReserved),
|
||||
DataType(Box<TypeDeclarationDataType>),
|
||||
Interface(Box<TypeDeclarationInterface>),
|
||||
Reserved(Box<TypeDeclarationReserved>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -173,17 +173,17 @@ pub struct TypeDeclarationReserved {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum TypeDeclarationKeyword {
|
||||
Enum(Keyword),
|
||||
Struct(Keyword),
|
||||
Union(Keyword),
|
||||
Class(Keyword),
|
||||
InterfaceClass((Keyword, Keyword)),
|
||||
Enum(Box<Keyword>),
|
||||
Struct(Box<Keyword>),
|
||||
Union(Box<Keyword>),
|
||||
Class(Box<Keyword>),
|
||||
InterfaceClass(Box<(Keyword, Keyword)>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum NetTypeDeclaration {
|
||||
DataType(NetTypeDeclarationDataType),
|
||||
NetType(NetTypeDeclarationNetType),
|
||||
DataType(Box<NetTypeDeclarationDataType>),
|
||||
NetType(Box<NetTypeDeclarationNetType>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -210,8 +210,8 @@ pub struct NetTypeDeclarationNetType {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum Lifetime {
|
||||
Static(Keyword),
|
||||
Automatic(Keyword),
|
||||
Static(Box<Keyword>),
|
||||
Automatic(Box<Keyword>),
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -220,12 +220,14 @@ pub enum Lifetime {
|
||||
pub fn data_declaration(s: Span) -> IResult<Span, DataDeclaration> {
|
||||
alt((
|
||||
data_declaration_variable,
|
||||
map(type_declaration, |x| DataDeclaration::TypeDeclaration(x)),
|
||||
map(type_declaration, |x| {
|
||||
DataDeclaration::TypeDeclaration(Box::new(x))
|
||||
}),
|
||||
map(package_import_declaration, |x| {
|
||||
DataDeclaration::PackageImportDeclaration(x)
|
||||
DataDeclaration::PackageImportDeclaration(Box::new(x))
|
||||
}),
|
||||
map(net_type_declaration, |x| {
|
||||
DataDeclaration::NetTypeDeclaration(x)
|
||||
DataDeclaration::NetTypeDeclaration(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -240,9 +242,9 @@ pub fn data_declaration_variable(s: Span) -> IResult<Span, DataDeclaration> {
|
||||
let (s, f) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DataDeclaration::Variable(DataDeclarationVariable {
|
||||
DataDeclaration::Variable(Box::new(DataDeclarationVariable {
|
||||
nodes: (a, b, c, d, e, f),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -272,7 +274,7 @@ pub fn package_import_item_identifier(s: Span) -> IResult<Span, PackageImportIte
|
||||
let (s, c) = identifier(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PackageImportItem::Identifier(PackageImportItemIdentifier { nodes: (a, b, c) }),
|
||||
PackageImportItem::Identifier(Box::new(PackageImportItemIdentifier { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -283,7 +285,7 @@ pub fn package_import_item_asterisk(s: Span) -> IResult<Span, PackageImportItem>
|
||||
let (s, c) = symbol("*")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PackageImportItem::Asterisk(PackageImportItemAsterisk { nodes: (a, b, c) }),
|
||||
PackageImportItem::Asterisk(Box::new(PackageImportItemAsterisk { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -302,7 +304,9 @@ pub fn package_export_declaration_asterisk(s: Span) -> IResult<Span, PackageExpo
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PackageExportDeclaration::Asterisk(PackageExportDeclarationAsterisk { nodes: (a, b, c) }),
|
||||
PackageExportDeclaration::Asterisk(Box::new(PackageExportDeclarationAsterisk {
|
||||
nodes: (a, b, c),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -313,7 +317,7 @@ pub fn package_export_declaration_item(s: Span) -> IResult<Span, PackageExportDe
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PackageExportDeclaration::Item(PackageExportDeclarationItem { nodes: (a, b, c) }),
|
||||
PackageExportDeclaration::Item(Box::new(PackageExportDeclarationItem { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -345,25 +349,25 @@ pub fn net_declaration_net_type(s: Span) -> IResult<Span, NetDeclaration> {
|
||||
let (s, g) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
NetDeclaration::NetType(NetDeclarationNetType {
|
||||
NetDeclaration::NetType(Box::new(NetDeclarationNetType {
|
||||
nodes: (a, b, c, d, e, f, g),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn strength(s: Span) -> IResult<Span, Strength> {
|
||||
alt((
|
||||
map(drive_strength, |x| Strength::Drive(x)),
|
||||
map(charge_strength, |x| Strength::Charge(x)),
|
||||
map(drive_strength, |x| Strength::Drive(Box::new(x))),
|
||||
map(charge_strength, |x| Strength::Charge(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn vector_scalar(s: Span) -> IResult<Span, VectorScalar> {
|
||||
alt((
|
||||
map(keyword("vectored"), |x| VectorScalar::Vectored(x)),
|
||||
map(keyword("scalared"), |x| VectorScalar::Scalared(x)),
|
||||
map(keyword("vectored"), |x| VectorScalar::Vectored(Box::new(x))),
|
||||
map(keyword("scalared"), |x| VectorScalar::Scalared(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -375,9 +379,9 @@ pub fn net_declaration_net_type_identifier(s: Span) -> IResult<Span, NetDeclarat
|
||||
let (s, d) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
NetDeclaration::NetTypeIdentifier(NetDeclarationNetTypeIdentifier {
|
||||
NetDeclaration::NetTypeIdentifier(Box::new(NetDeclarationNetTypeIdentifier {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -396,9 +400,9 @@ pub fn net_declaration_interconnect(s: Span) -> IResult<Span, NetDeclaration> {
|
||||
let (s, g) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
NetDeclaration::Interconnect(NetDeclarationInterconnect {
|
||||
NetDeclaration::Interconnect(Box::new(NetDeclarationInterconnect {
|
||||
nodes: (a, b, c, d, e, f, g),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -420,9 +424,9 @@ pub fn type_declaration_data_type(s: Span) -> IResult<Span, TypeDeclaration> {
|
||||
let (s, e) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
TypeDeclaration::DataType(TypeDeclarationDataType {
|
||||
TypeDeclaration::DataType(Box::new(TypeDeclarationDataType {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -437,9 +441,9 @@ pub fn type_declaration_interface(s: Span) -> IResult<Span, TypeDeclaration> {
|
||||
let (s, g) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
TypeDeclaration::Interface(TypeDeclarationInterface {
|
||||
TypeDeclaration::Interface(Box::new(TypeDeclarationInterface {
|
||||
nodes: (a, b, c, d, e, f, g),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -451,21 +455,29 @@ pub fn type_declaration_reserved(s: Span) -> IResult<Span, TypeDeclaration> {
|
||||
let (s, d) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
TypeDeclaration::Reserved(TypeDeclarationReserved {
|
||||
TypeDeclaration::Reserved(Box::new(TypeDeclarationReserved {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn type_declaration_keyword(s: Span) -> IResult<Span, TypeDeclarationKeyword> {
|
||||
alt((
|
||||
map(keyword("enum"), |x| TypeDeclarationKeyword::Enum(x)),
|
||||
map(keyword("struct"), |x| TypeDeclarationKeyword::Struct(x)),
|
||||
map(keyword("union"), |x| TypeDeclarationKeyword::Union(x)),
|
||||
map(keyword("class"), |x| TypeDeclarationKeyword::Class(x)),
|
||||
map(keyword("enum"), |x| {
|
||||
TypeDeclarationKeyword::Enum(Box::new(x))
|
||||
}),
|
||||
map(keyword("struct"), |x| {
|
||||
TypeDeclarationKeyword::Struct(Box::new(x))
|
||||
}),
|
||||
map(keyword("union"), |x| {
|
||||
TypeDeclarationKeyword::Union(Box::new(x))
|
||||
}),
|
||||
map(keyword("class"), |x| {
|
||||
TypeDeclarationKeyword::Class(Box::new(x))
|
||||
}),
|
||||
map(pair(keyword("interface"), keyword("class")), |x| {
|
||||
TypeDeclarationKeyword::InterfaceClass(x)
|
||||
TypeDeclarationKeyword::InterfaceClass(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -491,9 +503,9 @@ pub fn net_type_declaration_data_type(s: Span) -> IResult<Span, NetTypeDeclarati
|
||||
let (s, e) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
NetTypeDeclaration::DataType(NetTypeDeclarationDataType {
|
||||
NetTypeDeclaration::DataType(Box::new(NetTypeDeclarationDataType {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -506,17 +518,17 @@ pub fn net_type_declaration_net_type(s: Span) -> IResult<Span, NetTypeDeclaratio
|
||||
let (s, e) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
NetTypeDeclaration::NetType(NetTypeDeclarationNetType {
|
||||
NetTypeDeclaration::NetType(Box::new(NetTypeDeclarationNetType {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn lifetime(s: Span) -> IResult<Span, Lifetime> {
|
||||
alt((
|
||||
map(keyword("static"), |x| Lifetime::Static(x)),
|
||||
map(keyword("automatic"), |x| Lifetime::Automatic(x)),
|
||||
map(keyword("static"), |x| Lifetime::Static(Box::new(x))),
|
||||
map(keyword("automatic"), |x| Lifetime::Automatic(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
|
@ -49,8 +49,8 @@ pub struct StreamOperator {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum SliceSize {
|
||||
SimpleType(SimpleType),
|
||||
ConstantExpression(ConstantExpression),
|
||||
SimpleType(Box<SimpleType>),
|
||||
ConstantExpression(Box<ConstantExpression>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -65,10 +65,10 @@ pub struct StreamExpression {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ArrayRangeExpression {
|
||||
Expression(Expression),
|
||||
Colon(ArrayRangeExpressionColon),
|
||||
PlusColon(ArrayRangeExpressionPlusColon),
|
||||
MinusColon(ArrayRangeExpressionMinusColon),
|
||||
Expression(Box<Expression>),
|
||||
Colon(Box<ArrayRangeExpressionColon>),
|
||||
PlusColon(Box<ArrayRangeExpressionPlusColon>),
|
||||
MinusColon(Box<ArrayRangeExpressionMinusColon>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -152,8 +152,10 @@ pub fn stream_operator(s: Span) -> IResult<Span, StreamOperator> {
|
||||
#[parser]
|
||||
pub fn slice_size(s: Span) -> IResult<Span, SliceSize> {
|
||||
alt((
|
||||
map(simple_type, |x| SliceSize::SimpleType(x)),
|
||||
map(constant_expression, |x| SliceSize::ConstantExpression(x)),
|
||||
map(simple_type, |x| SliceSize::SimpleType(Box::new(x))),
|
||||
map(constant_expression, |x| {
|
||||
SliceSize::ConstantExpression(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -173,7 +175,9 @@ pub fn stream_expression(s: Span) -> IResult<Span, StreamExpression> {
|
||||
#[parser]
|
||||
pub fn array_range_expression(s: Span) -> IResult<Span, ArrayRangeExpression> {
|
||||
alt((
|
||||
map(expression, |x| ArrayRangeExpression::Expression(x)),
|
||||
map(expression, |x| {
|
||||
ArrayRangeExpression::Expression(Box::new(x))
|
||||
}),
|
||||
array_range_expression_colon,
|
||||
array_range_expression_plus_colon,
|
||||
array_range_expression_minus_colon,
|
||||
@ -187,7 +191,7 @@ pub fn array_range_expression_colon(s: Span) -> IResult<Span, ArrayRangeExpressi
|
||||
let (s, c) = expression(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ArrayRangeExpression::Colon(ArrayRangeExpressionColon { nodes: (a, b, c) }),
|
||||
ArrayRangeExpression::Colon(Box::new(ArrayRangeExpressionColon { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -198,7 +202,9 @@ pub fn array_range_expression_plus_colon(s: Span) -> IResult<Span, ArrayRangeExp
|
||||
let (s, c) = expression(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ArrayRangeExpression::PlusColon(ArrayRangeExpressionPlusColon { nodes: (a, b, c) }),
|
||||
ArrayRangeExpression::PlusColon(Box::new(ArrayRangeExpressionPlusColon {
|
||||
nodes: (a, b, c),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -209,7 +215,9 @@ pub fn array_range_expression_minus_colon(s: Span) -> IResult<Span, ArrayRangeEx
|
||||
let (s, c) = expression(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ArrayRangeExpression::MinusColon(ArrayRangeExpressionMinusColon { nodes: (a, b, c) }),
|
||||
ArrayRangeExpression::MinusColon(Box::new(ArrayRangeExpressionMinusColon {
|
||||
nodes: (a, b, c),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ use nom_packrat::packrat_parser;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum NetLvalue {
|
||||
Identifier(NetLvalueIdentifier),
|
||||
Identifier(Box<NetLvalueIdentifier>),
|
||||
Lvalue(Box<NetLvalueLvalue>),
|
||||
Pattern(Box<NetLvaluePattern>),
|
||||
}
|
||||
@ -34,10 +34,10 @@ pub struct NetLvaluePattern {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum VariableLvalue {
|
||||
Identifier(VariableLvalueIdentifier),
|
||||
Identifier(Box<VariableLvalueIdentifier>),
|
||||
Lvalue(Box<VariableLvalueLvalue>),
|
||||
Pattern(Box<VariableLvaluePattern>),
|
||||
StreamingConcatenation(StreamingConcatenation),
|
||||
StreamingConcatenation(Box<StreamingConcatenation>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -85,7 +85,7 @@ pub fn net_lvalue_identifier(s: Span) -> IResult<Span, NetLvalue> {
|
||||
let (s, b) = constant_select(s)?;
|
||||
Ok((
|
||||
s,
|
||||
NetLvalue::Identifier(NetLvalueIdentifier { nodes: (a, b) }),
|
||||
NetLvalue::Identifier(Box::new(NetLvalueIdentifier { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ pub fn variable_lvalue(s: Span) -> IResult<Span, VariableLvalue> {
|
||||
variable_lvalue_lvalue,
|
||||
variable_lvalue_pattern,
|
||||
map(streaming_concatenation, |x| {
|
||||
VariableLvalue::StreamingConcatenation(x)
|
||||
VariableLvalue::StreamingConcatenation(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -128,7 +128,7 @@ pub fn variable_lvalue_identifier(s: Span) -> IResult<Span, VariableLvalue> {
|
||||
let (s, c) = select(s)?;
|
||||
Ok((
|
||||
s,
|
||||
VariableLvalue::Identifier(VariableLvalueIdentifier { nodes: (a, b, c) }),
|
||||
VariableLvalue::Identifier(Box::new(VariableLvalueIdentifier { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -10,8 +10,8 @@ use nom_packrat::packrat_parser;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum IncOrDecExpression {
|
||||
Prefix(IncOrDecExpressionPrefix),
|
||||
Suffix(IncOrDecExpressionSuffix),
|
||||
Prefix(Box<IncOrDecExpressionPrefix>),
|
||||
Suffix(Box<IncOrDecExpressionSuffix>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -73,8 +73,8 @@ pub struct ConstantExpressionTernary {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ConstantMintypmaxExpression {
|
||||
Unary(ConstantExpression),
|
||||
Ternary(ConstantMintypmaxExpressionTernary),
|
||||
Unary(Box<ConstantExpression>),
|
||||
Ternary(Box<ConstantMintypmaxExpressionTernary>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -90,28 +90,28 @@ pub struct ConstantMintypmaxExpressionTernary {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ConstantParamExpression {
|
||||
ConstantMintypmaxExpression(ConstantMintypmaxExpression),
|
||||
DataType(DataType),
|
||||
Dollar(Symbol),
|
||||
ConstantMintypmaxExpression(Box<ConstantMintypmaxExpression>),
|
||||
DataType(Box<DataType>),
|
||||
Dollar(Box<Symbol>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ParamExpression {
|
||||
MintypmaxExpression(MintypmaxExpression),
|
||||
MintypmaxExpression(Box<MintypmaxExpression>),
|
||||
DataType(Box<DataType>),
|
||||
Dollar(Symbol),
|
||||
Dollar(Box<Symbol>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ConstantRangeExpression {
|
||||
ConstantExpression(ConstantExpression),
|
||||
ConstantPartSelectRange(ConstantPartSelectRange),
|
||||
ConstantExpression(Box<ConstantExpression>),
|
||||
ConstantPartSelectRange(Box<ConstantPartSelectRange>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ConstantPartSelectRange {
|
||||
ConstantRange(ConstantRange),
|
||||
ConstantIndexedRange(ConstantIndexedRange),
|
||||
ConstantRange(Box<ConstantRange>),
|
||||
ConstantIndexedRange(Box<ConstantIndexedRange>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -168,8 +168,8 @@ pub struct InsideExpression {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ValueRange {
|
||||
Expression(Expression),
|
||||
Binary(ValueRangeBinary),
|
||||
Expression(Box<Expression>),
|
||||
Binary(Box<ValueRangeBinary>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -179,8 +179,8 @@ pub struct ValueRangeBinary {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum MintypmaxExpression {
|
||||
Expression(Expression),
|
||||
Ternary(MintypmaxExpressionTernary),
|
||||
Expression(Box<Expression>),
|
||||
Ternary(Box<MintypmaxExpressionTernary>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -229,8 +229,8 @@ pub struct ModulePathExpressionBinary {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ModulePathMintypmaxExpression {
|
||||
ModulePathExpression(ModulePathExpression),
|
||||
Ternary(ModulePathMintypmaxExpressionTernary),
|
||||
ModulePathExpression(Box<ModulePathExpression>),
|
||||
Ternary(Box<ModulePathMintypmaxExpressionTernary>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -246,8 +246,8 @@ pub struct ModulePathMintypmaxExpressionTernary {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PartSelectRange {
|
||||
ConstantRange(ConstantRange),
|
||||
IndexedRange(IndexedRange),
|
||||
ConstantRange(Box<ConstantRange>),
|
||||
IndexedRange(Box<IndexedRange>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -274,7 +274,7 @@ pub fn inc_or_dec_expression_prefix(s: Span) -> IResult<Span, IncOrDecExpression
|
||||
let (s, c) = variable_lvalue(s)?;
|
||||
Ok((
|
||||
s,
|
||||
IncOrDecExpression::Prefix(IncOrDecExpressionPrefix { nodes: (a, b, c) }),
|
||||
IncOrDecExpression::Prefix(Box::new(IncOrDecExpressionPrefix { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -285,7 +285,7 @@ pub fn inc_or_dec_expression_suffix(s: Span) -> IResult<Span, IncOrDecExpression
|
||||
let (s, c) = inc_or_dec_operator(s)?;
|
||||
Ok((
|
||||
s,
|
||||
IncOrDecExpression::Suffix(IncOrDecExpressionSuffix { nodes: (a, b, c) }),
|
||||
IncOrDecExpression::Suffix(Box::new(IncOrDecExpressionSuffix { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -364,7 +364,7 @@ pub fn constant_mintypmax_expression(s: Span) -> IResult<Span, ConstantMintypmax
|
||||
alt((
|
||||
constant_mintypmax_expression_ternary,
|
||||
map(constant_expression, |x| {
|
||||
ConstantMintypmaxExpression::Unary(x)
|
||||
ConstantMintypmaxExpression::Unary(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -380,29 +380,33 @@ pub fn constant_mintypmax_expression_ternary(
|
||||
let (s, e) = constant_expression(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConstantMintypmaxExpression::Ternary(ConstantMintypmaxExpressionTernary {
|
||||
ConstantMintypmaxExpression::Ternary(Box::new(ConstantMintypmaxExpressionTernary {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn constant_param_expression(s: Span) -> IResult<Span, ConstantParamExpression> {
|
||||
alt((
|
||||
map(symbol("$"), |x| ConstantParamExpression::Dollar(x)),
|
||||
map(constant_mintypmax_expression, |x| {
|
||||
ConstantParamExpression::ConstantMintypmaxExpression(x)
|
||||
map(symbol("$"), |x| {
|
||||
ConstantParamExpression::Dollar(Box::new(x))
|
||||
}),
|
||||
map(constant_mintypmax_expression, |x| {
|
||||
ConstantParamExpression::ConstantMintypmaxExpression(Box::new(x))
|
||||
}),
|
||||
map(data_type, |x| {
|
||||
ConstantParamExpression::DataType(Box::new(x))
|
||||
}),
|
||||
map(data_type, |x| ConstantParamExpression::DataType(x)),
|
||||
))(s)
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn param_expression(s: Span) -> IResult<Span, ParamExpression> {
|
||||
alt((
|
||||
map(symbol("$"), |x| ParamExpression::Dollar(x)),
|
||||
map(symbol("$"), |x| ParamExpression::Dollar(Box::new(x))),
|
||||
map(mintypmax_expression, |x| {
|
||||
ParamExpression::MintypmaxExpression(x)
|
||||
ParamExpression::MintypmaxExpression(Box::new(x))
|
||||
}),
|
||||
map(data_type, |x| ParamExpression::DataType(Box::new(x))),
|
||||
))(s)
|
||||
@ -412,10 +416,10 @@ pub fn param_expression(s: Span) -> IResult<Span, ParamExpression> {
|
||||
pub fn constant_range_expression(s: Span) -> IResult<Span, ConstantRangeExpression> {
|
||||
alt((
|
||||
map(constant_part_select_range, |x| {
|
||||
ConstantRangeExpression::ConstantPartSelectRange(x)
|
||||
ConstantRangeExpression::ConstantPartSelectRange(Box::new(x))
|
||||
}),
|
||||
map(constant_expression, |x| {
|
||||
ConstantRangeExpression::ConstantExpression(x)
|
||||
ConstantRangeExpression::ConstantExpression(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -424,10 +428,10 @@ pub fn constant_range_expression(s: Span) -> IResult<Span, ConstantRangeExpressi
|
||||
pub fn constant_part_select_range(s: Span) -> IResult<Span, ConstantPartSelectRange> {
|
||||
alt((
|
||||
map(constant_range, |x| {
|
||||
ConstantPartSelectRange::ConstantRange(x)
|
||||
ConstantPartSelectRange::ConstantRange(Box::new(x))
|
||||
}),
|
||||
map(constant_indexed_range, |x| {
|
||||
ConstantPartSelectRange::ConstantIndexedRange(x)
|
||||
ConstantPartSelectRange::ConstantIndexedRange(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -525,21 +529,24 @@ pub fn inside_expression(s: Span) -> IResult<Span, InsideExpression> {
|
||||
pub fn value_range(s: Span) -> IResult<Span, ValueRange> {
|
||||
alt((
|
||||
value_range_binary,
|
||||
map(expression, |x| ValueRange::Expression(x)),
|
||||
map(expression, |x| ValueRange::Expression(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn value_range_binary(s: Span) -> IResult<Span, ValueRange> {
|
||||
let (s, a) = bracket(triple(expression, symbol(":"), expression))(s)?;
|
||||
Ok((s, ValueRange::Binary(ValueRangeBinary { nodes: (a,) })))
|
||||
Ok((
|
||||
s,
|
||||
ValueRange::Binary(Box::new(ValueRangeBinary { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn mintypmax_expression(s: Span) -> IResult<Span, MintypmaxExpression> {
|
||||
alt((
|
||||
mintypmax_expression_ternary,
|
||||
map(expression, |x| MintypmaxExpression::Expression(x)),
|
||||
map(expression, |x| MintypmaxExpression::Expression(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -552,9 +559,9 @@ pub fn mintypmax_expression_ternary(s: Span) -> IResult<Span, MintypmaxExpressio
|
||||
let (s, e) = expression(s)?;
|
||||
Ok((
|
||||
s,
|
||||
MintypmaxExpression::Ternary(MintypmaxExpressionTernary {
|
||||
MintypmaxExpression::Ternary(Box::new(MintypmaxExpressionTernary {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -620,7 +627,7 @@ pub fn module_path_mintypmax_expression(s: Span) -> IResult<Span, ModulePathMint
|
||||
alt((
|
||||
module_path_mintypmax_expression_ternary,
|
||||
map(module_path_expression, |x| {
|
||||
ModulePathMintypmaxExpression::ModulePathExpression(x)
|
||||
ModulePathMintypmaxExpression::ModulePathExpression(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -636,17 +643,21 @@ pub fn module_path_mintypmax_expression_ternary(
|
||||
let (s, e) = module_path_expression(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ModulePathMintypmaxExpression::Ternary(ModulePathMintypmaxExpressionTernary {
|
||||
ModulePathMintypmaxExpression::Ternary(Box::new(ModulePathMintypmaxExpressionTernary {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn part_select_range(s: Span) -> IResult<Span, PartSelectRange> {
|
||||
alt((
|
||||
map(constant_range, |x| PartSelectRange::ConstantRange(x)),
|
||||
map(indexed_range, |x| PartSelectRange::IndexedRange(x)),
|
||||
map(constant_range, |x| {
|
||||
PartSelectRange::ConstantRange(Box::new(x))
|
||||
}),
|
||||
map(indexed_range, |x| {
|
||||
PartSelectRange::IndexedRange(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
|
@ -13,24 +13,24 @@ use nom_packrat::packrat_parser;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum Number {
|
||||
IntegralNumber(IntegralNumber),
|
||||
RealNumber(RealNumber),
|
||||
IntegralNumber(Box<IntegralNumber>),
|
||||
RealNumber(Box<RealNumber>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum IntegralNumber {
|
||||
DecimalNumber(DecimalNumber),
|
||||
OctalNumber(OctalNumber),
|
||||
BinaryNumber(BinaryNumber),
|
||||
HexNumber(HexNumber),
|
||||
DecimalNumber(Box<DecimalNumber>),
|
||||
OctalNumber(Box<OctalNumber>),
|
||||
BinaryNumber(Box<BinaryNumber>),
|
||||
HexNumber(Box<HexNumber>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum DecimalNumber {
|
||||
UnsignedNumber(UnsignedNumber),
|
||||
BaseUnsigned(DecimalNumberBaseUnsigned),
|
||||
BaseXNumber(DecimalNumberBaseXNumber),
|
||||
BaseZNumber(DecimalNumberBaseZNumber),
|
||||
UnsignedNumber(Box<UnsignedNumber>),
|
||||
BaseUnsigned(Box<DecimalNumberBaseUnsigned>),
|
||||
BaseXNumber(Box<DecimalNumberBaseXNumber>),
|
||||
BaseZNumber(Box<DecimalNumberBaseZNumber>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -65,8 +65,8 @@ pub struct HexNumber {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum Sign {
|
||||
Plus(Symbol),
|
||||
Minus(Symbol),
|
||||
Plus(Box<Symbol>),
|
||||
Minus(Box<Symbol>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -81,8 +81,8 @@ pub struct NonZeroUnsignedNumber {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum RealNumber {
|
||||
FixedPointNumber(FixedPointNumber),
|
||||
Floating(RealNumberFloating),
|
||||
FixedPointNumber(Box<FixedPointNumber>),
|
||||
Floating(Box<RealNumberFloating>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -167,18 +167,20 @@ pub struct UnbasedUnsizedLiteral {
|
||||
#[parser]
|
||||
pub fn number(s: Span) -> IResult<Span, Number> {
|
||||
alt((
|
||||
map(real_number, |x| Number::RealNumber(x)),
|
||||
map(integral_number, |x| Number::IntegralNumber(x)),
|
||||
map(real_number, |x| Number::RealNumber(Box::new(x))),
|
||||
map(integral_number, |x| Number::IntegralNumber(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn integral_number(s: Span) -> IResult<Span, IntegralNumber> {
|
||||
alt((
|
||||
map(octal_number, |x| IntegralNumber::OctalNumber(x)),
|
||||
map(binary_number, |x| IntegralNumber::BinaryNumber(x)),
|
||||
map(hex_number, |x| IntegralNumber::HexNumber(x)),
|
||||
map(decimal_number, |x| IntegralNumber::DecimalNumber(x)),
|
||||
map(octal_number, |x| IntegralNumber::OctalNumber(Box::new(x))),
|
||||
map(binary_number, |x| IntegralNumber::BinaryNumber(Box::new(x))),
|
||||
map(hex_number, |x| IntegralNumber::HexNumber(Box::new(x))),
|
||||
map(decimal_number, |x| {
|
||||
IntegralNumber::DecimalNumber(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -188,7 +190,9 @@ pub fn decimal_number(s: Span) -> IResult<Span, DecimalNumber> {
|
||||
decimal_number_base_unsigned,
|
||||
decimal_number_base_x_number,
|
||||
decimal_number_base_z_number,
|
||||
map(unsigned_number, |x| DecimalNumber::UnsignedNumber(x)),
|
||||
map(unsigned_number, |x| {
|
||||
DecimalNumber::UnsignedNumber(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -199,7 +203,7 @@ pub fn decimal_number_base_unsigned(s: Span) -> IResult<Span, DecimalNumber> {
|
||||
let (s, c) = unsigned_number(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DecimalNumber::BaseUnsigned(DecimalNumberBaseUnsigned { nodes: (a, b, c) }),
|
||||
DecimalNumber::BaseUnsigned(Box::new(DecimalNumberBaseUnsigned { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -210,7 +214,7 @@ pub fn decimal_number_base_x_number(s: Span) -> IResult<Span, DecimalNumber> {
|
||||
let (s, c) = x_number(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DecimalNumber::BaseXNumber(DecimalNumberBaseXNumber { nodes: (a, b, c) }),
|
||||
DecimalNumber::BaseXNumber(Box::new(DecimalNumberBaseXNumber { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -221,7 +225,7 @@ pub fn decimal_number_base_z_number(s: Span) -> IResult<Span, DecimalNumber> {
|
||||
let (s, c) = z_number(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DecimalNumber::BaseZNumber(DecimalNumberBaseZNumber { nodes: (a, b, c) }),
|
||||
DecimalNumber::BaseZNumber(Box::new(DecimalNumberBaseZNumber { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -252,8 +256,8 @@ pub fn hex_number(s: Span) -> IResult<Span, HexNumber> {
|
||||
#[parser]
|
||||
pub fn sign(s: Span) -> IResult<Span, Sign> {
|
||||
alt((
|
||||
map(symbol("+"), |x| Sign::Plus(x)),
|
||||
map(symbol("-"), |x| Sign::Minus(x)),
|
||||
map(symbol("+"), |x| Sign::Plus(Box::new(x))),
|
||||
map(symbol("-"), |x| Sign::Minus(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -282,7 +286,9 @@ pub fn non_zero_unsigned_number_impl(s: Span) -> IResult<Span, Locate> {
|
||||
pub fn real_number(s: Span) -> IResult<Span, RealNumber> {
|
||||
alt((
|
||||
real_number_floating,
|
||||
map(fixed_point_number, |x| RealNumber::FixedPointNumber(x)),
|
||||
map(fixed_point_number, |x| {
|
||||
RealNumber::FixedPointNumber(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -295,9 +301,9 @@ pub fn real_number_floating(s: Span) -> IResult<Span, RealNumber> {
|
||||
let (s, e) = unsigned_number(s)?;
|
||||
Ok((
|
||||
s,
|
||||
RealNumber::Floating(RealNumberFloating {
|
||||
RealNumber::Floating(Box::new(RealNumberFloating {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -471,123 +477,39 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_number() {
|
||||
parser_test!(
|
||||
number,
|
||||
"659",
|
||||
Ok((_, Number::IntegralNumber(IntegralNumber::DecimalNumber(_))))
|
||||
);
|
||||
parser_test!(
|
||||
number,
|
||||
"'h 837FF",
|
||||
Ok((_, Number::IntegralNumber(IntegralNumber::HexNumber(_))))
|
||||
);
|
||||
parser_test!(
|
||||
number,
|
||||
"'h 837FF",
|
||||
Ok((_, Number::IntegralNumber(IntegralNumber::HexNumber(_))))
|
||||
);
|
||||
parser_test!(
|
||||
number,
|
||||
"'o7460",
|
||||
Ok((_, Number::IntegralNumber(IntegralNumber::OctalNumber(_))))
|
||||
);
|
||||
parser_test!(number, "659", Ok((_, Number::IntegralNumber(_))));
|
||||
parser_test!(number, "'h 837FF", Ok((_, Number::IntegralNumber(_))));
|
||||
parser_test!(number, "'h 837FF", Ok((_, Number::IntegralNumber(_))));
|
||||
parser_test!(number, "'o7460", Ok((_, Number::IntegralNumber(_))));
|
||||
parser_test!(number, "'4af", Err(_));
|
||||
parser_test!(
|
||||
number,
|
||||
"4'b1001",
|
||||
Ok((_, Number::IntegralNumber(IntegralNumber::BinaryNumber(_))))
|
||||
);
|
||||
parser_test!(
|
||||
number,
|
||||
"5 'D 3",
|
||||
Ok((_, Number::IntegralNumber(IntegralNumber::DecimalNumber(_))))
|
||||
);
|
||||
parser_test!(
|
||||
number,
|
||||
"3'b01x",
|
||||
Ok((_, Number::IntegralNumber(IntegralNumber::BinaryNumber(_))))
|
||||
);
|
||||
parser_test!(
|
||||
number,
|
||||
"12'hx",
|
||||
Ok((_, Number::IntegralNumber(IntegralNumber::HexNumber(_))))
|
||||
);
|
||||
parser_test!(
|
||||
number,
|
||||
"16'hz",
|
||||
Ok((_, Number::IntegralNumber(IntegralNumber::HexNumber(_))))
|
||||
);
|
||||
parser_test!(number, "4'b1001", Ok((_, Number::IntegralNumber(_))));
|
||||
parser_test!(number, "5 'D 3", Ok((_, Number::IntegralNumber(_))));
|
||||
parser_test!(number, "3'b01x", Ok((_, Number::IntegralNumber(_))));
|
||||
parser_test!(number, "12'hx", Ok((_, Number::IntegralNumber(_))));
|
||||
parser_test!(number, "16'hz", Ok((_, Number::IntegralNumber(_))));
|
||||
parser_test!(number, "8 'd -6", Err(_));
|
||||
parser_test!(
|
||||
number,
|
||||
"4 'shf",
|
||||
Ok((_, Number::IntegralNumber(IntegralNumber::HexNumber(_))))
|
||||
);
|
||||
parser_test!(
|
||||
number,
|
||||
"16'sd?",
|
||||
Ok((_, Number::IntegralNumber(IntegralNumber::DecimalNumber(_))))
|
||||
);
|
||||
parser_test!(
|
||||
number,
|
||||
"27_195_000",
|
||||
Ok((_, Number::IntegralNumber(IntegralNumber::DecimalNumber(_))))
|
||||
);
|
||||
parser_test!(number, "4 'shf", Ok((_, Number::IntegralNumber(_))));
|
||||
parser_test!(number, "16'sd?", Ok((_, Number::IntegralNumber(_))));
|
||||
parser_test!(number, "27_195_000", Ok((_, Number::IntegralNumber(_))));
|
||||
parser_test!(
|
||||
number,
|
||||
"16'b0011_0101_0001_1111",
|
||||
Ok((_, Number::IntegralNumber(IntegralNumber::BinaryNumber(_))))
|
||||
Ok((_, Number::IntegralNumber(_)))
|
||||
);
|
||||
parser_test!(
|
||||
number,
|
||||
"32 'h 12ab_f001",
|
||||
Ok((_, Number::IntegralNumber(IntegralNumber::HexNumber(_))))
|
||||
);
|
||||
parser_test!(
|
||||
number,
|
||||
"1.2",
|
||||
Ok((_, Number::RealNumber(RealNumber::FixedPointNumber(_))))
|
||||
);
|
||||
parser_test!(
|
||||
number,
|
||||
"0.1",
|
||||
Ok((_, Number::RealNumber(RealNumber::FixedPointNumber(_))))
|
||||
);
|
||||
parser_test!(
|
||||
number,
|
||||
"2394.26331",
|
||||
Ok((_, Number::RealNumber(RealNumber::FixedPointNumber(_))))
|
||||
);
|
||||
parser_test!(
|
||||
number,
|
||||
"1.2E12",
|
||||
Ok((_, Number::RealNumber(RealNumber::Floating(_))))
|
||||
);
|
||||
parser_test!(
|
||||
number,
|
||||
"1.30e-2",
|
||||
Ok((_, Number::RealNumber(RealNumber::Floating(_))))
|
||||
);
|
||||
parser_test!(
|
||||
number,
|
||||
"0.1e-0",
|
||||
Ok((_, Number::RealNumber(RealNumber::Floating(_))))
|
||||
);
|
||||
parser_test!(
|
||||
number,
|
||||
"23E10",
|
||||
Ok((_, Number::RealNumber(RealNumber::Floating(_))))
|
||||
);
|
||||
parser_test!(
|
||||
number,
|
||||
"29E-2",
|
||||
Ok((_, Number::RealNumber(RealNumber::Floating(_))))
|
||||
);
|
||||
parser_test!(
|
||||
number,
|
||||
"236.123_763_e-12",
|
||||
Ok((_, Number::RealNumber(RealNumber::Floating(_))))
|
||||
Ok((_, Number::IntegralNumber(_)))
|
||||
);
|
||||
parser_test!(number, "1.2", Ok((_, Number::RealNumber(_))));
|
||||
parser_test!(number, "0.1", Ok((_, Number::RealNumber(_))));
|
||||
parser_test!(number, "2394.26331", Ok((_, Number::RealNumber(_))));
|
||||
parser_test!(number, "1.2E12", Ok((_, Number::RealNumber(_))));
|
||||
parser_test!(number, "1.30e-2", Ok((_, Number::RealNumber(_))));
|
||||
parser_test!(number, "0.1e-0", Ok((_, Number::RealNumber(_))));
|
||||
parser_test!(number, "23E10", Ok((_, Number::RealNumber(_))));
|
||||
parser_test!(number, "29E-2", Ok((_, Number::RealNumber(_))));
|
||||
parser_test!(number, "236.123_763_e-12", Ok((_, Number::RealNumber(_))));
|
||||
parser_test!(number, ".12", Err(_));
|
||||
parser_test!(number, "9.", Err(_));
|
||||
parser_test!(number, "4.E3", Err(_));
|
||||
|
@ -10,21 +10,21 @@ use nom_packrat::packrat_parser;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ConstantPrimary {
|
||||
PrimaryLiteral(PrimaryLiteral),
|
||||
PsParameter(ConstantPrimaryPsParameter),
|
||||
Specparam(ConstantPrimarySpecparam),
|
||||
GenvarIdentifier(GenvarIdentifier),
|
||||
FormalPort(ConstantPrimaryFormalPort),
|
||||
Enum(ConstantPrimaryEnum),
|
||||
Concatenation(ConstantPrimaryConcatenation),
|
||||
MultipleConcatenation(ConstantPrimaryMultipleConcatenation),
|
||||
ConstantFunctionCall(ConstantFunctionCall),
|
||||
ConstantLetExpression(ConstantLetExpression),
|
||||
MintypmaxExpression(ConstantPrimaryMintypmaxExpression),
|
||||
ConstantCast(ConstantCast),
|
||||
ConstantAssignmentPatternExpression(ConstantAssignmentPatternExpression),
|
||||
TypeReference(TypeReference),
|
||||
Null(Keyword),
|
||||
PrimaryLiteral(Box<PrimaryLiteral>),
|
||||
PsParameter(Box<ConstantPrimaryPsParameter>),
|
||||
Specparam(Box<ConstantPrimarySpecparam>),
|
||||
GenvarIdentifier(Box<GenvarIdentifier>),
|
||||
FormalPort(Box<ConstantPrimaryFormalPort>),
|
||||
Enum(Box<ConstantPrimaryEnum>),
|
||||
Concatenation(Box<ConstantPrimaryConcatenation>),
|
||||
MultipleConcatenation(Box<ConstantPrimaryMultipleConcatenation>),
|
||||
ConstantFunctionCall(Box<ConstantFunctionCall>),
|
||||
ConstantLetExpression(Box<ConstantLetExpression>),
|
||||
MintypmaxExpression(Box<ConstantPrimaryMintypmaxExpression>),
|
||||
ConstantCast(Box<ConstantCast>),
|
||||
ConstantAssignmentPatternExpression(Box<ConstantAssignmentPatternExpression>),
|
||||
TypeReference(Box<TypeReference>),
|
||||
Null(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -73,12 +73,12 @@ pub struct ConstantPrimaryMintypmaxExpression {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ModulePathPrimary {
|
||||
Number(Number),
|
||||
Identifier(Identifier),
|
||||
ModulePathConcatenation(ModulePathConcatenation),
|
||||
ModulePathMultipleConcatenation(ModulePathMultipleConcatenation),
|
||||
FunctionSubroutineCall(FunctionSubroutineCall),
|
||||
Mintypmax(ModulePathPrimaryMintypmax),
|
||||
Number(Box<Number>),
|
||||
Identifier(Box<Identifier>),
|
||||
ModulePathConcatenation(Box<ModulePathConcatenation>),
|
||||
ModulePathMultipleConcatenation(Box<ModulePathMultipleConcatenation>),
|
||||
FunctionSubroutineCall(Box<FunctionSubroutineCall>),
|
||||
Mintypmax(Box<ModulePathPrimaryMintypmax>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -88,21 +88,21 @@ pub struct ModulePathPrimaryMintypmax {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum Primary {
|
||||
PrimaryLiteral(PrimaryLiteral),
|
||||
Hierarchical(PrimaryHierarchical),
|
||||
EmptyUnpackedArrayConcatenation(EmptyUnpackedArrayConcatenation),
|
||||
Concatenation(PrimaryConcatenation),
|
||||
MultipleConcatenation(PrimaryMultipleConcatenation),
|
||||
FunctionSubroutineCall(FunctionSubroutineCall),
|
||||
LetExpression(LetExpression),
|
||||
MintypmaxExpression(PrimaryMintypmaxExpression),
|
||||
Cast(Cast),
|
||||
AssignmentPatternExpression(AssignmentPatternExpression),
|
||||
StreamingConcatenation(StreamingConcatenation),
|
||||
SequenceMethodCall(SequenceMethodCall),
|
||||
This(Keyword),
|
||||
Dollar(Symbol),
|
||||
Null(Keyword),
|
||||
PrimaryLiteral(Box<PrimaryLiteral>),
|
||||
Hierarchical(Box<PrimaryHierarchical>),
|
||||
EmptyUnpackedArrayConcatenation(Box<EmptyUnpackedArrayConcatenation>),
|
||||
Concatenation(Box<PrimaryConcatenation>),
|
||||
MultipleConcatenation(Box<PrimaryMultipleConcatenation>),
|
||||
FunctionSubroutineCall(Box<FunctionSubroutineCall>),
|
||||
LetExpression(Box<LetExpression>),
|
||||
MintypmaxExpression(Box<PrimaryMintypmaxExpression>),
|
||||
Cast(Box<Cast>),
|
||||
AssignmentPatternExpression(Box<AssignmentPatternExpression>),
|
||||
StreamingConcatenation(Box<StreamingConcatenation>),
|
||||
SequenceMethodCall(Box<SequenceMethodCall>),
|
||||
This(Box<Keyword>),
|
||||
Dollar(Box<Symbol>),
|
||||
Null(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -131,8 +131,8 @@ pub struct PrimaryMintypmaxExpression {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ClassQualifierOrPackageScope {
|
||||
ClassQualifier(ClassQualifier),
|
||||
PackageScope(PackageScope),
|
||||
ClassQualifier(Box<ClassQualifier>),
|
||||
PackageScope(Box<PackageScope>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -142,22 +142,22 @@ pub struct ClassQualifier {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum RangeExpression {
|
||||
Expression(Expression),
|
||||
PartSelectRange(PartSelectRange),
|
||||
Expression(Box<Expression>),
|
||||
PartSelectRange(Box<PartSelectRange>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PrimaryLiteral {
|
||||
Number(Number),
|
||||
TimeLiteral(TimeLiteral),
|
||||
UnbasedUnsizedLiteral(UnbasedUnsizedLiteral),
|
||||
StringLiteral(StringLiteral),
|
||||
Number(Box<Number>),
|
||||
TimeLiteral(Box<TimeLiteral>),
|
||||
UnbasedUnsizedLiteral(Box<UnbasedUnsizedLiteral>),
|
||||
StringLiteral(Box<StringLiteral>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum TimeLiteral {
|
||||
Unsigned(TimeLiteralUnsigned),
|
||||
FixedPoint(TimeLiteralFixedPoint),
|
||||
Unsigned(Box<TimeLiteralUnsigned>),
|
||||
FixedPoint(Box<TimeLiteralFixedPoint>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -172,19 +172,19 @@ pub struct TimeLiteralFixedPoint {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum TimeUnit {
|
||||
S(Keyword),
|
||||
MS(Keyword),
|
||||
US(Keyword),
|
||||
NS(Keyword),
|
||||
PS(Keyword),
|
||||
FS(Keyword),
|
||||
S(Box<Keyword>),
|
||||
MS(Box<Keyword>),
|
||||
US(Box<Keyword>),
|
||||
NS(Box<Keyword>),
|
||||
PS(Box<Keyword>),
|
||||
FS(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ImplicitClassHandle {
|
||||
This(Keyword),
|
||||
Super(Keyword),
|
||||
ThisSuper((Keyword, Symbol, Keyword)),
|
||||
This(Box<Keyword>),
|
||||
Super(Box<Keyword>),
|
||||
ThisSuper(Box<(Keyword, Symbol, Keyword)>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -256,27 +256,35 @@ pub struct Cast {
|
||||
#[parser]
|
||||
pub fn constant_primary(s: Span) -> IResult<Span, ConstantPrimary> {
|
||||
alt((
|
||||
map(keyword("null"), |x| ConstantPrimary::Null(x)),
|
||||
map(primary_literal, |x| ConstantPrimary::PrimaryLiteral(x)),
|
||||
map(keyword("null"), |x| ConstantPrimary::Null(Box::new(x))),
|
||||
map(primary_literal, |x| {
|
||||
ConstantPrimary::PrimaryLiteral(Box::new(x))
|
||||
}),
|
||||
constant_primary_ps_parameter,
|
||||
constant_primary_specparam,
|
||||
map(genvar_identifier, |x| ConstantPrimary::GenvarIdentifier(x)),
|
||||
map(genvar_identifier, |x| {
|
||||
ConstantPrimary::GenvarIdentifier(Box::new(x))
|
||||
}),
|
||||
constant_primary_formal_port,
|
||||
constant_primary_enum,
|
||||
constant_primary_concatenation,
|
||||
constant_primary_multiple_concatenation,
|
||||
map(constant_function_call, |x| {
|
||||
ConstantPrimary::ConstantFunctionCall(x)
|
||||
ConstantPrimary::ConstantFunctionCall(Box::new(x))
|
||||
}),
|
||||
map(constant_let_expression, |x| {
|
||||
ConstantPrimary::ConstantLetExpression(x)
|
||||
ConstantPrimary::ConstantLetExpression(Box::new(x))
|
||||
}),
|
||||
constant_primary_mintypmax_expression,
|
||||
map(constant_cast, |x| ConstantPrimary::ConstantCast(x)),
|
||||
map(constant_assignment_pattern_expression, |x| {
|
||||
ConstantPrimary::ConstantAssignmentPatternExpression(x)
|
||||
map(constant_cast, |x| {
|
||||
ConstantPrimary::ConstantCast(Box::new(x))
|
||||
}),
|
||||
map(constant_assignment_pattern_expression, |x| {
|
||||
ConstantPrimary::ConstantAssignmentPatternExpression(Box::new(x))
|
||||
}),
|
||||
map(type_reference, |x| {
|
||||
ConstantPrimary::TypeReference(Box::new(x))
|
||||
}),
|
||||
map(type_reference, |x| ConstantPrimary::TypeReference(x)),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -286,7 +294,7 @@ pub fn constant_primary_ps_parameter(s: Span) -> IResult<Span, ConstantPrimary>
|
||||
let (s, b) = constant_select(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConstantPrimary::PsParameter(ConstantPrimaryPsParameter { nodes: (a, b) }),
|
||||
ConstantPrimary::PsParameter(Box::new(ConstantPrimaryPsParameter { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -296,7 +304,7 @@ pub fn constant_primary_specparam(s: Span) -> IResult<Span, ConstantPrimary> {
|
||||
let (s, b) = opt(bracket(constant_range_expression))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConstantPrimary::Specparam(ConstantPrimarySpecparam { nodes: (a, b) }),
|
||||
ConstantPrimary::Specparam(Box::new(ConstantPrimarySpecparam { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -306,7 +314,7 @@ pub fn constant_primary_formal_port(s: Span) -> IResult<Span, ConstantPrimary> {
|
||||
let (s, b) = constant_select(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConstantPrimary::FormalPort(ConstantPrimaryFormalPort { nodes: (a, b) }),
|
||||
ConstantPrimary::FormalPort(Box::new(ConstantPrimaryFormalPort { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -316,7 +324,7 @@ pub fn constant_primary_enum(s: Span) -> IResult<Span, ConstantPrimary> {
|
||||
let (s, b) = enum_identifier(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConstantPrimary::Enum(ConstantPrimaryEnum { nodes: (a, b) }),
|
||||
ConstantPrimary::Enum(Box::new(ConstantPrimaryEnum { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -326,7 +334,7 @@ pub fn constant_primary_concatenation(s: Span) -> IResult<Span, ConstantPrimary>
|
||||
let (s, b) = opt(bracket(constant_range_expression))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConstantPrimary::Concatenation(ConstantPrimaryConcatenation { nodes: (a, b) }),
|
||||
ConstantPrimary::Concatenation(Box::new(ConstantPrimaryConcatenation { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -336,9 +344,9 @@ pub fn constant_primary_multiple_concatenation(s: Span) -> IResult<Span, Constan
|
||||
let (s, b) = opt(bracket(constant_range_expression))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConstantPrimary::MultipleConcatenation(ConstantPrimaryMultipleConcatenation {
|
||||
ConstantPrimary::MultipleConcatenation(Box::new(ConstantPrimaryMultipleConcatenation {
|
||||
nodes: (a, b),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -347,23 +355,25 @@ pub fn constant_primary_mintypmax_expression(s: Span) -> IResult<Span, ConstantP
|
||||
let (s, a) = paren(constant_mintypmax_expression)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConstantPrimary::MintypmaxExpression(ConstantPrimaryMintypmaxExpression { nodes: (a,) }),
|
||||
ConstantPrimary::MintypmaxExpression(Box::new(ConstantPrimaryMintypmaxExpression {
|
||||
nodes: (a,),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn module_path_primary(s: Span) -> IResult<Span, ModulePathPrimary> {
|
||||
alt((
|
||||
map(number, |x| ModulePathPrimary::Number(x)),
|
||||
map(identifier, |x| ModulePathPrimary::Identifier(x)),
|
||||
map(number, |x| ModulePathPrimary::Number(Box::new(x))),
|
||||
map(identifier, |x| ModulePathPrimary::Identifier(Box::new(x))),
|
||||
map(module_path_concatenation, |x| {
|
||||
ModulePathPrimary::ModulePathConcatenation(x)
|
||||
ModulePathPrimary::ModulePathConcatenation(Box::new(x))
|
||||
}),
|
||||
map(module_path_multiple_concatenation, |x| {
|
||||
ModulePathPrimary::ModulePathMultipleConcatenation(x)
|
||||
ModulePathPrimary::ModulePathMultipleConcatenation(Box::new(x))
|
||||
}),
|
||||
map(function_subroutine_call, |x| {
|
||||
ModulePathPrimary::FunctionSubroutineCall(x)
|
||||
ModulePathPrimary::FunctionSubroutineCall(Box::new(x))
|
||||
}),
|
||||
module_path_primary_mintypmax_expression,
|
||||
))(s)
|
||||
@ -374,7 +384,7 @@ pub fn module_path_primary_mintypmax_expression(s: Span) -> IResult<Span, Module
|
||||
let (s, a) = paren(module_path_mintypmax_expression)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ModulePathPrimary::Mintypmax(ModulePathPrimaryMintypmax { nodes: (a,) }),
|
||||
ModulePathPrimary::Mintypmax(Box::new(ModulePathPrimaryMintypmax { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -382,28 +392,30 @@ pub fn module_path_primary_mintypmax_expression(s: Span) -> IResult<Span, Module
|
||||
#[parser]
|
||||
pub fn primary(s: Span) -> IResult<Span, Primary> {
|
||||
alt((
|
||||
map(keyword("this"), |x| Primary::This(x)),
|
||||
map(symbol("$"), |x| Primary::Dollar(x)),
|
||||
map(keyword("null"), |x| Primary::Null(x)),
|
||||
map(primary_literal, |x| Primary::PrimaryLiteral(x)),
|
||||
map(keyword("this"), |x| Primary::This(Box::new(x))),
|
||||
map(symbol("$"), |x| Primary::Dollar(Box::new(x))),
|
||||
map(keyword("null"), |x| Primary::Null(Box::new(x))),
|
||||
map(primary_literal, |x| Primary::PrimaryLiteral(Box::new(x))),
|
||||
primary_hierarchical,
|
||||
map(empty_unpacked_array_concatenation, |x| {
|
||||
Primary::EmptyUnpackedArrayConcatenation(x)
|
||||
Primary::EmptyUnpackedArrayConcatenation(Box::new(x))
|
||||
}),
|
||||
primary_concatenation,
|
||||
map(function_subroutine_call, |x| {
|
||||
Primary::FunctionSubroutineCall(x)
|
||||
Primary::FunctionSubroutineCall(Box::new(x))
|
||||
}),
|
||||
map(let_expression, |x| Primary::LetExpression(x)),
|
||||
map(let_expression, |x| Primary::LetExpression(Box::new(x))),
|
||||
primary_mintypmax_expression,
|
||||
map(cast, |x| Primary::Cast(x)),
|
||||
map(cast, |x| Primary::Cast(Box::new(x))),
|
||||
map(assignment_pattern_expression, |x| {
|
||||
Primary::AssignmentPatternExpression(x)
|
||||
Primary::AssignmentPatternExpression(Box::new(x))
|
||||
}),
|
||||
map(streaming_concatenation, |x| {
|
||||
Primary::StreamingConcatenation(x)
|
||||
Primary::StreamingConcatenation(Box::new(x))
|
||||
}),
|
||||
map(sequence_method_call, |x| {
|
||||
Primary::SequenceMethodCall(Box::new(x))
|
||||
}),
|
||||
map(sequence_method_call, |x| Primary::SequenceMethodCall(x)),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -414,7 +426,7 @@ pub fn primary_hierarchical(s: Span) -> IResult<Span, Primary> {
|
||||
let (s, c) = select(s)?;
|
||||
Ok((
|
||||
s,
|
||||
Primary::Hierarchical(PrimaryHierarchical { nodes: (a, b, c) }),
|
||||
Primary::Hierarchical(Box::new(PrimaryHierarchical { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -424,7 +436,7 @@ pub fn primary_concatenation(s: Span) -> IResult<Span, Primary> {
|
||||
let (s, b) = opt(bracket(range_expression))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
Primary::Concatenation(PrimaryConcatenation { nodes: (a, b) }),
|
||||
Primary::Concatenation(Box::new(PrimaryConcatenation { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -434,7 +446,7 @@ pub fn primary_multiple_concatenation(s: Span) -> IResult<Span, Primary> {
|
||||
let (s, b) = opt(bracket(range_expression))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
Primary::MultipleConcatenation(PrimaryMultipleConcatenation { nodes: (a, b) }),
|
||||
Primary::MultipleConcatenation(Box::new(PrimaryMultipleConcatenation { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -443,7 +455,7 @@ pub fn primary_mintypmax_expression(s: Span) -> IResult<Span, Primary> {
|
||||
let (s, a) = paren(mintypmax_expression)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
Primary::MintypmaxExpression(PrimaryMintypmaxExpression { nodes: (a,) }),
|
||||
Primary::MintypmaxExpression(Box::new(PrimaryMintypmaxExpression { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -451,10 +463,10 @@ pub fn primary_mintypmax_expression(s: Span) -> IResult<Span, Primary> {
|
||||
pub fn class_qualifier_or_package_scope(s: Span) -> IResult<Span, ClassQualifierOrPackageScope> {
|
||||
alt((
|
||||
map(class_qualifier, |x| {
|
||||
ClassQualifierOrPackageScope::ClassQualifier(x)
|
||||
ClassQualifierOrPackageScope::ClassQualifier(Box::new(x))
|
||||
}),
|
||||
map(package_scope, |x| {
|
||||
ClassQualifierOrPackageScope::PackageScope(x)
|
||||
ClassQualifierOrPackageScope::PackageScope(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -469,8 +481,10 @@ pub fn class_qualifier(s: Span) -> IResult<Span, ClassQualifier> {
|
||||
#[parser]
|
||||
pub fn range_expression(s: Span) -> IResult<Span, RangeExpression> {
|
||||
alt((
|
||||
map(expression, |x| RangeExpression::Expression(x)),
|
||||
map(part_select_range, |x| RangeExpression::PartSelectRange(x)),
|
||||
map(expression, |x| RangeExpression::Expression(Box::new(x))),
|
||||
map(part_select_range, |x| {
|
||||
RangeExpression::PartSelectRange(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -478,12 +492,14 @@ pub fn range_expression(s: Span) -> IResult<Span, RangeExpression> {
|
||||
#[parser]
|
||||
pub fn primary_literal(s: Span) -> IResult<Span, PrimaryLiteral> {
|
||||
alt((
|
||||
map(time_literal, |x| PrimaryLiteral::TimeLiteral(x)),
|
||||
map(number, |x| PrimaryLiteral::Number(x)),
|
||||
map(time_literal, |x| PrimaryLiteral::TimeLiteral(Box::new(x))),
|
||||
map(number, |x| PrimaryLiteral::Number(Box::new(x))),
|
||||
map(unbased_unsized_literal, |x| {
|
||||
PrimaryLiteral::UnbasedUnsizedLiteral(x)
|
||||
PrimaryLiteral::UnbasedUnsizedLiteral(Box::new(x))
|
||||
}),
|
||||
map(string_literal, |x| {
|
||||
PrimaryLiteral::StringLiteral(Box::new(x))
|
||||
}),
|
||||
map(string_literal, |x| PrimaryLiteral::StringLiteral(x)),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -498,7 +514,7 @@ pub fn time_literal_unsigned(s: Span) -> IResult<Span, TimeLiteral> {
|
||||
let (s, b) = time_unit(s)?;
|
||||
Ok((
|
||||
s,
|
||||
TimeLiteral::Unsigned(TimeLiteralUnsigned { nodes: (a, b) }),
|
||||
TimeLiteral::Unsigned(Box::new(TimeLiteralUnsigned { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -508,19 +524,19 @@ pub fn time_literal_fixed_point(s: Span) -> IResult<Span, TimeLiteral> {
|
||||
let (s, b) = time_unit(s)?;
|
||||
Ok((
|
||||
s,
|
||||
TimeLiteral::FixedPoint(TimeLiteralFixedPoint { nodes: (a, b) }),
|
||||
TimeLiteral::FixedPoint(Box::new(TimeLiteralFixedPoint { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn time_unit(s: Span) -> IResult<Span, TimeUnit> {
|
||||
alt((
|
||||
map(keyword("s"), |x| TimeUnit::S(x)),
|
||||
map(keyword("ms"), |x| TimeUnit::MS(x)),
|
||||
map(keyword("us"), |x| TimeUnit::US(x)),
|
||||
map(keyword("ns"), |x| TimeUnit::NS(x)),
|
||||
map(keyword("ps"), |x| TimeUnit::PS(x)),
|
||||
map(keyword("fs"), |x| TimeUnit::FS(x)),
|
||||
map(keyword("s"), |x| TimeUnit::S(Box::new(x))),
|
||||
map(keyword("ms"), |x| TimeUnit::MS(Box::new(x))),
|
||||
map(keyword("us"), |x| TimeUnit::US(Box::new(x))),
|
||||
map(keyword("ns"), |x| TimeUnit::NS(Box::new(x))),
|
||||
map(keyword("ps"), |x| TimeUnit::PS(Box::new(x))),
|
||||
map(keyword("fs"), |x| TimeUnit::FS(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -529,10 +545,12 @@ pub fn implicit_class_handle(s: Span) -> IResult<Span, ImplicitClassHandle> {
|
||||
alt((
|
||||
map(
|
||||
triple(keyword("this"), symbol("."), keyword("super")),
|
||||
|(x, y, z)| ImplicitClassHandle::ThisSuper((x, y, z)),
|
||||
|(x, y, z)| ImplicitClassHandle::ThisSuper(Box::new((x, y, z))),
|
||||
),
|
||||
map(keyword("this"), |x| ImplicitClassHandle::This(x)),
|
||||
map(keyword("super"), |x| ImplicitClassHandle::Super(x)),
|
||||
map(keyword("this"), |x| ImplicitClassHandle::This(Box::new(x))),
|
||||
map(keyword("super"), |x| {
|
||||
ImplicitClassHandle::Super(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -613,36 +631,11 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_primary() {
|
||||
parser_test!(
|
||||
primary,
|
||||
"2.1ns ",
|
||||
Ok((_, Primary::PrimaryLiteral(PrimaryLiteral::TimeLiteral(_))))
|
||||
);
|
||||
parser_test!(
|
||||
primary,
|
||||
"40 ps ",
|
||||
Ok((_, Primary::PrimaryLiteral(PrimaryLiteral::TimeLiteral(_))))
|
||||
);
|
||||
parser_test!(
|
||||
primary,
|
||||
"'0",
|
||||
Ok(
|
||||
(
|
||||
_,
|
||||
Primary::PrimaryLiteral(PrimaryLiteral::UnbasedUnsizedLiteral(_))
|
||||
),
|
||||
)
|
||||
);
|
||||
parser_test!(
|
||||
primary,
|
||||
"10",
|
||||
Ok((_, Primary::PrimaryLiteral(PrimaryLiteral::Number(_))))
|
||||
);
|
||||
parser_test!(
|
||||
primary,
|
||||
"\"aaa\"",
|
||||
Ok((_, Primary::PrimaryLiteral(PrimaryLiteral::StringLiteral(_))))
|
||||
);
|
||||
parser_test!(primary, "2.1ns ", Ok((_, Primary::PrimaryLiteral(_))));
|
||||
parser_test!(primary, "40 ps ", Ok((_, Primary::PrimaryLiteral(_))));
|
||||
parser_test!(primary, "'0", Ok((_, Primary::PrimaryLiteral(_))));
|
||||
parser_test!(primary, "10", Ok((_, Primary::PrimaryLiteral(_))));
|
||||
parser_test!(primary, "\"aaa\"", Ok((_, Primary::PrimaryLiteral(_))));
|
||||
parser_test!(primary, "this ", Ok((_, Primary::This(_))));
|
||||
parser_test!(primary, "$", Ok((_, Primary::Dollar(_))));
|
||||
parser_test!(primary, "null ", Ok((_, Primary::Null(_))));
|
||||
|
@ -25,9 +25,9 @@ pub struct TfCall {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum SystemTfCall {
|
||||
ArgOptionl(SystemTfCallArgOptional),
|
||||
ArgDataType(SystemTfCallArgDataType),
|
||||
ArgExpression(SystemTfCallArgExpression),
|
||||
ArgOptionl(Box<SystemTfCallArgOptional>),
|
||||
ArgDataType(Box<SystemTfCallArgDataType>),
|
||||
ArgExpression(Box<SystemTfCallArgExpression>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -74,8 +74,8 @@ pub struct FunctionSubroutineCall {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ListOfArguments {
|
||||
Ordered(ListOfArgumentsOrdered),
|
||||
Named(ListOfArgumentsNamed),
|
||||
Ordered(Box<ListOfArgumentsOrdered>),
|
||||
Named(Box<ListOfArgumentsNamed>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -103,8 +103,8 @@ pub struct MethodCall {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum MethodCallBody {
|
||||
User(MethodCallBodyUser),
|
||||
BuiltInMethodCall(BuiltInMethodCall),
|
||||
User(Box<MethodCallBodyUser>),
|
||||
BuiltInMethodCall(Box<BuiltInMethodCall>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -118,8 +118,8 @@ pub struct MethodCallBodyUser {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum BuiltInMethodCall {
|
||||
ArrayManipulationCall(ArrayManipulationCall),
|
||||
RandomizeCall(RandomizeCall),
|
||||
ArrayManipulationCall(Box<ArrayManipulationCall>),
|
||||
RandomizeCall(Box<RandomizeCall>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -148,23 +148,23 @@ pub struct RandomizeCall {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum VariableIdentifierListOrNull {
|
||||
VariableIdentifierList(VariableIdentifierList),
|
||||
Null(Keyword),
|
||||
VariableIdentifierList(Box<VariableIdentifierList>),
|
||||
Null(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum MethodCallRoot {
|
||||
Primary(Primary),
|
||||
ImplicitClassHandle(ImplicitClassHandle),
|
||||
Primary(Box<Primary>),
|
||||
ImplicitClassHandle(Box<ImplicitClassHandle>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ArrayMethodName {
|
||||
MethodIdentifier(MethodIdentifier),
|
||||
Unique(Keyword),
|
||||
And(Keyword),
|
||||
Or(Keyword),
|
||||
Xor(Keyword),
|
||||
MethodIdentifier(Box<MethodIdentifier>),
|
||||
Unique(Box<Keyword>),
|
||||
And(Box<Keyword>),
|
||||
Or(Box<Keyword>),
|
||||
Xor(Box<Keyword>),
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -198,7 +198,7 @@ pub fn system_tf_call_arg_optional(s: Span) -> IResult<Span, SystemTfCall> {
|
||||
let (s, b) = opt(paren(list_of_arguments))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
SystemTfCall::ArgOptionl(SystemTfCallArgOptional { nodes: (a, b) }),
|
||||
SystemTfCall::ArgOptionl(Box::new(SystemTfCallArgOptional { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ pub fn system_tf_call_arg_data_type(s: Span) -> IResult<Span, SystemTfCall> {
|
||||
let (s, b) = paren(pair(data_type, opt(pair(symbol(","), expression))))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
SystemTfCall::ArgDataType(SystemTfCallArgDataType { nodes: (a, b) }),
|
||||
SystemTfCall::ArgDataType(Box::new(SystemTfCallArgDataType { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -221,7 +221,7 @@ pub fn system_tf_call_arg_expression(s: Span) -> IResult<Span, SystemTfCall> {
|
||||
))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
SystemTfCall::ArgExpression(SystemTfCallArgExpression { nodes: (a, b) }),
|
||||
SystemTfCall::ArgExpression(Box::new(SystemTfCallArgExpression { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -269,7 +269,7 @@ pub fn list_of_arguments_ordered(s: Span) -> IResult<Span, ListOfArguments> {
|
||||
)))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ListOfArguments::Ordered(ListOfArgumentsOrdered { nodes: (a, b) }),
|
||||
ListOfArguments::Ordered(Box::new(ListOfArgumentsOrdered { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -286,9 +286,9 @@ pub fn list_of_arguments_named(s: Span) -> IResult<Span, ListOfArguments> {
|
||||
)))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ListOfArguments::Named(ListOfArgumentsNamed {
|
||||
ListOfArguments::Named(Box::new(ListOfArgumentsNamed {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -306,7 +306,7 @@ pub fn method_call_body(s: Span) -> IResult<Span, MethodCallBody> {
|
||||
alt((
|
||||
method_call_body_user,
|
||||
map(built_in_method_call, |x| {
|
||||
MethodCallBody::BuiltInMethodCall(x)
|
||||
MethodCallBody::BuiltInMethodCall(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -318,7 +318,7 @@ pub fn method_call_body_user(s: Span) -> IResult<Span, MethodCallBody> {
|
||||
let (s, c) = opt(paren(list_of_arguments))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
MethodCallBody::User(MethodCallBodyUser { nodes: (a, b, c) }),
|
||||
MethodCallBody::User(Box::new(MethodCallBodyUser { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -326,9 +326,11 @@ pub fn method_call_body_user(s: Span) -> IResult<Span, MethodCallBody> {
|
||||
pub fn built_in_method_call(s: Span) -> IResult<Span, BuiltInMethodCall> {
|
||||
alt((
|
||||
map(array_manipulation_call, |x| {
|
||||
BuiltInMethodCall::ArrayManipulationCall(x)
|
||||
BuiltInMethodCall::ArrayManipulationCall(Box::new(x))
|
||||
}),
|
||||
map(randomize_call, |x| {
|
||||
BuiltInMethodCall::RandomizeCall(Box::new(x))
|
||||
}),
|
||||
map(randomize_call, |x| BuiltInMethodCall::RandomizeCall(x)),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -368,18 +370,20 @@ pub fn randomize_call(s: Span) -> IResult<Span, RandomizeCall> {
|
||||
pub fn variable_identifier_list_or_null(s: Span) -> IResult<Span, VariableIdentifierListOrNull> {
|
||||
alt((
|
||||
map(variable_identifier_list, |x| {
|
||||
VariableIdentifierListOrNull::VariableIdentifierList(x)
|
||||
VariableIdentifierListOrNull::VariableIdentifierList(Box::new(x))
|
||||
}),
|
||||
map(keyword("null"), |x| {
|
||||
VariableIdentifierListOrNull::Null(Box::new(x))
|
||||
}),
|
||||
map(keyword("null"), |x| VariableIdentifierListOrNull::Null(x)),
|
||||
))(s)
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn method_call_root(s: Span) -> IResult<Span, MethodCallRoot> {
|
||||
alt((
|
||||
map(primary, |x| MethodCallRoot::Primary(x)),
|
||||
map(primary, |x| MethodCallRoot::Primary(Box::new(x))),
|
||||
map(implicit_class_handle, |x| {
|
||||
MethodCallRoot::ImplicitClassHandle(x)
|
||||
MethodCallRoot::ImplicitClassHandle(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -387,11 +391,13 @@ pub fn method_call_root(s: Span) -> IResult<Span, MethodCallRoot> {
|
||||
#[parser]
|
||||
pub fn array_method_name(s: Span) -> IResult<Span, ArrayMethodName> {
|
||||
alt((
|
||||
map(keyword("unique"), |x| ArrayMethodName::Unique(x)),
|
||||
map(keyword("and"), |x| ArrayMethodName::And(x)),
|
||||
map(keyword("or"), |x| ArrayMethodName::Or(x)),
|
||||
map(keyword("xor"), |x| ArrayMethodName::Xor(x)),
|
||||
map(method_identifier, |x| ArrayMethodName::MethodIdentifier(x)),
|
||||
map(keyword("unique"), |x| ArrayMethodName::Unique(Box::new(x))),
|
||||
map(keyword("and"), |x| ArrayMethodName::And(Box::new(x))),
|
||||
map(keyword("or"), |x| ArrayMethodName::Or(Box::new(x))),
|
||||
map(keyword("xor"), |x| ArrayMethodName::Xor(Box::new(x))),
|
||||
map(method_identifier, |x| {
|
||||
ArrayMethodName::MethodIdentifier(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
|
@ -201,8 +201,8 @@ pub struct HierarchicalVariableIdentifier {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum Identifier {
|
||||
SimpleIdentifier(SimpleIdentifier),
|
||||
EscapedIdentifier(EscapedIdentifier),
|
||||
SimpleIdentifier(Box<SimpleIdentifier>),
|
||||
EscapedIdentifier(Box<EscapedIdentifier>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -282,8 +282,8 @@ pub struct PackageIdentifier {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PackageScope {
|
||||
Package(PackageScopePackage),
|
||||
Unit(Unit),
|
||||
Package(Box<PackageScopePackage>),
|
||||
Unit(Box<Unit>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -351,8 +351,8 @@ pub struct PsOrHierarchicalArrayIdentifier {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PsOrHierarchicalNetIdentifier {
|
||||
PackageScope(PsOrHierarchicalNetIdentifierPackageScope),
|
||||
HierarchicalNetIdentifier(HierarchicalNetIdentifier),
|
||||
PackageScope(Box<PsOrHierarchicalNetIdentifierPackageScope>),
|
||||
HierarchicalNetIdentifier(Box<HierarchicalNetIdentifier>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -367,8 +367,8 @@ pub struct PsOrHierarchicalNetIdentifierHierarchical {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PsOrHierarchicalPropertyIdentifier {
|
||||
PackageScope(PsOrHierarchicalPropertyIdentifierPackageScope),
|
||||
HierarchicalPropertyIdentifier(HierarchicalPropertyIdentifier),
|
||||
PackageScope(Box<PsOrHierarchicalPropertyIdentifierPackageScope>),
|
||||
HierarchicalPropertyIdentifier(Box<HierarchicalPropertyIdentifier>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -383,8 +383,8 @@ pub struct PsOrHierarchicalPropertyIdentifierHierarchical {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PsOrHierarchicalSequenceIdentifier {
|
||||
PackageScope(PsOrHierarchicalSequenceIdentifierPackageScope),
|
||||
HierarchicalSequenceIdentifier(HierarchicalSequenceIdentifier),
|
||||
PackageScope(Box<PsOrHierarchicalSequenceIdentifierPackageScope>),
|
||||
HierarchicalSequenceIdentifier(Box<HierarchicalSequenceIdentifier>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -399,8 +399,8 @@ pub struct PsOrHierarchicalSequenceIdentifierHierarchical {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PsOrHierarchicalTfIdentifier {
|
||||
PackageScope(PsOrHierarchicalTfIdentifierPackageScope),
|
||||
HierarchicalTfIdentifier(HierarchicalTfIdentifier),
|
||||
PackageScope(Box<PsOrHierarchicalTfIdentifierPackageScope>),
|
||||
HierarchicalTfIdentifier(Box<HierarchicalTfIdentifier>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -415,8 +415,8 @@ pub struct PsOrHierarchicalTfIdentifierHierarchical {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PsParameterIdentifier {
|
||||
Scope(PsParameterIdentifierScope),
|
||||
Generate(PsParameterIdentifierGenerate),
|
||||
Scope(Box<PsParameterIdentifierScope>),
|
||||
Generate(Box<PsParameterIdentifierGenerate>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -443,9 +443,9 @@ pub struct PsTypeIdentifier {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum LocalOrPackageScopeOrClassScope {
|
||||
Local(Local),
|
||||
PackageScope(PackageScope),
|
||||
ClassScope(ClassScope),
|
||||
Local(Box<Local>),
|
||||
PackageScope(Box<PackageScope>),
|
||||
ClassScope(Box<ClassScope>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -515,27 +515,27 @@ pub struct VariableIdentifier {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ImplicitClassHandleOrClassScopeOrPackageScope {
|
||||
ImplicitClassHandle((ImplicitClassHandle, Symbol)),
|
||||
ClassScope(ClassScope),
|
||||
PackageScope(PackageScope),
|
||||
ImplicitClassHandle(Box<(ImplicitClassHandle, Symbol)>),
|
||||
ClassScope(Box<ClassScope>),
|
||||
PackageScope(Box<PackageScope>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ImplicitClassHandleOrPackageScope {
|
||||
ImplicitClassHandle((ImplicitClassHandle, Symbol)),
|
||||
PackageScope(PackageScope),
|
||||
ImplicitClassHandle(Box<(ImplicitClassHandle, Symbol)>),
|
||||
PackageScope(Box<PackageScope>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ImplicitClassHandleOrClassScope {
|
||||
ImplicitClassHandle((ImplicitClassHandle, Symbol)),
|
||||
ClassScope(ClassScope),
|
||||
ImplicitClassHandle(Box<(ImplicitClassHandle, Symbol)>),
|
||||
ClassScope(Box<ClassScope>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PackageScopeOrClassScope {
|
||||
PackageScope(PackageScope),
|
||||
ClassScope(ClassScope),
|
||||
PackageScope(Box<PackageScope>),
|
||||
ClassScope(Box<ClassScope>),
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -790,8 +790,12 @@ pub fn hierarchical_variable_identifier(s: Span) -> IResult<Span, HierarchicalVa
|
||||
#[parser]
|
||||
pub fn identifier(s: Span) -> IResult<Span, Identifier> {
|
||||
alt((
|
||||
map(escaped_identifier, |x| Identifier::EscapedIdentifier(x)),
|
||||
map(simple_identifier, |x| Identifier::SimpleIdentifier(x)),
|
||||
map(escaped_identifier, |x| {
|
||||
Identifier::EscapedIdentifier(Box::new(x))
|
||||
}),
|
||||
map(simple_identifier, |x| {
|
||||
Identifier::SimpleIdentifier(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -888,7 +892,10 @@ pub fn package_identifier(s: Span) -> IResult<Span, PackageIdentifier> {
|
||||
#[packrat_parser]
|
||||
#[parser]
|
||||
pub fn package_scope(s: Span) -> IResult<Span, PackageScope> {
|
||||
alt((package_scope_package, map(unit, |x| PackageScope::Unit(x))))(s)
|
||||
alt((
|
||||
package_scope_package,
|
||||
map(unit, |x| PackageScope::Unit(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
#[parser]
|
||||
@ -897,7 +904,7 @@ pub fn package_scope_package(s: Span) -> IResult<Span, PackageScope> {
|
||||
let (s, b) = symbol("::")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PackageScope::Package(PackageScopePackage { nodes: (a, b) }),
|
||||
PackageScope::Package(Box::new(PackageScopePackage { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -980,7 +987,7 @@ pub fn ps_or_hierarchical_net_identifier(s: Span) -> IResult<Span, PsOrHierarchi
|
||||
alt((
|
||||
ps_or_hierarchical_net_identifier_package_scope,
|
||||
map(hierarchical_net_identifier, |x| {
|
||||
PsOrHierarchicalNetIdentifier::HierarchicalNetIdentifier(x)
|
||||
PsOrHierarchicalNetIdentifier::HierarchicalNetIdentifier(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -993,9 +1000,9 @@ pub fn ps_or_hierarchical_net_identifier_package_scope(
|
||||
let (s, b) = net_identifier(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PsOrHierarchicalNetIdentifier::PackageScope(PsOrHierarchicalNetIdentifierPackageScope {
|
||||
nodes: (a, b),
|
||||
}),
|
||||
PsOrHierarchicalNetIdentifier::PackageScope(Box::new(
|
||||
PsOrHierarchicalNetIdentifierPackageScope { nodes: (a, b) },
|
||||
)),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1006,7 +1013,7 @@ pub fn ps_or_hierarchical_property_identifier(
|
||||
alt((
|
||||
ps_or_hierarchical_property_identifier_package_scope,
|
||||
map(hierarchical_property_identifier, |x| {
|
||||
PsOrHierarchicalPropertyIdentifier::HierarchicalPropertyIdentifier(x)
|
||||
PsOrHierarchicalPropertyIdentifier::HierarchicalPropertyIdentifier(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -1019,9 +1026,9 @@ pub fn ps_or_hierarchical_property_identifier_package_scope(
|
||||
let (s, b) = property_identifier(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PsOrHierarchicalPropertyIdentifier::PackageScope(
|
||||
PsOrHierarchicalPropertyIdentifier::PackageScope(Box::new(
|
||||
PsOrHierarchicalPropertyIdentifierPackageScope { nodes: (a, b) },
|
||||
),
|
||||
)),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1032,7 +1039,7 @@ pub fn ps_or_hierarchical_sequence_identifier(
|
||||
alt((
|
||||
ps_or_hierarchical_sequence_identifier_package_scope,
|
||||
map(hierarchical_sequence_identifier, |x| {
|
||||
PsOrHierarchicalSequenceIdentifier::HierarchicalSequenceIdentifier(x)
|
||||
PsOrHierarchicalSequenceIdentifier::HierarchicalSequenceIdentifier(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -1045,9 +1052,9 @@ pub fn ps_or_hierarchical_sequence_identifier_package_scope(
|
||||
let (s, b) = sequence_identifier(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PsOrHierarchicalSequenceIdentifier::PackageScope(
|
||||
PsOrHierarchicalSequenceIdentifier::PackageScope(Box::new(
|
||||
PsOrHierarchicalSequenceIdentifierPackageScope { nodes: (a, b) },
|
||||
),
|
||||
)),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1056,7 +1063,7 @@ pub fn ps_or_hierarchical_tf_identifier(s: Span) -> IResult<Span, PsOrHierarchic
|
||||
alt((
|
||||
ps_or_hierarchical_tf_identifier_package_scope,
|
||||
map(hierarchical_tf_identifier, |x| {
|
||||
PsOrHierarchicalTfIdentifier::HierarchicalTfIdentifier(x)
|
||||
PsOrHierarchicalTfIdentifier::HierarchicalTfIdentifier(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -1069,9 +1076,9 @@ pub fn ps_or_hierarchical_tf_identifier_package_scope(
|
||||
let (s, b) = tf_identifier(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PsOrHierarchicalTfIdentifier::PackageScope(PsOrHierarchicalTfIdentifierPackageScope {
|
||||
nodes: (a, b),
|
||||
}),
|
||||
PsOrHierarchicalTfIdentifier::PackageScope(Box::new(
|
||||
PsOrHierarchicalTfIdentifierPackageScope { nodes: (a, b) },
|
||||
)),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1090,7 +1097,7 @@ pub fn ps_parameter_identifier_scope(s: Span) -> IResult<Span, PsParameterIdenti
|
||||
let (s, b) = parameter_identifier(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PsParameterIdentifier::Scope(PsParameterIdentifierScope { nodes: (a, b) }),
|
||||
PsParameterIdentifier::Scope(Box::new(PsParameterIdentifierScope { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1104,7 +1111,7 @@ pub fn ps_parameter_identifier_generate(s: Span) -> IResult<Span, PsParameterIde
|
||||
let (s, b) = parameter_identifier(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PsParameterIdentifier::Generate(PsParameterIdentifierGenerate { nodes: (a, b) }),
|
||||
PsParameterIdentifier::Generate(Box::new(PsParameterIdentifierGenerate { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1219,13 +1226,13 @@ pub fn implicit_class_handle_or_class_scope_or_package_scope(
|
||||
) -> IResult<Span, ImplicitClassHandleOrClassScopeOrPackageScope> {
|
||||
alt((
|
||||
map(pair(implicit_class_handle, symbol(".")), |x| {
|
||||
ImplicitClassHandleOrClassScopeOrPackageScope::ImplicitClassHandle(x)
|
||||
ImplicitClassHandleOrClassScopeOrPackageScope::ImplicitClassHandle(Box::new(x))
|
||||
}),
|
||||
map(class_scope, |x| {
|
||||
ImplicitClassHandleOrClassScopeOrPackageScope::ClassScope(x)
|
||||
ImplicitClassHandleOrClassScopeOrPackageScope::ClassScope(Box::new(x))
|
||||
}),
|
||||
map(package_scope, |x| {
|
||||
ImplicitClassHandleOrClassScopeOrPackageScope::PackageScope(x)
|
||||
ImplicitClassHandleOrClassScopeOrPackageScope::PackageScope(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -1236,10 +1243,10 @@ pub fn implicit_class_handle_or_package_scope(
|
||||
) -> IResult<Span, ImplicitClassHandleOrPackageScope> {
|
||||
alt((
|
||||
map(pair(implicit_class_handle, symbol(".")), |x| {
|
||||
ImplicitClassHandleOrPackageScope::ImplicitClassHandle(x)
|
||||
ImplicitClassHandleOrPackageScope::ImplicitClassHandle(Box::new(x))
|
||||
}),
|
||||
map(package_scope, |x| {
|
||||
ImplicitClassHandleOrPackageScope::PackageScope(x)
|
||||
ImplicitClassHandleOrPackageScope::PackageScope(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -1250,10 +1257,10 @@ pub fn implicit_class_handle_or_class_scope(
|
||||
) -> IResult<Span, ImplicitClassHandleOrClassScope> {
|
||||
alt((
|
||||
map(pair(implicit_class_handle, symbol(".")), |x| {
|
||||
ImplicitClassHandleOrClassScope::ImplicitClassHandle(x)
|
||||
ImplicitClassHandleOrClassScope::ImplicitClassHandle(Box::new(x))
|
||||
}),
|
||||
map(class_scope, |x| {
|
||||
ImplicitClassHandleOrClassScope::ClassScope(x)
|
||||
ImplicitClassHandleOrClassScope::ClassScope(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -1261,8 +1268,12 @@ pub fn implicit_class_handle_or_class_scope(
|
||||
#[parser]
|
||||
pub fn package_scope_or_class_scope(s: Span) -> IResult<Span, PackageScopeOrClassScope> {
|
||||
alt((
|
||||
map(package_scope, |x| PackageScopeOrClassScope::PackageScope(x)),
|
||||
map(class_scope, |x| PackageScopeOrClassScope::ClassScope(x)),
|
||||
map(package_scope, |x| {
|
||||
PackageScopeOrClassScope::PackageScope(Box::new(x))
|
||||
}),
|
||||
map(class_scope, |x| {
|
||||
PackageScopeOrClassScope::ClassScope(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -1271,12 +1282,14 @@ pub fn local_or_package_scope_or_class_scope(
|
||||
s: Span,
|
||||
) -> IResult<Span, LocalOrPackageScopeOrClassScope> {
|
||||
alt((
|
||||
map(local, |x| LocalOrPackageScopeOrClassScope::Local(x)),
|
||||
map(local, |x| {
|
||||
LocalOrPackageScopeOrClassScope::Local(Box::new(x))
|
||||
}),
|
||||
map(package_scope, |x| {
|
||||
LocalOrPackageScopeOrClassScope::PackageScope(x)
|
||||
LocalOrPackageScopeOrClassScope::PackageScope(Box::new(x))
|
||||
}),
|
||||
map(class_scope, |x| {
|
||||
LocalOrPackageScopeOrClassScope::ClassScope(x)
|
||||
LocalOrPackageScopeOrClassScope::ClassScope(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ pub struct CheckerInstantiation {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ListOfCheckerPortConnections {
|
||||
Ordered(ListOfCheckerPortConnectionsOrdered),
|
||||
Named(ListOfCheckerPortConnectionsNamed),
|
||||
Ordered(Box<ListOfCheckerPortConnectionsOrdered>),
|
||||
Named(Box<ListOfCheckerPortConnectionsNamed>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -40,8 +40,8 @@ pub struct OrderedCheckerPortConnection {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum NamedCheckerPortConnection {
|
||||
Identifier(NamedCheckerPortConnectionIdentifier),
|
||||
Asterisk(NamedCheckerPortConnectionAsterisk),
|
||||
Identifier(Box<NamedCheckerPortConnectionIdentifier>),
|
||||
Asterisk(Box<NamedCheckerPortConnectionAsterisk>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -90,7 +90,9 @@ pub fn list_of_checker_port_connections_ordered(
|
||||
let (s, a) = list(symbol(","), ordered_checker_port_connection)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ListOfCheckerPortConnections::Ordered(ListOfCheckerPortConnectionsOrdered { nodes: (a,) }),
|
||||
ListOfCheckerPortConnections::Ordered(Box::new(ListOfCheckerPortConnectionsOrdered {
|
||||
nodes: (a,),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -101,7 +103,9 @@ pub fn list_of_checker_port_connections_named(
|
||||
let (s, a) = list(symbol(","), named_checker_port_connection)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ListOfCheckerPortConnections::Named(ListOfCheckerPortConnectionsNamed { nodes: (a,) }),
|
||||
ListOfCheckerPortConnections::Named(Box::new(ListOfCheckerPortConnectionsNamed {
|
||||
nodes: (a,),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -130,9 +134,9 @@ pub fn named_checker_port_connection_identifier(
|
||||
let (s, d) = opt(paren(opt(property_actual_arg)))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
NamedCheckerPortConnection::Identifier(NamedCheckerPortConnectionIdentifier {
|
||||
NamedCheckerPortConnection::Identifier(Box::new(NamedCheckerPortConnectionIdentifier {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -144,7 +148,9 @@ pub fn named_checker_port_connection_asterisk(
|
||||
let (s, b) = symbol(".*")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
NamedCheckerPortConnection::Asterisk(NamedCheckerPortConnectionAsterisk { nodes: (a, b) }),
|
||||
NamedCheckerPortConnection::Asterisk(Box::new(NamedCheckerPortConnectionAsterisk {
|
||||
nodes: (a, b),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -40,9 +40,9 @@ pub struct Genvar {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum GenvarIteration {
|
||||
Assignment(GenvarIterationAssignment),
|
||||
Prefix(GenvarIterationPrefix),
|
||||
Suffix(GenvarIterationSuffix),
|
||||
Assignment(Box<GenvarIterationAssignment>),
|
||||
Prefix(Box<GenvarIterationPrefix>),
|
||||
Suffix(Box<GenvarIterationSuffix>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -62,8 +62,8 @@ pub struct GenvarIterationSuffix {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ConditionalGenerateConstruct {
|
||||
If(IfGenerateConstruct),
|
||||
Case(CaseGenerateConstruct),
|
||||
If(Box<IfGenerateConstruct>),
|
||||
Case(Box<CaseGenerateConstruct>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -88,8 +88,8 @@ pub struct CaseGenerateConstruct {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum CaseGenerateItem {
|
||||
Nondefault(CaseGenerateItemNondefault),
|
||||
Default(CaseGenerateItemDefault),
|
||||
Nondefault(Box<CaseGenerateItemNondefault>),
|
||||
Default(Box<CaseGenerateItemDefault>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -104,8 +104,8 @@ pub struct CaseGenerateItemDefault {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum GenerateBlock {
|
||||
GenerateItem(GenerateItem),
|
||||
Multiple(GenerateBlockMultiple),
|
||||
GenerateItem(Box<GenerateItem>),
|
||||
Multiple(Box<GenerateBlockMultiple>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -122,9 +122,9 @@ pub struct GenerateBlockMultiple {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum GenerateItem {
|
||||
ModuleOrGenerateItem(ModuleOrGenerateItem),
|
||||
InterfaceOrGenerateItem(InterfaceOrGenerateItem),
|
||||
CheckerOrGenerateItem(CheckerOrGenerateItem),
|
||||
ModuleOrGenerateItem(Box<ModuleOrGenerateItem>),
|
||||
InterfaceOrGenerateItem(Box<InterfaceOrGenerateItem>),
|
||||
CheckerOrGenerateItem(Box<CheckerOrGenerateItem>),
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -181,7 +181,7 @@ pub fn genvar_iteration_assignment(s: Span) -> IResult<Span, GenvarIteration> {
|
||||
let (s, c) = genvar_expression(s)?;
|
||||
Ok((
|
||||
s,
|
||||
GenvarIteration::Assignment(GenvarIterationAssignment { nodes: (a, b, c) }),
|
||||
GenvarIteration::Assignment(Box::new(GenvarIterationAssignment { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ pub fn genvar_iteration_prefix(s: Span) -> IResult<Span, GenvarIteration> {
|
||||
let (s, b) = genvar_identifier(s)?;
|
||||
Ok((
|
||||
s,
|
||||
GenvarIteration::Prefix(GenvarIterationPrefix { nodes: (a, b) }),
|
||||
GenvarIteration::Prefix(Box::new(GenvarIterationPrefix { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -201,7 +201,7 @@ pub fn genvar_iteration_suffix(s: Span) -> IResult<Span, GenvarIteration> {
|
||||
let (s, b) = inc_or_dec_operator(s)?;
|
||||
Ok((
|
||||
s,
|
||||
GenvarIteration::Suffix(GenvarIterationSuffix { nodes: (a, b) }),
|
||||
GenvarIteration::Suffix(Box::new(GenvarIterationSuffix { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -209,10 +209,10 @@ pub fn genvar_iteration_suffix(s: Span) -> IResult<Span, GenvarIteration> {
|
||||
pub fn conditional_generate_construct(s: Span) -> IResult<Span, ConditionalGenerateConstruct> {
|
||||
alt((
|
||||
map(if_generate_construct, |x| {
|
||||
ConditionalGenerateConstruct::If(x)
|
||||
ConditionalGenerateConstruct::If(Box::new(x))
|
||||
}),
|
||||
map(case_generate_construct, |x| {
|
||||
ConditionalGenerateConstruct::Case(x)
|
||||
ConditionalGenerateConstruct::Case(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -257,7 +257,7 @@ pub fn case_generate_item_nondefault(s: Span) -> IResult<Span, CaseGenerateItem>
|
||||
let (s, c) = generate_block(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CaseGenerateItem::Nondefault(CaseGenerateItemNondefault { nodes: (a, b, c) }),
|
||||
CaseGenerateItem::Nondefault(Box::new(CaseGenerateItemNondefault { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -268,14 +268,14 @@ pub fn case_generate_item_default(s: Span) -> IResult<Span, CaseGenerateItem> {
|
||||
let (s, c) = generate_block(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CaseGenerateItem::Default(CaseGenerateItemDefault { nodes: (a, b, c) }),
|
||||
CaseGenerateItem::Default(Box::new(CaseGenerateItemDefault { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn generate_block(s: Span) -> IResult<Span, GenerateBlock> {
|
||||
alt((
|
||||
map(generate_item, |x| GenerateBlock::GenerateItem(x)),
|
||||
map(generate_item, |x| GenerateBlock::GenerateItem(Box::new(x))),
|
||||
generate_block_multiple,
|
||||
))(s)
|
||||
}
|
||||
@ -290,9 +290,9 @@ pub fn generate_block_multiple(s: Span) -> IResult<Span, GenerateBlock> {
|
||||
let (s, f) = opt(pair(symbol(":"), generate_block_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
GenerateBlock::Multiple(GenerateBlockMultiple {
|
||||
GenerateBlock::Multiple(Box::new(GenerateBlockMultiple {
|
||||
nodes: (a, b, c, d, e, f),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -300,13 +300,13 @@ pub fn generate_block_multiple(s: Span) -> IResult<Span, GenerateBlock> {
|
||||
pub fn generate_item(s: Span) -> IResult<Span, GenerateItem> {
|
||||
alt((
|
||||
map(module_or_generate_item, |x| {
|
||||
GenerateItem::ModuleOrGenerateItem(x)
|
||||
GenerateItem::ModuleOrGenerateItem(Box::new(x))
|
||||
}),
|
||||
map(interface_or_generate_item, |x| {
|
||||
GenerateItem::InterfaceOrGenerateItem(x)
|
||||
GenerateItem::InterfaceOrGenerateItem(Box::new(x))
|
||||
}),
|
||||
map(checker_or_generate_item, |x| {
|
||||
GenerateItem::CheckerOrGenerateItem(x)
|
||||
GenerateItem::CheckerOrGenerateItem(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
@ -24,8 +24,8 @@ pub struct ParameterValueAssignment {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ListOfParameterAssignments {
|
||||
Ordered(ListOfParameterAssignmentsOrdered),
|
||||
Named(ListOfParameterAssignmentsNamed),
|
||||
Ordered(Box<ListOfParameterAssignmentsOrdered>),
|
||||
Named(Box<ListOfParameterAssignmentsNamed>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -60,8 +60,8 @@ pub struct NameOfInstance {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ListOfPortConnections {
|
||||
Ordered(ListOfPortConnectionsOrdered),
|
||||
Named(ListOfPortConnectionsNamed),
|
||||
Ordered(Box<ListOfPortConnectionsOrdered>),
|
||||
Named(Box<ListOfPortConnectionsNamed>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -81,8 +81,8 @@ pub struct OrderedPortConnection {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum NamedPortConnection {
|
||||
Identifier(NamedPortConnectionIdentifier),
|
||||
Asterisk(NamedPortConnectionAsterisk),
|
||||
Identifier(Box<NamedPortConnectionIdentifier>),
|
||||
Asterisk(Box<NamedPortConnectionAsterisk>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -136,7 +136,9 @@ pub fn list_of_parameter_assignments_ordered(s: Span) -> IResult<Span, ListOfPar
|
||||
let (s, a) = list(symbol(","), ordered_parameter_assignment)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ListOfParameterAssignments::Ordered(ListOfParameterAssignmentsOrdered { nodes: (a,) }),
|
||||
ListOfParameterAssignments::Ordered(Box::new(ListOfParameterAssignmentsOrdered {
|
||||
nodes: (a,),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -145,7 +147,9 @@ pub fn list_of_parameter_assignments_named(s: Span) -> IResult<Span, ListOfParam
|
||||
let (s, a) = list(symbol(","), named_parameter_assignment)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ListOfParameterAssignments::Named(ListOfParameterAssignmentsNamed { nodes: (a,) }),
|
||||
ListOfParameterAssignments::Named(Box::new(ListOfParameterAssignmentsNamed {
|
||||
nodes: (a,),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -190,7 +194,7 @@ pub fn list_of_port_connections_ordered(s: Span) -> IResult<Span, ListOfPortConn
|
||||
let (s, a) = list(symbol(","), ordered_port_connection)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ListOfPortConnections::Ordered(ListOfPortConnectionsOrdered { nodes: (a,) }),
|
||||
ListOfPortConnections::Ordered(Box::new(ListOfPortConnectionsOrdered { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -199,7 +203,7 @@ pub fn list_of_port_connections_named(s: Span) -> IResult<Span, ListOfPortConnec
|
||||
let (s, a) = list(symbol(","), named_port_connection)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ListOfPortConnections::Named(ListOfPortConnectionsNamed { nodes: (a,) }),
|
||||
ListOfPortConnections::Named(Box::new(ListOfPortConnectionsNamed { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -226,9 +230,9 @@ pub fn named_port_connection_identifier(s: Span) -> IResult<Span, NamedPortConne
|
||||
let (s, d) = opt(paren(opt(expression)))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
NamedPortConnection::Identifier(NamedPortConnectionIdentifier {
|
||||
NamedPortConnection::Identifier(Box::new(NamedPortConnectionIdentifier {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -238,7 +242,7 @@ pub fn named_port_connection_asterisk(s: Span) -> IResult<Span, NamedPortConnect
|
||||
let (s, b) = symbol(".*")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
NamedPortConnection::Asterisk(NamedPortConnectionAsterisk { nodes: (a, b) }),
|
||||
NamedPortConnection::Asterisk(Box::new(NamedPortConnectionAsterisk { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -9,15 +9,15 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum GateInstantiation {
|
||||
Cmos(GateInstantiationCmos),
|
||||
Enable(GateInstantiationEnable),
|
||||
Mos(GateInstantiationMos),
|
||||
NInput(GateInstantiationNInput),
|
||||
NOutput(GateInstantiationNOutput),
|
||||
PassEn(GateInstantiationPassEn),
|
||||
Pass(GateInstantiationPass),
|
||||
Pulldown(GateInstantiationPulldown),
|
||||
Pullup(GateInstantiationPullup),
|
||||
Cmos(Box<GateInstantiationCmos>),
|
||||
Enable(Box<GateInstantiationEnable>),
|
||||
Mos(Box<GateInstantiationMos>),
|
||||
NInput(Box<GateInstantiationNInput>),
|
||||
NOutput(Box<GateInstantiationNOutput>),
|
||||
PassEn(Box<GateInstantiationPassEn>),
|
||||
Pass(Box<GateInstantiationPass>),
|
||||
Pulldown(Box<GateInstantiationPulldown>),
|
||||
Pullup(Box<GateInstantiationPullup>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -214,9 +214,9 @@ pub fn gate_instantiation_cmos(s: Span) -> IResult<Span, GateInstantiation> {
|
||||
let (s, d) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
GateInstantiation::Cmos(GateInstantiationCmos {
|
||||
GateInstantiation::Cmos(Box::new(GateInstantiationCmos {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -229,9 +229,9 @@ pub fn gate_instantiation_enable(s: Span) -> IResult<Span, GateInstantiation> {
|
||||
let (s, e) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
GateInstantiation::Enable(GateInstantiationEnable {
|
||||
GateInstantiation::Enable(Box::new(GateInstantiationEnable {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -243,9 +243,9 @@ pub fn gate_instantiation_mos(s: Span) -> IResult<Span, GateInstantiation> {
|
||||
let (s, d) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
GateInstantiation::Mos(GateInstantiationMos {
|
||||
GateInstantiation::Mos(Box::new(GateInstantiationMos {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -258,9 +258,9 @@ pub fn gate_instantiation_n_input(s: Span) -> IResult<Span, GateInstantiation> {
|
||||
let (s, e) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
GateInstantiation::NInput(GateInstantiationNInput {
|
||||
GateInstantiation::NInput(Box::new(GateInstantiationNInput {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -273,9 +273,9 @@ pub fn gate_instantiation_n_output(s: Span) -> IResult<Span, GateInstantiation>
|
||||
let (s, e) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
GateInstantiation::NOutput(GateInstantiationNOutput {
|
||||
GateInstantiation::NOutput(Box::new(GateInstantiationNOutput {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -287,9 +287,9 @@ pub fn gate_instantiation_pass_en(s: Span) -> IResult<Span, GateInstantiation> {
|
||||
let (s, d) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
GateInstantiation::PassEn(GateInstantiationPassEn {
|
||||
GateInstantiation::PassEn(Box::new(GateInstantiationPassEn {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -300,7 +300,7 @@ pub fn gate_instantiation_pass(s: Span) -> IResult<Span, GateInstantiation> {
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
GateInstantiation::Pass(GateInstantiationPass { nodes: (a, b, c) }),
|
||||
GateInstantiation::Pass(Box::new(GateInstantiationPass { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -312,9 +312,9 @@ pub fn gate_instantiation_pulldown(s: Span) -> IResult<Span, GateInstantiation>
|
||||
let (s, d) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
GateInstantiation::Pulldown(GateInstantiationPulldown {
|
||||
GateInstantiation::Pulldown(Box::new(GateInstantiationPulldown {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -326,9 +326,9 @@ pub fn gate_instantiation_pullup(s: Span) -> IResult<Span, GateInstantiation> {
|
||||
let (s, d) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
GateInstantiation::Pullup(GateInstantiationPullup {
|
||||
GateInstantiation::Pullup(Box::new(GateInstantiationPullup {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -7,9 +7,9 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PulldownStrength {
|
||||
Strength01(PulldownStrength01),
|
||||
Strength10(PulldownStrength10),
|
||||
Strength0(PulldownStrength0),
|
||||
Strength01(Box<PulldownStrength01>),
|
||||
Strength10(Box<PulldownStrength10>),
|
||||
Strength0(Box<PulldownStrength0>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -29,9 +29,9 @@ pub struct PulldownStrength0 {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PullupStrength {
|
||||
Strength01(PullupStrength01),
|
||||
Strength10(PullupStrength10),
|
||||
Strength1(PullupStrength1),
|
||||
Strength01(Box<PullupStrength01>),
|
||||
Strength10(Box<PullupStrength10>),
|
||||
Strength1(Box<PullupStrength1>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -61,7 +61,7 @@ pub fn pulldown_strength01(s: Span) -> IResult<Span, PulldownStrength> {
|
||||
let (s, a) = paren(triple(strength0, symbol(","), strength1))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PulldownStrength::Strength01(PulldownStrength01 { nodes: (a,) }),
|
||||
PulldownStrength::Strength01(Box::new(PulldownStrength01 { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ pub fn pulldown_strength10(s: Span) -> IResult<Span, PulldownStrength> {
|
||||
let (s, a) = paren(triple(strength1, symbol(","), strength0))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PulldownStrength::Strength10(PulldownStrength10 { nodes: (a,) }),
|
||||
PulldownStrength::Strength10(Box::new(PulldownStrength10 { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ pub fn pulldown_strength0(s: Span) -> IResult<Span, PulldownStrength> {
|
||||
let (s, a) = paren(strength0)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PulldownStrength::Strength0(PulldownStrength0 { nodes: (a,) }),
|
||||
PulldownStrength::Strength0(Box::new(PulldownStrength0 { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ pub fn pullup_strength01(s: Span) -> IResult<Span, PullupStrength> {
|
||||
let (s, a) = paren(triple(strength0, symbol(","), strength1))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PullupStrength::Strength01(PullupStrength01 { nodes: (a,) }),
|
||||
PullupStrength::Strength01(Box::new(PullupStrength01 { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ pub fn pullup_strength10(s: Span) -> IResult<Span, PullupStrength> {
|
||||
let (s, a) = paren(triple(strength1, symbol(","), strength0))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PullupStrength::Strength10(PullupStrength10 { nodes: (a,) }),
|
||||
PullupStrength::Strength10(Box::new(PullupStrength10 { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ pub fn pullup_strength1(s: Span) -> IResult<Span, PullupStrength> {
|
||||
let (s, a) = paren(strength1)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PullupStrength::Strength1(PullupStrength1 { nodes: (a,) }),
|
||||
PullupStrength::Strength1(Box::new(PullupStrength1 { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -27,33 +27,33 @@ pub struct CheckerPortItem {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum CheckerPortDirection {
|
||||
Input(Keyword),
|
||||
Output(Keyword),
|
||||
Input(Box<Keyword>),
|
||||
Output(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum CheckerOrGenerateItem {
|
||||
CheckerOrGenerateItemDeclaration(CheckerOrGenerateItemDeclaration),
|
||||
InitialConstruct(InitialConstruct),
|
||||
AlwaysConstruct(AlwaysConstruct),
|
||||
FinalConstruct(FinalConstruct),
|
||||
AssertionItem(AssertionItem),
|
||||
ContinuousAssign(ContinuousAssign),
|
||||
CheckerGenerateItem(CheckerGenerateItem),
|
||||
CheckerOrGenerateItemDeclaration(Box<CheckerOrGenerateItemDeclaration>),
|
||||
InitialConstruct(Box<InitialConstruct>),
|
||||
AlwaysConstruct(Box<AlwaysConstruct>),
|
||||
FinalConstruct(Box<FinalConstruct>),
|
||||
AssertionItem(Box<AssertionItem>),
|
||||
ContinuousAssign(Box<ContinuousAssign>),
|
||||
CheckerGenerateItem(Box<CheckerGenerateItem>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum CheckerOrGenerateItemDeclaration {
|
||||
Data(CheckerOrGenerateItemDeclarationData),
|
||||
FunctionDeclaration(FunctionDeclaration),
|
||||
CheckerDeclaration(CheckerDeclaration),
|
||||
AssertionItemDeclaration(AssertionItemDeclaration),
|
||||
CovergroupDeclaration(CovergroupDeclaration),
|
||||
GenvarDeclaration(GenvarDeclaration),
|
||||
ClockingDeclaration(ClockingDeclaration),
|
||||
Clocking(CheckerOrGenerateItemDeclarationClocking),
|
||||
Disable(CheckerOrGenerateItemDeclarationDisable),
|
||||
Empty(Symbol),
|
||||
Data(Box<CheckerOrGenerateItemDeclarationData>),
|
||||
FunctionDeclaration(Box<FunctionDeclaration>),
|
||||
CheckerDeclaration(Box<CheckerDeclaration>),
|
||||
AssertionItemDeclaration(Box<AssertionItemDeclaration>),
|
||||
CovergroupDeclaration(Box<CovergroupDeclaration>),
|
||||
GenvarDeclaration(Box<GenvarDeclaration>),
|
||||
ClockingDeclaration(Box<ClockingDeclaration>),
|
||||
Clocking(Box<CheckerOrGenerateItemDeclarationClocking>),
|
||||
Disable(Box<CheckerOrGenerateItemDeclarationDisable>),
|
||||
Empty(Box<Symbol>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -80,8 +80,8 @@ pub struct CheckerOrGenerateItemDeclarationDisable {
|
||||
pub enum CheckerGenerateItem {
|
||||
LoopGenerateConstruct(Box<LoopGenerateConstruct>),
|
||||
ConditionalGenerateConstruct(Box<ConditionalGenerateConstruct>),
|
||||
GenerateRegion(GenerateRegion),
|
||||
ElaborationSystemTask(ElaborationSystemTask),
|
||||
GenerateRegion(Box<GenerateRegion>),
|
||||
ElaborationSystemTask(Box<ElaborationSystemTask>),
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -111,8 +111,12 @@ pub fn checker_port_item(s: Span) -> IResult<Span, CheckerPortItem> {
|
||||
#[parser]
|
||||
pub fn checker_port_direction(s: Span) -> IResult<Span, CheckerPortDirection> {
|
||||
alt((
|
||||
map(keyword("input"), |x| CheckerPortDirection::Input(x)),
|
||||
map(keyword("output"), |x| CheckerPortDirection::Output(x)),
|
||||
map(keyword("input"), |x| {
|
||||
CheckerPortDirection::Input(Box::new(x))
|
||||
}),
|
||||
map(keyword("output"), |x| {
|
||||
CheckerPortDirection::Output(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -120,23 +124,25 @@ pub fn checker_port_direction(s: Span) -> IResult<Span, CheckerPortDirection> {
|
||||
pub fn checker_or_generate_item(s: Span) -> IResult<Span, CheckerOrGenerateItem> {
|
||||
alt((
|
||||
map(checker_or_generate_item_declaration, |x| {
|
||||
CheckerOrGenerateItem::CheckerOrGenerateItemDeclaration(x)
|
||||
CheckerOrGenerateItem::CheckerOrGenerateItemDeclaration(Box::new(x))
|
||||
}),
|
||||
map(initial_construct, |x| {
|
||||
CheckerOrGenerateItem::InitialConstruct(x)
|
||||
CheckerOrGenerateItem::InitialConstruct(Box::new(x))
|
||||
}),
|
||||
map(always_construct, |x| {
|
||||
CheckerOrGenerateItem::AlwaysConstruct(x)
|
||||
CheckerOrGenerateItem::AlwaysConstruct(Box::new(x))
|
||||
}),
|
||||
map(final_construct, |x| {
|
||||
CheckerOrGenerateItem::FinalConstruct(x)
|
||||
CheckerOrGenerateItem::FinalConstruct(Box::new(x))
|
||||
}),
|
||||
map(assertion_item, |x| {
|
||||
CheckerOrGenerateItem::AssertionItem(Box::new(x))
|
||||
}),
|
||||
map(assertion_item, |x| CheckerOrGenerateItem::AssertionItem(x)),
|
||||
map(continuous_assign, |x| {
|
||||
CheckerOrGenerateItem::ContinuousAssign(x)
|
||||
CheckerOrGenerateItem::ContinuousAssign(Box::new(x))
|
||||
}),
|
||||
map(checker_generate_item, |x| {
|
||||
CheckerOrGenerateItem::CheckerGenerateItem(x)
|
||||
CheckerOrGenerateItem::CheckerGenerateItem(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -148,26 +154,28 @@ pub fn checker_or_generate_item_declaration(
|
||||
alt((
|
||||
checker_or_generate_item_declaration_data,
|
||||
map(function_declaration, |x| {
|
||||
CheckerOrGenerateItemDeclaration::FunctionDeclaration(x)
|
||||
CheckerOrGenerateItemDeclaration::FunctionDeclaration(Box::new(x))
|
||||
}),
|
||||
map(checker_declaration, |x| {
|
||||
CheckerOrGenerateItemDeclaration::CheckerDeclaration(x)
|
||||
CheckerOrGenerateItemDeclaration::CheckerDeclaration(Box::new(x))
|
||||
}),
|
||||
map(assertion_item_declaration, |x| {
|
||||
CheckerOrGenerateItemDeclaration::AssertionItemDeclaration(x)
|
||||
CheckerOrGenerateItemDeclaration::AssertionItemDeclaration(Box::new(x))
|
||||
}),
|
||||
map(covergroup_declaration, |x| {
|
||||
CheckerOrGenerateItemDeclaration::CovergroupDeclaration(x)
|
||||
CheckerOrGenerateItemDeclaration::CovergroupDeclaration(Box::new(x))
|
||||
}),
|
||||
map(genvar_declaration, |x| {
|
||||
CheckerOrGenerateItemDeclaration::GenvarDeclaration(x)
|
||||
CheckerOrGenerateItemDeclaration::GenvarDeclaration(Box::new(x))
|
||||
}),
|
||||
map(clocking_declaration, |x| {
|
||||
CheckerOrGenerateItemDeclaration::ClockingDeclaration(x)
|
||||
CheckerOrGenerateItemDeclaration::ClockingDeclaration(Box::new(x))
|
||||
}),
|
||||
checker_or_generate_item_declaration_clocking,
|
||||
checker_or_generate_item_declaration_disable,
|
||||
map(symbol(";"), |x| CheckerOrGenerateItemDeclaration::Empty(x)),
|
||||
map(symbol(";"), |x| {
|
||||
CheckerOrGenerateItemDeclaration::Empty(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -179,9 +187,9 @@ pub fn checker_or_generate_item_declaration_data(
|
||||
let (s, b) = data_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CheckerOrGenerateItemDeclaration::Data(CheckerOrGenerateItemDeclarationData {
|
||||
CheckerOrGenerateItemDeclaration::Data(Box::new(CheckerOrGenerateItemDeclarationData {
|
||||
nodes: (a, b),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -201,9 +209,11 @@ pub fn checker_or_generate_item_declaration_clocking(
|
||||
let (s, d) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CheckerOrGenerateItemDeclaration::Clocking(CheckerOrGenerateItemDeclarationClocking {
|
||||
CheckerOrGenerateItemDeclaration::Clocking(Box::new(
|
||||
CheckerOrGenerateItemDeclarationClocking {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
},
|
||||
)),
|
||||
))
|
||||
}
|
||||
|
||||
@ -218,9 +228,11 @@ pub fn checker_or_generate_item_declaration_disable(
|
||||
let (s, e) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
CheckerOrGenerateItemDeclaration::Disable(CheckerOrGenerateItemDeclarationDisable {
|
||||
CheckerOrGenerateItemDeclaration::Disable(Box::new(
|
||||
CheckerOrGenerateItemDeclarationDisable {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
},
|
||||
)),
|
||||
))
|
||||
}
|
||||
|
||||
@ -233,9 +245,11 @@ pub fn checker_generate_item(s: Span) -> IResult<Span, CheckerGenerateItem> {
|
||||
map(conditional_generate_construct, |x| {
|
||||
CheckerGenerateItem::ConditionalGenerateConstruct(Box::new(x))
|
||||
}),
|
||||
map(generate_region, |x| CheckerGenerateItem::GenerateRegion(x)),
|
||||
map(generate_region, |x| {
|
||||
CheckerGenerateItem::GenerateRegion(Box::new(x))
|
||||
}),
|
||||
map(elaboration_system_task, |x| {
|
||||
CheckerGenerateItem::ElaborationSystemTask(x)
|
||||
CheckerGenerateItem::ElaborationSystemTask(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
@ -10,14 +10,14 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ClassItem {
|
||||
Property(ClassItemProperty),
|
||||
Method(ClassItemMethod),
|
||||
Constraint(ClassItemConstraint),
|
||||
Declaration(ClassItemDeclaration),
|
||||
Covergroup(ClassItemCovergroup),
|
||||
LocalParameterDeclaration((LocalParameterDeclaration, Symbol)),
|
||||
ParameterDeclaration((ParameterDeclaration, Symbol)),
|
||||
Empty(Symbol),
|
||||
Property(Box<ClassItemProperty>),
|
||||
Method(Box<ClassItemMethod>),
|
||||
Constraint(Box<ClassItemConstraint>),
|
||||
Declaration(Box<ClassItemDeclaration>),
|
||||
Covergroup(Box<ClassItemCovergroup>),
|
||||
LocalParameterDeclaration(Box<(LocalParameterDeclaration, Symbol)>),
|
||||
ParameterDeclaration(Box<(ParameterDeclaration, Symbol)>),
|
||||
Empty(Box<Symbol>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -47,8 +47,8 @@ pub struct ClassItemCovergroup {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ClassProperty {
|
||||
NonConst(ClassPropertyNonConst),
|
||||
Const(ClassPropertyConst),
|
||||
NonConst(Box<ClassPropertyNonConst>),
|
||||
Const(Box<ClassPropertyConst>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -70,12 +70,12 @@ pub struct ClassPropertyConst {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ClassMethod {
|
||||
Task(ClassMethodTask),
|
||||
Function(ClassMethodFunction),
|
||||
PureVirtual(ClassMethodPureVirtual),
|
||||
ExternMethod(ClassMethodExternMethod),
|
||||
Constructor(ClassMethodConstructor),
|
||||
ExternConstructor(ClassMethodExternConstructor),
|
||||
Task(Box<ClassMethodTask>),
|
||||
Function(Box<ClassMethodFunction>),
|
||||
PureVirtual(Box<ClassMethodPureVirtual>),
|
||||
ExternMethod(Box<ClassMethodExternMethod>),
|
||||
Constructor(Box<ClassMethodConstructor>),
|
||||
ExternConstructor(Box<ClassMethodExternConstructor>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -121,40 +121,40 @@ pub struct ClassConstructorPrototype {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ClassConstraint {
|
||||
ConstraintPrototype(ConstraintPrototype),
|
||||
ConstraintDeclaration(ConstraintDeclaration),
|
||||
ConstraintPrototype(Box<ConstraintPrototype>),
|
||||
ConstraintDeclaration(Box<ConstraintDeclaration>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ClassItemQualifier {
|
||||
Static(Keyword),
|
||||
Protected(Keyword),
|
||||
Local(Keyword),
|
||||
Static(Box<Keyword>),
|
||||
Protected(Box<Keyword>),
|
||||
Local(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PropertyQualifier {
|
||||
RandomQualifier(RandomQualifier),
|
||||
ClassItemQualifier(ClassItemQualifier),
|
||||
RandomQualifier(Box<RandomQualifier>),
|
||||
ClassItemQualifier(Box<ClassItemQualifier>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum RandomQualifier {
|
||||
Rand(Keyword),
|
||||
Randc(Keyword),
|
||||
Rand(Box<Keyword>),
|
||||
Randc(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum MethodQualifier {
|
||||
Virtual(Keyword),
|
||||
PureVirtual((Keyword, Keyword)),
|
||||
ClassItemQualifier(ClassItemQualifier),
|
||||
Virtual(Box<Keyword>),
|
||||
PureVirtual(Box<(Keyword, Keyword)>),
|
||||
ClassItemQualifier(Box<ClassItemQualifier>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum MethodPrototype {
|
||||
TaskPrototype(TaskPrototype),
|
||||
FunctionPrototype(FunctionPrototype),
|
||||
TaskPrototype(Box<TaskPrototype>),
|
||||
FunctionPrototype(Box<FunctionPrototype>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -195,12 +195,12 @@ pub fn class_item(s: Span) -> IResult<Span, ClassItem> {
|
||||
class_item_declaration,
|
||||
class_item_covergroup,
|
||||
map(pair(local_parameter_declaration, symbol(";")), |x| {
|
||||
ClassItem::LocalParameterDeclaration(x)
|
||||
ClassItem::LocalParameterDeclaration(Box::new(x))
|
||||
}),
|
||||
map(pair(parameter_declaration, symbol(";")), |x| {
|
||||
ClassItem::ParameterDeclaration(x)
|
||||
ClassItem::ParameterDeclaration(Box::new(x))
|
||||
}),
|
||||
map(symbol(";"), |x| ClassItem::Empty(x)),
|
||||
map(symbol(";"), |x| ClassItem::Empty(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -208,14 +208,20 @@ pub fn class_item(s: Span) -> IResult<Span, ClassItem> {
|
||||
pub fn class_item_property(s: Span) -> IResult<Span, ClassItem> {
|
||||
let (s, a) = many0(attribute_instance)(s)?;
|
||||
let (s, b) = class_property(s)?;
|
||||
Ok((s, ClassItem::Property(ClassItemProperty { nodes: (a, b) })))
|
||||
Ok((
|
||||
s,
|
||||
ClassItem::Property(Box::new(ClassItemProperty { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn class_item_method(s: Span) -> IResult<Span, ClassItem> {
|
||||
let (s, a) = many0(attribute_instance)(s)?;
|
||||
let (s, b) = class_method(s)?;
|
||||
Ok((s, ClassItem::Method(ClassItemMethod { nodes: (a, b) })))
|
||||
Ok((
|
||||
s,
|
||||
ClassItem::Method(Box::new(ClassItemMethod { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
@ -224,7 +230,7 @@ pub fn class_item_constraint(s: Span) -> IResult<Span, ClassItem> {
|
||||
let (s, b) = class_constraint(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ClassItem::Constraint(ClassItemConstraint { nodes: (a, b) }),
|
||||
ClassItem::Constraint(Box::new(ClassItemConstraint { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -234,7 +240,7 @@ pub fn class_item_declaration(s: Span) -> IResult<Span, ClassItem> {
|
||||
let (s, b) = class_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ClassItem::Declaration(ClassItemDeclaration { nodes: (a, b) }),
|
||||
ClassItem::Declaration(Box::new(ClassItemDeclaration { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -244,7 +250,7 @@ pub fn class_item_covergroup(s: Span) -> IResult<Span, ClassItem> {
|
||||
let (s, b) = covergroup_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ClassItem::Covergroup(ClassItemCovergroup { nodes: (a, b) }),
|
||||
ClassItem::Covergroup(Box::new(ClassItemCovergroup { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -259,7 +265,7 @@ pub fn class_property_non_const(s: Span) -> IResult<Span, ClassProperty> {
|
||||
let (s, b) = data_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ClassProperty::NonConst(ClassPropertyNonConst { nodes: (a, b) }),
|
||||
ClassProperty::NonConst(Box::new(ClassPropertyNonConst { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -273,9 +279,9 @@ pub fn class_property_const(s: Span) -> IResult<Span, ClassProperty> {
|
||||
let (s, f) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ClassProperty::Const(ClassPropertyConst {
|
||||
ClassProperty::Const(Box::new(ClassPropertyConst {
|
||||
nodes: (a, b, c, d, e, f),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -295,7 +301,10 @@ pub fn class_method(s: Span) -> IResult<Span, ClassMethod> {
|
||||
pub fn class_method_task(s: Span) -> IResult<Span, ClassMethod> {
|
||||
let (s, a) = many0(method_qualifier)(s)?;
|
||||
let (s, b) = task_declaration(s)?;
|
||||
Ok((s, ClassMethod::Task(ClassMethodTask { nodes: (a, b) })))
|
||||
Ok((
|
||||
s,
|
||||
ClassMethod::Task(Box::new(ClassMethodTask { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
@ -304,7 +313,7 @@ pub fn class_method_function(s: Span) -> IResult<Span, ClassMethod> {
|
||||
let (s, b) = function_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ClassMethod::Function(ClassMethodFunction { nodes: (a, b) }),
|
||||
ClassMethod::Function(Box::new(ClassMethodFunction { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -317,9 +326,9 @@ pub fn class_method_pure_virtual(s: Span) -> IResult<Span, ClassMethod> {
|
||||
let (s, e) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ClassMethod::PureVirtual(ClassMethodPureVirtual {
|
||||
ClassMethod::PureVirtual(Box::new(ClassMethodPureVirtual {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -331,9 +340,9 @@ pub fn class_method_extern_method(s: Span) -> IResult<Span, ClassMethod> {
|
||||
let (s, d) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ClassMethod::ExternMethod(ClassMethodExternMethod {
|
||||
ClassMethod::ExternMethod(Box::new(ClassMethodExternMethod {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -343,7 +352,7 @@ pub fn class_method_constructor(s: Span) -> IResult<Span, ClassMethod> {
|
||||
let (s, b) = class_constructor_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ClassMethod::Constructor(ClassMethodConstructor { nodes: (a, b) }),
|
||||
ClassMethod::Constructor(Box::new(ClassMethodConstructor { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -354,7 +363,7 @@ pub fn class_method_extern_constructor(s: Span) -> IResult<Span, ClassMethod> {
|
||||
let (s, c) = class_constructor_prototype(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ClassMethod::ExternConstructor(ClassMethodExternConstructor { nodes: (a, b, c) }),
|
||||
ClassMethod::ExternConstructor(Box::new(ClassMethodExternConstructor { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -376,10 +385,10 @@ pub fn class_constructor_prototype(s: Span) -> IResult<Span, ClassConstructorPro
|
||||
pub fn class_constraint(s: Span) -> IResult<Span, ClassConstraint> {
|
||||
alt((
|
||||
map(constraint_prototype, |x| {
|
||||
ClassConstraint::ConstraintPrototype(x)
|
||||
ClassConstraint::ConstraintPrototype(Box::new(x))
|
||||
}),
|
||||
map(constraint_declaration, |x| {
|
||||
ClassConstraint::ConstraintDeclaration(x)
|
||||
ClassConstraint::ConstraintDeclaration(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -387,18 +396,24 @@ pub fn class_constraint(s: Span) -> IResult<Span, ClassConstraint> {
|
||||
#[parser]
|
||||
pub fn class_item_qualifier(s: Span) -> IResult<Span, ClassItemQualifier> {
|
||||
alt((
|
||||
map(keyword("static"), |x| ClassItemQualifier::Static(x)),
|
||||
map(keyword("protected"), |x| ClassItemQualifier::Protected(x)),
|
||||
map(keyword("local"), |x| ClassItemQualifier::Local(x)),
|
||||
map(keyword("static"), |x| {
|
||||
ClassItemQualifier::Static(Box::new(x))
|
||||
}),
|
||||
map(keyword("protected"), |x| {
|
||||
ClassItemQualifier::Protected(Box::new(x))
|
||||
}),
|
||||
map(keyword("local"), |x| ClassItemQualifier::Local(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn property_qualifier(s: Span) -> IResult<Span, PropertyQualifier> {
|
||||
alt((
|
||||
map(random_qualifier, |x| PropertyQualifier::RandomQualifier(x)),
|
||||
map(random_qualifier, |x| {
|
||||
PropertyQualifier::RandomQualifier(Box::new(x))
|
||||
}),
|
||||
map(class_item_qualifier, |x| {
|
||||
PropertyQualifier::ClassItemQualifier(x)
|
||||
PropertyQualifier::ClassItemQualifier(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -406,8 +421,8 @@ pub fn property_qualifier(s: Span) -> IResult<Span, PropertyQualifier> {
|
||||
#[parser]
|
||||
pub fn random_qualifier(s: Span) -> IResult<Span, RandomQualifier> {
|
||||
alt((
|
||||
map(keyword("randc"), |x| RandomQualifier::Randc(x)),
|
||||
map(keyword("rand"), |x| RandomQualifier::Rand(x)),
|
||||
map(keyword("randc"), |x| RandomQualifier::Randc(Box::new(x))),
|
||||
map(keyword("rand"), |x| RandomQualifier::Rand(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -415,11 +430,13 @@ pub fn random_qualifier(s: Span) -> IResult<Span, RandomQualifier> {
|
||||
pub fn method_qualifier(s: Span) -> IResult<Span, MethodQualifier> {
|
||||
alt((
|
||||
map(pair(keyword("pure"), keyword("virtual")), |x| {
|
||||
MethodQualifier::PureVirtual(x)
|
||||
MethodQualifier::PureVirtual(Box::new(x))
|
||||
}),
|
||||
map(keyword("virtual"), |x| {
|
||||
MethodQualifier::Virtual(Box::new(x))
|
||||
}),
|
||||
map(keyword("virtual"), |x| MethodQualifier::Virtual(x)),
|
||||
map(class_item_qualifier, |x| {
|
||||
MethodQualifier::ClassItemQualifier(x)
|
||||
MethodQualifier::ClassItemQualifier(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -427,9 +444,11 @@ pub fn method_qualifier(s: Span) -> IResult<Span, MethodQualifier> {
|
||||
#[parser]
|
||||
pub fn method_prototype(s: Span) -> IResult<Span, MethodPrototype> {
|
||||
alt((
|
||||
map(task_prototype, |x| MethodPrototype::TaskPrototype(x)),
|
||||
map(task_prototype, |x| {
|
||||
MethodPrototype::TaskPrototype(Box::new(x))
|
||||
}),
|
||||
map(function_prototype, |x| {
|
||||
MethodPrototype::FunctionPrototype(x)
|
||||
MethodPrototype::FunctionPrototype(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
@ -33,11 +33,11 @@ pub struct DesignStatement {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ConfigRuleStatement {
|
||||
Default(ConfigRuleStatementDefault),
|
||||
InstLib(ConfigRuleStatementInstLib),
|
||||
InstUse(ConfigRuleStatementInstUse),
|
||||
CellLib(ConfigRuleStatementCellLib),
|
||||
CellUse(ConfigRuleStatementCellUse),
|
||||
Default(Box<ConfigRuleStatementDefault>),
|
||||
InstLib(Box<ConfigRuleStatementInstLib>),
|
||||
InstUse(Box<ConfigRuleStatementInstUse>),
|
||||
CellLib(Box<ConfigRuleStatementCellLib>),
|
||||
CellUse(Box<ConfigRuleStatementCellUse>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -92,9 +92,9 @@ pub struct LiblistClause {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum UseClause {
|
||||
Cell(UseClauseCell),
|
||||
Named(UseClauseNamed),
|
||||
CellNamed(UseClauseCellNamed),
|
||||
Cell(Box<UseClauseCell>),
|
||||
Named(Box<UseClauseNamed>),
|
||||
CellNamed(Box<UseClauseCellNamed>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -181,7 +181,7 @@ pub fn config_rule_statement_default(s: Span) -> IResult<Span, ConfigRuleStateme
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConfigRuleStatement::Default(ConfigRuleStatementDefault { nodes: (a, b, c) }),
|
||||
ConfigRuleStatement::Default(Box::new(ConfigRuleStatementDefault { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ pub fn config_rule_statement_inst_lib(s: Span) -> IResult<Span, ConfigRuleStatem
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConfigRuleStatement::InstLib(ConfigRuleStatementInstLib { nodes: (a, b, c) }),
|
||||
ConfigRuleStatement::InstLib(Box::new(ConfigRuleStatementInstLib { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -203,7 +203,7 @@ pub fn config_rule_statement_inst_use(s: Span) -> IResult<Span, ConfigRuleStatem
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConfigRuleStatement::InstUse(ConfigRuleStatementInstUse { nodes: (a, b, c) }),
|
||||
ConfigRuleStatement::InstUse(Box::new(ConfigRuleStatementInstUse { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@ pub fn config_rule_statement_cell_lib(s: Span) -> IResult<Span, ConfigRuleStatem
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConfigRuleStatement::CellLib(ConfigRuleStatementCellLib { nodes: (a, b, c) }),
|
||||
ConfigRuleStatement::CellLib(Box::new(ConfigRuleStatementCellLib { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -225,7 +225,7 @@ pub fn config_rule_statement_cell_use(s: Span) -> IResult<Span, ConfigRuleStatem
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConfigRuleStatement::CellUse(ConfigRuleStatementCellUse { nodes: (a, b, c) }),
|
||||
ConfigRuleStatement::CellUse(Box::new(ConfigRuleStatementCellUse { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -277,9 +277,9 @@ pub fn use_clause_cell(s: Span) -> IResult<Span, UseClause> {
|
||||
let (s, d) = opt(pair(symbol(":"), config))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
UseClause::Cell(UseClauseCell {
|
||||
UseClause::Cell(Box::new(UseClauseCell {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -288,7 +288,10 @@ pub fn use_clause_named(s: Span) -> IResult<Span, UseClause> {
|
||||
let (s, a) = keyword("use")(s)?;
|
||||
let (s, b) = list(symbol(","), named_parameter_assignment)(s)?;
|
||||
let (s, c) = opt(pair(symbol(":"), config))(s)?;
|
||||
Ok((s, UseClause::Named(UseClauseNamed { nodes: (a, b, c) })))
|
||||
Ok((
|
||||
s,
|
||||
UseClause::Named(Box::new(UseClauseNamed { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
@ -300,9 +303,9 @@ pub fn use_clause_cell_named(s: Span) -> IResult<Span, UseClause> {
|
||||
let (s, e) = opt(pair(symbol(":"), config))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
UseClause::CellNamed(UseClauseCellNamed {
|
||||
UseClause::CellNamed(Box::new(UseClauseCellNamed {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,8 @@ pub struct ConstraintBlock {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ConstraintBlockItem {
|
||||
Solve(ConstraintBlockItemSolve),
|
||||
ConstraintExpression(ConstraintExpression),
|
||||
Solve(Box<ConstraintBlockItemSolve>),
|
||||
ConstraintExpression(Box<ConstraintExpression>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -55,12 +55,12 @@ pub struct ConstraintPrimary {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ConstraintExpression {
|
||||
Expression(ConstraintExpressionExpression),
|
||||
UniquenessConstraint((UniquenessConstraint, Symbol)),
|
||||
Arrow(ConstraintExpressionArrow),
|
||||
If(ConstraintExpressionIf),
|
||||
Foreach(ConstraintExpressionForeach),
|
||||
Disable(ConstraintExpressionDisable),
|
||||
Expression(Box<ConstraintExpressionExpression>),
|
||||
UniquenessConstraint(Box<(UniquenessConstraint, Symbol)>),
|
||||
Arrow(Box<ConstraintExpressionArrow>),
|
||||
If(Box<ConstraintExpressionIf>),
|
||||
Foreach(Box<ConstraintExpressionForeach>),
|
||||
Disable(Box<ConstraintExpressionDisable>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -110,7 +110,7 @@ pub struct UniquenessConstraint {
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ConstraintSet {
|
||||
ConstraintExpression(Box<ConstraintExpression>),
|
||||
Brace(ConstraintSetBrace),
|
||||
Brace(Box<ConstraintSetBrace>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -130,8 +130,8 @@ pub struct DistItem {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum DistWeight {
|
||||
Equal(DistWeightEqual),
|
||||
Divide(DistWeightDivide),
|
||||
Equal(Box<DistWeightEqual>),
|
||||
Divide(Box<DistWeightDivide>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -157,8 +157,8 @@ pub struct ConstraintPrototype {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ConstraintPrototypeQualifier {
|
||||
Extern(Keyword),
|
||||
Pure(Keyword),
|
||||
Extern(Box<Keyword>),
|
||||
Pure(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -210,7 +210,7 @@ pub fn constraint_block_item(s: Span) -> IResult<Span, ConstraintBlockItem> {
|
||||
alt((
|
||||
constraint_block_item_solve,
|
||||
map(constraint_expression, |x| {
|
||||
ConstraintBlockItem::ConstraintExpression(x)
|
||||
ConstraintBlockItem::ConstraintExpression(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -224,9 +224,9 @@ pub fn constraint_block_item_solve(s: Span) -> IResult<Span, ConstraintBlockItem
|
||||
let (s, e) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConstraintBlockItem::Solve(ConstraintBlockItemSolve {
|
||||
ConstraintBlockItem::Solve(Box::new(ConstraintBlockItemSolve {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -249,7 +249,7 @@ pub fn constraint_expression(s: Span) -> IResult<Span, ConstraintExpression> {
|
||||
alt((
|
||||
constraint_expression_expression,
|
||||
map(pair(uniqueness_constraint, symbol(";")), |x| {
|
||||
ConstraintExpression::UniquenessConstraint(x)
|
||||
ConstraintExpression::UniquenessConstraint(Box::new(x))
|
||||
}),
|
||||
constraint_expression_arrow,
|
||||
constraint_expression_if,
|
||||
@ -265,7 +265,9 @@ pub fn constraint_expression_expression(s: Span) -> IResult<Span, ConstraintExpr
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConstraintExpression::Expression(ConstraintExpressionExpression { nodes: (a, b, c) }),
|
||||
ConstraintExpression::Expression(Box::new(ConstraintExpressionExpression {
|
||||
nodes: (a, b, c),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -282,7 +284,7 @@ pub fn constraint_expression_arrow(s: Span) -> IResult<Span, ConstraintExpressio
|
||||
let (s, c) = constraint_set(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConstraintExpression::Arrow(ConstraintExpressionArrow { nodes: (a, b, c) }),
|
||||
ConstraintExpression::Arrow(Box::new(ConstraintExpressionArrow { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -294,9 +296,9 @@ pub fn constraint_expression_if(s: Span) -> IResult<Span, ConstraintExpression>
|
||||
let (s, d) = opt(pair(keyword("else"), constraint_set))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConstraintExpression::If(ConstraintExpressionIf {
|
||||
ConstraintExpression::If(Box::new(ConstraintExpressionIf {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -310,7 +312,7 @@ pub fn constraint_expression_foreach(s: Span) -> IResult<Span, ConstraintExpress
|
||||
let (s, c) = constraint_set(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConstraintExpression::Foreach(ConstraintExpressionForeach { nodes: (a, b, c) }),
|
||||
ConstraintExpression::Foreach(Box::new(ConstraintExpressionForeach { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -322,9 +324,9 @@ pub fn constraint_expression_disable(s: Span) -> IResult<Span, ConstraintExpress
|
||||
let (s, d) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ConstraintExpression::Disable(ConstraintExpressionDisable {
|
||||
ConstraintExpression::Disable(Box::new(ConstraintExpressionDisable {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -348,7 +350,10 @@ pub fn constraint_set(s: Span) -> IResult<Span, ConstraintSet> {
|
||||
#[parser]
|
||||
pub fn constraint_set_brace(s: Span) -> IResult<Span, ConstraintSet> {
|
||||
let (s, a) = brace(many0(constraint_expression))(s)?;
|
||||
Ok((s, ConstraintSet::Brace(ConstraintSetBrace { nodes: (a,) })))
|
||||
Ok((
|
||||
s,
|
||||
ConstraintSet::Brace(Box::new(ConstraintSetBrace { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser(MaybeRecursive)]
|
||||
@ -373,14 +378,20 @@ pub fn dist_weight(s: Span) -> IResult<Span, DistWeight> {
|
||||
pub fn dist_weight_equal(s: Span) -> IResult<Span, DistWeight> {
|
||||
let (s, a) = symbol(":=")(s)?;
|
||||
let (s, b) = expression(s)?;
|
||||
Ok((s, DistWeight::Equal(DistWeightEqual { nodes: (a, b) })))
|
||||
Ok((
|
||||
s,
|
||||
DistWeight::Equal(Box::new(DistWeightEqual { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn dist_weight_divide(s: Span) -> IResult<Span, DistWeight> {
|
||||
let (s, a) = symbol(":/")(s)?;
|
||||
let (s, b) = expression(s)?;
|
||||
Ok((s, DistWeight::Divide(DistWeightDivide { nodes: (a, b) })))
|
||||
Ok((
|
||||
s,
|
||||
DistWeight::Divide(Box::new(DistWeightDivide { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
@ -402,9 +413,11 @@ pub fn constraint_prototype(s: Span) -> IResult<Span, ConstraintPrototype> {
|
||||
pub fn constraint_prototype_qualifier(s: Span) -> IResult<Span, ConstraintPrototypeQualifier> {
|
||||
alt((
|
||||
map(keyword("extern"), |x| {
|
||||
ConstraintPrototypeQualifier::Extern(x)
|
||||
ConstraintPrototypeQualifier::Extern(Box::new(x))
|
||||
}),
|
||||
map(keyword("pure"), |x| {
|
||||
ConstraintPrototypeQualifier::Pure(Box::new(x))
|
||||
}),
|
||||
map(keyword("pure"), |x| ConstraintPrototypeQualifier::Pure(x)),
|
||||
))(s)
|
||||
}
|
||||
|
||||
|
@ -10,8 +10,8 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum InterfaceOrGenerateItem {
|
||||
Module(InterfaceOrGenerateItemModule),
|
||||
Extern(InterfaceOrGenerateItemExtern),
|
||||
Module(Box<InterfaceOrGenerateItemModule>),
|
||||
Extern(Box<InterfaceOrGenerateItemExtern>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -26,8 +26,8 @@ pub struct InterfaceOrGenerateItemExtern {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ExternTfDeclaration {
|
||||
Method(ExternTfDeclarationMethod),
|
||||
Task(ExternTfDeclarationTask),
|
||||
Method(Box<ExternTfDeclarationMethod>),
|
||||
Task(Box<ExternTfDeclarationTask>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -42,18 +42,18 @@ pub struct ExternTfDeclarationTask {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum InterfaceItem {
|
||||
PortDeclaration((PortDeclaration, Symbol)),
|
||||
NonPortInterfaceItem(NonPortInterfaceItem),
|
||||
PortDeclaration(Box<(PortDeclaration, Symbol)>),
|
||||
NonPortInterfaceItem(Box<NonPortInterfaceItem>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum NonPortInterfaceItem {
|
||||
GenerateRegion(GenerateRegion),
|
||||
InterfaceOrGenerateItem(InterfaceOrGenerateItem),
|
||||
ProgramDeclaration(ProgramDeclaration),
|
||||
ModportDeclaration(ModportDeclaration),
|
||||
InterfaceDeclaration(InterfaceDeclaration),
|
||||
TimeunitsDeclaration(TimeunitsDeclaration),
|
||||
GenerateRegion(Box<GenerateRegion>),
|
||||
InterfaceOrGenerateItem(Box<InterfaceOrGenerateItem>),
|
||||
ProgramDeclaration(Box<ProgramDeclaration>),
|
||||
ModportDeclaration(Box<ModportDeclaration>),
|
||||
InterfaceDeclaration(Box<InterfaceDeclaration>),
|
||||
TimeunitsDeclaration(Box<TimeunitsDeclaration>),
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -72,7 +72,7 @@ pub fn interface_or_generate_item_module(s: Span) -> IResult<Span, InterfaceOrGe
|
||||
let (s, b) = module_common_item(s)?;
|
||||
Ok((
|
||||
s,
|
||||
InterfaceOrGenerateItem::Module(InterfaceOrGenerateItemModule { nodes: (a, b) }),
|
||||
InterfaceOrGenerateItem::Module(Box::new(InterfaceOrGenerateItemModule { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ pub fn interface_or_generate_item_extern(s: Span) -> IResult<Span, InterfaceOrGe
|
||||
let (s, b) = extern_tf_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
InterfaceOrGenerateItem::Extern(InterfaceOrGenerateItemExtern { nodes: (a, b) }),
|
||||
InterfaceOrGenerateItem::Extern(Box::new(InterfaceOrGenerateItemExtern { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ pub fn extern_tf_declaration_method(s: Span) -> IResult<Span, ExternTfDeclaratio
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ExternTfDeclaration::Method(ExternTfDeclarationMethod { nodes: (a, b, c) }),
|
||||
ExternTfDeclaration::Method(Box::new(ExternTfDeclarationMethod { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -110,9 +110,9 @@ pub fn extern_tf_declaration_task(s: Span) -> IResult<Span, ExternTfDeclaration>
|
||||
let (s, d) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ExternTfDeclaration::Task(ExternTfDeclarationTask {
|
||||
ExternTfDeclaration::Task(Box::new(ExternTfDeclarationTask {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -120,10 +120,10 @@ pub fn extern_tf_declaration_task(s: Span) -> IResult<Span, ExternTfDeclaration>
|
||||
pub fn interface_item(s: Span) -> IResult<Span, InterfaceItem> {
|
||||
alt((
|
||||
map(pair(port_declaration, symbol(";")), |x| {
|
||||
InterfaceItem::PortDeclaration(x)
|
||||
InterfaceItem::PortDeclaration(Box::new(x))
|
||||
}),
|
||||
map(non_port_interface_item, |x| {
|
||||
InterfaceItem::NonPortInterfaceItem(x)
|
||||
InterfaceItem::NonPortInterfaceItem(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -131,21 +131,23 @@ pub fn interface_item(s: Span) -> IResult<Span, InterfaceItem> {
|
||||
#[parser]
|
||||
pub fn non_port_interface_item(s: Span) -> IResult<Span, NonPortInterfaceItem> {
|
||||
alt((
|
||||
map(generate_region, |x| NonPortInterfaceItem::GenerateRegion(x)),
|
||||
map(generate_region, |x| {
|
||||
NonPortInterfaceItem::GenerateRegion(Box::new(x))
|
||||
}),
|
||||
map(interface_or_generate_item, |x| {
|
||||
NonPortInterfaceItem::InterfaceOrGenerateItem(x)
|
||||
NonPortInterfaceItem::InterfaceOrGenerateItem(Box::new(x))
|
||||
}),
|
||||
map(program_declaration, |x| {
|
||||
NonPortInterfaceItem::ProgramDeclaration(x)
|
||||
NonPortInterfaceItem::ProgramDeclaration(Box::new(x))
|
||||
}),
|
||||
map(modport_declaration, |x| {
|
||||
NonPortInterfaceItem::ModportDeclaration(x)
|
||||
NonPortInterfaceItem::ModportDeclaration(Box::new(x))
|
||||
}),
|
||||
map(interface_declaration, |x| {
|
||||
NonPortInterfaceItem::InterfaceDeclaration(x)
|
||||
NonPortInterfaceItem::InterfaceDeclaration(Box::new(x))
|
||||
}),
|
||||
map(timeunits_declaration, |x| {
|
||||
NonPortInterfaceItem::TimeunitsDeclaration(x)
|
||||
NonPortInterfaceItem::TimeunitsDeclaration(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
@ -15,10 +15,10 @@ pub struct LibraryText {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum LibraryDescription {
|
||||
LibraryDeclaration(LibraryDeclaration),
|
||||
IncludeStatement(IncludeStatement),
|
||||
ConfigDeclaration(ConfigDeclaration),
|
||||
Null(Symbol),
|
||||
LibraryDeclaration(Box<LibraryDeclaration>),
|
||||
IncludeStatement(Box<IncludeStatement>),
|
||||
ConfigDeclaration(Box<ConfigDeclaration>),
|
||||
Null(Box<Symbol>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -54,15 +54,15 @@ pub fn library_text(s: Span) -> IResult<Span, LibraryText> {
|
||||
pub fn library_description(s: Span) -> IResult<Span, LibraryDescription> {
|
||||
alt((
|
||||
map(library_declaration, |x| {
|
||||
LibraryDescription::LibraryDeclaration(x)
|
||||
LibraryDescription::LibraryDeclaration(Box::new(x))
|
||||
}),
|
||||
map(include_statement, |x| {
|
||||
LibraryDescription::IncludeStatement(x)
|
||||
LibraryDescription::IncludeStatement(Box::new(x))
|
||||
}),
|
||||
map(config_declaration, |x| {
|
||||
LibraryDescription::ConfigDeclaration(x)
|
||||
LibraryDescription::ConfigDeclaration(Box::new(x))
|
||||
}),
|
||||
map(symbol(";"), |x| LibraryDescription::Null(x)),
|
||||
map(symbol(";"), |x| LibraryDescription::Null(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
|
@ -10,10 +10,10 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ElaborationSystemTask {
|
||||
TaskFatal(ElaborationSystemTaskFatal),
|
||||
TaskError(ElaborationSystemTaskError),
|
||||
TaskWarning(ElaborationSystemTaskWarning),
|
||||
TaskInfo(ElaborationSystemTaskInfo),
|
||||
TaskFatal(Box<ElaborationSystemTaskFatal>),
|
||||
TaskError(Box<ElaborationSystemTaskError>),
|
||||
TaskWarning(Box<ElaborationSystemTaskWarning>),
|
||||
TaskInfo(Box<ElaborationSystemTaskInfo>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -42,40 +42,40 @@ pub struct ElaborationSystemTaskInfo {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum FinishNumber {
|
||||
Zero(Symbol),
|
||||
One(Symbol),
|
||||
Two(Symbol),
|
||||
Zero(Box<Symbol>),
|
||||
One(Box<Symbol>),
|
||||
Two(Box<Symbol>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ModuleCommonItem {
|
||||
ModuleOrGenerateItemDeclaration(ModuleOrGenerateItemDeclaration),
|
||||
InterfaceInstantiation(InterfaceInstantiation),
|
||||
ProgramInstantiation(ProgramInstantiation),
|
||||
AssertionItem(AssertionItem),
|
||||
BindDirective(BindDirective),
|
||||
ContinuousAssign(ContinuousAssign),
|
||||
NetAlias(NetAlias),
|
||||
InitialConstruct(InitialConstruct),
|
||||
FinalConstruct(FinalConstruct),
|
||||
AlwaysConstruct(AlwaysConstruct),
|
||||
ModuleOrGenerateItemDeclaration(Box<ModuleOrGenerateItemDeclaration>),
|
||||
InterfaceInstantiation(Box<InterfaceInstantiation>),
|
||||
ProgramInstantiation(Box<ProgramInstantiation>),
|
||||
AssertionItem(Box<AssertionItem>),
|
||||
BindDirective(Box<BindDirective>),
|
||||
ContinuousAssign(Box<ContinuousAssign>),
|
||||
NetAlias(Box<NetAlias>),
|
||||
InitialConstruct(Box<InitialConstruct>),
|
||||
FinalConstruct(Box<FinalConstruct>),
|
||||
AlwaysConstruct(Box<AlwaysConstruct>),
|
||||
LoopGenerateConstruct(Box<LoopGenerateConstruct>),
|
||||
ConditionalGenerateConstruct(Box<ConditionalGenerateConstruct>),
|
||||
ElaborationSystemTask(ElaborationSystemTask),
|
||||
ElaborationSystemTask(Box<ElaborationSystemTask>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ModuleItem {
|
||||
PortDeclaration((PortDeclaration, Symbol)),
|
||||
NonPortModuleItem(NonPortModuleItem),
|
||||
PortDeclaration(Box<(PortDeclaration, Symbol)>),
|
||||
NonPortModuleItem(Box<NonPortModuleItem>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ModuleOrGenerateItem {
|
||||
Parameter(ModuleOrGenerateItemParameter),
|
||||
Gate(ModuleOrGenerateItemGate),
|
||||
Udp(ModuleOrGenerateItemUdp),
|
||||
Module(ModuleOrGenerateItemModule),
|
||||
Parameter(Box<ModuleOrGenerateItemParameter>),
|
||||
Gate(Box<ModuleOrGenerateItemGate>),
|
||||
Udp(Box<ModuleOrGenerateItemUdp>),
|
||||
Module(Box<ModuleOrGenerateItemModule>),
|
||||
ModuleItem(Box<ModuleOrGenerateItemModuleItem>),
|
||||
}
|
||||
|
||||
@ -106,11 +106,11 @@ pub struct ModuleOrGenerateItemModuleItem {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ModuleOrGenerateItemDeclaration {
|
||||
PackageOrGenerateItemDeclaration(PackageOrGenerateItemDeclaration),
|
||||
GenvarDeclaration(GenvarDeclaration),
|
||||
ClockingDeclaration(ClockingDeclaration),
|
||||
Clocking(ModuleOrGenerateItemDeclarationClocking),
|
||||
Disable(ModuleOrGenerateItemDeclarationDisable),
|
||||
PackageOrGenerateItemDeclaration(Box<PackageOrGenerateItemDeclaration>),
|
||||
GenvarDeclaration(Box<GenvarDeclaration>),
|
||||
ClockingDeclaration(Box<ClockingDeclaration>),
|
||||
Clocking(Box<ModuleOrGenerateItemDeclarationClocking>),
|
||||
Disable(Box<ModuleOrGenerateItemDeclarationDisable>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -125,14 +125,14 @@ pub struct ModuleOrGenerateItemDeclarationDisable {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum NonPortModuleItem {
|
||||
GenerateRegion(GenerateRegion),
|
||||
ModuleOrGenerateItem(ModuleOrGenerateItem),
|
||||
SpecifyBlock(SpecifyBlock),
|
||||
Specparam(NonPortModuleItemSpecparam),
|
||||
ProgramDeclaration(ProgramDeclaration),
|
||||
ModuleDeclaration(ModuleDeclaration),
|
||||
InterfaceDeclaration(InterfaceDeclaration),
|
||||
TimeunitsDeclaration(TimeunitsDeclaration),
|
||||
GenerateRegion(Box<GenerateRegion>),
|
||||
ModuleOrGenerateItem(Box<ModuleOrGenerateItem>),
|
||||
SpecifyBlock(Box<SpecifyBlock>),
|
||||
Specparam(Box<NonPortModuleItemSpecparam>),
|
||||
ProgramDeclaration(Box<ProgramDeclaration>),
|
||||
ModuleDeclaration(Box<ModuleDeclaration>),
|
||||
InterfaceDeclaration(Box<InterfaceDeclaration>),
|
||||
TimeunitsDeclaration(Box<TimeunitsDeclaration>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -147,8 +147,8 @@ pub struct ParameterOverride {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum BindDirective {
|
||||
Scope(BindDirectiveScope),
|
||||
Instance(BindDirectiveInstance),
|
||||
Scope(Box<BindDirectiveScope>),
|
||||
Instance(Box<BindDirectiveInstance>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -169,8 +169,8 @@ pub struct BindDirectiveInstance {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum BindTargetScope {
|
||||
ModuleIdentifier(ModuleIdentifier),
|
||||
InterfaceIdentifier(InterfaceIdentifier),
|
||||
ModuleIdentifier(Box<ModuleIdentifier>),
|
||||
InterfaceIdentifier(Box<InterfaceIdentifier>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -185,10 +185,10 @@ pub struct BindTargetInstanceList {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum BindInstantiation {
|
||||
ProgramInstantiation(ProgramInstantiation),
|
||||
ModuleInstantiation(ModuleInstantiation),
|
||||
InterfaceInstantiation(InterfaceInstantiation),
|
||||
CheckerInstantiation(CheckerInstantiation),
|
||||
ProgramInstantiation(Box<ProgramInstantiation>),
|
||||
ModuleInstantiation(Box<ModuleInstantiation>),
|
||||
InterfaceInstantiation(Box<InterfaceInstantiation>),
|
||||
CheckerInstantiation(Box<CheckerInstantiation>),
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -213,7 +213,7 @@ pub fn elaboration_system_task_fatal(s: Span) -> IResult<Span, ElaborationSystem
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ElaborationSystemTask::TaskFatal(ElaborationSystemTaskFatal { nodes: (a, b, c) }),
|
||||
ElaborationSystemTask::TaskFatal(Box::new(ElaborationSystemTaskFatal { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -224,7 +224,7 @@ pub fn elaboration_system_task_error(s: Span) -> IResult<Span, ElaborationSystem
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ElaborationSystemTask::TaskError(ElaborationSystemTaskError { nodes: (a, b, c) }),
|
||||
ElaborationSystemTask::TaskError(Box::new(ElaborationSystemTaskError { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -235,7 +235,9 @@ pub fn elaboration_system_task_warning(s: Span) -> IResult<Span, ElaborationSyst
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ElaborationSystemTask::TaskWarning(ElaborationSystemTaskWarning { nodes: (a, b, c) }),
|
||||
ElaborationSystemTask::TaskWarning(Box::new(ElaborationSystemTaskWarning {
|
||||
nodes: (a, b, c),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -246,16 +248,16 @@ pub fn elaboration_system_task_info(s: Span) -> IResult<Span, ElaborationSystemT
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ElaborationSystemTask::TaskInfo(ElaborationSystemTaskInfo { nodes: (a, b, c) }),
|
||||
ElaborationSystemTask::TaskInfo(Box::new(ElaborationSystemTaskInfo { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn finish_number(s: Span) -> IResult<Span, FinishNumber> {
|
||||
alt((
|
||||
map(symbol("0"), |x| FinishNumber::Zero(x)),
|
||||
map(symbol("1"), |x| FinishNumber::One(x)),
|
||||
map(symbol("2"), |x| FinishNumber::Two(x)),
|
||||
map(symbol("0"), |x| FinishNumber::Zero(Box::new(x))),
|
||||
map(symbol("1"), |x| FinishNumber::One(Box::new(x))),
|
||||
map(symbol("2"), |x| FinishNumber::Two(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -263,21 +265,33 @@ pub fn finish_number(s: Span) -> IResult<Span, FinishNumber> {
|
||||
pub fn module_common_item(s: Span) -> IResult<Span, ModuleCommonItem> {
|
||||
alt((
|
||||
map(module_or_generate_item_declaration, |x| {
|
||||
ModuleCommonItem::ModuleOrGenerateItemDeclaration(x)
|
||||
ModuleCommonItem::ModuleOrGenerateItemDeclaration(Box::new(x))
|
||||
}),
|
||||
map(interface_instantiation, |x| {
|
||||
ModuleCommonItem::InterfaceInstantiation(x)
|
||||
ModuleCommonItem::InterfaceInstantiation(Box::new(x))
|
||||
}),
|
||||
map(program_instantiation, |x| {
|
||||
ModuleCommonItem::ProgramInstantiation(x)
|
||||
ModuleCommonItem::ProgramInstantiation(Box::new(x))
|
||||
}),
|
||||
map(assertion_item, |x| {
|
||||
ModuleCommonItem::AssertionItem(Box::new(x))
|
||||
}),
|
||||
map(bind_directive, |x| {
|
||||
ModuleCommonItem::BindDirective(Box::new(x))
|
||||
}),
|
||||
map(continuous_assign, |x| {
|
||||
ModuleCommonItem::ContinuousAssign(Box::new(x))
|
||||
}),
|
||||
map(net_alias, |x| ModuleCommonItem::NetAlias(Box::new(x))),
|
||||
map(initial_construct, |x| {
|
||||
ModuleCommonItem::InitialConstruct(Box::new(x))
|
||||
}),
|
||||
map(final_construct, |x| {
|
||||
ModuleCommonItem::FinalConstruct(Box::new(x))
|
||||
}),
|
||||
map(always_construct, |x| {
|
||||
ModuleCommonItem::AlwaysConstruct(Box::new(x))
|
||||
}),
|
||||
map(assertion_item, |x| ModuleCommonItem::AssertionItem(x)),
|
||||
map(bind_directive, |x| ModuleCommonItem::BindDirective(x)),
|
||||
map(continuous_assign, |x| ModuleCommonItem::ContinuousAssign(x)),
|
||||
map(net_alias, |x| ModuleCommonItem::NetAlias(x)),
|
||||
map(initial_construct, |x| ModuleCommonItem::InitialConstruct(x)),
|
||||
map(final_construct, |x| ModuleCommonItem::FinalConstruct(x)),
|
||||
map(always_construct, |x| ModuleCommonItem::AlwaysConstruct(x)),
|
||||
map(loop_generate_construct, |x| {
|
||||
ModuleCommonItem::LoopGenerateConstruct(Box::new(x))
|
||||
}),
|
||||
@ -285,7 +299,7 @@ pub fn module_common_item(s: Span) -> IResult<Span, ModuleCommonItem> {
|
||||
ModuleCommonItem::ConditionalGenerateConstruct(Box::new(x))
|
||||
}),
|
||||
map(elaboration_system_task, |x| {
|
||||
ModuleCommonItem::ElaborationSystemTask(x)
|
||||
ModuleCommonItem::ElaborationSystemTask(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -294,9 +308,11 @@ pub fn module_common_item(s: Span) -> IResult<Span, ModuleCommonItem> {
|
||||
pub fn module_item(s: Span) -> IResult<Span, ModuleItem> {
|
||||
alt((
|
||||
map(pair(port_declaration, symbol(";")), |x| {
|
||||
ModuleItem::PortDeclaration(x)
|
||||
ModuleItem::PortDeclaration(Box::new(x))
|
||||
}),
|
||||
map(non_port_module_item, |x| {
|
||||
ModuleItem::NonPortModuleItem(Box::new(x))
|
||||
}),
|
||||
map(non_port_module_item, |x| ModuleItem::NonPortModuleItem(x)),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -317,7 +333,7 @@ pub fn module_or_generate_item_parameter(s: Span) -> IResult<Span, ModuleOrGener
|
||||
let (s, b) = parameter_override(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ModuleOrGenerateItem::Parameter(ModuleOrGenerateItemParameter { nodes: (a, b) }),
|
||||
ModuleOrGenerateItem::Parameter(Box::new(ModuleOrGenerateItemParameter { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -327,7 +343,7 @@ pub fn module_or_generate_item_gate(s: Span) -> IResult<Span, ModuleOrGenerateIt
|
||||
let (s, b) = gate_instantiation(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ModuleOrGenerateItem::Gate(ModuleOrGenerateItemGate { nodes: (a, b) }),
|
||||
ModuleOrGenerateItem::Gate(Box::new(ModuleOrGenerateItemGate { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -337,7 +353,7 @@ pub fn module_or_generate_item_udp(s: Span) -> IResult<Span, ModuleOrGenerateIte
|
||||
let (s, b) = udp_instantiation(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ModuleOrGenerateItem::Udp(ModuleOrGenerateItemUdp { nodes: (a, b) }),
|
||||
ModuleOrGenerateItem::Udp(Box::new(ModuleOrGenerateItemUdp { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -347,7 +363,7 @@ pub fn module_or_generate_item_module(s: Span) -> IResult<Span, ModuleOrGenerate
|
||||
let (s, b) = module_instantiation(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ModuleOrGenerateItem::Module(ModuleOrGenerateItemModule { nodes: (a, b) }),
|
||||
ModuleOrGenerateItem::Module(Box::new(ModuleOrGenerateItemModule { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -369,13 +385,13 @@ pub fn module_or_generate_item_declaration(
|
||||
) -> IResult<Span, ModuleOrGenerateItemDeclaration> {
|
||||
alt((
|
||||
map(package_or_generate_item_declaration, |x| {
|
||||
ModuleOrGenerateItemDeclaration::PackageOrGenerateItemDeclaration(x)
|
||||
ModuleOrGenerateItemDeclaration::PackageOrGenerateItemDeclaration(Box::new(x))
|
||||
}),
|
||||
map(genvar_declaration, |x| {
|
||||
ModuleOrGenerateItemDeclaration::GenvarDeclaration(x)
|
||||
ModuleOrGenerateItemDeclaration::GenvarDeclaration(Box::new(x))
|
||||
}),
|
||||
map(clocking_declaration, |x| {
|
||||
ModuleOrGenerateItemDeclaration::ClockingDeclaration(x)
|
||||
ModuleOrGenerateItemDeclaration::ClockingDeclaration(Box::new(x))
|
||||
}),
|
||||
module_or_generate_item_declaration_clocking,
|
||||
module_or_generate_item_declaration_disable,
|
||||
@ -392,9 +408,11 @@ pub fn module_or_generate_item_declaration_clocking(
|
||||
let (s, d) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ModuleOrGenerateItemDeclaration::Clocking(ModuleOrGenerateItemDeclarationClocking {
|
||||
ModuleOrGenerateItemDeclaration::Clocking(Box::new(
|
||||
ModuleOrGenerateItemDeclarationClocking {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
},
|
||||
)),
|
||||
))
|
||||
}
|
||||
|
||||
@ -409,32 +427,38 @@ pub fn module_or_generate_item_declaration_disable(
|
||||
let (s, e) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ModuleOrGenerateItemDeclaration::Disable(ModuleOrGenerateItemDeclarationDisable {
|
||||
ModuleOrGenerateItemDeclaration::Disable(Box::new(
|
||||
ModuleOrGenerateItemDeclarationDisable {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
},
|
||||
)),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn non_port_module_item(s: Span) -> IResult<Span, NonPortModuleItem> {
|
||||
alt((
|
||||
map(generate_region, |x| NonPortModuleItem::GenerateRegion(x)),
|
||||
map(module_or_generate_item, |x| {
|
||||
NonPortModuleItem::ModuleOrGenerateItem(x)
|
||||
map(generate_region, |x| {
|
||||
NonPortModuleItem::GenerateRegion(Box::new(x))
|
||||
}),
|
||||
map(module_or_generate_item, |x| {
|
||||
NonPortModuleItem::ModuleOrGenerateItem(Box::new(x))
|
||||
}),
|
||||
map(specify_block, |x| {
|
||||
NonPortModuleItem::SpecifyBlock(Box::new(x))
|
||||
}),
|
||||
map(specify_block, |x| NonPortModuleItem::SpecifyBlock(x)),
|
||||
non_port_module_item_specparam,
|
||||
map(program_declaration, |x| {
|
||||
NonPortModuleItem::ProgramDeclaration(x)
|
||||
NonPortModuleItem::ProgramDeclaration(Box::new(x))
|
||||
}),
|
||||
map(module_declaration, |x| {
|
||||
NonPortModuleItem::ModuleDeclaration(x)
|
||||
NonPortModuleItem::ModuleDeclaration(Box::new(x))
|
||||
}),
|
||||
map(interface_declaration, |x| {
|
||||
NonPortModuleItem::InterfaceDeclaration(x)
|
||||
NonPortModuleItem::InterfaceDeclaration(Box::new(x))
|
||||
}),
|
||||
map(timeunits_declaration, |x| {
|
||||
NonPortModuleItem::TimeunitsDeclaration(x)
|
||||
NonPortModuleItem::TimeunitsDeclaration(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -445,7 +469,7 @@ pub fn non_port_module_item_specparam(s: Span) -> IResult<Span, NonPortModuleIte
|
||||
let (s, b) = specparam_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
NonPortModuleItem::Specparam(NonPortModuleItemSpecparam { nodes: (a, b) }),
|
||||
NonPortModuleItem::Specparam(Box::new(NonPortModuleItemSpecparam { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -471,9 +495,9 @@ pub fn bind_directive_scope(s: Span) -> IResult<Span, BindDirective> {
|
||||
let (s, e) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
BindDirective::Scope(BindDirectiveScope {
|
||||
BindDirective::Scope(Box::new(BindDirectiveScope {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -485,18 +509,20 @@ pub fn bind_directive_instance(s: Span) -> IResult<Span, BindDirective> {
|
||||
let (s, d) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
BindDirective::Instance(BindDirectiveInstance {
|
||||
BindDirective::Instance(Box::new(BindDirectiveInstance {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn bind_target_scope(s: Span) -> IResult<Span, BindTargetScope> {
|
||||
alt((
|
||||
map(module_identifier, |x| BindTargetScope::ModuleIdentifier(x)),
|
||||
map(module_identifier, |x| {
|
||||
BindTargetScope::ModuleIdentifier(Box::new(x))
|
||||
}),
|
||||
map(interface_identifier, |x| {
|
||||
BindTargetScope::InterfaceIdentifier(x)
|
||||
BindTargetScope::InterfaceIdentifier(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -518,16 +544,16 @@ pub fn bind_target_instance_list(s: Span) -> IResult<Span, BindTargetInstanceLis
|
||||
pub fn bind_instantiation(s: Span) -> IResult<Span, BindInstantiation> {
|
||||
alt((
|
||||
map(program_instantiation, |x| {
|
||||
BindInstantiation::ProgramInstantiation(x)
|
||||
BindInstantiation::ProgramInstantiation(Box::new(x))
|
||||
}),
|
||||
map(module_instantiation, |x| {
|
||||
BindInstantiation::ModuleInstantiation(x)
|
||||
BindInstantiation::ModuleInstantiation(Box::new(x))
|
||||
}),
|
||||
map(interface_instantiation, |x| {
|
||||
BindInstantiation::InterfaceInstantiation(x)
|
||||
BindInstantiation::InterfaceInstantiation(Box::new(x))
|
||||
}),
|
||||
map(checker_instantiation, |x| {
|
||||
BindInstantiation::CheckerInstantiation(x)
|
||||
BindInstantiation::CheckerInstantiation(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
@ -10,9 +10,9 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ParameterPortList {
|
||||
Assignment(ParameterPortListAssignment),
|
||||
Declaration(ParameterPortListDeclaration),
|
||||
Empty((Symbol, Symbol, Symbol)),
|
||||
Assignment(Box<ParameterPortListAssignment>),
|
||||
Declaration(Box<ParameterPortListDeclaration>),
|
||||
Empty(Box<(Symbol, Symbol, Symbol)>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -33,10 +33,10 @@ pub struct ParameterPortListDeclaration {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ParameterPortDeclaration {
|
||||
ParameterDeclaration(ParameterDeclaration),
|
||||
LocalParameterDeclaration(LocalParameterDeclaration),
|
||||
ParamList(ParameterPortDeclarationParamList),
|
||||
TypeList(ParameterPortDeclarationTypeList),
|
||||
ParameterDeclaration(Box<ParameterDeclaration>),
|
||||
LocalParameterDeclaration(Box<LocalParameterDeclaration>),
|
||||
ParamList(Box<ParameterPortDeclarationParamList>),
|
||||
TypeList(Box<ParameterPortDeclarationTypeList>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -61,11 +61,11 @@ pub struct ListOfPortDeclarations {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PortDeclaration {
|
||||
Inout(PortDeclarationInout),
|
||||
Input(PortDeclarationInput),
|
||||
Output(PortDeclarationOutput),
|
||||
Ref(PortDeclarationRef),
|
||||
Interface(PortDeclarationInterface),
|
||||
Inout(Box<PortDeclarationInout>),
|
||||
Input(Box<PortDeclarationInput>),
|
||||
Output(Box<PortDeclarationOutput>),
|
||||
Ref(Box<PortDeclarationRef>),
|
||||
Interface(Box<PortDeclarationInterface>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -95,8 +95,8 @@ pub struct PortDeclarationInterface {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum Port {
|
||||
NonNamed(PortNonNamed),
|
||||
Named(PortNamed),
|
||||
NonNamed(Box<PortNonNamed>),
|
||||
Named(Box<PortNamed>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -111,8 +111,8 @@ pub struct PortNamed {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PortExpression {
|
||||
PortReference(PortReference),
|
||||
Brace(PortExpressionBrace),
|
||||
PortReference(Box<PortReference>),
|
||||
Brace(Box<PortExpressionBrace>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -127,10 +127,10 @@ pub struct PortReference {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PortDirection {
|
||||
Input(Keyword),
|
||||
Output(Keyword),
|
||||
Inout(Keyword),
|
||||
Ref(Keyword),
|
||||
Input(Box<Keyword>),
|
||||
Output(Box<Keyword>),
|
||||
Inout(Box<Keyword>),
|
||||
Ref(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -145,8 +145,8 @@ pub struct VariablePortHeader {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum InterfacePortHeader {
|
||||
Identifier(InterfacePortHeaderIdentifier),
|
||||
Interface(InterfacePortHeaderInterface),
|
||||
Identifier(Box<InterfacePortHeaderIdentifier>),
|
||||
Interface(Box<InterfacePortHeaderInterface>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -161,14 +161,14 @@ pub struct InterfacePortHeaderInterface {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum NetPortHeaderOrInterfacePortHeader {
|
||||
NetPortHeader(NetPortHeader),
|
||||
InterfacePortHeader(InterfacePortHeader),
|
||||
NetPortHeader(Box<NetPortHeader>),
|
||||
InterfacePortHeader(Box<InterfacePortHeader>),
|
||||
}
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum AnsiPortDeclaration {
|
||||
Net(AnsiPortDeclarationNet),
|
||||
Variable(AnsiPortDeclarationVariable),
|
||||
Paren(AnsiPortDeclarationParen),
|
||||
Net(Box<AnsiPortDeclarationNet>),
|
||||
Variable(Box<AnsiPortDeclarationVariable>),
|
||||
Paren(Box<AnsiPortDeclarationParen>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -221,7 +221,7 @@ pub fn parameter_port_list_assignment(s: Span) -> IResult<Span, ParameterPortLis
|
||||
))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ParameterPortList::Assignment(ParameterPortListAssignment { nodes: (a, b) }),
|
||||
ParameterPortList::Assignment(Box::new(ParameterPortListAssignment { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -231,7 +231,7 @@ pub fn parameter_port_list_declaration(s: Span) -> IResult<Span, ParameterPortLi
|
||||
let (s, b) = paren(list(symbol(","), parameter_port_declaration))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ParameterPortList::Declaration(ParameterPortListDeclaration { nodes: (a, b) }),
|
||||
ParameterPortList::Declaration(Box::new(ParameterPortListDeclaration { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -240,17 +240,17 @@ pub fn parameter_port_list_empty(s: Span) -> IResult<Span, ParameterPortList> {
|
||||
let (s, a) = symbol("#")(s)?;
|
||||
let (s, b) = symbol("(")(s)?;
|
||||
let (s, c) = symbol(")")(s)?;
|
||||
Ok((s, ParameterPortList::Empty((a, b, c))))
|
||||
Ok((s, ParameterPortList::Empty(Box::new((a, b, c)))))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn parameter_port_declaration(s: Span) -> IResult<Span, ParameterPortDeclaration> {
|
||||
alt((
|
||||
map(parameter_declaration, |x| {
|
||||
ParameterPortDeclaration::ParameterDeclaration(x)
|
||||
ParameterPortDeclaration::ParameterDeclaration(Box::new(x))
|
||||
}),
|
||||
map(local_parameter_declaration, |x| {
|
||||
ParameterPortDeclaration::LocalParameterDeclaration(x)
|
||||
ParameterPortDeclaration::LocalParameterDeclaration(Box::new(x))
|
||||
}),
|
||||
parameter_port_declaration_param_list,
|
||||
parameter_port_declaration_type_list,
|
||||
@ -263,7 +263,9 @@ pub fn parameter_port_declaration_param_list(s: Span) -> IResult<Span, Parameter
|
||||
let (s, b) = list_of_param_assignments(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ParameterPortDeclaration::ParamList(ParameterPortDeclarationParamList { nodes: (a, b) }),
|
||||
ParameterPortDeclaration::ParamList(Box::new(ParameterPortDeclarationParamList {
|
||||
nodes: (a, b),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -273,7 +275,9 @@ pub fn parameter_port_declaration_type_list(s: Span) -> IResult<Span, ParameterP
|
||||
let (s, b) = list_of_type_assignments(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ParameterPortDeclaration::TypeList(ParameterPortDeclarationTypeList { nodes: (a, b) }),
|
||||
ParameterPortDeclaration::TypeList(Box::new(ParameterPortDeclarationTypeList {
|
||||
nodes: (a, b),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -309,7 +313,7 @@ pub fn port_declaration_inout(s: Span) -> IResult<Span, PortDeclaration> {
|
||||
let (s, b) = inout_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PortDeclaration::Inout(PortDeclarationInout { nodes: (a, b) }),
|
||||
PortDeclaration::Inout(Box::new(PortDeclarationInout { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -319,7 +323,7 @@ pub fn port_declaration_input(s: Span) -> IResult<Span, PortDeclaration> {
|
||||
let (s, b) = input_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PortDeclaration::Input(PortDeclarationInput { nodes: (a, b) }),
|
||||
PortDeclaration::Input(Box::new(PortDeclarationInput { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -329,7 +333,7 @@ pub fn port_declaration_output(s: Span) -> IResult<Span, PortDeclaration> {
|
||||
let (s, b) = output_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PortDeclaration::Output(PortDeclarationOutput { nodes: (a, b) }),
|
||||
PortDeclaration::Output(Box::new(PortDeclarationOutput { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -339,7 +343,7 @@ pub fn port_declaration_ref(s: Span) -> IResult<Span, PortDeclaration> {
|
||||
let (s, b) = ref_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PortDeclaration::Ref(PortDeclarationRef { nodes: (a, b) }),
|
||||
PortDeclaration::Ref(Box::new(PortDeclarationRef { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -349,7 +353,7 @@ pub fn port_declaration_interface(s: Span) -> IResult<Span, PortDeclaration> {
|
||||
let (s, b) = interface_port_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PortDeclaration::Interface(PortDeclarationInterface { nodes: (a, b) }),
|
||||
PortDeclaration::Interface(Box::new(PortDeclarationInterface { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -361,7 +365,7 @@ pub fn port(s: Span) -> IResult<Span, Port> {
|
||||
#[parser(MaybeRecursive)]
|
||||
pub fn port_non_named(s: Span) -> IResult<Span, Port> {
|
||||
let (s, a) = opt(port_expression)(s)?;
|
||||
Ok((s, Port::NonNamed(PortNonNamed { nodes: (a,) })))
|
||||
Ok((s, Port::NonNamed(Box::new(PortNonNamed { nodes: (a,) }))))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
@ -369,13 +373,15 @@ pub fn port_named(s: Span) -> IResult<Span, Port> {
|
||||
let (s, a) = symbol(".")(s)?;
|
||||
let (s, b) = port_identifier(s)?;
|
||||
let (s, c) = paren(opt(port_expression))(s)?;
|
||||
Ok((s, Port::Named(PortNamed { nodes: (a, b, c) })))
|
||||
Ok((s, Port::Named(Box::new(PortNamed { nodes: (a, b, c) }))))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn port_expression(s: Span) -> IResult<Span, PortExpression> {
|
||||
alt((
|
||||
map(port_reference, |x| PortExpression::PortReference(x)),
|
||||
map(port_reference, |x| {
|
||||
PortExpression::PortReference(Box::new(x))
|
||||
}),
|
||||
port_expressio_named,
|
||||
))(s)
|
||||
}
|
||||
@ -385,7 +391,7 @@ pub fn port_expressio_named(s: Span) -> IResult<Span, PortExpression> {
|
||||
let (s, a) = brace(list(symbol(","), port_reference))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PortExpression::Brace(PortExpressionBrace { nodes: (a,) }),
|
||||
PortExpression::Brace(Box::new(PortExpressionBrace { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -399,10 +405,10 @@ pub fn port_reference(s: Span) -> IResult<Span, PortReference> {
|
||||
#[parser]
|
||||
pub fn port_direction(s: Span) -> IResult<Span, PortDirection> {
|
||||
alt((
|
||||
map(keyword("input"), |x| PortDirection::Input(x)),
|
||||
map(keyword("output"), |x| PortDirection::Output(x)),
|
||||
map(keyword("inout"), |x| PortDirection::Inout(x)),
|
||||
map(keyword("ref"), |x| PortDirection::Ref(x)),
|
||||
map(keyword("input"), |x| PortDirection::Input(Box::new(x))),
|
||||
map(keyword("output"), |x| PortDirection::Output(Box::new(x))),
|
||||
map(keyword("inout"), |x| PortDirection::Inout(Box::new(x))),
|
||||
map(keyword("ref"), |x| PortDirection::Ref(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -434,7 +440,7 @@ pub fn interface_port_header_identifier(s: Span) -> IResult<Span, InterfacePortH
|
||||
let (s, b) = opt(pair(symbol("."), modport_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
InterfacePortHeader::Identifier(InterfacePortHeaderIdentifier { nodes: (a, b) }),
|
||||
InterfacePortHeader::Identifier(Box::new(InterfacePortHeaderIdentifier { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -444,7 +450,7 @@ pub fn interface_port_header_interface(s: Span) -> IResult<Span, InterfacePortHe
|
||||
let (s, b) = opt(pair(symbol("."), modport_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
InterfacePortHeader::Interface(InterfacePortHeaderInterface { nodes: (a, b) }),
|
||||
InterfacePortHeader::Interface(Box::new(InterfacePortHeaderInterface { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -465,9 +471,9 @@ pub fn ansi_port_declaration_net(s: Span) -> IResult<Span, AnsiPortDeclaration>
|
||||
let (s, d) = opt(pair(symbol("="), constant_expression))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
AnsiPortDeclaration::Net(AnsiPortDeclarationNet {
|
||||
AnsiPortDeclaration::Net(Box::new(AnsiPortDeclarationNet {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -477,10 +483,10 @@ pub fn net_port_header_or_interface_port_header(
|
||||
) -> IResult<Span, NetPortHeaderOrInterfacePortHeader> {
|
||||
alt((
|
||||
map(net_port_header, |x| {
|
||||
NetPortHeaderOrInterfacePortHeader::NetPortHeader(x)
|
||||
NetPortHeaderOrInterfacePortHeader::NetPortHeader(Box::new(x))
|
||||
}),
|
||||
map(interface_port_header, |x| {
|
||||
NetPortHeaderOrInterfacePortHeader::InterfacePortHeader(x)
|
||||
NetPortHeaderOrInterfacePortHeader::InterfacePortHeader(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -493,9 +499,9 @@ pub fn ansi_port_declaration_port(s: Span) -> IResult<Span, AnsiPortDeclaration>
|
||||
let (s, d) = opt(pair(symbol("="), constant_expression))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
AnsiPortDeclaration::Variable(AnsiPortDeclarationVariable {
|
||||
AnsiPortDeclaration::Variable(Box::new(AnsiPortDeclarationVariable {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -507,8 +513,8 @@ pub fn ansi_port_declaration_paren(s: Span) -> IResult<Span, AnsiPortDeclaration
|
||||
let (s, d) = paren(opt(expression))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
AnsiPortDeclaration::Paren(AnsiPortDeclarationParen {
|
||||
AnsiPortDeclaration::Paren(Box::new(AnsiPortDeclarationParen {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
@ -10,28 +10,28 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PackageItem {
|
||||
PackageOrGenerateItemDeclaration(PackageOrGenerateItemDeclaration),
|
||||
AnonymousProgram(AnonymousProgram),
|
||||
PackageExportDeclaration(PackageExportDeclaration),
|
||||
TimeunitsDeclaration(TimeunitsDeclaration),
|
||||
PackageOrGenerateItemDeclaration(Box<PackageOrGenerateItemDeclaration>),
|
||||
AnonymousProgram(Box<AnonymousProgram>),
|
||||
PackageExportDeclaration(Box<PackageExportDeclaration>),
|
||||
TimeunitsDeclaration(Box<TimeunitsDeclaration>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PackageOrGenerateItemDeclaration {
|
||||
NetDeclaration(NetDeclaration),
|
||||
DataDeclaration(DataDeclaration),
|
||||
TaskDeclaration(TaskDeclaration),
|
||||
FunctionDeclaration(FunctionDeclaration),
|
||||
CheckerDeclaration(CheckerDeclaration),
|
||||
DpiImportExport(DpiImportExport),
|
||||
ExternConstraintDeclaration(ExternConstraintDeclaration),
|
||||
ClassDeclaration(ClassDeclaration),
|
||||
ClassConstructorDeclaration(ClassConstructorDeclaration),
|
||||
LocalParameterDeclaration((LocalParameterDeclaration, Symbol)),
|
||||
ParameterDeclaration((ParameterDeclaration, Symbol)),
|
||||
CovergroupDeclaration(CovergroupDeclaration),
|
||||
AssertionItemDeclaration(AssertionItemDeclaration),
|
||||
Empty(Symbol),
|
||||
NetDeclaration(Box<NetDeclaration>),
|
||||
DataDeclaration(Box<DataDeclaration>),
|
||||
TaskDeclaration(Box<TaskDeclaration>),
|
||||
FunctionDeclaration(Box<FunctionDeclaration>),
|
||||
CheckerDeclaration(Box<CheckerDeclaration>),
|
||||
DpiImportExport(Box<DpiImportExport>),
|
||||
ExternConstraintDeclaration(Box<ExternConstraintDeclaration>),
|
||||
ClassDeclaration(Box<ClassDeclaration>),
|
||||
ClassConstructorDeclaration(Box<ClassConstructorDeclaration>),
|
||||
LocalParameterDeclaration(Box<(LocalParameterDeclaration, Symbol)>),
|
||||
ParameterDeclaration(Box<(ParameterDeclaration, Symbol)>),
|
||||
CovergroupDeclaration(Box<CovergroupDeclaration>),
|
||||
AssertionItemDeclaration(Box<AssertionItemDeclaration>),
|
||||
Empty(Box<Symbol>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -41,12 +41,12 @@ pub struct AnonymousProgram {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum AnonymousProgramItem {
|
||||
TaskDeclaration(TaskDeclaration),
|
||||
FunctionDeclaration(FunctionDeclaration),
|
||||
ClassDeclaration(ClassDeclaration),
|
||||
CovergroupDeclaration(CovergroupDeclaration),
|
||||
ClassConstructorDeclaration(ClassConstructorDeclaration),
|
||||
Empty(Symbol),
|
||||
TaskDeclaration(Box<TaskDeclaration>),
|
||||
FunctionDeclaration(Box<FunctionDeclaration>),
|
||||
ClassDeclaration(Box<ClassDeclaration>),
|
||||
CovergroupDeclaration(Box<CovergroupDeclaration>),
|
||||
ClassConstructorDeclaration(Box<ClassConstructorDeclaration>),
|
||||
Empty(Box<Symbol>),
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -55,14 +55,16 @@ pub enum AnonymousProgramItem {
|
||||
pub fn package_item(s: Span) -> IResult<Span, PackageItem> {
|
||||
alt((
|
||||
map(package_or_generate_item_declaration, |x| {
|
||||
PackageItem::PackageOrGenerateItemDeclaration(x)
|
||||
PackageItem::PackageOrGenerateItemDeclaration(Box::new(x))
|
||||
}),
|
||||
map(anonymous_program, |x| {
|
||||
PackageItem::AnonymousProgram(Box::new(x))
|
||||
}),
|
||||
map(anonymous_program, |x| PackageItem::AnonymousProgram(x)),
|
||||
map(package_export_declaration, |x| {
|
||||
PackageItem::PackageExportDeclaration(x)
|
||||
PackageItem::PackageExportDeclaration(Box::new(x))
|
||||
}),
|
||||
map(timeunits_declaration, |x| {
|
||||
PackageItem::TimeunitsDeclaration(x)
|
||||
PackageItem::TimeunitsDeclaration(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -73,45 +75,47 @@ pub fn package_or_generate_item_declaration(
|
||||
) -> IResult<Span, PackageOrGenerateItemDeclaration> {
|
||||
alt((
|
||||
map(net_declaration, |x| {
|
||||
PackageOrGenerateItemDeclaration::NetDeclaration(x)
|
||||
PackageOrGenerateItemDeclaration::NetDeclaration(Box::new(x))
|
||||
}),
|
||||
map(data_declaration, |x| {
|
||||
PackageOrGenerateItemDeclaration::DataDeclaration(x)
|
||||
PackageOrGenerateItemDeclaration::DataDeclaration(Box::new(x))
|
||||
}),
|
||||
map(task_declaration, |x| {
|
||||
PackageOrGenerateItemDeclaration::TaskDeclaration(x)
|
||||
PackageOrGenerateItemDeclaration::TaskDeclaration(Box::new(x))
|
||||
}),
|
||||
map(function_declaration, |x| {
|
||||
PackageOrGenerateItemDeclaration::FunctionDeclaration(x)
|
||||
PackageOrGenerateItemDeclaration::FunctionDeclaration(Box::new(x))
|
||||
}),
|
||||
map(checker_declaration, |x| {
|
||||
PackageOrGenerateItemDeclaration::CheckerDeclaration(x)
|
||||
PackageOrGenerateItemDeclaration::CheckerDeclaration(Box::new(x))
|
||||
}),
|
||||
map(dpi_import_export, |x| {
|
||||
PackageOrGenerateItemDeclaration::DpiImportExport(x)
|
||||
PackageOrGenerateItemDeclaration::DpiImportExport(Box::new(x))
|
||||
}),
|
||||
map(extern_constraint_declaration, |x| {
|
||||
PackageOrGenerateItemDeclaration::ExternConstraintDeclaration(x)
|
||||
PackageOrGenerateItemDeclaration::ExternConstraintDeclaration(Box::new(x))
|
||||
}),
|
||||
map(class_declaration, |x| {
|
||||
PackageOrGenerateItemDeclaration::ClassDeclaration(x)
|
||||
PackageOrGenerateItemDeclaration::ClassDeclaration(Box::new(x))
|
||||
}),
|
||||
map(class_constructor_declaration, |x| {
|
||||
PackageOrGenerateItemDeclaration::ClassConstructorDeclaration(x)
|
||||
PackageOrGenerateItemDeclaration::ClassConstructorDeclaration(Box::new(x))
|
||||
}),
|
||||
map(pair(local_parameter_declaration, symbol(";")), |x| {
|
||||
PackageOrGenerateItemDeclaration::LocalParameterDeclaration(x)
|
||||
PackageOrGenerateItemDeclaration::LocalParameterDeclaration(Box::new(x))
|
||||
}),
|
||||
map(pair(parameter_declaration, symbol(";")), |x| {
|
||||
PackageOrGenerateItemDeclaration::ParameterDeclaration(x)
|
||||
PackageOrGenerateItemDeclaration::ParameterDeclaration(Box::new(x))
|
||||
}),
|
||||
map(covergroup_declaration, |x| {
|
||||
PackageOrGenerateItemDeclaration::CovergroupDeclaration(x)
|
||||
PackageOrGenerateItemDeclaration::CovergroupDeclaration(Box::new(x))
|
||||
}),
|
||||
map(assertion_item_declaration, |x| {
|
||||
PackageOrGenerateItemDeclaration::AssertionItemDeclaration(x)
|
||||
PackageOrGenerateItemDeclaration::AssertionItemDeclaration(Box::new(x))
|
||||
}),
|
||||
map(symbol(";"), |x| {
|
||||
PackageOrGenerateItemDeclaration::Empty(Box::new(x))
|
||||
}),
|
||||
map(symbol(";"), |x| PackageOrGenerateItemDeclaration::Empty(x)),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -133,20 +137,20 @@ pub fn anonymous_program(s: Span) -> IResult<Span, AnonymousProgram> {
|
||||
pub fn anonymous_program_item(s: Span) -> IResult<Span, AnonymousProgramItem> {
|
||||
alt((
|
||||
map(task_declaration, |x| {
|
||||
AnonymousProgramItem::TaskDeclaration(x)
|
||||
AnonymousProgramItem::TaskDeclaration(Box::new(x))
|
||||
}),
|
||||
map(function_declaration, |x| {
|
||||
AnonymousProgramItem::FunctionDeclaration(x)
|
||||
AnonymousProgramItem::FunctionDeclaration(Box::new(x))
|
||||
}),
|
||||
map(class_declaration, |x| {
|
||||
AnonymousProgramItem::ClassDeclaration(x)
|
||||
AnonymousProgramItem::ClassDeclaration(Box::new(x))
|
||||
}),
|
||||
map(covergroup_declaration, |x| {
|
||||
AnonymousProgramItem::CovergroupDeclaration(x)
|
||||
AnonymousProgramItem::CovergroupDeclaration(Box::new(x))
|
||||
}),
|
||||
map(class_constructor_declaration, |x| {
|
||||
AnonymousProgramItem::ClassConstructorDeclaration(x)
|
||||
AnonymousProgramItem::ClassConstructorDeclaration(Box::new(x))
|
||||
}),
|
||||
map(symbol(";"), |x| AnonymousProgramItem::Empty(x)),
|
||||
map(symbol(";"), |x| AnonymousProgramItem::Empty(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
@ -10,19 +10,19 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ProgramItem {
|
||||
PortDeclaration((PortDeclaration, Symbol)),
|
||||
NonPortProgramItem(NonPortProgramItem),
|
||||
PortDeclaration(Box<(PortDeclaration, Symbol)>),
|
||||
NonPortProgramItem(Box<NonPortProgramItem>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum NonPortProgramItem {
|
||||
Assign(NonPortProgramItemAssign),
|
||||
Module(NonPortProgramItemModule),
|
||||
Initial(NonPortProgramItemInitial),
|
||||
Final(NonPortProgramItemFinal),
|
||||
Assertion(NonPortProgramItemAssertion),
|
||||
TimeunitsDeclaration(TimeunitsDeclaration),
|
||||
ProgramGenerateItem(ProgramGenerateItem),
|
||||
Assign(Box<NonPortProgramItemAssign>),
|
||||
Module(Box<NonPortProgramItemModule>),
|
||||
Initial(Box<NonPortProgramItemInitial>),
|
||||
Final(Box<NonPortProgramItemFinal>),
|
||||
Assertion(Box<NonPortProgramItemAssertion>),
|
||||
TimeunitsDeclaration(Box<TimeunitsDeclaration>),
|
||||
ProgramGenerateItem(Box<ProgramGenerateItem>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -52,10 +52,10 @@ pub struct NonPortProgramItemAssertion {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ProgramGenerateItem {
|
||||
LoopGenerateConstruct(LoopGenerateConstruct),
|
||||
ConditionalGenerateConstruct(ConditionalGenerateConstruct),
|
||||
GenerateRegion(GenerateRegion),
|
||||
ElaborationSystemTask(ElaborationSystemTask),
|
||||
LoopGenerateConstruct(Box<LoopGenerateConstruct>),
|
||||
ConditionalGenerateConstruct(Box<ConditionalGenerateConstruct>),
|
||||
GenerateRegion(Box<GenerateRegion>),
|
||||
ElaborationSystemTask(Box<ElaborationSystemTask>),
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -64,10 +64,10 @@ pub enum ProgramGenerateItem {
|
||||
pub fn program_item(s: Span) -> IResult<Span, ProgramItem> {
|
||||
alt((
|
||||
map(pair(port_declaration, symbol(";")), |x| {
|
||||
ProgramItem::PortDeclaration(x)
|
||||
ProgramItem::PortDeclaration(Box::new(x))
|
||||
}),
|
||||
map(non_port_program_item, |x| {
|
||||
ProgramItem::NonPortProgramItem(x)
|
||||
ProgramItem::NonPortProgramItem(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -81,10 +81,10 @@ pub fn non_port_program_item(s: Span) -> IResult<Span, NonPortProgramItem> {
|
||||
non_port_program_item_final,
|
||||
non_port_program_item_assertion,
|
||||
map(timeunits_declaration, |x| {
|
||||
NonPortProgramItem::TimeunitsDeclaration(x)
|
||||
NonPortProgramItem::TimeunitsDeclaration(Box::new(x))
|
||||
}),
|
||||
map(program_generate_item, |x| {
|
||||
NonPortProgramItem::ProgramGenerateItem(x)
|
||||
NonPortProgramItem::ProgramGenerateItem(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -95,7 +95,7 @@ pub fn non_port_program_item_assign(s: Span) -> IResult<Span, NonPortProgramItem
|
||||
let (s, b) = continuous_assign(s)?;
|
||||
Ok((
|
||||
s,
|
||||
NonPortProgramItem::Assign(NonPortProgramItemAssign { nodes: (a, b) }),
|
||||
NonPortProgramItem::Assign(Box::new(NonPortProgramItemAssign { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ pub fn non_port_program_item_module(s: Span) -> IResult<Span, NonPortProgramItem
|
||||
let (s, b) = module_or_generate_item_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
NonPortProgramItem::Module(NonPortProgramItemModule { nodes: (a, b) }),
|
||||
NonPortProgramItem::Module(Box::new(NonPortProgramItemModule { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ pub fn non_port_program_item_initial(s: Span) -> IResult<Span, NonPortProgramIte
|
||||
let (s, b) = initial_construct(s)?;
|
||||
Ok((
|
||||
s,
|
||||
NonPortProgramItem::Initial(NonPortProgramItemInitial { nodes: (a, b) }),
|
||||
NonPortProgramItem::Initial(Box::new(NonPortProgramItemInitial { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ pub fn non_port_program_item_final(s: Span) -> IResult<Span, NonPortProgramItem>
|
||||
let (s, b) = final_construct(s)?;
|
||||
Ok((
|
||||
s,
|
||||
NonPortProgramItem::Final(NonPortProgramItemFinal { nodes: (a, b) }),
|
||||
NonPortProgramItem::Final(Box::new(NonPortProgramItemFinal { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ pub fn non_port_program_item_assertion(s: Span) -> IResult<Span, NonPortProgramI
|
||||
let (s, b) = concurrent_assertion_item(s)?;
|
||||
Ok((
|
||||
s,
|
||||
NonPortProgramItem::Assertion(NonPortProgramItemAssertion { nodes: (a, b) }),
|
||||
NonPortProgramItem::Assertion(Box::new(NonPortProgramItemAssertion { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -143,14 +143,16 @@ pub fn non_port_program_item_assertion(s: Span) -> IResult<Span, NonPortProgramI
|
||||
pub fn program_generate_item(s: Span) -> IResult<Span, ProgramGenerateItem> {
|
||||
alt((
|
||||
map(loop_generate_construct, |x| {
|
||||
ProgramGenerateItem::LoopGenerateConstruct(x)
|
||||
ProgramGenerateItem::LoopGenerateConstruct(Box::new(x))
|
||||
}),
|
||||
map(conditional_generate_construct, |x| {
|
||||
ProgramGenerateItem::ConditionalGenerateConstruct(x)
|
||||
ProgramGenerateItem::ConditionalGenerateConstruct(Box::new(x))
|
||||
}),
|
||||
map(generate_region, |x| {
|
||||
ProgramGenerateItem::GenerateRegion(Box::new(x))
|
||||
}),
|
||||
map(generate_region, |x| ProgramGenerateItem::GenerateRegion(x)),
|
||||
map(elaboration_system_task, |x| {
|
||||
ProgramGenerateItem::ElaborationSystemTask(x)
|
||||
ProgramGenerateItem::ElaborationSystemTask(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
@ -15,14 +15,14 @@ pub struct SourceText {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum Description {
|
||||
ModuleDeclaration(ModuleDeclaration),
|
||||
UdpDeclaration(UdpDeclaration),
|
||||
InterfaceDeclaration(InterfaceDeclaration),
|
||||
ProgramDeclaration(ProgramDeclaration),
|
||||
PackageDeclaration(PackageDeclaration),
|
||||
PackageItem(DescriptionPackageItem),
|
||||
BindDirective(DescriptionBindDirective),
|
||||
ConfigDeclaration(ConfigDeclaration),
|
||||
ModuleDeclaration(Box<ModuleDeclaration>),
|
||||
UdpDeclaration(Box<UdpDeclaration>),
|
||||
InterfaceDeclaration(Box<InterfaceDeclaration>),
|
||||
ProgramDeclaration(Box<ProgramDeclaration>),
|
||||
PackageDeclaration(Box<PackageDeclaration>),
|
||||
PackageItem(Box<DescriptionPackageItem>),
|
||||
BindDirective(Box<DescriptionBindDirective>),
|
||||
ConfigDeclaration(Box<ConfigDeclaration>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -65,11 +65,11 @@ pub struct ModuleAnsiHeader {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ModuleDeclaration {
|
||||
Nonansi(ModuleDeclarationNonansi),
|
||||
Ansi(ModuleDeclarationAnsi),
|
||||
Wildcard(ModuleDeclarationWildcard),
|
||||
ExternNonansi(ModuleDeclarationExternNonansi),
|
||||
ExternAnsi(ModuleDeclarationExternAnsi),
|
||||
Nonansi(Box<ModuleDeclarationNonansi>),
|
||||
Ansi(Box<ModuleDeclarationAnsi>),
|
||||
Wildcard(Box<ModuleDeclarationWildcard>),
|
||||
ExternNonansi(Box<ModuleDeclarationExternNonansi>),
|
||||
ExternAnsi(Box<ModuleDeclarationExternAnsi>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -122,17 +122,17 @@ pub struct ModuleDeclarationExternAnsi {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ModuleKeyword {
|
||||
Module(Keyword),
|
||||
Macromodule(Keyword),
|
||||
Module(Box<Keyword>),
|
||||
Macromodule(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum InterfaceDeclaration {
|
||||
Nonansi(InterfaceDeclarationNonansi),
|
||||
Ansi(InterfaceDeclarationAnsi),
|
||||
Wildcard(InterfaceDeclarationWildcard),
|
||||
ExternNonansi(InterfaceDeclarationExternNonansi),
|
||||
ExternAnsi(InterfaceDeclarationExternAnsi),
|
||||
Nonansi(Box<InterfaceDeclarationNonansi>),
|
||||
Ansi(Box<InterfaceDeclarationAnsi>),
|
||||
Wildcard(Box<InterfaceDeclarationWildcard>),
|
||||
ExternNonansi(Box<InterfaceDeclarationExternNonansi>),
|
||||
ExternAnsi(Box<InterfaceDeclarationExternAnsi>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -213,11 +213,11 @@ pub struct InterfaceAnsiHeader {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ProgramDeclaration {
|
||||
Nonansi(ProgramDeclarationNonansi),
|
||||
Ansi(ProgramDeclarationAnsi),
|
||||
Wildcard(ProgramDeclarationWildcard),
|
||||
ExternNonansi(ProgramDeclarationExternNonansi),
|
||||
ExternAnsi(ProgramDeclarationExternAnsi),
|
||||
Nonansi(Box<ProgramDeclarationNonansi>),
|
||||
Ansi(Box<ProgramDeclarationAnsi>),
|
||||
Wildcard(Box<ProgramDeclarationWildcard>),
|
||||
ExternNonansi(Box<ProgramDeclarationExternNonansi>),
|
||||
ExternAnsi(Box<ProgramDeclarationExternAnsi>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -352,11 +352,11 @@ pub struct InterfaceClassDeclaration {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum InterfaceClassItem {
|
||||
TypeDeclaration(TypeDeclaration),
|
||||
Method(InterfaceClassItemMethod),
|
||||
LocalParameterDeclaration((LocalParameterDeclaration, Symbol)),
|
||||
ParameterDeclaration((ParameterDeclaration, Symbol)),
|
||||
Null(Symbol),
|
||||
TypeDeclaration(Box<TypeDeclaration>),
|
||||
Method(Box<InterfaceClassItemMethod>),
|
||||
LocalParameterDeclaration(Box<(LocalParameterDeclaration, Symbol)>),
|
||||
ParameterDeclaration(Box<(ParameterDeclaration, Symbol)>),
|
||||
Null(Box<Symbol>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -386,10 +386,10 @@ pub struct PackageDeclaration {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum TimeunitsDeclaration {
|
||||
Timeunit(TimeunitsDeclarationTimeunit),
|
||||
Timeprecision(TimeunitsDeclarationTimeprecision),
|
||||
TimeunitTimeprecision(TimeunitsDeclarationTimeunitTimeprecision),
|
||||
TimeprecisionTimeunit(TimeunitsDeclarationTimeprecisionTimeunit),
|
||||
Timeunit(Box<TimeunitsDeclarationTimeunit>),
|
||||
Timeprecision(Box<TimeunitsDeclarationTimeprecision>),
|
||||
TimeunitTimeprecision(Box<TimeunitsDeclarationTimeunitTimeprecision>),
|
||||
TimeprecisionTimeunit(Box<TimeunitsDeclarationTimeprecisionTimeunit>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -424,16 +424,26 @@ pub fn source_text(s: Span) -> IResult<Span, SourceText> {
|
||||
#[parser]
|
||||
pub fn description(s: Span) -> IResult<Span, Description> {
|
||||
alt((
|
||||
map(module_declaration, |x| Description::ModuleDeclaration(x)),
|
||||
map(udp_declaration, |x| Description::UdpDeclaration(x)),
|
||||
map(interface_declaration, |x| {
|
||||
Description::InterfaceDeclaration(x)
|
||||
map(module_declaration, |x| {
|
||||
Description::ModuleDeclaration(Box::new(x))
|
||||
}),
|
||||
map(udp_declaration, |x| {
|
||||
Description::UdpDeclaration(Box::new(x))
|
||||
}),
|
||||
map(interface_declaration, |x| {
|
||||
Description::InterfaceDeclaration(Box::new(x))
|
||||
}),
|
||||
map(program_declaration, |x| {
|
||||
Description::ProgramDeclaration(Box::new(x))
|
||||
}),
|
||||
map(package_declaration, |x| {
|
||||
Description::PackageDeclaration(Box::new(x))
|
||||
}),
|
||||
map(program_declaration, |x| Description::ProgramDeclaration(x)),
|
||||
map(package_declaration, |x| Description::PackageDeclaration(x)),
|
||||
description_package_item,
|
||||
description_bind_directive,
|
||||
map(config_declaration, |x| Description::ConfigDeclaration(x)),
|
||||
map(config_declaration, |x| {
|
||||
Description::ConfigDeclaration(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -443,7 +453,7 @@ pub fn description_package_item(s: Span) -> IResult<Span, Description> {
|
||||
let (s, b) = package_item(s)?;
|
||||
Ok((
|
||||
s,
|
||||
Description::PackageItem(DescriptionPackageItem { nodes: (a, b) }),
|
||||
Description::PackageItem(Box::new(DescriptionPackageItem { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -453,7 +463,7 @@ pub fn description_bind_directive(s: Span) -> IResult<Span, Description> {
|
||||
let (s, b) = bind_directive(s)?;
|
||||
Ok((
|
||||
s,
|
||||
Description::BindDirective(DescriptionBindDirective { nodes: (a, b) }),
|
||||
Description::BindDirective(Box::new(DescriptionBindDirective { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -513,9 +523,9 @@ pub fn module_declaration_nonansi(s: Span) -> IResult<Span, ModuleDeclaration> {
|
||||
let (s, e) = opt(pair(symbol(":"), module_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ModuleDeclaration::Nonansi(ModuleDeclarationNonansi {
|
||||
ModuleDeclaration::Nonansi(Box::new(ModuleDeclarationNonansi {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -528,9 +538,9 @@ pub fn module_declaration_ansi(s: Span) -> IResult<Span, ModuleDeclaration> {
|
||||
let (s, e) = opt(pair(symbol(":"), module_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ModuleDeclaration::Ansi(ModuleDeclarationAnsi {
|
||||
ModuleDeclaration::Ansi(Box::new(ModuleDeclarationAnsi {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -548,9 +558,9 @@ pub fn module_declaration_wildcard(s: Span) -> IResult<Span, ModuleDeclaration>
|
||||
let (s, j) = opt(pair(symbol(":"), module_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ModuleDeclaration::Wildcard(ModuleDeclarationWildcard {
|
||||
ModuleDeclaration::Wildcard(Box::new(ModuleDeclarationWildcard {
|
||||
nodes: (a, b, c, d, e, f, g, h, i, j),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -560,7 +570,9 @@ pub fn module_declaration_extern_nonansi(s: Span) -> IResult<Span, ModuleDeclara
|
||||
let (s, b) = module_nonansi_header(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ModuleDeclaration::ExternNonansi(ModuleDeclarationExternNonansi { nodes: (a, b) }),
|
||||
ModuleDeclaration::ExternNonansi(Box::new(ModuleDeclarationExternNonansi {
|
||||
nodes: (a, b),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -570,15 +582,17 @@ pub fn module_declaration_extern_ansi(s: Span) -> IResult<Span, ModuleDeclaratio
|
||||
let (s, b) = module_ansi_header(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ModuleDeclaration::ExternAnsi(ModuleDeclarationExternAnsi { nodes: (a, b) }),
|
||||
ModuleDeclaration::ExternAnsi(Box::new(ModuleDeclarationExternAnsi { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn module_keyword(s: Span) -> IResult<Span, ModuleKeyword> {
|
||||
alt((
|
||||
map(keyword("module"), |x| ModuleKeyword::Module(x)),
|
||||
map(keyword("macromodule"), |x| ModuleKeyword::Macromodule(x)),
|
||||
map(keyword("module"), |x| ModuleKeyword::Module(Box::new(x))),
|
||||
map(keyword("macromodule"), |x| {
|
||||
ModuleKeyword::Macromodule(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -602,9 +616,9 @@ pub fn interface_declaration_nonansi(s: Span) -> IResult<Span, InterfaceDeclarat
|
||||
let (s, e) = opt(pair(symbol(":"), interface_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
InterfaceDeclaration::Nonansi(InterfaceDeclarationNonansi {
|
||||
InterfaceDeclaration::Nonansi(Box::new(InterfaceDeclarationNonansi {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -617,9 +631,9 @@ pub fn interface_declaration_ansi(s: Span) -> IResult<Span, InterfaceDeclaration
|
||||
let (s, e) = opt(pair(symbol(":"), interface_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
InterfaceDeclaration::Ansi(InterfaceDeclarationAnsi {
|
||||
InterfaceDeclaration::Ansi(Box::new(InterfaceDeclarationAnsi {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -637,9 +651,9 @@ pub fn interface_declaration_wildcard(s: Span) -> IResult<Span, InterfaceDeclara
|
||||
let (s, j) = opt(pair(symbol(":"), interface_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
InterfaceDeclaration::Wildcard(InterfaceDeclarationWildcard {
|
||||
InterfaceDeclaration::Wildcard(Box::new(InterfaceDeclarationWildcard {
|
||||
nodes: (a, b, c, d, e, f, g, h, i, j),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -649,7 +663,9 @@ pub fn interface_declaration_extern_nonansi(s: Span) -> IResult<Span, InterfaceD
|
||||
let (s, b) = interface_nonansi_header(s)?;
|
||||
Ok((
|
||||
s,
|
||||
InterfaceDeclaration::ExternNonansi(InterfaceDeclarationExternNonansi { nodes: (a, b) }),
|
||||
InterfaceDeclaration::ExternNonansi(Box::new(InterfaceDeclarationExternNonansi {
|
||||
nodes: (a, b),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -659,7 +675,9 @@ pub fn interface_declaration_extern_ansi(s: Span) -> IResult<Span, InterfaceDecl
|
||||
let (s, b) = interface_ansi_header(s)?;
|
||||
Ok((
|
||||
s,
|
||||
InterfaceDeclaration::ExternAnsi(InterfaceDeclarationExternAnsi { nodes: (a, b) }),
|
||||
InterfaceDeclaration::ExternAnsi(Box::new(InterfaceDeclarationExternAnsi {
|
||||
nodes: (a, b),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -719,9 +737,9 @@ pub fn program_declaration_nonansi(s: Span) -> IResult<Span, ProgramDeclaration>
|
||||
let (s, e) = opt(pair(symbol(":"), program_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ProgramDeclaration::Nonansi(ProgramDeclarationNonansi {
|
||||
ProgramDeclaration::Nonansi(Box::new(ProgramDeclarationNonansi {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -734,9 +752,9 @@ pub fn program_declaration_ansi(s: Span) -> IResult<Span, ProgramDeclaration> {
|
||||
let (s, e) = opt(pair(symbol(":"), program_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ProgramDeclaration::Ansi(ProgramDeclarationAnsi {
|
||||
ProgramDeclaration::Ansi(Box::new(ProgramDeclarationAnsi {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -753,9 +771,9 @@ pub fn program_declaration_wildcard(s: Span) -> IResult<Span, ProgramDeclaration
|
||||
let (s, i) = opt(pair(symbol(":"), program_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ProgramDeclaration::Wildcard(ProgramDeclarationWildcard {
|
||||
ProgramDeclaration::Wildcard(Box::new(ProgramDeclarationWildcard {
|
||||
nodes: (a, b, c, d, e, f, g, h, i),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -765,7 +783,9 @@ pub fn program_declaration_extern_nonansi(s: Span) -> IResult<Span, ProgramDecla
|
||||
let (s, b) = program_nonansi_header(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ProgramDeclaration::ExternNonansi(ProgramDeclarationExternNonansi { nodes: (a, b) }),
|
||||
ProgramDeclaration::ExternNonansi(Box::new(ProgramDeclarationExternNonansi {
|
||||
nodes: (a, b),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -775,7 +795,7 @@ pub fn program_declaration_extern_ansi(s: Span) -> IResult<Span, ProgramDeclarat
|
||||
let (s, b) = program_ansi_header(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ProgramDeclaration::ExternAnsi(ProgramDeclarationExternAnsi { nodes: (a, b) }),
|
||||
ProgramDeclaration::ExternAnsi(Box::new(ProgramDeclarationExternAnsi { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -892,15 +912,17 @@ pub fn interface_class_declaration(s: Span) -> IResult<Span, InterfaceClassDecla
|
||||
#[parser]
|
||||
pub fn interface_class_item(s: Span) -> IResult<Span, InterfaceClassItem> {
|
||||
alt((
|
||||
map(type_declaration, |x| InterfaceClassItem::TypeDeclaration(x)),
|
||||
map(type_declaration, |x| {
|
||||
InterfaceClassItem::TypeDeclaration(Box::new(x))
|
||||
}),
|
||||
interface_class_item_method,
|
||||
map(pair(local_parameter_declaration, symbol(";")), |x| {
|
||||
InterfaceClassItem::LocalParameterDeclaration(x)
|
||||
InterfaceClassItem::LocalParameterDeclaration(Box::new(x))
|
||||
}),
|
||||
map(pair(parameter_declaration, symbol(";")), |x| {
|
||||
InterfaceClassItem::ParameterDeclaration(x)
|
||||
InterfaceClassItem::ParameterDeclaration(Box::new(x))
|
||||
}),
|
||||
map(symbol(";"), |x| InterfaceClassItem::Null(x)),
|
||||
map(symbol(";"), |x| InterfaceClassItem::Null(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -910,7 +932,7 @@ pub fn interface_class_item_method(s: Span) -> IResult<Span, InterfaceClassItem>
|
||||
let (s, b) = interface_class_method(s)?;
|
||||
Ok((
|
||||
s,
|
||||
InterfaceClassItem::Method(InterfaceClassItemMethod { nodes: (a, b) }),
|
||||
InterfaceClassItem::Method(Box::new(InterfaceClassItemMethod { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -965,9 +987,9 @@ pub fn timeunits_declaration_timeunit(s: Span) -> IResult<Span, TimeunitsDeclara
|
||||
let (s, d) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
TimeunitsDeclaration::Timeunit(TimeunitsDeclarationTimeunit {
|
||||
TimeunitsDeclaration::Timeunit(Box::new(TimeunitsDeclarationTimeunit {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -978,7 +1000,9 @@ pub fn timeunits_declaration_timeprecision(s: Span) -> IResult<Span, TimeunitsDe
|
||||
let (s, c) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
TimeunitsDeclaration::Timeprecision(TimeunitsDeclarationTimeprecision { nodes: (a, b, c) }),
|
||||
TimeunitsDeclaration::Timeprecision(Box::new(TimeunitsDeclarationTimeprecision {
|
||||
nodes: (a, b, c),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -994,9 +1018,11 @@ pub fn timeunits_declaration_timeunit_timeprecision(
|
||||
let (s, f) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
TimeunitsDeclaration::TimeunitTimeprecision(TimeunitsDeclarationTimeunitTimeprecision {
|
||||
TimeunitsDeclaration::TimeunitTimeprecision(Box::new(
|
||||
TimeunitsDeclarationTimeunitTimeprecision {
|
||||
nodes: (a, b, c, d, e, f),
|
||||
}),
|
||||
},
|
||||
)),
|
||||
))
|
||||
}
|
||||
|
||||
@ -1012,9 +1038,11 @@ pub fn timeunits_declaration_timeprecision_timeunit(
|
||||
let (s, f) = symbol(";")(s)?;
|
||||
Ok((
|
||||
s,
|
||||
TimeunitsDeclaration::TimeprecisionTimeunit(TimeunitsDeclarationTimeprecisionTimeunit {
|
||||
TimeunitsDeclaration::TimeprecisionTimeunit(Box::new(
|
||||
TimeunitsDeclarationTimeprecisionTimeunit {
|
||||
nodes: (a, b, c, d, e, f),
|
||||
}),
|
||||
},
|
||||
)),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -14,11 +14,11 @@ pub struct SpecifyBlock {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum SpecifyItem {
|
||||
SpecparamDeclaration(SpecparamDeclaration),
|
||||
PulsestyleDeclaration(PulsestyleDeclaration),
|
||||
ShowcancelledDeclaration(ShowcancelledDeclaration),
|
||||
PathDeclaration(PathDeclaration),
|
||||
SystemTimingCheck(SystemTimingCheck),
|
||||
SpecparamDeclaration(Box<SpecparamDeclaration>),
|
||||
PulsestyleDeclaration(Box<PulsestyleDeclaration>),
|
||||
ShowcancelledDeclaration(Box<ShowcancelledDeclaration>),
|
||||
PathDeclaration(Box<PathDeclaration>),
|
||||
SystemTimingCheck(Box<SystemTimingCheck>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -45,16 +45,20 @@ pub fn specify_block(s: Span) -> IResult<Span, SpecifyBlock> {
|
||||
pub fn specify_item(s: Span) -> IResult<Span, SpecifyItem> {
|
||||
alt((
|
||||
map(specparam_declaration, |x| {
|
||||
SpecifyItem::SpecparamDeclaration(x)
|
||||
SpecifyItem::SpecparamDeclaration(Box::new(x))
|
||||
}),
|
||||
map(pulsestyle_declaration, |x| {
|
||||
SpecifyItem::PulsestyleDeclaration(x)
|
||||
SpecifyItem::PulsestyleDeclaration(Box::new(x))
|
||||
}),
|
||||
map(showcancelled_declaration, |x| {
|
||||
SpecifyItem::ShowcancelledDeclaration(x)
|
||||
SpecifyItem::ShowcancelledDeclaration(Box::new(x))
|
||||
}),
|
||||
map(path_declaration, |x| {
|
||||
SpecifyItem::PathDeclaration(Box::new(x))
|
||||
}),
|
||||
map(system_timing_check, |x| {
|
||||
SpecifyItem::SystemTimingCheck(Box::new(x))
|
||||
}),
|
||||
map(path_declaration, |x| SpecifyItem::PathDeclaration(x)),
|
||||
map(system_timing_check, |x| SpecifyItem::SystemTimingCheck(x)),
|
||||
))(s)
|
||||
}
|
||||
|
||||
|
@ -18,9 +18,9 @@ pub struct SpecifyOutputTerminalDescriptor {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum InputIdentifier {
|
||||
InputPortIdentifier(InputPortIdentifier),
|
||||
InoutPortIdentifier(InoutPortIdentifier),
|
||||
Interface(InputIdentifierInterface),
|
||||
InputPortIdentifier(Box<InputPortIdentifier>),
|
||||
InoutPortIdentifier(Box<InoutPortIdentifier>),
|
||||
Interface(Box<InputIdentifierInterface>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -30,9 +30,9 @@ pub struct InputIdentifierInterface {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum OutputIdentifier {
|
||||
OutputPortIdentifier(OutputPortIdentifier),
|
||||
InoutPortIdentifier(InoutPortIdentifier),
|
||||
Interface(OutputIdentifierInterface),
|
||||
OutputPortIdentifier(Box<OutputPortIdentifier>),
|
||||
InoutPortIdentifier(Box<InoutPortIdentifier>),
|
||||
Interface(Box<OutputIdentifierInterface>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -62,10 +62,10 @@ pub fn specify_output_terminal_descriptor(
|
||||
pub fn input_identifier(s: Span) -> IResult<Span, InputIdentifier> {
|
||||
alt((
|
||||
map(input_port_identifier, |x| {
|
||||
InputIdentifier::InputPortIdentifier(x)
|
||||
InputIdentifier::InputPortIdentifier(Box::new(x))
|
||||
}),
|
||||
map(inout_port_identifier, |x| {
|
||||
InputIdentifier::InoutPortIdentifier(x)
|
||||
InputIdentifier::InoutPortIdentifier(Box::new(x))
|
||||
}),
|
||||
input_identifier_interface,
|
||||
))(s)
|
||||
@ -78,7 +78,7 @@ pub fn input_identifier_interface(s: Span) -> IResult<Span, InputIdentifier> {
|
||||
let (s, c) = port_identifier(s)?;
|
||||
Ok((
|
||||
s,
|
||||
InputIdentifier::Interface(InputIdentifierInterface { nodes: (a, b, c) }),
|
||||
InputIdentifier::Interface(Box::new(InputIdentifierInterface { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -86,10 +86,10 @@ pub fn input_identifier_interface(s: Span) -> IResult<Span, InputIdentifier> {
|
||||
pub fn output_identifier(s: Span) -> IResult<Span, OutputIdentifier> {
|
||||
alt((
|
||||
map(output_port_identifier, |x| {
|
||||
OutputIdentifier::OutputPortIdentifier(x)
|
||||
OutputIdentifier::OutputPortIdentifier(Box::new(x))
|
||||
}),
|
||||
map(inout_port_identifier, |x| {
|
||||
OutputIdentifier::InoutPortIdentifier(x)
|
||||
OutputIdentifier::InoutPortIdentifier(Box::new(x))
|
||||
}),
|
||||
output_identifier_interface,
|
||||
))(s)
|
||||
@ -102,6 +102,6 @@ pub fn output_identifier_interface(s: Span) -> IResult<Span, OutputIdentifier> {
|
||||
let (s, c) = port_identifier(s)?;
|
||||
Ok((
|
||||
s,
|
||||
OutputIdentifier::Interface(OutputIdentifierInterface { nodes: (a, b, c) }),
|
||||
OutputIdentifier::Interface(Box::new(OutputIdentifierInterface { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
@ -9,15 +9,15 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PathDeclaration {
|
||||
SimplePathDeclaration((SimplePathDeclaration, Symbol)),
|
||||
EdgeSensitivePathDeclaration((EdgeSensitivePathDeclaration, Symbol)),
|
||||
StateDependentPathDeclaration((StateDependentPathDeclaration, Symbol)),
|
||||
SimplePathDeclaration(Box<(SimplePathDeclaration, Symbol)>),
|
||||
EdgeSensitivePathDeclaration(Box<(EdgeSensitivePathDeclaration, Symbol)>),
|
||||
StateDependentPathDeclaration(Box<(StateDependentPathDeclaration, Symbol)>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum SimplePathDeclaration {
|
||||
Parallel(SimplePathDeclarationParallel),
|
||||
Full(SimplePathDeclarationFull),
|
||||
Parallel(Box<SimplePathDeclarationParallel>),
|
||||
Full(Box<SimplePathDeclarationFull>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -70,13 +70,13 @@ pub struct ListOfPathOutputs {
|
||||
pub fn path_declaration(s: Span) -> IResult<Span, PathDeclaration> {
|
||||
alt((
|
||||
map(pair(simple_path_declaration, symbol(";")), |x| {
|
||||
PathDeclaration::SimplePathDeclaration(x)
|
||||
PathDeclaration::SimplePathDeclaration(Box::new(x))
|
||||
}),
|
||||
map(pair(edge_sensitive_path_declaration, symbol(";")), |x| {
|
||||
PathDeclaration::EdgeSensitivePathDeclaration(x)
|
||||
PathDeclaration::EdgeSensitivePathDeclaration(Box::new(x))
|
||||
}),
|
||||
map(pair(state_dependent_path_declaration, symbol(";")), |x| {
|
||||
PathDeclaration::StateDependentPathDeclaration(x)
|
||||
PathDeclaration::StateDependentPathDeclaration(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -96,7 +96,9 @@ pub fn simple_path_declaration_parallel(s: Span) -> IResult<Span, SimplePathDecl
|
||||
let (s, c) = path_delay_value(s)?;
|
||||
Ok((
|
||||
s,
|
||||
SimplePathDeclaration::Parallel(SimplePathDeclarationParallel { nodes: (a, b, c) }),
|
||||
SimplePathDeclaration::Parallel(Box::new(SimplePathDeclarationParallel {
|
||||
nodes: (a, b, c),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -107,7 +109,7 @@ pub fn simple_path_declaration_full(s: Span) -> IResult<Span, SimplePathDeclarat
|
||||
let (s, c) = path_delay_value(s)?;
|
||||
Ok((
|
||||
s,
|
||||
SimplePathDeclaration::Full(SimplePathDeclarationFull { nodes: (a, b, c) }),
|
||||
SimplePathDeclaration::Full(Box::new(SimplePathDeclarationFull { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -9,8 +9,8 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum PathDelayValue {
|
||||
ListOfPathDelayExpressions(ListOfPathDelayExpressions),
|
||||
Paren(PathDelayValueParen),
|
||||
ListOfPathDelayExpressions(Box<ListOfPathDelayExpressions>),
|
||||
Paren(Box<PathDelayValueParen>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -34,8 +34,8 @@ pub struct PathDelayExpression {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum EdgeSensitivePathDeclaration {
|
||||
Parallel(EdgeSensitivePathDeclarationParallel),
|
||||
Full(EdgeSensitivePathDeclarationFull),
|
||||
Parallel(Box<EdgeSensitivePathDeclarationParallel>),
|
||||
Full(Box<EdgeSensitivePathDeclarationFull>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -91,16 +91,16 @@ pub struct DataSourceExpression {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum EdgeIdentifier {
|
||||
Posedge(Keyword),
|
||||
Negedge(Keyword),
|
||||
Edge(Keyword),
|
||||
Posedge(Box<Keyword>),
|
||||
Negedge(Box<Keyword>),
|
||||
Edge(Box<Keyword>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum StateDependentPathDeclaration {
|
||||
IfSimple(StateDependentPathDeclarationIfSimple),
|
||||
IfEdgeSensitive(StateDependentPathDeclarationIfEdgeSensitive),
|
||||
IfNone(StateDependentPathDeclarationIfNone),
|
||||
IfSimple(Box<StateDependentPathDeclarationIfSimple>),
|
||||
IfEdgeSensitive(Box<StateDependentPathDeclarationIfEdgeSensitive>),
|
||||
IfNone(Box<StateDependentPathDeclarationIfNone>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -133,7 +133,7 @@ pub struct PolarityOperator {
|
||||
pub fn path_delay_value(s: Span) -> IResult<Span, PathDelayValue> {
|
||||
alt((
|
||||
map(list_of_path_delay_expressions, |x| {
|
||||
PathDelayValue::ListOfPathDelayExpressions(x)
|
||||
PathDelayValue::ListOfPathDelayExpressions(Box::new(x))
|
||||
}),
|
||||
path_delay_value_paren,
|
||||
))(s)
|
||||
@ -144,7 +144,7 @@ pub fn path_delay_value_paren(s: Span) -> IResult<Span, PathDelayValue> {
|
||||
let (s, a) = paren(list_of_path_delay_expressions)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PathDelayValue::Paren(PathDelayValueParen { nodes: (a,) }),
|
||||
PathDelayValue::Paren(Box::new(PathDelayValueParen { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -183,9 +183,9 @@ pub fn edge_sensitive_path_declaration_parallel(
|
||||
let (s, c) = path_delay_value(s)?;
|
||||
Ok((
|
||||
s,
|
||||
EdgeSensitivePathDeclaration::Parallel(EdgeSensitivePathDeclarationParallel {
|
||||
EdgeSensitivePathDeclaration::Parallel(Box::new(EdgeSensitivePathDeclarationParallel {
|
||||
nodes: (a, b, c),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -198,7 +198,9 @@ pub fn edge_sensitive_path_declaration_full(
|
||||
let (s, c) = path_delay_value(s)?;
|
||||
Ok((
|
||||
s,
|
||||
EdgeSensitivePathDeclaration::Full(EdgeSensitivePathDeclarationFull { nodes: (a, b, c) }),
|
||||
EdgeSensitivePathDeclaration::Full(Box::new(EdgeSensitivePathDeclarationFull {
|
||||
nodes: (a, b, c),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -249,9 +251,9 @@ pub fn data_source_expression(s: Span) -> IResult<Span, DataSourceExpression> {
|
||||
#[parser]
|
||||
pub fn edge_identifier(s: Span) -> IResult<Span, EdgeIdentifier> {
|
||||
alt((
|
||||
map(keyword("posedge"), |x| EdgeIdentifier::Posedge(x)),
|
||||
map(keyword("negedge"), |x| EdgeIdentifier::Negedge(x)),
|
||||
map(keyword("edge"), |x| EdgeIdentifier::Edge(x)),
|
||||
map(keyword("posedge"), |x| EdgeIdentifier::Posedge(Box::new(x))),
|
||||
map(keyword("negedge"), |x| EdgeIdentifier::Negedge(Box::new(x))),
|
||||
map(keyword("edge"), |x| EdgeIdentifier::Edge(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -273,9 +275,9 @@ pub fn state_dependent_path_declaration_if_simple(
|
||||
let (s, c) = simple_path_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
StateDependentPathDeclaration::IfSimple(StateDependentPathDeclarationIfSimple {
|
||||
StateDependentPathDeclaration::IfSimple(Box::new(StateDependentPathDeclarationIfSimple {
|
||||
nodes: (a, b, c),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -288,9 +290,9 @@ pub fn state_dependent_path_declaration_if_edge_sensitive(
|
||||
let (s, c) = edge_sensitive_path_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
StateDependentPathDeclaration::IfEdgeSensitive(
|
||||
StateDependentPathDeclaration::IfEdgeSensitive(Box::new(
|
||||
StateDependentPathDeclarationIfEdgeSensitive { nodes: (a, b, c) },
|
||||
),
|
||||
)),
|
||||
))
|
||||
}
|
||||
|
||||
@ -302,9 +304,9 @@ pub fn state_dependent_path_declaration_if_none(
|
||||
let (s, b) = simple_path_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
StateDependentPathDeclaration::IfNone(StateDependentPathDeclarationIfNone {
|
||||
StateDependentPathDeclaration::IfNone(Box::new(StateDependentPathDeclarationIfNone {
|
||||
nodes: (a, b),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -23,8 +23,8 @@ pub struct DataEvent {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum DelayedData {
|
||||
TerminalIdentifier(TerminalIdentifier),
|
||||
WithMintypmax(DelayedDataWithMintypmax),
|
||||
TerminalIdentifier(Box<TerminalIdentifier>),
|
||||
WithMintypmax(Box<DelayedDataWithMintypmax>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -34,8 +34,8 @@ pub struct DelayedDataWithMintypmax {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum DelayedReference {
|
||||
TerminalIdentifier(TerminalIdentifier),
|
||||
WithMintypmax(DelayedReferenceWithMintypmax),
|
||||
TerminalIdentifier(Box<TerminalIdentifier>),
|
||||
WithMintypmax(Box<DelayedReferenceWithMintypmax>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -111,7 +111,9 @@ pub fn data_event(s: Span) -> IResult<Span, DataEvent> {
|
||||
#[parser]
|
||||
pub fn delayed_data(s: Span) -> IResult<Span, DelayedData> {
|
||||
alt((
|
||||
map(terminal_identifier, |x| DelayedData::TerminalIdentifier(x)),
|
||||
map(terminal_identifier, |x| {
|
||||
DelayedData::TerminalIdentifier(Box::new(x))
|
||||
}),
|
||||
delayed_data_with_mintypmax,
|
||||
))(s)
|
||||
}
|
||||
@ -122,7 +124,7 @@ pub fn delayed_data_with_mintypmax(s: Span) -> IResult<Span, DelayedData> {
|
||||
let (s, b) = bracket(constant_mintypmax_expression)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DelayedData::WithMintypmax(DelayedDataWithMintypmax { nodes: (a, b) }),
|
||||
DelayedData::WithMintypmax(Box::new(DelayedDataWithMintypmax { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -130,7 +132,7 @@ pub fn delayed_data_with_mintypmax(s: Span) -> IResult<Span, DelayedData> {
|
||||
pub fn delayed_reference(s: Span) -> IResult<Span, DelayedReference> {
|
||||
alt((
|
||||
map(terminal_identifier, |x| {
|
||||
DelayedReference::TerminalIdentifier(x)
|
||||
DelayedReference::TerminalIdentifier(Box::new(x))
|
||||
}),
|
||||
delayed_reference_with_mintypmax,
|
||||
))(s)
|
||||
@ -142,7 +144,7 @@ pub fn delayed_reference_with_mintypmax(s: Span) -> IResult<Span, DelayedReferen
|
||||
let (s, b) = bracket(constant_mintypmax_expression)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
DelayedReference::WithMintypmax(DelayedReferenceWithMintypmax { nodes: (a, b) }),
|
||||
DelayedReference::WithMintypmax(Box::new(DelayedReferenceWithMintypmax { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -9,18 +9,18 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum SystemTimingCheck {
|
||||
SetupTimingCheck(SetupTimingCheck),
|
||||
HoldTimingCheck(HoldTimingCheck),
|
||||
SetupholdTimingCheck(SetupholdTimingCheck),
|
||||
RecoveryTimingCheck(RecoveryTimingCheck),
|
||||
RemovalTimingCheck(RemovalTimingCheck),
|
||||
RecremTimingCheck(RecremTimingCheck),
|
||||
SkewTimingCheck(SkewTimingCheck),
|
||||
TimeskewTimingCheck(TimeskewTimingCheck),
|
||||
FullskewTimingCheck(FullskewTimingCheck),
|
||||
PeriodTimingCheck(PeriodTimingCheck),
|
||||
WidthTimingCheck(WidthTimingCheck),
|
||||
NochargeTimingCheck(NochargeTimingCheck),
|
||||
SetupTimingCheck(Box<SetupTimingCheck>),
|
||||
HoldTimingCheck(Box<HoldTimingCheck>),
|
||||
SetupholdTimingCheck(Box<SetupholdTimingCheck>),
|
||||
RecoveryTimingCheck(Box<RecoveryTimingCheck>),
|
||||
RemovalTimingCheck(Box<RemovalTimingCheck>),
|
||||
RecremTimingCheck(Box<RecremTimingCheck>),
|
||||
SkewTimingCheck(Box<SkewTimingCheck>),
|
||||
TimeskewTimingCheck(Box<TimeskewTimingCheck>),
|
||||
FullskewTimingCheck(Box<FullskewTimingCheck>),
|
||||
PeriodTimingCheck(Box<PeriodTimingCheck>),
|
||||
WidthTimingCheck(Box<WidthTimingCheck>),
|
||||
NochargeTimingCheck(Box<NochargeTimingCheck>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -275,36 +275,40 @@ pub struct NochargeTimingCheck {
|
||||
pub fn system_timing_check(s: Span) -> IResult<Span, SystemTimingCheck> {
|
||||
alt((
|
||||
map(setup_timing_check, |x| {
|
||||
SystemTimingCheck::SetupTimingCheck(x)
|
||||
SystemTimingCheck::SetupTimingCheck(Box::new(x))
|
||||
}),
|
||||
map(hold_timing_check, |x| {
|
||||
SystemTimingCheck::HoldTimingCheck(Box::new(x))
|
||||
}),
|
||||
map(hold_timing_check, |x| SystemTimingCheck::HoldTimingCheck(x)),
|
||||
map(setuphold_timing_check, |x| {
|
||||
SystemTimingCheck::SetupholdTimingCheck(x)
|
||||
SystemTimingCheck::SetupholdTimingCheck(Box::new(x))
|
||||
}),
|
||||
map(recovery_timing_check, |x| {
|
||||
SystemTimingCheck::RecoveryTimingCheck(x)
|
||||
SystemTimingCheck::RecoveryTimingCheck(Box::new(x))
|
||||
}),
|
||||
map(removal_timing_check, |x| {
|
||||
SystemTimingCheck::RemovalTimingCheck(x)
|
||||
SystemTimingCheck::RemovalTimingCheck(Box::new(x))
|
||||
}),
|
||||
map(recrem_timing_check, |x| {
|
||||
SystemTimingCheck::RecremTimingCheck(x)
|
||||
SystemTimingCheck::RecremTimingCheck(Box::new(x))
|
||||
}),
|
||||
map(skew_timing_check, |x| {
|
||||
SystemTimingCheck::SkewTimingCheck(Box::new(x))
|
||||
}),
|
||||
map(skew_timing_check, |x| SystemTimingCheck::SkewTimingCheck(x)),
|
||||
map(timeskew_timing_check, |x| {
|
||||
SystemTimingCheck::TimeskewTimingCheck(x)
|
||||
SystemTimingCheck::TimeskewTimingCheck(Box::new(x))
|
||||
}),
|
||||
map(fullskew_timing_check, |x| {
|
||||
SystemTimingCheck::FullskewTimingCheck(x)
|
||||
SystemTimingCheck::FullskewTimingCheck(Box::new(x))
|
||||
}),
|
||||
map(period_timing_check, |x| {
|
||||
SystemTimingCheck::PeriodTimingCheck(x)
|
||||
SystemTimingCheck::PeriodTimingCheck(Box::new(x))
|
||||
}),
|
||||
map(width_timing_check, |x| {
|
||||
SystemTimingCheck::WidthTimingCheck(x)
|
||||
SystemTimingCheck::WidthTimingCheck(Box::new(x))
|
||||
}),
|
||||
map(nocharge_timing_check, |x| {
|
||||
SystemTimingCheck::NochargeTimingCheck(x)
|
||||
SystemTimingCheck::NochargeTimingCheck(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
@ -27,16 +27,16 @@ pub struct ControlledTimingCheckEvent {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum TimingCheckEventControl {
|
||||
Posedge(Keyword),
|
||||
Negedge(Keyword),
|
||||
Edge(Keyword),
|
||||
EdgeControlSpecifier(EdgeControlSpecifier),
|
||||
Posedge(Box<Keyword>),
|
||||
Negedge(Box<Keyword>),
|
||||
Edge(Box<Keyword>),
|
||||
EdgeControlSpecifier(Box<EdgeControlSpecifier>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum SpecifyTerminalDescriptor {
|
||||
SpecifyInputTerminalDescriptor(SpecifyInputTerminalDescriptor),
|
||||
SpecifyOutputTerminalDescriptor(SpecifyOutputTerminalDescriptor),
|
||||
SpecifyInputTerminalDescriptor(Box<SpecifyInputTerminalDescriptor>),
|
||||
SpecifyOutputTerminalDescriptor(Box<SpecifyOutputTerminalDescriptor>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -51,8 +51,8 @@ pub struct EdgeDescriptor {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum TimingCheckCondition {
|
||||
ScalarTimingCheckCondition(ScalarTimingCheckCondition),
|
||||
Paren(TimingCheckConditionParen),
|
||||
ScalarTimingCheckCondition(Box<ScalarTimingCheckCondition>),
|
||||
Paren(Box<TimingCheckConditionParen>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -62,9 +62,9 @@ pub struct TimingCheckConditionParen {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum ScalarTimingCheckCondition {
|
||||
Expression(Expression),
|
||||
Unary(ScalarTimingCheckConditionUnary),
|
||||
Binary(ScalarTimingCheckConditionBinary),
|
||||
Expression(Box<Expression>),
|
||||
Unary(Box<ScalarTimingCheckConditionUnary>),
|
||||
Binary(Box<ScalarTimingCheckConditionBinary>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -103,11 +103,17 @@ pub fn controlled_timing_check_event(s: Span) -> IResult<Span, ControlledTimingC
|
||||
#[parser]
|
||||
pub fn timing_check_event_control(s: Span) -> IResult<Span, TimingCheckEventControl> {
|
||||
alt((
|
||||
map(keyword("posedge"), |x| TimingCheckEventControl::Posedge(x)),
|
||||
map(keyword("negedge"), |x| TimingCheckEventControl::Negedge(x)),
|
||||
map(keyword("edge"), |x| TimingCheckEventControl::Edge(x)),
|
||||
map(keyword("posedge"), |x| {
|
||||
TimingCheckEventControl::Posedge(Box::new(x))
|
||||
}),
|
||||
map(keyword("negedge"), |x| {
|
||||
TimingCheckEventControl::Negedge(Box::new(x))
|
||||
}),
|
||||
map(keyword("edge"), |x| {
|
||||
TimingCheckEventControl::Edge(Box::new(x))
|
||||
}),
|
||||
map(edge_control_specifier, |x| {
|
||||
TimingCheckEventControl::EdgeControlSpecifier(x)
|
||||
TimingCheckEventControl::EdgeControlSpecifier(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -116,10 +122,10 @@ pub fn timing_check_event_control(s: Span) -> IResult<Span, TimingCheckEventCont
|
||||
pub fn specify_terminal_descriptor(s: Span) -> IResult<Span, SpecifyTerminalDescriptor> {
|
||||
alt((
|
||||
map(specify_input_terminal_descriptor, |x| {
|
||||
SpecifyTerminalDescriptor::SpecifyInputTerminalDescriptor(x)
|
||||
SpecifyTerminalDescriptor::SpecifyInputTerminalDescriptor(Box::new(x))
|
||||
}),
|
||||
map(specify_output_terminal_descriptor, |x| {
|
||||
SpecifyTerminalDescriptor::SpecifyOutputTerminalDescriptor(x)
|
||||
SpecifyTerminalDescriptor::SpecifyOutputTerminalDescriptor(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -159,7 +165,7 @@ pub fn edge_descriptor(s: Span) -> IResult<Span, EdgeDescriptor> {
|
||||
pub fn timing_check_condition(s: Span) -> IResult<Span, TimingCheckCondition> {
|
||||
alt((
|
||||
map(scalar_timing_check_condition, |x| {
|
||||
TimingCheckCondition::ScalarTimingCheckCondition(x)
|
||||
TimingCheckCondition::ScalarTimingCheckCondition(Box::new(x))
|
||||
}),
|
||||
timing_check_condition_paren,
|
||||
))(s)
|
||||
@ -170,14 +176,16 @@ pub fn timing_check_condition_paren(s: Span) -> IResult<Span, TimingCheckConditi
|
||||
let (s, a) = paren(scalar_timing_check_condition)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
TimingCheckCondition::Paren(TimingCheckConditionParen { nodes: (a,) }),
|
||||
TimingCheckCondition::Paren(Box::new(TimingCheckConditionParen { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn scalar_timing_check_condition(s: Span) -> IResult<Span, ScalarTimingCheckCondition> {
|
||||
alt((
|
||||
map(expression, |x| ScalarTimingCheckCondition::Expression(x)),
|
||||
map(expression, |x| {
|
||||
ScalarTimingCheckCondition::Expression(Box::new(x))
|
||||
}),
|
||||
scalar_timing_check_condition_unary,
|
||||
scalar_timing_check_condition_binary,
|
||||
))(s)
|
||||
@ -189,7 +197,9 @@ pub fn scalar_timing_check_condition_unary(s: Span) -> IResult<Span, ScalarTimin
|
||||
let (s, b) = expression(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ScalarTimingCheckCondition::Unary(ScalarTimingCheckConditionUnary { nodes: (a, b) }),
|
||||
ScalarTimingCheckCondition::Unary(Box::new(ScalarTimingCheckConditionUnary {
|
||||
nodes: (a, b),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -200,7 +210,9 @@ pub fn scalar_timing_check_condition_binary(s: Span) -> IResult<Span, ScalarTimi
|
||||
let (s, c) = scalar_constant(s)?;
|
||||
Ok((
|
||||
s,
|
||||
ScalarTimingCheckCondition::Binary(ScalarTimingCheckConditionBinary { nodes: (a, b, c) }),
|
||||
ScalarTimingCheckCondition::Binary(Box::new(ScalarTimingCheckConditionBinary {
|
||||
nodes: (a, b, c),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -10,8 +10,8 @@ use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum UdpBody {
|
||||
CombinationalBody(CombinationalBody),
|
||||
SequentialBody(SequentialBody),
|
||||
CombinationalBody(Box<CombinationalBody>),
|
||||
SequentialBody(Box<SequentialBody>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -64,8 +64,8 @@ pub struct SequentialEntry {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum SeqInputList {
|
||||
LevelInputList(LevelInputList),
|
||||
EdgeInputList(EdgeInputList),
|
||||
LevelInputList(Box<LevelInputList>),
|
||||
EdgeInputList(Box<EdgeInputList>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -80,8 +80,8 @@ pub struct EdgeInputList {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum EdgeIndicator {
|
||||
Paren(EdgeIndicatorParen),
|
||||
EdgeSymbol(EdgeSymbol),
|
||||
Paren(Box<EdgeIndicatorParen>),
|
||||
EdgeSymbol(Box<EdgeSymbol>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -96,8 +96,8 @@ pub struct CurrentState {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum NextState {
|
||||
OutputSymbol(OutputSymbol),
|
||||
Minus(Symbol),
|
||||
OutputSymbol(Box<OutputSymbol>),
|
||||
Minus(Box<Symbol>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -120,8 +120,10 @@ pub struct EdgeSymbol {
|
||||
#[parser]
|
||||
pub fn udp_body(s: Span) -> IResult<Span, UdpBody> {
|
||||
alt((
|
||||
map(combinational_body, |x| UdpBody::CombinationalBody(x)),
|
||||
map(sequential_body, |x| UdpBody::SequentialBody(x)),
|
||||
map(combinational_body, |x| {
|
||||
UdpBody::CombinationalBody(Box::new(x))
|
||||
}),
|
||||
map(sequential_body, |x| UdpBody::SequentialBody(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -218,8 +220,12 @@ pub fn sequential_entry(s: Span) -> IResult<Span, SequentialEntry> {
|
||||
#[parser]
|
||||
pub fn seq_input_list(s: Span) -> IResult<Span, SeqInputList> {
|
||||
alt((
|
||||
map(level_input_list, |x| SeqInputList::LevelInputList(x)),
|
||||
map(edge_input_list, |x| SeqInputList::EdgeInputList(x)),
|
||||
map(level_input_list, |x| {
|
||||
SeqInputList::LevelInputList(Box::new(x))
|
||||
}),
|
||||
map(edge_input_list, |x| {
|
||||
SeqInputList::EdgeInputList(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -242,14 +248,17 @@ pub fn edge_input_list(s: Span) -> IResult<Span, EdgeInputList> {
|
||||
pub fn edge_indicator(s: Span) -> IResult<Span, EdgeIndicator> {
|
||||
alt((
|
||||
edge_indicator_paren,
|
||||
map(edge_symbol, |x| EdgeIndicator::EdgeSymbol(x)),
|
||||
map(edge_symbol, |x| EdgeIndicator::EdgeSymbol(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
#[parser]
|
||||
pub fn edge_indicator_paren(s: Span) -> IResult<Span, EdgeIndicator> {
|
||||
let (s, a) = paren(pair(level_symbol, level_symbol))(s)?;
|
||||
Ok((s, EdgeIndicator::Paren(EdgeIndicatorParen { nodes: (a,) })))
|
||||
Ok((
|
||||
s,
|
||||
EdgeIndicator::Paren(Box::new(EdgeIndicatorParen { nodes: (a,) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[parser]
|
||||
@ -261,8 +270,8 @@ pub fn current_state(s: Span) -> IResult<Span, CurrentState> {
|
||||
#[parser]
|
||||
pub fn next_state(s: Span) -> IResult<Span, NextState> {
|
||||
alt((
|
||||
map(output_symbol, |x| NextState::OutputSymbol(x)),
|
||||
map(symbol("-"), |x| NextState::Minus(x)),
|
||||
map(output_symbol, |x| NextState::OutputSymbol(Box::new(x))),
|
||||
map(symbol("-"), |x| NextState::Minus(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
|
@ -32,11 +32,11 @@ pub struct UdpAnsiDeclaration {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum UdpDeclaration {
|
||||
Nonansi(UdpDeclarationNonansi),
|
||||
Ansi(UdpDeclarationAnsi),
|
||||
ExternNonansi(UdpDeclarationExternNonansi),
|
||||
ExternAnsi(UdpDeclarationExternAnsi),
|
||||
Wildcard(UdpDeclarationWildcard),
|
||||
Nonansi(Box<UdpDeclarationNonansi>),
|
||||
Ansi(Box<UdpDeclarationAnsi>),
|
||||
ExternNonansi(Box<UdpDeclarationExternNonansi>),
|
||||
ExternAnsi(Box<UdpDeclarationExternAnsi>),
|
||||
Wildcard(Box<UdpDeclarationWildcard>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -139,9 +139,9 @@ pub fn udp_declaration_nonansi(s: Span) -> IResult<Span, UdpDeclaration> {
|
||||
let (s, f) = opt(pair(symbol(":"), udp_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
UdpDeclaration::Nonansi(UdpDeclarationNonansi {
|
||||
UdpDeclaration::Nonansi(Box::new(UdpDeclarationNonansi {
|
||||
nodes: (a, b, c, d, e, f),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -153,9 +153,9 @@ pub fn udp_declaration_ansi(s: Span) -> IResult<Span, UdpDeclaration> {
|
||||
let (s, d) = opt(pair(symbol(":"), udp_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
UdpDeclaration::Ansi(UdpDeclarationAnsi {
|
||||
UdpDeclaration::Ansi(Box::new(UdpDeclarationAnsi {
|
||||
nodes: (a, b, c, d),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ pub fn udp_declaration_extern_nonansi(s: Span) -> IResult<Span, UdpDeclaration>
|
||||
let (s, b) = udp_nonansi_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
UdpDeclaration::ExternNonansi(UdpDeclarationExternNonansi { nodes: (a, b) }),
|
||||
UdpDeclaration::ExternNonansi(Box::new(UdpDeclarationExternNonansi { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ pub fn udp_declaration_extern_ansi(s: Span) -> IResult<Span, UdpDeclaration> {
|
||||
let (s, b) = udp_ansi_declaration(s)?;
|
||||
Ok((
|
||||
s,
|
||||
UdpDeclaration::ExternAnsi(UdpDeclarationExternAnsi { nodes: (a, b) }),
|
||||
UdpDeclaration::ExternAnsi(Box::new(UdpDeclarationExternAnsi { nodes: (a, b) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -192,8 +192,8 @@ pub fn udp_declaration_wildcard(s: Span) -> IResult<Span, UdpDeclaration> {
|
||||
let (s, i) = opt(pair(symbol(":"), udp_identifier))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
UdpDeclaration::Wildcard(UdpDeclarationWildcard {
|
||||
UdpDeclaration::Wildcard(Box::new(UdpDeclarationWildcard {
|
||||
nodes: (a, b, c, d, e, f, g, h, i),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
@ -28,15 +28,15 @@ pub struct UdpDeclarationPortList {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum UdpPortDeclaration {
|
||||
UdpOutputDeclaration((UdpOutputDeclaration, Symbol)),
|
||||
UdpInputDeclaration((UdpInputDeclaration, Symbol)),
|
||||
UdpRegDeclaration((UdpRegDeclaration, Symbol)),
|
||||
UdpOutputDeclaration(Box<(UdpOutputDeclaration, Symbol)>),
|
||||
UdpInputDeclaration(Box<(UdpInputDeclaration, Symbol)>),
|
||||
UdpRegDeclaration(Box<(UdpRegDeclaration, Symbol)>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum UdpOutputDeclaration {
|
||||
Nonreg(UdpOutputDeclarationNonreg),
|
||||
Reg(UdpOutputDeclarationReg),
|
||||
Nonreg(Box<UdpOutputDeclarationNonreg>),
|
||||
Reg(Box<UdpOutputDeclarationReg>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -87,13 +87,13 @@ pub fn udp_declaration_port_list(s: Span) -> IResult<Span, UdpDeclarationPortLis
|
||||
pub fn udp_port_declaration(s: Span) -> IResult<Span, UdpPortDeclaration> {
|
||||
alt((
|
||||
map(pair(udp_output_declaration, symbol(";")), |x| {
|
||||
UdpPortDeclaration::UdpOutputDeclaration(x)
|
||||
UdpPortDeclaration::UdpOutputDeclaration(Box::new(x))
|
||||
}),
|
||||
map(pair(udp_input_declaration, symbol(";")), |x| {
|
||||
UdpPortDeclaration::UdpInputDeclaration(x)
|
||||
UdpPortDeclaration::UdpInputDeclaration(Box::new(x))
|
||||
}),
|
||||
map(pair(udp_reg_declaration, symbol(";")), |x| {
|
||||
UdpPortDeclaration::UdpRegDeclaration(x)
|
||||
UdpPortDeclaration::UdpRegDeclaration(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
@ -110,7 +110,7 @@ pub fn udp_output_declaration_nonreg(s: Span) -> IResult<Span, UdpOutputDeclarat
|
||||
let (s, c) = port_identifier(s)?;
|
||||
Ok((
|
||||
s,
|
||||
UdpOutputDeclaration::Nonreg(UdpOutputDeclarationNonreg { nodes: (a, b, c) }),
|
||||
UdpOutputDeclaration::Nonreg(Box::new(UdpOutputDeclarationNonreg { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -123,9 +123,9 @@ pub fn udp_output_declaration_reg(s: Span) -> IResult<Span, UdpOutputDeclaration
|
||||
let (s, e) = opt(pair(symbol("="), constant_expression))(s)?;
|
||||
Ok((
|
||||
s,
|
||||
UdpOutputDeclaration::Reg(UdpOutputDeclarationReg {
|
||||
UdpOutputDeclaration::Reg(Box::new(UdpOutputDeclarationReg {
|
||||
nodes: (a, b, c, d, e),
|
||||
}),
|
||||
})),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -273,8 +273,8 @@ pub struct Keyword {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub enum WhiteSpace {
|
||||
Space(Locate),
|
||||
Comment(Comment),
|
||||
Space(Box<Locate>),
|
||||
Comment(Box<Comment>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
@ -473,8 +473,8 @@ where
|
||||
#[parser]
|
||||
pub fn white_space(s: Span) -> IResult<Span, WhiteSpace> {
|
||||
alt((
|
||||
map(multispace1, |x: Span| WhiteSpace::Space(x.into())),
|
||||
map(comment, |x| WhiteSpace::Comment(x)),
|
||||
map(multispace1, |x: Span| WhiteSpace::Space(Box::new(x.into()))),
|
||||
map(comment, |x| WhiteSpace::Comment(Box::new(x))),
|
||||
))(s)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user