From d839a4a47ba6af49e1beb0d80eef6d3dac2b6a79 Mon Sep 17 00:00:00 2001 From: dalance Date: Fri, 12 Jul 2019 18:33:41 +0900 Subject: [PATCH] Apply derive(Node) to all --- src/ast/any_node.rs | 32 +++ .../assertion_statements.rs | 24 +- .../behavioral_statements/case_statements.rs | 34 +-- .../behavioral_statements/clocking_block.rs | 52 ++--- .../conditional_statements.rs | 8 +- ...ous_assignment_and_net_alias_statements.rs | 15 +- .../looping_statements.rs | 26 +-- .../parallel_and_sequential_blocks.rs | 11 +- src/parser/behavioral_statements/patterns.rs | 36 +-- .../procedural_blocks_and_assignments.rs | 39 ++-- .../behavioral_statements/randsequence.rs | 35 +-- .../behavioral_statements/statements.rs | 17 +- .../subroutine_call_statements.rs | 5 +- .../timing_control_statements.rs | 54 ++--- .../declarations/assertion_declarations.rs | 213 +++++++++--------- .../declarations/block_item_declarations.rs | 11 +- .../declarations/covergroup_declarations.rs | 173 +++++++------- .../declarations/declaration_assignments.rs | 37 +-- src/parser/declarations/declaration_lists.rs | 27 +-- src/parser/declarations/declaration_ranges.rs | 23 +- src/parser/declarations/delays.rs | 8 +- .../declarations/function_declarations.rs | 61 ++--- .../declarations/interface_declarations.rs | 39 ++-- src/parser/declarations/let_declarations.rs | 23 +- .../module_parameter_declarations.rs | 15 +- .../declarations/net_and_variable_types.rs | 179 ++++++++------- src/parser/declarations/port_declarations.rs | 19 +- src/parser/declarations/task_declarations.rs | 33 +-- src/parser/declarations/type_declarations.rs | 32 +-- src/parser/expressions/concatenations.rs | 33 +-- .../expressions/expression_leftside_values.rs | 19 +- src/parser/expressions/expressions.rs | 71 +++--- src/parser/expressions/primaries.rs | 54 ++--- src/parser/expressions/subroutine_calls.rs | 43 ++-- src/parser/general/attributes.rs | 5 +- src/parser/general/identifiers.rs | 64 +++--- .../instantiations/checker_instantiation.rs | 17 +- .../instantiations/generated_instantiation.rs | 35 +-- .../instantiations/interface_instantiation.rs | 3 +- .../instantiations/module_instantiation.rs | 33 +-- .../instantiations/program_instantiation.rs | 3 +- src/parser/source_text/checker_items.rs | 37 +-- src/parser/source_text/class_items.rs | 103 +++++---- .../source_text/configuration_source_text.rs | 53 +++-- src/parser/source_text/constraints.rs | 77 ++++--- src/parser/source_text/interface_items.rs | 17 +- src/parser/source_text/library_source_text.rs | 11 +- src/parser/source_text/module_items.rs | 65 +++--- .../module_parameters_and_ports.rs | 81 +++---- src/parser/source_text/package_items.rs | 13 +- src/parser/source_text/program_items.rs | 17 +- .../source_text/system_verilog_source_text.rs | 87 +++---- .../specify_block_terminals.rs | 4 +- 53 files changed, 1160 insertions(+), 1066 deletions(-) diff --git a/src/ast/any_node.rs b/src/ast/any_node.rs index a4bc539..2f6b4e3 100644 --- a/src/ast/any_node.rs +++ b/src/ast/any_node.rs @@ -115,6 +115,26 @@ where } } +impl<'a, T: 'a, U: 'a, V: 'a, W: 'a, S: 'a> From<&'a (T, U, V, W, S)> for AnyNodes<'a> +where + &'a T: Into>, + &'a U: Into>, + &'a V: Into>, + &'a W: Into>, + &'a S: Into>, +{ + fn from(x: &'a (T, U, V, W, S)) -> Self { + let mut ret = Vec::new(); + let (t, u, v, w, s) = x; + ret.append(&mut t.into().0); + ret.append(&mut u.into().0); + ret.append(&mut v.into().0); + ret.append(&mut w.into().0); + ret.append(&mut s.into().0); + ret.into() + } +} + impl<'a, T> From<&'a Paren<'a, T>> for AnyNodes<'a> where &'a T: Into>, @@ -193,3 +213,15 @@ where ret.into() } } + +impl<'a, T: 'a> From<&'a Box> for AnyNodes<'a> +where + &'a T: Into>, +{ + fn from(x: &'a Box) -> Self { + let mut ret = Vec::new(); + let mut x: AnyNodes<'a> = x.into(); + ret.append(&mut x.0); + ret.into() + } +} diff --git a/src/parser/behavioral_statements/assertion_statements.rs b/src/parser/behavioral_statements/assertion_statements.rs index cd1d9ba..4df1b2d 100644 --- a/src/parser/behavioral_statements/assertion_statements.rs +++ b/src/parser/behavioral_statements/assertion_statements.rs @@ -7,13 +7,13 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum AssertionItem<'a> { Concurrent(ConcurrentAssertionItem<'a>), Immediate(DeferredImmediateAssetionItem<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DeferredImmediateAssetionItem<'a> { pub nodes: ( Option<(BlockIdentifier<'a>, Symbol<'a>)>, @@ -21,49 +21,49 @@ pub struct DeferredImmediateAssetionItem<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ProceduralAssertionStatement<'a> { Concurrent(ConcurrentAssertionStatement<'a>), Immediate(ImmediateAssetionStatement<'a>), Checker(CheckerInstantiation<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ImmediateAssetionStatement<'a> { Simple(SimpleImmediateAssertionStatement<'a>), Deferred(DeferredImmediateAssertionStatement<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum SimpleImmediateAssertionStatement<'a> { Assert(SimpleImmediateAssertStatement<'a>), Assume(SimpleImmediateAssumeStatement<'a>), Cover(SimpleImmediateCoverStatement<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SimpleImmediateAssertStatement<'a> { pub nodes: (Symbol<'a>, Paren<'a, Expression<'a>>, ActionBlock<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SimpleImmediateAssumeStatement<'a> { pub nodes: (Symbol<'a>, Paren<'a, Expression<'a>>, ActionBlock<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SimpleImmediateCoverStatement<'a> { pub nodes: (Symbol<'a>, Paren<'a, Expression<'a>>, StatementOrNull<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum DeferredImmediateAssertionStatement<'a> { Assert(DeferredImmediateAssertStatement<'a>), Assume(DeferredImmediateAssumeStatement<'a>), Cover(DeferredImmediateCoverStatement<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DeferredImmediateAssertStatement<'a> { pub nodes: ( Symbol<'a>, @@ -73,7 +73,7 @@ pub struct DeferredImmediateAssertStatement<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DeferredImmediateAssumeStatement<'a> { pub nodes: ( Symbol<'a>, @@ -83,7 +83,7 @@ pub struct DeferredImmediateAssumeStatement<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DeferredImmediateCoverStatement<'a> { pub nodes: ( Symbol<'a>, diff --git a/src/parser/behavioral_statements/case_statements.rs b/src/parser/behavioral_statements/case_statements.rs index 0ce04b1..161591a 100644 --- a/src/parser/behavioral_statements/case_statements.rs +++ b/src/parser/behavioral_statements/case_statements.rs @@ -8,14 +8,14 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum CaseStatement<'a> { Normal(CaseStatementNormal<'a>), Matches(CaseStatementMatches<'a>), Inside(CaseStatementInside<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CaseStatementNormal<'a> { pub nodes: ( Option>, @@ -27,7 +27,7 @@ pub struct CaseStatementNormal<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CaseStatementMatches<'a> { pub nodes: ( Option>, @@ -40,7 +40,7 @@ pub struct CaseStatementMatches<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CaseStatementInside<'a> { pub nodes: ( Option>, @@ -60,18 +60,18 @@ pub enum CaseKeyword<'a> { Casex(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CaseExpression<'a> { pub nodes: (Expression<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum CaseItem<'a> { NonDefault(CaseItemNondefault<'a>), Default(CaseItemDefault<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CaseItemNondefault<'a> { pub nodes: ( List, CaseItemExpression<'a>>, @@ -80,18 +80,18 @@ pub struct CaseItemNondefault<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CaseItemDefault<'a> { pub nodes: (Symbol<'a>, Option>, StatementOrNull<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum CasePatternItem<'a> { NonDefault(CasePatternItemNondefault<'a>), Default(CaseItemDefault<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CasePatternItemNondefault<'a> { pub nodes: ( Pattern<'a>, @@ -101,23 +101,23 @@ pub struct CasePatternItemNondefault<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum CaseInsideItem<'a> { NonDefault(CaseInsideItemNondefault<'a>), Default(CaseItemDefault<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CaseInsideItemNondefault<'a> { pub nodes: (OpenRangeList<'a>, Symbol<'a>, StatementOrNull<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CaseItemExpression<'a> { pub nodes: (Expression<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct RandcaseStatement<'a> { pub nodes: ( Symbol<'a>, @@ -127,17 +127,17 @@ pub struct RandcaseStatement<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct RandcaseItem<'a> { pub nodes: (Expression<'a>, Symbol<'a>, StatementOrNull<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct OpenRangeList<'a> { pub nodes: (List, OpenValueRange<'a>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct OpenValueRange<'a> { pub nodes: (ValueRange<'a>,), } diff --git a/src/parser/behavioral_statements/clocking_block.rs b/src/parser/behavioral_statements/clocking_block.rs index 3a81261..5a9162c 100644 --- a/src/parser/behavioral_statements/clocking_block.rs +++ b/src/parser/behavioral_statements/clocking_block.rs @@ -8,13 +8,13 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ClockingDeclaration<'a> { Local(ClockingDeclarationLocal<'a>), Global(ClockingDeclarationGlobal<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClockingDeclarationLocal<'a> { pub nodes: ( Option>, @@ -33,7 +33,7 @@ pub struct Default<'a> { pub nodes: (Symbol<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClockingDeclarationGlobal<'a> { pub nodes: ( Symbol<'a>, @@ -46,7 +46,7 @@ pub struct ClockingDeclarationGlobal<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ClockingEvent<'a> { Identifier(ClockingEventIdentifier<'a>), Expression(ClockingEventExpression<'a>), @@ -57,24 +57,24 @@ pub struct ClockingEventIdentifier<'a> { pub nodes: (Symbol<'a>, Identifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClockingEventExpression<'a> { pub nodes: (Symbol<'a>, Paren<'a, EventExpression<'a>>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ClockingItem<'a> { Default(ClockingItemDefault<'a>), Direction(ClockingItemDirection<'a>), Assertion(ClockingItemAssertion<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClockingItemDefault<'a> { pub nodes: (Symbol<'a>, DefaultSkew<'a>, Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClockingItemDirection<'a> { pub nodes: ( ClockingDirection<'a>, @@ -83,34 +83,34 @@ pub struct ClockingItemDirection<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClockingItemAssertion<'a> { pub nodes: (Vec>, AssertionItemDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum DefaultSkew<'a> { Input(DefaultSkewInput<'a>), Output(DefaultSkewOutput<'a>), InputOutput(DefaultSkewInputOutput<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DefaultSkewInput<'a> { pub nodes: (Symbol<'a>, ClockingSkew<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DefaultSkewOutput<'a> { pub nodes: (Symbol<'a>, ClockingSkew<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DefaultSkewInputOutput<'a> { pub nodes: (Symbol<'a>, ClockingSkew<'a>, Symbol<'a>, ClockingSkew<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ClockingDirection<'a> { Input(ClockingDirectionInput<'a>), Output(ClockingDirectionOutput<'a>), @@ -118,17 +118,17 @@ pub enum ClockingDirection<'a> { Inout(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClockingDirectionInput<'a> { pub nodes: (Symbol<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClockingDirectionOutput<'a> { pub nodes: (Symbol<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClockingDirectionInputOutput<'a> { pub nodes: ( Symbol<'a>, @@ -138,28 +138,28 @@ pub struct ClockingDirectionInputOutput<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfClockingDeclAssign<'a> { pub nodes: (List, ClockingDeclAssign<'a>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClockingDeclAssign<'a> { pub nodes: (SignalIdentifier<'a>, Option<(Symbol<'a>, Expression<'a>)>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ClockingSkew<'a> { Edge(ClockingSkewEdge<'a>), DelayControl(DelayControl<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClockingSkewEdge<'a> { pub nodes: (EdgeIdentifier<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClockingDrive<'a> { pub nodes: ( ClockvarExpression<'a>, @@ -169,7 +169,7 @@ pub struct ClockingDrive<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum CycleDelay<'a> { Integral(CycleDelayIntegral<'a>), Identifier(CycleDelayIdentifier<'a>), @@ -186,17 +186,17 @@ pub struct CycleDelayIdentifier<'a> { pub nodes: (Symbol<'a>, Identifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CycleDelayExpression<'a> { pub nodes: (Symbol<'a>, Paren<'a, Expression<'a>>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct Clockvar<'a> { pub nodes: (HierarchicalIdentifier<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClockvarExpression<'a> { pub nodes: (Clockvar<'a>, Select<'a>), } diff --git a/src/parser/behavioral_statements/conditional_statements.rs b/src/parser/behavioral_statements/conditional_statements.rs index 97f1b52..48edf8c 100644 --- a/src/parser/behavioral_statements/conditional_statements.rs +++ b/src/parser/behavioral_statements/conditional_statements.rs @@ -8,7 +8,7 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConditionalStatement<'a> { pub nodes: ( Option>, @@ -32,18 +32,18 @@ pub enum UniquePriority<'a> { Priority(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CondPredicate<'a> { pub nodes: (List, ExpressionOrCondPattern<'a>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ExpressionOrCondPattern<'a> { Expression(Expression<'a>), CondPattern(CondPattern<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CondPattern<'a> { pub nodes: (Expression<'a>, Symbol<'a>, Pattern<'a>), } diff --git a/src/parser/behavioral_statements/continuous_assignment_and_net_alias_statements.rs b/src/parser/behavioral_statements/continuous_assignment_and_net_alias_statements.rs index 6e6f4c8..15d8c42 100644 --- a/src/parser/behavioral_statements/continuous_assignment_and_net_alias_statements.rs +++ b/src/parser/behavioral_statements/continuous_assignment_and_net_alias_statements.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; use nom::branch::*; use nom::combinator::*; @@ -5,13 +6,13 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ContinuousAssign<'a> { Net(ContinuousAssignNet<'a>), Variable(ContinuousAssignVariable<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ContinuousAssignNet<'a> { pub nodes: ( Symbol<'a>, @@ -22,7 +23,7 @@ pub struct ContinuousAssignNet<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ContinuousAssignVariable<'a> { pub nodes: ( Symbol<'a>, @@ -32,17 +33,17 @@ pub struct ContinuousAssignVariable<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfNetAssignments<'a> { pub nodes: (List, NetAssignment<'a>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfVariableAssignments<'a> { pub nodes: (List, VariableAssignment<'a>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NetAlias<'a> { pub nodes: ( Symbol<'a>, @@ -53,7 +54,7 @@ pub struct NetAlias<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NetAssignment<'a> { pub nodes: (NetLvalue<'a>, Symbol<'a>, Expression<'a>), } diff --git a/src/parser/behavioral_statements/looping_statements.rs b/src/parser/behavioral_statements/looping_statements.rs index f0c4fe7..0ed7e8a 100644 --- a/src/parser/behavioral_statements/looping_statements.rs +++ b/src/parser/behavioral_statements/looping_statements.rs @@ -7,7 +7,7 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum LoopStatement<'a> { Forever(LoopStatementForever<'a>), Repeat(LoopStatementRepeat<'a>), @@ -17,22 +17,22 @@ pub enum LoopStatement<'a> { Foreach(LoopStatementForeach<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct LoopStatementForever<'a> { pub nodes: (Symbol<'a>, StatementOrNull<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct LoopStatementRepeat<'a> { pub nodes: (Symbol<'a>, Paren<'a, Expression<'a>>, StatementOrNull<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct LoopStatementWhile<'a> { pub nodes: (Symbol<'a>, Paren<'a, Expression<'a>>, StatementOrNull<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct LoopStatementFor<'a> { pub nodes: ( Symbol<'a>, @@ -50,7 +50,7 @@ pub struct LoopStatementFor<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct LoopStatementDoWhile<'a> { pub nodes: ( Symbol<'a>, @@ -61,7 +61,7 @@ pub struct LoopStatementDoWhile<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct LoopStatementForeach<'a> { pub nodes: ( Symbol<'a>, @@ -76,18 +76,18 @@ pub struct LoopStatementForeach<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ForInitialization<'a> { ListOfVariableAssignments(ListOfVariableAssignments<'a>), Declaration(ForInitializationDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ForInitializationDeclaration<'a> { pub nodes: (List, ForVariableDeclaration<'a>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ForVariableDeclaration<'a> { pub nodes: ( Option>, @@ -101,19 +101,19 @@ pub struct Var<'a> { pub nodes: (Symbol<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ForStep<'a> { pub nodes: (List, ForStepAssignment<'a>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ForStepAssignment<'a> { OperatorAssignment(OperatorAssignment<'a>), IncOrDecExpression(IncOrDecExpression<'a>), FunctionSubroutineCall(FunctionSubroutineCall<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct LoopVariables<'a> { pub nodes: (List, Option>>,), } diff --git a/src/parser/behavioral_statements/parallel_and_sequential_blocks.rs b/src/parser/behavioral_statements/parallel_and_sequential_blocks.rs index d64ad91..d0a79f2 100644 --- a/src/parser/behavioral_statements/parallel_and_sequential_blocks.rs +++ b/src/parser/behavioral_statements/parallel_and_sequential_blocks.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; use nom::branch::*; use nom::combinator::*; @@ -7,18 +8,18 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ActionBlock<'a> { StatementOrNull(StatementOrNull<'a>), Else(ActionBlockElse<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ActionBlockElse<'a> { pub nodes: (Option>, Symbol<'a>, StatementOrNull<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SeqBlock<'a> { pub nodes: ( Symbol<'a>, @@ -30,7 +31,7 @@ pub struct SeqBlock<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ParBlock<'a> { pub nodes: ( Symbol<'a>, @@ -42,7 +43,7 @@ pub struct ParBlock<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum JoinKeyword<'a> { Join(Symbol<'a>), JoinAny(Symbol<'a>), diff --git a/src/parser/behavioral_statements/patterns.rs b/src/parser/behavioral_statements/patterns.rs index 5ba99eb..9a609ab 100644 --- a/src/parser/behavioral_statements/patterns.rs +++ b/src/parser/behavioral_statements/patterns.rs @@ -7,7 +7,7 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum Pattern<'a> { Variable(Box>), Asterisk(Symbol<'a>), @@ -22,23 +22,23 @@ pub struct PatternVariable<'a> { pub nodes: (Symbol<'a>, VariableIdentifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PatternTagged<'a> { pub nodes: (Symbol<'a>, MemberIdentifier<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PatternList<'a> { pub nodes: (ApostropheBrace<'a, List, Pattern<'a>>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PatternIdentifierList<'a> { pub nodes: (ApostropheBrace<'a, List, (MemberIdentifier<'a>, Symbol<'a>, Pattern<'a>)>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum AssignmentPattern<'a> { List(AssignmentPatternList<'a>), Structure(AssignmentPatternStructure<'a>), @@ -46,12 +46,12 @@ pub enum AssignmentPattern<'a> { Repeat(AssignmentPatternRepeat<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct AssignmentPatternList<'a> { pub nodes: (ApostropheBrace<'a, List, Expression<'a>>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct AssignmentPatternStructure<'a> { pub nodes: ( ApostropheBrace< @@ -61,14 +61,14 @@ pub struct AssignmentPatternStructure<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct AssignmentPatternArray<'a> { pub nodes: ( ApostropheBrace<'a, List, (ArrayPatternKey<'a>, Symbol<'a>, Expression<'a>)>>, ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct AssignmentPatternRepeat<'a> { pub nodes: ( ApostropheBrace< @@ -81,25 +81,25 @@ pub struct AssignmentPatternRepeat<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum StructurePatternKey<'a> { MemberIdentifier(MemberIdentifier<'a>), AssignmentPatternKey(AssignmentPatternKey<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ArrayPatternKey<'a> { ConstantExpression(ConstantExpression<'a>), AssignmentPatternKey(AssignmentPatternKey<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum AssignmentPatternKey<'a> { SimpleType(SimpleType<'a>), Default(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct AssignmentPatternExpression<'a> { pub nodes: ( Option>, @@ -107,25 +107,25 @@ pub struct AssignmentPatternExpression<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum AssignmentPatternExpressionType<'a> { PsTypeIdentifier(PsTypeIdentifier<'a>), PsParameterIdentifier(PsParameterIdentifier<'a>), - IntegerAtomType(IntegerAtomType), + IntegerAtomType(IntegerAtomType<'a>), TypeReference(TypeReference<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstantAssignmentPatternExpression<'a> { pub nodes: (AssignmentPatternExpression<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct AssignmentPatternNetLvalue<'a> { pub nodes: (ApostropheBrace<'a, List, NetLvalue<'a>>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct AssignmentPatternVariableLvalue<'a> { pub nodes: (ApostropheBrace<'a, List, VariableLvalue<'a>>>,), } diff --git a/src/parser/behavioral_statements/procedural_blocks_and_assignments.rs b/src/parser/behavioral_statements/procedural_blocks_and_assignments.rs index e650e65..7f708fe 100644 --- a/src/parser/behavioral_statements/procedural_blocks_and_assignments.rs +++ b/src/parser/behavioral_statements/procedural_blocks_and_assignments.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; use nom::branch::*; use nom::combinator::*; @@ -5,17 +6,17 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InitialConstruct<'a> { pub nodes: (Symbol<'a>, StatementOrNull<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct AlwaysConstruct<'a> { pub nodes: (AlwaysKeyword<'a>, Statement<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum AlwaysKeyword<'a> { Always(Symbol<'a>), AlwaysComb(Symbol<'a>), @@ -23,12 +24,12 @@ pub enum AlwaysKeyword<'a> { AlwaysFf(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct FinalConstruct<'a> { pub nodes: (Symbol<'a>, FunctionStatement<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum BlockingAssignment<'a> { Variable(BlockingAssignmentVariable<'a>), NonrangeVariable(BlockingAssignmentNonrangeVariable<'a>), @@ -36,7 +37,7 @@ pub enum BlockingAssignment<'a> { OperatorAssignment(OperatorAssignment<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BlockingAssignmentVariable<'a> { pub nodes: ( VariableLvalue<'a>, @@ -46,12 +47,12 @@ pub struct BlockingAssignmentVariable<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BlockingAssignmentNonrangeVariable<'a> { pub nodes: (NonrangeVariableLvalue<'a>, Symbol<'a>, DynamicArrayNew<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BlockingAssignmentHierarchicalVariable<'a> { pub nodes: ( Option>, @@ -62,17 +63,17 @@ pub struct BlockingAssignmentHierarchicalVariable<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct OperatorAssignment<'a> { pub nodes: (VariableLvalue<'a>, AssignmentOperator<'a>, Expression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct AssignmentOperator<'a> { pub nodes: (Symbol<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NonblockingAssignment<'a> { pub nodes: ( VariableLvalue<'a>, @@ -82,7 +83,7 @@ pub struct NonblockingAssignment<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ProceduralContinuousAssignment<'a> { Assign(ProceduralContinuousAssignmentAssign<'a>), Deassign(ProceduralContinuousAssignmentDeassign<'a>), @@ -92,37 +93,37 @@ pub enum ProceduralContinuousAssignment<'a> { ReleaseNet(ProceduralContinuousAssignmentReleaseNet<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ProceduralContinuousAssignmentAssign<'a> { pub nodes: (Symbol<'a>, VariableAssignment<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ProceduralContinuousAssignmentDeassign<'a> { pub nodes: (Symbol<'a>, VariableLvalue<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ProceduralContinuousAssignmentForceVariable<'a> { pub nodes: (Symbol<'a>, VariableAssignment<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ProceduralContinuousAssignmentForceNet<'a> { pub nodes: (Symbol<'a>, NetAssignment<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ProceduralContinuousAssignmentReleaseVariable<'a> { pub nodes: (Symbol<'a>, VariableLvalue<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ProceduralContinuousAssignmentReleaseNet<'a> { pub nodes: (Symbol<'a>, NetLvalue<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct VariableAssignment<'a> { pub nodes: (VariableLvalue<'a>, Symbol<'a>, Expression<'a>), } diff --git a/src/parser/behavioral_statements/randsequence.rs b/src/parser/behavioral_statements/randsequence.rs index dc3f1f7..6e5e906 100644 --- a/src/parser/behavioral_statements/randsequence.rs +++ b/src/parser/behavioral_statements/randsequence.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; use nom::branch::*; use nom::combinator::*; @@ -7,7 +8,7 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct RandsequenceStatement<'a> { pub nodes: ( Symbol<'a>, @@ -18,7 +19,7 @@ pub struct RandsequenceStatement<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct Production<'a> { pub nodes: ( Option>, @@ -30,7 +31,7 @@ pub struct Production<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct RsRule<'a> { pub nodes: ( RsProductionList<'a>, @@ -38,18 +39,18 @@ pub struct RsRule<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum RsProductionList<'a> { Prod(RsProductionListProd<'a>), Join(RsProductionListJoin<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct RsProductionListProd<'a> { pub nodes: (RsProd<'a>, Vec>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct RsProductionListJoin<'a> { pub nodes: ( Symbol<'a>, @@ -61,24 +62,24 @@ pub struct RsProductionListJoin<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum WeightSpecification<'a> { IntegralNumber(IntegralNumber<'a>), PsIdentifier(PsIdentifier<'a>), Expression(WeightSpecificationExpression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct WeightSpecificationExpression<'a> { pub nodes: (Paren<'a, Expression<'a>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct RsCodeBlock<'a> { pub nodes: (Brace<'a, (Vec>, Vec>)>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum RsProd<'a> { ProductionItem(ProductionItem<'a>), RsCodeBlock(RsCodeBlock<'a>), @@ -87,7 +88,7 @@ pub enum RsProd<'a> { RsCase(RsCase<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ProductionItem<'a> { pub nodes: ( ProductionIdentifier<'a>, @@ -95,7 +96,7 @@ pub struct ProductionItem<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct RsIfElse<'a> { pub nodes: ( Symbol<'a>, @@ -105,12 +106,12 @@ pub struct RsIfElse<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct RsRepeat<'a> { pub nodes: (Symbol<'a>, Paren<'a, Expression<'a>>, ProductionItem<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct RsCase<'a> { pub nodes: ( Symbol<'a>, @@ -121,13 +122,13 @@ pub struct RsCase<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum RsCaseItem<'a> { NonDefault(RsCaseItemNondefault<'a>), Default(RsCaseItemDefault<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct RsCaseItemNondefault<'a> { pub nodes: ( List, CaseItemExpression<'a>>, @@ -137,7 +138,7 @@ pub struct RsCaseItemNondefault<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct RsCaseItemDefault<'a> { pub nodes: ( Symbol<'a>, diff --git a/src/parser/behavioral_statements/statements.rs b/src/parser/behavioral_statements/statements.rs index 7aeee47..002fe3a 100644 --- a/src/parser/behavioral_statements/statements.rs +++ b/src/parser/behavioral_statements/statements.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; use nom::branch::*; use nom::combinator::*; @@ -7,18 +8,18 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum StatementOrNull<'a> { Statement(Statement<'a>), Attribute(StatementOrNullAttribute<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct StatementOrNullAttribute<'a> { pub nodes: (Vec>, Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct Statement<'a> { pub nodes: ( Option<(BlockIdentifier<'a>, Symbol<'a>)>, @@ -27,7 +28,7 @@ pub struct Statement<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum StatementItem<'a> { BlockingAssignment(Box<(BlockingAssignment<'a>, Symbol<'a>)>), NonblockingAssignment(Box<(NonblockingAssignment<'a>, Symbol<'a>)>), @@ -51,23 +52,23 @@ pub enum StatementItem<'a> { ExpectPropertyStatement(Box>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct FunctionStatement<'a> { pub nodes: (Statement<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum FunctionStatementOrNull<'a> { Statement(FunctionStatement<'a>), Attribute(FunctionStatementOrNullAttribute<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct FunctionStatementOrNullAttribute<'a> { pub nodes: (Vec>, Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct VariableIdentifierList<'a> { pub nodes: (List, VariableIdentifier<'a>>,), } diff --git a/src/parser/behavioral_statements/subroutine_call_statements.rs b/src/parser/behavioral_statements/subroutine_call_statements.rs index b197993..c5d9fa3 100644 --- a/src/parser/behavioral_statements/subroutine_call_statements.rs +++ b/src/parser/behavioral_statements/subroutine_call_statements.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; use nom::branch::*; use nom::combinator::*; @@ -6,13 +7,13 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum SubroutineCallStatement<'a> { SubroutineCall((SubroutineCall<'a>, Symbol<'a>)), Function(SubroutineCallStatementFunction<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SubroutineCallStatementFunction<'a> { pub nodes: ( Symbol<'a>, diff --git a/src/parser/behavioral_statements/timing_control_statements.rs b/src/parser/behavioral_statements/timing_control_statements.rs index 6882d58..1ca94ff 100644 --- a/src/parser/behavioral_statements/timing_control_statements.rs +++ b/src/parser/behavioral_statements/timing_control_statements.rs @@ -7,24 +7,24 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ProceduralTimingControlStatement<'a> { pub nodes: (ProceduralTimingControl<'a>, StatementOrNull<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum DelayOrEventControl<'a> { Delay(DelayControl<'a>), Event(EventControl<'a>), Repeat(DelayOrEventControlRepeat<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DelayOrEventControlRepeat<'a> { pub nodes: (Symbol<'a>, Paren<'a, Expression<'a>>, EventControl<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum DelayControl<'a> { Delay(DelayControlDelay<'a>), Mintypmax(DelayControlMintypmax<'a>), @@ -35,12 +35,12 @@ pub struct DelayControlDelay<'a> { pub nodes: (Symbol<'a>, DelayValue<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DelayControlMintypmax<'a> { pub nodes: (Symbol<'a>, Paren<'a, MintypmaxExpression<'a>>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum EventControl<'a> { EventIdentifier(EventControlEventIdentifier<'a>), EventExpression(EventControlEventExpression<'a>), @@ -49,12 +49,12 @@ pub enum EventControl<'a> { SequenceIdentifier(EventControlSequenceIdentifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct EventControlEventIdentifier<'a> { pub nodes: (Symbol<'a>, HierarchicalEventIdentifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct EventControlEventExpression<'a> { pub nodes: (Symbol<'a>, Paren<'a, EventExpression<'a>>), } @@ -69,12 +69,12 @@ pub struct EventControlParenAsterisk<'a> { pub nodes: (Symbol<'a>, Paren<'a, Symbol<'a>>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct EventControlSequenceIdentifier<'a> { pub nodes: (Symbol<'a>, PsOrHierarchicalSequenceIdentifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum EventExpression<'a> { Expression(Box>), Sequence(Box>), @@ -83,7 +83,7 @@ pub enum EventExpression<'a> { Paren(Box>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct EventExpressionExpression<'a> { pub nodes: ( Option>, @@ -92,41 +92,41 @@ pub struct EventExpressionExpression<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct EventExpressionSequence<'a> { pub nodes: (SequenceInstance<'a>, Option<(Symbol<'a>, Expression<'a>)>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct EventExpressionOr<'a> { pub nodes: (EventExpression<'a>, Symbol<'a>, EventExpression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct EventExpressionComma<'a> { pub nodes: (EventExpression<'a>, Symbol<'a>, EventExpression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct EventExpressionParen<'a> { pub nodes: (Paren<'a, EventExpression<'a>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ProceduralTimingControl<'a> { DelayControl(DelayControl<'a>), EventControl(EventControl<'a>), CycleDelay(CycleDelay<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum JumpStatement<'a> { Return(JumpStatementReturn<'a>), Break(JumpStatementBreak<'a>), Continue(JumpStatementContinue<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct JumpStatementReturn<'a> { pub nodes: (Symbol<'a>, Option>, Symbol<'a>), } @@ -141,14 +141,14 @@ pub struct JumpStatementContinue<'a> { pub nodes: (Symbol<'a>, Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum WaitStatement<'a> { Wait(WaitStatementWait<'a>), Fork(WaitStatementFork<'a>), Order(WaitStatementOrder<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct WaitStatementWait<'a> { pub nodes: (Symbol<'a>, Paren<'a, Expression<'a>>, StatementOrNull<'a>), } @@ -158,7 +158,7 @@ pub struct WaitStatementFork<'a> { pub nodes: (Symbol<'a>, Symbol<'a>, Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct WaitStatementOrder<'a> { pub nodes: ( Symbol<'a>, @@ -167,18 +167,18 @@ pub struct WaitStatementOrder<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum EventTrigger<'a> { Named(EventTriggerNamed<'a>), Nonblocking(EventTriggerNonblocking<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct EventTriggerNamed<'a> { pub nodes: (Symbol<'a>, HierarchicalEventIdentifier<'a>, Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct EventTriggerNonblocking<'a> { pub nodes: ( Symbol<'a>, @@ -188,19 +188,19 @@ pub struct EventTriggerNonblocking<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum DisableStatement<'a> { Task(DisableStatementTask<'a>), Block(DisableStatementBlock<'a>), Fork(DisableStatementFork<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DisableStatementTask<'a> { pub nodes: (Symbol<'a>, HierarchicalTaskIdentifier<'a>, Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DisableStatementBlock<'a> { pub nodes: (Symbol<'a>, HierarchicalBlockIdentifier<'a>, Symbol<'a>), } diff --git a/src/parser/declarations/assertion_declarations.rs b/src/parser/declarations/assertion_declarations.rs index d3b7ff5..4aa4a28 100644 --- a/src/parser/declarations/assertion_declarations.rs +++ b/src/parser/declarations/assertion_declarations.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; //use nom::branch::*; //use nom::combinator::*; @@ -6,18 +7,18 @@ use nom::{Err, IResult}; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ConcurrentAssertionItem<'a> { Statement(ConcurrentAssertionItemStatement<'a>), CheckerInstantiation(CheckerInstantiation<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConcurrentAssertionItemStatement<'a> { pub nodes: (Identifier<'a>, ConcurrentAssertionStatement<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ConcurrentAssertionStatement<'a> { AssertProperty(AssertPropertyStatement<'a>), AssumeProperty(AssumePropertyStatement<'a>), @@ -26,27 +27,27 @@ pub enum ConcurrentAssertionStatement<'a> { RestrictProperty(RestrictPropertyStatement<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct AssertPropertyStatement<'a> { pub nodes: (PropertySpec<'a>, ActionBlock<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct AssumePropertyStatement<'a> { pub nodes: (PropertySpec<'a>, ActionBlock<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CoverPropertyStatement<'a> { pub nodes: (PropertySpec<'a>, StatementOrNull<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ExpectPropertyStatement<'a> { pub nodes: (PropertySpec<'a>, ActionBlock<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CoverSequenceStatement<'a> { pub nodes: ( Option>, @@ -56,23 +57,23 @@ pub struct CoverSequenceStatement<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct RestrictPropertyStatement<'a> { pub nodes: (PropertySpec<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyInstance<'a> { pub nodes: (Identifier<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum PropertyListOfArguments<'a> { Ordered(PropertyListOfArgumentsOrdered<'a>), Named(PropertyListOfArgumentsNamed<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyListOfArgumentsOrdered<'a> { pub nodes: ( Vec>, @@ -80,25 +81,25 @@ pub struct PropertyListOfArgumentsOrdered<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyListOfArgumentsNamed<'a> { pub nodes: (Vec<(Identifier<'a>, Option>)>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum PropertyActualArg<'a> { PropertyExpr(PropertyExpr<'a>), SequenceActualArg(SequenceActualArg<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum AssertionItemDeclaration<'a> { PropertyDeclaration(PropertyDeclaration<'a>), SequenceDeclaration(SequenceDeclaration<'a>), LetDeclaration(LetDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyDeclaration<'a> { pub nodes: ( Identifier<'a>, @@ -108,16 +109,16 @@ pub struct PropertyDeclaration<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyPortList<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyPortItem<'a> { pub nodes: ( Vec>, - Option, + Option>, PropertyFormalType<'a>, Identifier<'a>, Vec>, @@ -125,18 +126,18 @@ pub struct PropertyPortItem<'a> { ), } -#[derive(Debug)] -pub enum PropertyLvarPortDirection { - Input, +#[derive(Debug, Node)] +pub enum PropertyLvarPortDirection<'a> { + Input(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum PropertyFormalType<'a> { SequenceFormalType(SequenceFormalType<'a>), - Property, + Property(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertySpec<'a> { pub nodes: ( Option>, @@ -145,7 +146,7 @@ pub struct PropertySpec<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum PropertyExpr<'a> { SequenceExpr(SequenceExpr<'a>), Strong(PropertyExprStrong<'a>), @@ -180,47 +181,47 @@ pub enum PropertyExpr<'a> { ClockingEvent(Box>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprStrong<'a> { pub nodes: (SequenceExpr<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprWeak<'a> { pub nodes: (SequenceExpr<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprParen<'a> { pub nodes: (PropertyExpr<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprNot<'a> { pub nodes: (PropertyExpr<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprOr<'a> { pub nodes: (PropertyExpr<'a>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprAnd<'a> { pub nodes: (PropertyExpr<'a>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprImplicationOverlapped<'a> { pub nodes: (SequenceExpr<'a>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprImplicationNonoverlapped<'a> { pub nodes: (SequenceExpr<'a>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprIf<'a> { pub nodes: ( ExpressionOrDist<'a>, @@ -229,123 +230,123 @@ pub struct PropertyExprIf<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprCase<'a> { pub nodes: (ExpressionOrDist<'a>, Vec>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprFollowedByOverlapped<'a> { pub nodes: (SequenceExpr<'a>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprFollowedByNonoverlapped<'a> { pub nodes: (SequenceExpr<'a>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprNexttime<'a> { pub nodes: (Option>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprSNexttime<'a> { pub nodes: (Option>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprAlways<'a> { pub nodes: (Option>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprSAlways<'a> { pub nodes: (Option>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprEventually<'a> { pub nodes: (ConstantRange<'a>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprSEventually<'a> { pub nodes: (Option>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprUntil<'a> { pub nodes: (PropertyExpr<'a>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprSUntil<'a> { pub nodes: (PropertyExpr<'a>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprUntilWith<'a> { pub nodes: (PropertyExpr<'a>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprSUntilWith<'a> { pub nodes: (PropertyExpr<'a>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprImplies<'a> { pub nodes: (PropertyExpr<'a>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprIff<'a> { pub nodes: (PropertyExpr<'a>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprAcceptOn<'a> { pub nodes: (ExpressionOrDist<'a>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprRejectOn<'a> { pub nodes: (ExpressionOrDist<'a>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprSyncAcceptOn<'a> { pub nodes: (ExpressionOrDist<'a>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprSyncRejectOn<'a> { pub nodes: (ExpressionOrDist<'a>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyExprClockingEvent<'a> { pub nodes: (ClockingEvent<'a>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum PropertyCaseItem<'a> { Nondefault(PropertyCaseItemNondefault<'a>), Default(PropertyCaseItemDefault<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyCaseItemNondefault<'a> { pub nodes: (Vec>, PropertyExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PropertyCaseItemDefault<'a> { pub nodes: (PropertyExpr<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SequenceDeclaration<'a> { pub nodes: ( Identifier<'a>, @@ -356,16 +357,16 @@ pub struct SequenceDeclaration<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SequencePortList<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SequencePortItem<'a> { pub nodes: ( Vec>, - Option, + Option>, SequenceFormalType<'a>, Identifier<'a>, Vec>, @@ -373,21 +374,21 @@ pub struct SequencePortItem<'a> { ), } -#[derive(Debug)] -pub enum SequenceLvarPortDirection { - Input, - Inout, - Output, +#[derive(Debug, Node)] +pub enum SequenceLvarPortDirection<'a> { + Input(Symbol<'a>), + Inout(Symbol<'a>), + Output(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum SequenceFormalType<'a> { DataTypeOrImplicit(DataTypeOrImplicit<'a>), - Sequence, - Untyped, + Sequence(Symbol<'a>), + Untyped(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum SequenceExpr<'a> { CycleDelayExpr(SequenceExprCycleDelayExpr<'a>), ExprCycleDelayExpr(Box>), @@ -403,12 +404,12 @@ pub enum SequenceExpr<'a> { ClockingEvent(Box>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SequenceExprCycleDelayExpr<'a> { pub nodes: (Vec<(CycleDelayRange<'a>, SequenceExpr<'a>)>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SequenceExprExprCycleDelayExpr<'a> { pub nodes: ( SequenceExpr<'a>, @@ -416,17 +417,17 @@ pub struct SequenceExprExprCycleDelayExpr<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SequenceExprExpression<'a> { pub nodes: (ExpressionOrDist<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SequenceExprInstance<'a> { pub nodes: (SequenceInstance<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SequenceExprParen<'a> { pub nodes: ( SequenceExpr<'a>, @@ -435,73 +436,73 @@ pub struct SequenceExprParen<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SequenceExprAnd<'a> { pub nodes: (SequenceExpr<'a>, SequenceExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SequenceExprIntersect<'a> { pub nodes: (SequenceExpr<'a>, SequenceExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SequenceExprOr<'a> { pub nodes: (SequenceExpr<'a>, SequenceExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SequenceExprFirstMatch<'a> { pub nodes: (SequenceExpr<'a>, Vec>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SequenceExprThroughout<'a> { pub nodes: (ExpressionOrDist<'a>, SequenceExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SequenceExprWithin<'a> { pub nodes: (SequenceExpr<'a>, SequenceExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SequenceExprClockingEvent<'a> { pub nodes: (ClockingEvent<'a>, SequenceExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum CycleDelayRange<'a> { ConstantPrimary(ConstantPrimary<'a>), CycleDelayConstRangeExpression(CycleDelayConstRangeExpression<'a>), - Asterisk, - Plus, + Asterisk(Symbol<'a>), + Plus(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SequenceMethodCall<'a> { pub nodes: (SequenceInstance<'a>, Identifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum SequenceMatchItem<'a> { OperatorAssignment(OperatorAssignment<'a>), IncOrDecExpression(IncOrDecExpression<'a>), SubroutineCall(SubroutineCall<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SequenceInstance<'a> { pub nodes: (Identifier<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum SequenceListOfArguments<'a> { Ordered(SequenceListOfArgumentsOrdered<'a>), Named(SequenceListOfArgumentsNamed<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SequenceListOfArgumentsOrdered<'a> { pub nodes: ( Vec>, @@ -509,74 +510,74 @@ pub struct SequenceListOfArgumentsOrdered<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SequenceListOfArgumentsNamed<'a> { pub nodes: (Vec<(Identifier<'a>, Option>)>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum SequenceActualArg<'a> { EventExpression(EventExpression<'a>), SequenceExpr(SequenceExpr<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum BooleanAbbrev<'a> { ConsecutiveRepetition(ConsecutiveRepetition<'a>), NonConsecutiveRepetition(NonConsecutiveRepetition<'a>), GotoRepetition(GotoRepetition<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SequenceAbbrev<'a> { pub nodes: (ConsecutiveRepetition<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ConsecutiveRepetition<'a> { ConstOrRangeExpression(ConstOrRangeExpression<'a>), - Asterisk, - Plus, + Asterisk(Symbol<'a>), + Plus(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NonConsecutiveRepetition<'a> { pub nodes: (ConstOrRangeExpression<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct GotoRepetition<'a> { pub nodes: (ConstOrRangeExpression<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ConstOrRangeExpression<'a> { ConstantExpression(ConstantExpression<'a>), CycleDelayConstRangeExpression(CycleDelayConstRangeExpression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum CycleDelayConstRangeExpression<'a> { Binary(CycleDelayConstRangeExpressionBinary<'a>), Dollar(CycleDelayConstRangeExpressionDollar<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CycleDelayConstRangeExpressionBinary<'a> { pub nodes: (ConstantExpression<'a>, ConstantExpression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CycleDelayConstRangeExpressionDollar<'a> { pub nodes: (ConstantExpression<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ExpressionOrDist<'a> { pub nodes: (Expression<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct AssertionVariableDeclaration<'a> { pub nodes: (VarDataType<'a>, ListOfVariableDeclAssignments<'a>), } diff --git a/src/parser/declarations/block_item_declarations.rs b/src/parser/declarations/block_item_declarations.rs index bd7831e..2c46ef0 100644 --- a/src/parser/declarations/block_item_declarations.rs +++ b/src/parser/declarations/block_item_declarations.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; use nom::branch::*; use nom::multi::*; @@ -5,7 +6,7 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum BlockItemDeclaration<'a> { Data(BlockItemDeclarationData<'a>), LocalParameter(BlockItemDeclarationLocalParameter<'a>), @@ -13,12 +14,12 @@ pub enum BlockItemDeclaration<'a> { Let(BlockItemDeclarationLet<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BlockItemDeclarationData<'a> { pub nodes: (Vec>, DataDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BlockItemDeclarationLocalParameter<'a> { pub nodes: ( Vec>, @@ -27,7 +28,7 @@ pub struct BlockItemDeclarationLocalParameter<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BlockItemDeclarationParameter<'a> { pub nodes: ( Vec>, @@ -36,7 +37,7 @@ pub struct BlockItemDeclarationParameter<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BlockItemDeclarationLet<'a> { pub nodes: (Vec>, LetDeclaration<'a>), } diff --git a/src/parser/declarations/covergroup_declarations.rs b/src/parser/declarations/covergroup_declarations.rs index e8713f9..f62855a 100644 --- a/src/parser/declarations/covergroup_declarations.rs +++ b/src/parser/declarations/covergroup_declarations.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; //use nom::branch::*; //use nom::combinator::*; @@ -6,7 +7,7 @@ use nom::{Err, IResult}; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CovergroupDeclaration<'a> { pub nodes: ( Identifier<'a>, @@ -17,91 +18,91 @@ pub struct CovergroupDeclaration<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum CoverageSpecOrOption<'a> { Spec(CoverageSpecOrOptionSpec<'a>), Option(CoverageSpecOrOptionOption<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CoverageSpecOrOptionSpec<'a> { pub nodes: (Vec>, CoverageSpec<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CoverageSpecOrOptionOption<'a> { pub nodes: (Vec>, CoverageOption<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum CoverageOption<'a> { Option(CoverageOptionOption<'a>), TypeOption(CoverageOptionTypeOption<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CoverageOptionOption<'a> { pub nodes: (Identifier<'a>, Expression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CoverageOptionTypeOption<'a> { pub nodes: (Identifier<'a>, ConstantExpression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum CoverageSpec<'a> { CoverPoint(CoverPoint<'a>), CoverCross(CoverCross<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum CoverageEvent<'a> { ClockingEvent(ClockingEvent<'a>), Sample(CoverageEventSample<'a>), At(CoverageEventAt<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CoverageEventSample<'a> { pub nodes: (Option>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CoverageEventAt<'a> { pub nodes: (BlockEventExpression<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum BlockEventExpression<'a> { Or(Box>), Begin(BlockEventExpressionBegin<'a>), End(BlockEventExpressionEnd<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BlockEventExpressionOr<'a> { pub nodes: (BlockEventExpression<'a>, BlockEventExpression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BlockEventExpressionBegin<'a> { pub nodes: (HierarchicalBtfIdentifier<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BlockEventExpressionEnd<'a> { pub nodes: (HierarchicalBtfIdentifier<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum HierarchicalBtfIdentifier<'a> { Tf(Identifier<'a>), Block(Identifier<'a>), Method(HierarchicalBtfIdentifierMethod<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct HierarchicalBtfIdentifierMethod<'a> { pub nodes: ( Option>, @@ -109,13 +110,13 @@ pub struct HierarchicalBtfIdentifierMethod<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum HierarchicalIdentifierOrClassScope<'a> { HierarchicalIdentifier(HierarchicalIdentifier<'a>), ClassScope(ClassScope<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CoverPoint<'a> { pub nodes: ( Option<(Option>, Identifier<'a>)>, @@ -125,18 +126,18 @@ pub struct CoverPoint<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum BinsOrEmpty<'a> { NonEmpty(BinsOrEmptyNonEmpty<'a>), - Empty, + Empty(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BinsOrEmptyNonEmpty<'a> { pub nodes: (Vec>, Vec>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum BinsOrOptions<'a> { Option(CoverageOption<'a>), Covergroup(BinsOrOptionsCovergroup<'a>), @@ -147,11 +148,11 @@ pub enum BinsOrOptions<'a> { DefaultSequence(BinsOrOptionsDefaultSequence<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BinsOrOptionsCovergroup<'a> { pub nodes: ( - Option, - BinsKeyword, + Option>, + BinsKeyword<'a>, Identifier<'a>, Option>, CovergroupRangeList<'a>, @@ -160,14 +161,16 @@ pub struct BinsOrOptionsCovergroup<'a> { ), } -#[derive(Debug)] -pub struct Wildcard {} +#[derive(Debug, Node)] +pub struct Wildcard<'a> { + pub nodes: (Symbol<'a>,), +} -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BinsOrOptionsCoverPoint<'a> { pub nodes: ( - Option, - BinsKeyword, + Option>, + BinsKeyword<'a>, Identifier<'a>, Option>, Identifier<'a>, @@ -176,11 +179,11 @@ pub struct BinsOrOptionsCoverPoint<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BinsOrOptionsSetCovergroup<'a> { pub nodes: ( - Option, - BinsKeyword, + Option>, + BinsKeyword<'a>, Identifier<'a>, Option>, SetCovergroupExpression<'a>, @@ -188,50 +191,50 @@ pub struct BinsOrOptionsSetCovergroup<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BinsOrOptionsTransList<'a> { pub nodes: ( - Option, - BinsKeyword, + Option>, + BinsKeyword<'a>, Identifier<'a>, TransList<'a>, Option>, ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BinsOrOptionsDefault<'a> { pub nodes: ( - BinsKeyword, + BinsKeyword<'a>, Identifier<'a>, Option>, Option>, ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BinsOrOptionsDefaultSequence<'a> { - pub nodes: (BinsKeyword, Identifier<'a>, Option>), + pub nodes: (BinsKeyword<'a>, Identifier<'a>, Option>), } -#[derive(Debug)] -pub enum BinsKeyword { - Bins, - IllegalBins, - IgnoreBins, +#[derive(Debug, Node)] +pub enum BinsKeyword<'a> { + Bins(Symbol<'a>), + IllegalBins(Symbol<'a>), + IgnoreBins(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TransList<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TransSet<'a> { pub nodes: (TransRangeList<'a>, Vec>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum TransRangeList<'a> { Single(TransItem<'a>), Asterisk(TransRangeListAsterisk<'a>), @@ -239,38 +242,38 @@ pub enum TransRangeList<'a> { Equal(TransRangeListEqual<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TransRangeListAsterisk<'a> { pub nodes: (TransItem<'a>, RepeatRange<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TransRangeListRight<'a> { pub nodes: (TransItem<'a>, RepeatRange<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TransRangeListEqual<'a> { pub nodes: (TransItem<'a>, RepeatRange<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TransItem<'a> { pub nodes: (CovergroupRangeList<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum RepeatRange<'a> { Single(CovergroupExpression<'a>), Binary(RepeatRangeBinary<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct RepeatRangeBinary<'a> { pub nodes: (CovergroupExpression<'a>, CovergroupExpression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CoverCross<'a> { pub nodes: ( Option>, @@ -280,61 +283,61 @@ pub struct CoverCross<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfCrossItems<'a> { pub nodes: (CrossItem<'a>, CrossItem<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum CrossItem<'a> { CoverPointIdentifier(Identifier<'a>), VariableIdentifier(Identifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum CrossBody<'a> { NonEmpty(CrossBodyNonEmpty<'a>), - Empty, + Empty(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CrossBodyNonEmpty<'a> { pub nodes: (Vec>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum CrossBodyItem<'a> { FunctionDeclaration(FunctionDeclaration<'a>), BinsSelectionOrOption(BinsSelectionOrOption<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum BinsSelectionOrOption<'a> { Coverage(BinsSelectionOrOptionCoverage<'a>), Bins(BinsSelectionOrOptionBins<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BinsSelectionOrOptionCoverage<'a> { pub nodes: (Vec>, CoverageOption<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BinsSelectionOrOptionBins<'a> { pub nodes: (Vec>, BinsSelection<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BinsSelection<'a> { pub nodes: ( - BinsKeyword, + BinsKeyword<'a>, Identifier<'a>, SelectExpression<'a>, Option>, ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum SelectExpression<'a> { SelectCondition(SelectCondition<'a>), Not(SelectExpressionNot<'a>), @@ -346,27 +349,27 @@ pub enum SelectExpression<'a> { CrossSet(SelectExpressionCrossSet<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SelectExpressionNot<'a> { pub nodes: (SelectCondition<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SelectExpressionAnd<'a> { pub nodes: (SelectExpression<'a>, SelectExpression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SelectExpressionOr<'a> { pub nodes: (SelectExpression<'a>, SelectExpression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SelectExpressionParen<'a> { pub nodes: (SelectExpression<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SelectExpressionWith<'a> { pub nodes: ( SelectExpression<'a>, @@ -375,7 +378,7 @@ pub struct SelectExpressionWith<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SelectExpressionCrossSet<'a> { pub nodes: ( CrossSetExpression<'a>, @@ -383,59 +386,59 @@ pub struct SelectExpressionCrossSet<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SelectCondition<'a> { pub nodes: (BinsExpression<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum BinsExpression<'a> { VariableIdentifier(Identifier<'a>), CoverPoint(BinsExpressionCoverPoint<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BinsExpressionCoverPoint<'a> { pub nodes: (Identifier<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CovergroupRangeList<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum CovergroupValueRange<'a> { Single(CovergroupExpression<'a>), Binary(CovergroupValueRangeBinary<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CovergroupValueRangeBinary<'a> { pub nodes: (CovergroupExpression<'a>, CovergroupExpression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct WithCovergroupExpression<'a> { pub nodes: (CovergroupExpression<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SetCovergroupExpression<'a> { pub nodes: (CovergroupExpression<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct IntegerCovergroupExpression<'a> { pub nodes: (CovergroupExpression<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CrossSetExpression<'a> { pub nodes: (CovergroupExpression<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CovergroupExpression<'a> { pub nodes: (Expression<'a>,), } diff --git a/src/parser/declarations/declaration_assignments.rs b/src/parser/declarations/declaration_assignments.rs index 1a18d02..6a7cc78 100644 --- a/src/parser/declarations/declaration_assignments.rs +++ b/src/parser/declarations/declaration_assignments.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; //use nom::branch::*; //use nom::combinator::*; @@ -6,17 +7,17 @@ use nom::{Err, IResult}; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DefparamAssignment<'a> { pub nodes: (HierarchicalIdentifier<'a>, ConstantMintypmaxExpression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NetDeclAssignment<'a> { pub nodes: (Identifier<'a>, Vec>, Expression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ParamAssignment<'a> { pub nodes: ( Identifier<'a>, @@ -25,23 +26,23 @@ pub struct ParamAssignment<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum SpecparamAssignment<'a> { Mintypmax(SpecparamAssignmentMintypmax<'a>), PulseControl(PulseControlSpecparam<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SpecparamAssignmentMintypmax<'a> { pub nodes: (Identifier<'a>, ConstantMintypmaxExpression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TypeAssignment<'a> { pub nodes: (Identifier<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PulseControlSpecparam<'a> { pub nodes: ( Option<( @@ -53,29 +54,29 @@ pub struct PulseControlSpecparam<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ErrorLimitValue<'a> { pub nodes: (LimitValue<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct RejectLimitValue<'a> { pub nodes: (LimitValue<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct LimitValue<'a> { pub nodes: (ConstantMintypmaxExpression<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum VariableDeclAssignment<'a> { Variable(VariableDeclAssignmentVariable<'a>), DynamicArray(VariableDeclAssignmentDynamicArray<'a>), Class(VariableDeclAssignmentClass<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct VariableDeclAssignmentVariable<'a> { pub nodes: ( Identifier<'a>, @@ -84,33 +85,33 @@ pub struct VariableDeclAssignmentVariable<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct VariableDeclAssignmentDynamicArray<'a> { pub nodes: ( Identifier<'a>, - UnsizedDimension, + UnsizedDimension<'a>, Vec>, Option>, ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct VariableDeclAssignmentClass<'a> { pub nodes: (Identifier<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ClassNew<'a> { Argument(ClassNewArgument<'a>), Expression(Expression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClassNewArgument<'a> { pub nodes: (Option>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DynamicArrayNew<'a> { pub nodes: (Expression<'a>, Option>), } diff --git a/src/parser/declarations/declaration_lists.rs b/src/parser/declarations/declaration_lists.rs index 77e0622..dd5f574 100644 --- a/src/parser/declarations/declaration_lists.rs +++ b/src/parser/declarations/declaration_lists.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; //use nom::branch::*; //use nom::combinator::*; @@ -6,47 +7,47 @@ use nom::{Err, IResult}; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfDefparamAssignments<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfGenvarIdentifiers<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfInterfaceIdentifiers<'a> { pub nodes: (Vec<(Identifier<'a>, Vec>)>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfNetDeclAssignments<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfParamAssignments<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfPortIdentifiers<'a> { pub nodes: (Vec<(Identifier<'a>, Vec>)>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfUdpPortIdentifiers<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfSpecparamAssignments<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfTfVariableIdentifiers<'a> { pub nodes: ( Vec<( @@ -57,22 +58,22 @@ pub struct ListOfTfVariableIdentifiers<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfTypeAssignments<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfVariableDeclAssignments<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfVariableIdentifiers<'a> { pub nodes: (Vec<(Identifier<'a>, Vec>)>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfVariablePortIdentifiers<'a> { pub nodes: ( Vec<( diff --git a/src/parser/declarations/declaration_ranges.rs b/src/parser/declarations/declaration_ranges.rs index 9c6214f..2b6626d 100644 --- a/src/parser/declarations/declaration_ranges.rs +++ b/src/parser/declarations/declaration_ranges.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; //use nom::branch::*; //use nom::combinator::*; @@ -6,40 +7,40 @@ use nom::{Err, IResult}; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum UnpackedDimension<'a> { Range(ConstantRange<'a>), Expression(ConstantExpression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum PackedDimension<'a> { Range(ConstantRange<'a>), - Unsized(UnsizedDimension), + Unsized(UnsizedDimension<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum AssociativeDimension<'a> { DataType(DataType<'a>), - Asterisk, + Asterisk(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum VariableDimension<'a> { - Unsized(UnsizedDimension), + Unsized(UnsizedDimension<'a>), Unpacked(UnpackedDimension<'a>), Associative(AssociativeDimension<'a>), Queue(QueueDimension<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct QueueDimension<'a> { pub nodes: (Option>,), } -#[derive(Debug)] -pub struct UnsizedDimension { - pub nodes: (), +#[derive(Debug, Node)] +pub struct UnsizedDimension<'a> { + pub nodes: (Symbol<'a>,), } // ----------------------------------------------------------------------------- diff --git a/src/parser/declarations/delays.rs b/src/parser/declarations/delays.rs index a7c6ac2..9d68b8b 100644 --- a/src/parser/declarations/delays.rs +++ b/src/parser/declarations/delays.rs @@ -7,7 +7,7 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum Delay3<'a> { Single(Delay3Single<'a>), Mintypmax(Delay3Mintypmax<'a>), @@ -18,7 +18,7 @@ pub struct Delay3Single<'a> { pub nodes: (Symbol<'a>, DelayValue<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct Delay3Mintypmax<'a> { pub nodes: ( Symbol<'a>, @@ -36,7 +36,7 @@ pub struct Delay3Mintypmax<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum Delay2<'a> { Single(Delay2Single<'a>), Mintypmax(Delay2Mintypmax<'a>), @@ -47,7 +47,7 @@ pub struct Delay2Single<'a> { pub nodes: (Symbol<'a>, DelayValue<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct Delay2Mintypmax<'a> { pub nodes: ( Symbol<'a>, diff --git a/src/parser/declarations/function_declarations.rs b/src/parser/declarations/function_declarations.rs index f923bd0..6463c42 100644 --- a/src/parser/declarations/function_declarations.rs +++ b/src/parser/declarations/function_declarations.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; //use nom::branch::*; //use nom::combinator::*; @@ -6,24 +7,24 @@ use nom::{Err, IResult}; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum FunctionDataTypeOrImplicit<'a> { DataType(DataTypeOrVoid<'a>), Implicit(ImplicitDataType<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct FunctionDeclaration<'a> { pub nodes: (Option>, FunctionBodyDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum FunctionBodyDeclaration<'a> { WithoutPort(FunctionBodyDeclarationWithoutPort<'a>), WithPort(FunctionBodyDeclarationWithPort<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct FunctionBodyDeclarationWithoutPort<'a> { pub nodes: ( FunctionDataTypeOrImplicit<'a>, @@ -35,7 +36,7 @@ pub struct FunctionBodyDeclarationWithoutPort<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct FunctionBodyDeclarationWithPort<'a> { pub nodes: ( FunctionDataTypeOrImplicit<'a>, @@ -48,12 +49,12 @@ pub struct FunctionBodyDeclarationWithPort<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct FunctionPrototype<'a> { pub nodes: (DataTypeOrVoid<'a>, Identifier<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum DpiImportExport<'a> { ImportFunction(DpiImportExportImportFunction<'a>), ImportTask(DpiImportExportImportTask<'a>), @@ -61,59 +62,59 @@ pub enum DpiImportExport<'a> { ExportTask(DpiImportExportExportTask<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DpiImportExportImportFunction<'a> { pub nodes: ( - DpiSpecString, - Option, + DpiSpecString<'a>, + Option>, Option>, DpiFunctionProto<'a>, ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DpiImportExportImportTask<'a> { pub nodes: ( - DpiSpecString, - Option, + DpiSpecString<'a>, + Option>, Option>, DpiTaskProto<'a>, ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DpiImportExportExportFunction<'a> { - pub nodes: (DpiSpecString, Option>, Identifier<'a>), + pub nodes: (DpiSpecString<'a>, Option>, Identifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DpiImportExportExportTask<'a> { - pub nodes: (DpiSpecString, Option>, Identifier<'a>), + pub nodes: (DpiSpecString<'a>, Option>, Identifier<'a>), } -#[derive(Debug)] -pub enum DpiSpecString { - DpiC, - Dpi, +#[derive(Debug, Node)] +pub enum DpiSpecString<'a> { + DpiC(Symbol<'a>), + Dpi(Symbol<'a>), } -#[derive(Debug)] -pub enum DpiFunctionImportProperty { - Context, - Pure, +#[derive(Debug, Node)] +pub enum DpiFunctionImportProperty<'a> { + Context(Symbol<'a>), + Pure(Symbol<'a>), } -#[derive(Debug)] -pub enum DpiTaskImportProperty { - Context, +#[derive(Debug, Node)] +pub enum DpiTaskImportProperty<'a> { + Context(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DpiFunctionProto<'a> { pub nodes: (FunctionPrototype<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DpiTaskProto<'a> { pub nodes: (TaskPrototype<'a>,), } diff --git a/src/parser/declarations/interface_declarations.rs b/src/parser/declarations/interface_declarations.rs index 54f7192..0b1b231 100644 --- a/src/parser/declarations/interface_declarations.rs +++ b/src/parser/declarations/interface_declarations.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; //use nom::branch::*; //use nom::combinator::*; @@ -6,24 +7,24 @@ use nom::{Err, IResult}; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModportDeclaration<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModportItem<'a> { pub nodes: (Identifier<'a>, Vec>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ModportPortsDeclaraton<'a> { Simple(ModportPortsDeclaratonSimple<'a>), Tf(ModportPortsDeclaratonTf<'a>), Clocing(ModportPortsDeclaratonClocking<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModportPortsDeclaratonSimple<'a> { pub nodes: ( Vec>, @@ -31,57 +32,57 @@ pub struct ModportPortsDeclaratonSimple<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModportPortsDeclaratonTf<'a> { pub nodes: (Vec>, ModportTfPortsDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModportPortsDeclaratonClocking<'a> { pub nodes: (Vec>, ModportClockingDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModportClockingDeclaration<'a> { pub nodes: (Identifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModportSimplePortsDeclaration<'a> { - pub nodes: (PortDirection, Vec>), + pub nodes: (PortDirection<'a>, Vec>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ModportSimplePort<'a> { Ordered(ModportSimplePortOrdered<'a>), Named(ModportSimplePortNamed<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModportSimplePortOrdered<'a> { pub nodes: (Identifier<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModportSimplePortNamed<'a> { pub nodes: (Identifier<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModportTfPortsDeclaration<'a> { - pub nodes: (ImportExport, Vec>), + pub nodes: (ImportExport<'a>, Vec>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ModportTfPort<'a> { Prototype(MethodPrototype<'a>), Identifier(Identifier<'a>), } -#[derive(Debug)] -pub enum ImportExport { - Import, - Export, +#[derive(Debug, Node)] +pub enum ImportExport<'a> { + Import(Symbol<'a>), + Export(Symbol<'a>), } // ----------------------------------------------------------------------------- diff --git a/src/parser/declarations/let_declarations.rs b/src/parser/declarations/let_declarations.rs index dd0190a..0a6e206 100644 --- a/src/parser/declarations/let_declarations.rs +++ b/src/parser/declarations/let_declarations.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; //use nom::branch::*; //use nom::combinator::*; @@ -6,22 +7,22 @@ use nom::{Err, IResult}; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct LetDeclaration<'a> { pub nodes: (LetIdentifier<'a>, Option>, Expression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct LetIdentifier<'a> { pub nodes: (Identifier<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct LetPortList<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct LetPortItem<'a> { pub nodes: ( Vec>, @@ -32,13 +33,13 @@ pub struct LetPortItem<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum LetFormalType<'a> { DataTypeOrImplicit(DataTypeOrImplicit<'a>), - Untyped, + Untyped(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct LetExpression<'a> { pub nodes: ( Option>, @@ -47,13 +48,13 @@ pub struct LetExpression<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum LetListOfArguments<'a> { Ordered(LetListOfArgumentsOrdered<'a>), Named(LetListOfArgumentsNamed<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct LetListOfArgumentsOrdered<'a> { pub nodes: ( Vec>, @@ -61,12 +62,12 @@ pub struct LetListOfArgumentsOrdered<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct LetListOfArgumentsNamed<'a> { pub nodes: (Vec<(Identifier<'a>, LetActualArg<'a>)>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct LetActualArg<'a> { pub nodes: (Expression<'a>,), } diff --git a/src/parser/declarations/module_parameter_declarations.rs b/src/parser/declarations/module_parameter_declarations.rs index f38aebe..22adadd 100644 --- a/src/parser/declarations/module_parameter_declarations.rs +++ b/src/parser/declarations/module_parameter_declarations.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; use nom::branch::*; use nom::combinator::*; @@ -5,13 +6,13 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum LocalParameterDeclaration<'a> { Param(LocalParameterDeclarationParam<'a>), Type(LocalParameterDeclarationType<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct LocalParameterDeclarationParam<'a> { pub nodes: ( Symbol<'a>, @@ -20,18 +21,18 @@ pub struct LocalParameterDeclarationParam<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct LocalParameterDeclarationType<'a> { pub nodes: (Symbol<'a>, Symbol<'a>, ListOfTypeAssignments<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ParameterDeclaration<'a> { Param(ParameterDeclarationParam<'a>), Type(ParameterDeclarationType<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ParameterDeclarationParam<'a> { pub nodes: ( Symbol<'a>, @@ -40,12 +41,12 @@ pub struct ParameterDeclarationParam<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ParameterDeclarationType<'a> { pub nodes: (Symbol<'a>, Symbol<'a>, ListOfTypeAssignments<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SpecparamDeclaration<'a> { pub nodes: ( Symbol<'a>, diff --git a/src/parser/declarations/net_and_variable_types.rs b/src/parser/declarations/net_and_variable_types.rs index cac4d41..b64b83b 100644 --- a/src/parser/declarations/net_and_variable_types.rs +++ b/src/parser/declarations/net_and_variable_types.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; //use nom::branch::*; //use nom::combinator::*; @@ -6,55 +7,61 @@ use nom::{Err, IResult}; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum CastingType<'a> { SimpleType(Box>), ConstantPrimary(Box>), - Signing(Box), - String, - Const, + Signing(Box>), + String(Symbol<'a>), + Const(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum DataType<'a> { Vector(DataTypeVector<'a>), - Atom(DataTypeAtom), - NonIntegerType(NonIntegerType), + Atom(DataTypeAtom<'a>), + NonIntegerType(NonIntegerType<'a>), Union(DataTypeUnion<'a>), Enum(DataTypeEnum<'a>), - String, - Chandle, + String(Symbol<'a>), + Chandle(Symbol<'a>), Virtual(DataTypeVirtual<'a>), Type(DataTypeType<'a>), ClassType(ClassType<'a>), - Event, + Event(Symbol<'a>), PsCovergroupIdentifier(PsCovergroupIdentifier<'a>), TypeReference(Box>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DataTypeVector<'a> { - pub nodes: (IntegerVectorType, Option, Vec>), + pub nodes: ( + IntegerVectorType<'a>, + Option>, + Vec>, + ), } -#[derive(Debug)] -pub struct DataTypeAtom { - pub nodes: (IntegerAtomType, Option), +#[derive(Debug, Node)] +pub struct DataTypeAtom<'a> { + pub nodes: (IntegerAtomType<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DataTypeUnion<'a> { pub nodes: ( - StructUnion, - Option<(Packed, Option)>, + StructUnion<'a>, + Option<(Packed<'a>, Option>)>, Vec>, ), } -#[derive(Debug)] -pub struct Packed {} +#[derive(Debug, Node)] +pub struct Packed<'a> { + pub nodes: (Symbol<'a>,), +} -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DataTypeEnum<'a> { pub nodes: ( Option>, @@ -63,20 +70,22 @@ pub struct DataTypeEnum<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DataTypeVirtual<'a> { pub nodes: ( - Option, + Option>, InterfaceIdentifier<'a>, Option>, Option>, ), } -#[derive(Debug)] -pub struct Interface {} +#[derive(Debug, Node)] +pub struct Interface<'a> { + pub nodes: (Symbol<'a>,), +} -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DataTypeType<'a> { pub nodes: ( Option>, @@ -85,44 +94,44 @@ pub struct DataTypeType<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum DataTypeOrImplicit<'a> { DataType(DataType<'a>), ImplicitDataType(ImplicitDataType<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ImplicitDataType<'a> { - pub nodes: (Option, Vec>), + pub nodes: (Option>, Vec>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum EnumBaseType<'a> { - Atom(EnumBaseTypeAtom), + Atom(EnumBaseTypeAtom<'a>), Vector(EnumBaseTypeVector<'a>), Type(EnumBaseTypeType<'a>), } -#[derive(Debug)] -pub struct EnumBaseTypeAtom { - pub nodes: (IntegerAtomType, Option), +#[derive(Debug, Node)] +pub struct EnumBaseTypeAtom<'a> { + pub nodes: (IntegerAtomType<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct EnumBaseTypeVector<'a> { pub nodes: ( - IntegerVectorType, - Option, + IntegerVectorType<'a>, + Option>, Option>, ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct EnumBaseTypeType<'a> { pub nodes: (Identifier<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct EnumNameDeclaration<'a> { pub nodes: ( Identifier<'a>, @@ -131,12 +140,12 @@ pub struct EnumNameDeclaration<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClassScope<'a> { pub nodes: (ClassType<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClassType<'a> { pub nodes: ( Identifier<'a>, @@ -145,37 +154,37 @@ pub struct ClassType<'a> { ), } -#[derive(Debug)] -pub enum IntegerType { - Vector(IntegerVectorType), - Atom(IntegerAtomType), +#[derive(Debug, Node)] +pub enum IntegerType<'a> { + Vector(IntegerVectorType<'a>), + Atom(IntegerAtomType<'a>), } -#[derive(Debug)] -pub enum IntegerAtomType { - Byte, - Shortint, - Int, - Longint, - Integer, - Time, +#[derive(Debug, Node)] +pub enum IntegerAtomType<'a> { + Byte(Symbol<'a>), + Shortint(Symbol<'a>), + Int(Symbol<'a>), + Longint(Symbol<'a>), + Integer(Symbol<'a>), + Time(Symbol<'a>), } -#[derive(Debug)] -pub enum IntegerVectorType { - Bit, - Logic, - Reg, +#[derive(Debug, Node)] +pub enum IntegerVectorType<'a> { + Bit(Symbol<'a>), + Logic(Symbol<'a>), + Reg(Symbol<'a>), } -#[derive(Debug)] -pub enum NonIntegerType { - Shortreal, - Real, - Realtime, +#[derive(Debug, Node)] +pub enum NonIntegerType<'a> { + Shortreal(Symbol<'a>), + Real(Symbol<'a>), + Realtime(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum NetType<'a> { Supply0(Symbol<'a>), Supply1(Symbol<'a>), @@ -191,67 +200,67 @@ pub enum NetType<'a> { Wor(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum NetPortType<'a> { DataType(NetPortTypeDataType<'a>), NetType(Identifier<'a>), Interconnect(ImplicitDataType<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NetPortTypeDataType<'a> { pub nodes: (Option>, DataTypeOrImplicit<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct VariablePortType<'a> { pub nodes: (VarDataType<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum VarDataType<'a> { DataType(DataType<'a>), DataTypeOrImplicit(DataTypeOrImplicit<'a>), } -#[derive(Debug)] -pub enum Signing { - Signed, - Unsigned, +#[derive(Debug, Node)] +pub enum Signing<'a> { + Signed(Symbol<'a>), + Unsigned(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum SimpleType<'a> { - IntegerType(IntegerType), - NonNonIntegerType(IntegerType), + IntegerType(IntegerType<'a>), + NonNonIntegerType(IntegerType<'a>), TypeIdentifier(Identifier<'a>), ParameterIdentifier(Identifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct StructUnionMember<'a> { pub nodes: ( Vec>, - Option, + Option>, DataTypeOrVoid<'a>, ListOfVariableDeclAssignments<'a>, ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum DataTypeOrVoid<'a> { DataType(DataType<'a>), - Void, + Void(Symbol<'a>), } -#[derive(Debug)] -pub enum StructUnion { - Struct, - Union, - UnionTagged, +#[derive(Debug, Node)] +pub enum StructUnion<'a> { + Struct(Symbol<'a>), + Union(Symbol<'a>), + UnionTagged(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum TypeReference<'a> { Expression(Expression<'a>), DataType(DataType<'a>), diff --git a/src/parser/declarations/port_declarations.rs b/src/parser/declarations/port_declarations.rs index 5aa7344..9814fbc 100644 --- a/src/parser/declarations/port_declarations.rs +++ b/src/parser/declarations/port_declarations.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; use nom::branch::*; use nom::combinator::*; @@ -6,23 +7,23 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InoutDeclaration<'a> { pub nodes: (Symbol<'a>, NetPortType<'a>, ListOfPortIdentifiers<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum InputDeclaration<'a> { Net(InputDeclarationNet<'a>), Variable(InputDeclarationVariable<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InputDeclarationNet<'a> { pub nodes: (Symbol<'a>, NetPortType<'a>, ListOfPortIdentifiers<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InputDeclarationVariable<'a> { pub nodes: ( Symbol<'a>, @@ -31,18 +32,18 @@ pub struct InputDeclarationVariable<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum OutputDeclaration<'a> { Net(OutputDeclarationNet<'a>), Variable(OutputDeclarationVariable<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct OutputDeclarationNet<'a> { pub nodes: (Symbol<'a>, NetPortType<'a>, ListOfPortIdentifiers<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct OutputDeclarationVariable<'a> { pub nodes: ( Symbol<'a>, @@ -51,7 +52,7 @@ pub struct OutputDeclarationVariable<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InterfacePortDeclaration<'a> { pub nodes: ( InterfaceIdentifier<'a>, @@ -60,7 +61,7 @@ pub struct InterfacePortDeclaration<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct RefDeclaration<'a> { pub nodes: ( Symbol<'a>, diff --git a/src/parser/declarations/task_declarations.rs b/src/parser/declarations/task_declarations.rs index b2d9c63..bacb6ab 100644 --- a/src/parser/declarations/task_declarations.rs +++ b/src/parser/declarations/task_declarations.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; //use nom::branch::*; //use nom::combinator::*; @@ -6,18 +7,18 @@ use nom::{Err, IResult}; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TaskDeclaration<'a> { pub nodes: (Option>, TaskBodyDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum TaskBodyDeclaration<'a> { WithoutPort(TaskBodyDeclarationWithoutPort<'a>), WithPort(TaskBodyDeclarationWithPort<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TaskBodyDeclarationWithoutPort<'a> { pub nodes: ( Option>, @@ -28,7 +29,7 @@ pub struct TaskBodyDeclarationWithoutPort<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TaskBodyDeclarationWithPort<'a> { pub nodes: ( Option>, @@ -40,28 +41,28 @@ pub struct TaskBodyDeclarationWithPort<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum InterfaceIdentifierOrClassScope<'a> { InterfaceIdentifier(InterfaceIdentifier<'a>), ClassScope(ClassScope<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum TfItemDeclaration<'a> { Block(BlockItemDeclaration<'a>), Port(TfPortDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TfPortList<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TfPortItem<'a> { pub nodes: ( Vec>, - Option, + Option>, Option>, DataTypeOrImplicit<'a>, Option<( @@ -72,24 +73,24 @@ pub struct TfPortItem<'a> { ), } -#[derive(Debug)] -pub enum TfPortDirection { - PortDirection(PortDirection), - ConstRef, +#[derive(Debug, Node)] +pub enum TfPortDirection<'a> { + PortDirection(PortDirection<'a>), + ConstRef(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TfPortDeclaration<'a> { pub nodes: ( Vec>, - TfPortDirection, + TfPortDirection<'a>, Option>, DataTypeOrImplicit<'a>, ListOfTfVariableIdentifiers<'a>, ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TaskPrototype<'a> { pub nodes: (Identifier<'a>, Option>), } diff --git a/src/parser/declarations/type_declarations.rs b/src/parser/declarations/type_declarations.rs index ff17208..adb5c30 100644 --- a/src/parser/declarations/type_declarations.rs +++ b/src/parser/declarations/type_declarations.rs @@ -8,7 +8,7 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum DataDeclaration<'a> { Variable(DataDeclarationVariable<'a>), TypeDeclaration(TypeDeclaration<'a>), @@ -16,7 +16,7 @@ pub enum DataDeclaration<'a> { NetTypeDeclaration(NetTypeDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DataDeclarationVariable<'a> { pub nodes: ( Option>, @@ -33,7 +33,7 @@ pub struct Const<'a> { pub nodes: (Symbol<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PackageImportDeclaration<'a> { pub nodes: ( Symbol<'a>, @@ -78,19 +78,19 @@ pub struct PackageExportDeclarationItem<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct GenvarDeclaration<'a> { pub nodes: (Symbol<'a>, ListOfGenvarIdentifiers<'a>, Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum NetDeclaration<'a> { NetType(NetDeclarationNetType<'a>), NetTypeIdentifier(NetDeclarationNetTypeIdentifier<'a>), Interconnect(NetDeclarationInterconnect<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NetDeclarationNetType<'a> { pub nodes: ( NetType<'a>, @@ -103,7 +103,7 @@ pub struct NetDeclarationNetType<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum Strength<'a> { Drive(DriveStrength<'a>), Charge(ChargeStrength<'a>), @@ -115,7 +115,7 @@ pub enum VectorScalar<'a> { Scalared(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NetDeclarationNetTypeIdentifier<'a> { pub nodes: ( NetTypeIdentifier<'a>, @@ -125,7 +125,7 @@ pub struct NetDeclarationNetTypeIdentifier<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NetDeclarationInterconnect<'a> { pub nodes: ( Symbol<'a>, @@ -138,14 +138,14 @@ pub struct NetDeclarationInterconnect<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum TypeDeclaration<'a> { DataType(TypeDeclarationDataType<'a>), Interface(TypeDeclarationInterface<'a>), Reserved(TypeDeclarationReserved<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TypeDeclarationDataType<'a> { pub nodes: ( Symbol<'a>, @@ -156,7 +156,7 @@ pub struct TypeDeclarationDataType<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TypeDeclarationInterface<'a> { pub nodes: ( Symbol<'a>, @@ -169,7 +169,7 @@ pub struct TypeDeclarationInterface<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TypeDeclarationReserved<'a> { pub nodes: ( Symbol<'a>, @@ -188,13 +188,13 @@ pub enum TypeDeclarationKeyword<'a> { InterfaceClass((Symbol<'a>, Symbol<'a>)), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum NetTypeDeclaration<'a> { DataType(NetTypeDeclarationDataType<'a>), NetType(NetTypeDeclarationNetType<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NetTypeDeclarationDataType<'a> { pub nodes: ( Symbol<'a>, @@ -209,7 +209,7 @@ pub struct NetTypeDeclarationDataType<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NetTypeDeclarationNetType<'a> { pub nodes: ( Symbol<'a>, diff --git a/src/parser/expressions/concatenations.rs b/src/parser/expressions/concatenations.rs index d5d5848..b57a765 100644 --- a/src/parser/expressions/concatenations.rs +++ b/src/parser/expressions/concatenations.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; use nom::branch::*; use nom::combinator::*; @@ -6,37 +7,37 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct Concatenation<'a> { pub nodes: (Brace<'a, List, Expression<'a>>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstantConcatenation<'a> { pub nodes: (Brace<'a, List, ConstantExpression<'a>>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstantMultipleConcatenation<'a> { pub nodes: (Brace<'a, (ConstantExpression<'a>, ConstantConcatenation<'a>)>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModulePathConcatenation<'a> { pub nodes: (Brace<'a, List, ModulePathExpression<'a>>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModulePathMultipleConcatenation<'a> { pub nodes: (Brace<'a, (ConstantExpression<'a>, ModulePathConcatenation<'a>)>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct MultipleConcatenation<'a> { pub nodes: (Brace<'a, (Expression<'a>, Concatenation<'a>)>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct StreamingConcatenation<'a> { pub nodes: ( Brace< @@ -50,23 +51,23 @@ pub struct StreamingConcatenation<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct StreamOperator<'a> { pub nodes: (Symbol<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum SliceSize<'a> { SimpleType(SimpleType<'a>), ConstantExpression(ConstantExpression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct StreamConcatenation<'a> { pub nodes: (Brace<'a, List, StreamExpression<'a>>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct StreamExpression<'a> { pub nodes: ( Expression<'a>, @@ -74,7 +75,7 @@ pub struct StreamExpression<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ArrayRangeExpression<'a> { Expression(Expression<'a>), Colon(ArrayRangeExpressionColon<'a>), @@ -82,22 +83,22 @@ pub enum ArrayRangeExpression<'a> { MinusColon(ArrayRangeExpressionMinusColon<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ArrayRangeExpressionColon<'a> { pub nodes: (Expression<'a>, Symbol<'a>, Expression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ArrayRangeExpressionPlusColon<'a> { pub nodes: (Expression<'a>, Symbol<'a>, Expression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ArrayRangeExpressionMinusColon<'a> { pub nodes: (Expression<'a>, Symbol<'a>, Expression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct EmptyUnpackedArrayConcatenation<'a> { pub nodes: (Symbol<'a>, Symbol<'a>), } diff --git a/src/parser/expressions/expression_leftside_values.rs b/src/parser/expressions/expression_leftside_values.rs index e8156a0..4d60e15 100644 --- a/src/parser/expressions/expression_leftside_values.rs +++ b/src/parser/expressions/expression_leftside_values.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; use nom::branch::*; use nom::combinator::*; @@ -5,24 +6,24 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum NetLvalue<'a> { Identifier(NetLvalueIdentifier<'a>), Lvalue(Box>), Pattern(Box>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NetLvalueIdentifier<'a> { pub nodes: (PsOrHierarchicalNetIdentifier<'a>, ConstantSelect<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NetLvalueLvalue<'a> { pub nodes: (Brace<'a, List, NetLvalue<'a>>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NetLvaluePattern<'a> { pub nodes: ( Option>, @@ -30,7 +31,7 @@ pub struct NetLvaluePattern<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum VariableLvalue<'a> { Identifier(VariableLvalueIdentifier<'a>), Lvalue(Box>), @@ -38,7 +39,7 @@ pub enum VariableLvalue<'a> { StreamingConcatenation(StreamingConcatenation<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct VariableLvalueIdentifier<'a> { pub nodes: ( Option>, @@ -47,12 +48,12 @@ pub struct VariableLvalueIdentifier<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct VariableLvalueLvalue<'a> { pub nodes: (Brace<'a, List, VariableLvalue<'a>>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct VariableLvaluePattern<'a> { pub nodes: ( Option>, @@ -60,7 +61,7 @@ pub struct VariableLvaluePattern<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NonrangeVariableLvalue<'a> { pub nodes: ( Option>, diff --git a/src/parser/expressions/expressions.rs b/src/parser/expressions/expressions.rs index ea8d870..9396122 100644 --- a/src/parser/expressions/expressions.rs +++ b/src/parser/expressions/expressions.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; use nom::branch::*; use nom::combinator::*; @@ -6,13 +7,13 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum IncOrDecExpression<'a> { Prefix(IncOrDecExpressionPrefix<'a>), Suffix(IncOrDecExpressionSuffix<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct IncOrDecExpressionPrefix<'a> { pub nodes: ( IncOrDecOperator<'a>, @@ -21,7 +22,7 @@ pub struct IncOrDecExpressionPrefix<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct IncOrDecExpressionSuffix<'a> { pub nodes: ( VariableLvalue<'a>, @@ -30,7 +31,7 @@ pub struct IncOrDecExpressionSuffix<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConditionalExpression<'a> { pub nodes: ( CondPredicate<'a>, @@ -42,7 +43,7 @@ pub struct ConditionalExpression<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ConstantExpression<'a> { ConstantPrimary(Box>), Unary(Box>), @@ -50,7 +51,7 @@ pub enum ConstantExpression<'a> { Ternary(Box>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstantExpressionUnary<'a> { pub nodes: ( UnaryOperator<'a>, @@ -59,7 +60,7 @@ pub struct ConstantExpressionUnary<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstantExpressionBinary<'a> { pub nodes: ( ConstantExpression<'a>, @@ -69,7 +70,7 @@ pub struct ConstantExpressionBinary<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstantExpressionTernary<'a> { pub nodes: ( ConstantExpression<'a>, @@ -81,13 +82,13 @@ pub struct ConstantExpressionTernary<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ConstantMintypmaxExpression<'a> { Unary(ConstantExpression<'a>), Ternary(ConstantMintypmaxExpressionTernary<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstantMintypmaxExpressionTernary<'a> { pub nodes: ( ConstantExpression<'a>, @@ -98,43 +99,43 @@ pub struct ConstantMintypmaxExpressionTernary<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ConstantParamExpression<'a> { ConstantMintypmaxExpression(ConstantMintypmaxExpression<'a>), DataType(DataType<'a>), Dollar(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ParamExpression<'a> { MintypmaxExpression(MintypmaxExpression<'a>), DataType(Box>), Dollar(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ConstantRangeExpression<'a> { ConstantExpression(ConstantExpression<'a>), ConstantPartSelectRange(ConstantPartSelectRange<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ConstantPartSelectRange<'a> { ConstantRange(ConstantRange<'a>), ConstantIndexedRange(ConstantIndexedRange<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstantRange<'a> { pub nodes: (ConstantExpression<'a>, Symbol<'a>, ConstantExpression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstantIndexedRange<'a> { pub nodes: (ConstantExpression<'a>, Symbol<'a>, ConstantExpression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum Expression<'a> { Primary(Box>), Unary(Box>), @@ -146,17 +147,17 @@ pub enum Expression<'a> { TaggedUnionExpression(Box>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ExpressionUnary<'a> { pub nodes: (UnaryOperator<'a>, Vec>, Primary<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ExpressionOperatorAssignment<'a> { pub nodes: (Paren<'a, OperatorAssignment<'a>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ExpressionBinary<'a> { pub nodes: ( Expression<'a>, @@ -166,34 +167,34 @@ pub struct ExpressionBinary<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TaggedUnionExpression<'a> { pub nodes: (Symbol<'a>, MemberIdentifier<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InsideExpression<'a> { pub nodes: (Expression<'a>, Symbol<'a>, Brace<'a, OpenRangeList<'a>>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ValueRange<'a> { Expression(Expression<'a>), Binary(ValueRangeBinary<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ValueRangeBinary<'a> { pub nodes: (Bracket<'a, (Expression<'a>, Symbol<'a>, Expression<'a>)>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum MintypmaxExpression<'a> { Expression(Expression<'a>), Ternary(MintypmaxExpressionTernary<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct MintypmaxExpressionTernary<'a> { pub nodes: ( Expression<'a>, @@ -204,7 +205,7 @@ pub struct MintypmaxExpressionTernary<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModulePathConditionalExpression<'a> { pub nodes: ( ModulePathExpression<'a>, @@ -216,7 +217,7 @@ pub struct ModulePathConditionalExpression<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ModulePathExpression<'a> { ModulePathPrimary(Box>), Unary(Box>), @@ -224,7 +225,7 @@ pub enum ModulePathExpression<'a> { ModulePathConditionalExpression(Box>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModulePathExpressionUnary<'a> { pub nodes: ( UnaryModulePathOperator<'a>, @@ -233,7 +234,7 @@ pub struct ModulePathExpressionUnary<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModulePathExpressionBinary<'a> { pub nodes: ( ModulePathExpression<'a>, @@ -243,13 +244,13 @@ pub struct ModulePathExpressionBinary<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ModulePathMintypmaxExpression<'a> { ModulePathExpression(ModulePathExpression<'a>), Ternary(ModulePathMintypmaxExpressionTernary<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModulePathMintypmaxExpressionTernary<'a> { pub nodes: ( ModulePathExpression<'a>, @@ -260,18 +261,18 @@ pub struct ModulePathMintypmaxExpressionTernary<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum PartSelectRange<'a> { ConstantRange(ConstantRange<'a>), IndexedRange(IndexedRange<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct IndexedRange<'a> { pub nodes: (Expression<'a>, Symbol<'a>, ConstantExpression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct GenvarExpression<'a> { pub nodes: (ConstantExpression<'a>,), } diff --git a/src/parser/expressions/primaries.rs b/src/parser/expressions/primaries.rs index bbeddeb..9217e28 100644 --- a/src/parser/expressions/primaries.rs +++ b/src/parser/expressions/primaries.rs @@ -7,7 +7,7 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ConstantPrimary<'a> { PrimaryLiteral(PrimaryLiteral<'a>), PsParameter(ConstantPrimaryPsParameter<'a>), @@ -26,12 +26,12 @@ pub enum ConstantPrimary<'a> { Null(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstantPrimaryPsParameter<'a> { pub nodes: (PsParameterIdentifier<'a>, ConstantSelect<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstantPrimarySpecparam<'a> { pub nodes: ( SpecparamIdentifier<'a>, @@ -39,17 +39,17 @@ pub struct ConstantPrimarySpecparam<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstantPrimaryFormalPort<'a> { pub nodes: (FormalPortIdentifier<'a>, ConstantSelect<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstantPrimaryEnum<'a> { pub nodes: (PackageScopeOrClassScope<'a>, EnumIdentifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstantPrimaryConcatenation<'a> { pub nodes: ( ConstantConcatenation<'a>, @@ -57,7 +57,7 @@ pub struct ConstantPrimaryConcatenation<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstantPrimaryMultipleConcatenation<'a> { pub nodes: ( ConstantMultipleConcatenation<'a>, @@ -65,12 +65,12 @@ pub struct ConstantPrimaryMultipleConcatenation<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstantPrimaryMintypmaxExpression<'a> { pub nodes: (Paren<'a, ConstantMintypmaxExpression<'a>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ModulePathPrimary<'a> { Number(Number<'a>), Identifier(Identifier<'a>), @@ -80,12 +80,12 @@ pub enum ModulePathPrimary<'a> { Mintypmax(ModulePathPrimaryMintypmax<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModulePathPrimaryMintypmax<'a> { pub nodes: (Paren<'a, ModulePathMintypmaxExpression<'a>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum Primary<'a> { PrimaryLiteral(PrimaryLiteral<'a>), Hierarchical(PrimaryHierarchical<'a>), @@ -104,7 +104,7 @@ pub enum Primary<'a> { Null(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PrimaryHierarchical<'a> { pub nodes: ( Option>, @@ -113,12 +113,12 @@ pub struct PrimaryHierarchical<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PrimaryConcatenation<'a> { pub nodes: (Concatenation<'a>, Option>>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PrimaryMultipleConcatenation<'a> { pub nodes: ( MultipleConcatenation<'a>, @@ -126,18 +126,18 @@ pub struct PrimaryMultipleConcatenation<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PrimaryMintypmaxExpression<'a> { pub nodes: (Paren<'a, MintypmaxExpression<'a>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ClassQualifierOrPackageScope<'a> { ClassQualifier(ClassQualifier<'a>), PackageScope(PackageScope<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClassQualifier<'a> { pub nodes: ( Option>, @@ -145,13 +145,13 @@ pub struct ClassQualifier<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum RangeExpression<'a> { Expression(Expression<'a>), PartSelectRange(PartSelectRange<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum PrimaryLiteral<'a> { Number(Number<'a>), TimeLiteral(TimeLiteral<'a>), @@ -192,12 +192,12 @@ pub enum ImplicitClassHandle<'a> { ThisSuper((Symbol<'a>, Symbol<'a>, Symbol<'a>)), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BitSelect<'a> { nodes: (Vec>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct Select<'a> { pub nodes: ( Option<( @@ -210,7 +210,7 @@ pub struct Select<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NonrangeSelect<'a> { pub nodes: ( Option<( @@ -222,12 +222,12 @@ pub struct NonrangeSelect<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstantBitSelect<'a> { nodes: (Vec>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstantSelect<'a> { pub nodes: ( Option<( @@ -240,7 +240,7 @@ pub struct ConstantSelect<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstantCast<'a> { pub nodes: ( CastingType<'a>, @@ -249,12 +249,12 @@ pub struct ConstantCast<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstantLetExpression<'a> { pub nodes: (LetExpression<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct Cast<'a> { pub nodes: (CastingType<'a>, Symbol<'a>, Paren<'a, Expression<'a>>), } diff --git a/src/parser/expressions/subroutine_calls.rs b/src/parser/expressions/subroutine_calls.rs index 20dc28a..bb9bb23 100644 --- a/src/parser/expressions/subroutine_calls.rs +++ b/src/parser/expressions/subroutine_calls.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; use nom::branch::*; use nom::combinator::*; @@ -7,12 +8,12 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstantFunctionCall<'a> { pub nodes: (FunctionSubroutineCall<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TfCall<'a> { pub nodes: ( PsOrHierarchicalTfIdentifier<'a>, @@ -21,14 +22,14 @@ pub struct TfCall<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum SystemTfCall<'a> { ArgOptionl(SystemTfCallArgOptional<'a>), ArgDataType(SystemTfCallArgDataType<'a>), ArgExpression(SystemTfCallArgExpression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SystemTfCallArgOptional<'a> { pub nodes: ( SystemTfIdentifier<'a>, @@ -36,7 +37,7 @@ pub struct SystemTfCallArgOptional<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SystemTfCallArgDataType<'a> { pub nodes: ( SystemTfIdentifier<'a>, @@ -44,7 +45,7 @@ pub struct SystemTfCallArgDataType<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SystemTfCallArgExpression<'a> { pub nodes: ( SystemTfIdentifier<'a>, @@ -58,7 +59,7 @@ pub struct SystemTfCallArgExpression<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum SubroutineCall<'a> { TfCall(Box>), SystemTfCall(Box>), @@ -66,23 +67,23 @@ pub enum SubroutineCall<'a> { Randomize(Box>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SubroutineCallRandomize<'a> { pub nodes: (Option<(Symbol<'a>, Symbol<'a>)>, RandomizeCall<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct FunctionSubroutineCall<'a> { pub nodes: (SubroutineCall<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ListOfArguments<'a> { Ordered(ListOfArgumentsOrdered<'a>), Named(ListOfArgumentsNamed<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfArgumentsOrdered<'a> { pub nodes: ( List, Option>>, @@ -95,7 +96,7 @@ pub struct ListOfArgumentsOrdered<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfArgumentsNamed<'a> { pub nodes: ( Symbol<'a>, @@ -110,18 +111,18 @@ pub struct ListOfArgumentsNamed<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct MethodCall<'a> { pub nodes: (MethodCallRoot<'a>, Symbol<'a>, MethodCallBody<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum MethodCallBody<'a> { User(MethodCallBodyUser<'a>), BuiltInMethodCall(BuiltInMethodCall<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct MethodCallBodyUser<'a> { pub nodes: ( MethodIdentifier<'a>, @@ -130,13 +131,13 @@ pub struct MethodCallBodyUser<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum BuiltInMethodCall<'a> { ArrayManipulationCall(ArrayManipulationCall<'a>), RandomizeCall(RandomizeCall<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ArrayManipulationCall<'a> { pub nodes: ( ArrayMethodName<'a>, @@ -146,7 +147,7 @@ pub struct ArrayManipulationCall<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct RandomizeCall<'a> { pub nodes: ( Symbol<'a>, @@ -160,19 +161,19 @@ pub struct RandomizeCall<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum VariableIdentifierListOrNull<'a> { VariableIdentifierList(VariableIdentifierList<'a>), Null(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum MethodCallRoot<'a> { Primary(Primary<'a>), ImplicitClassHandle(ImplicitClassHandle<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ArrayMethodName<'a> { MethodIdentifier(MethodIdentifier<'a>), Unique(Symbol<'a>), diff --git a/src/parser/general/attributes.rs b/src/parser/general/attributes.rs index a9e65cf..7d21aed 100644 --- a/src/parser/general/attributes.rs +++ b/src/parser/general/attributes.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; use nom::combinator::*; use nom::sequence::*; @@ -5,12 +6,12 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct AttributeInstance<'a> { pub nodes: (Symbol<'a>, List, AttrSpec<'a>>, Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct AttrSpec<'a> { pub nodes: (Identifier<'a>, Option<(Symbol<'a>, ConstantExpression<'a>)>), } diff --git a/src/parser/general/identifiers.rs b/src/parser/general/identifiers.rs index 85a955d..4890805 100644 --- a/src/parser/general/identifiers.rs +++ b/src/parser/general/identifiers.rs @@ -133,22 +133,22 @@ pub struct GenvarIdentifier<'a> { pub nodes: (Identifier<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct HierarchicalArrayIdentifier<'a> { pub nodes: (HierarchicalIdentifier<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct HierarchicalBlockIdentifier<'a> { pub nodes: (HierarchicalIdentifier<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct HierarchicalEventIdentifier<'a> { pub nodes: (HierarchicalIdentifier<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct HierarchicalIdentifier<'a> { pub nodes: ( Option>, @@ -162,37 +162,37 @@ pub struct Root<'a> { pub nodes: (Symbol<'a>, Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct HierarchicalNetIdentifier<'a> { pub nodes: (HierarchicalIdentifier<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct HierarchicalParameterIdentifier<'a> { pub nodes: (HierarchicalIdentifier<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct HierarchicalPropertyIdentifier<'a> { pub nodes: (HierarchicalIdentifier<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct HierarchicalSequenceIdentifier<'a> { pub nodes: (HierarchicalIdentifier<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct HierarchicalTaskIdentifier<'a> { pub nodes: (HierarchicalIdentifier<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct HierarchicalTfIdentifier<'a> { pub nodes: (HierarchicalIdentifier<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct HierarchicalVariableIdentifier<'a> { pub nodes: (HierarchicalIdentifier<'a>,), } @@ -339,7 +339,7 @@ pub struct PsIdentifier<'a> { pub nodes: (Option>, Identifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PsOrHierarchicalArrayIdentifier<'a> { pub nodes: ( Option>, @@ -347,7 +347,7 @@ pub struct PsOrHierarchicalArrayIdentifier<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum PsOrHierarchicalNetIdentifier<'a> { PackageScope(PsOrHierarchicalNetIdentifierPackageScope<'a>), HierarchicalNetIdentifier(HierarchicalNetIdentifier<'a>), @@ -358,66 +358,66 @@ pub struct PsOrHierarchicalNetIdentifierPackageScope<'a> { pub nodes: (Option>, NetIdentifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PsOrHierarchicalNetIdentifierHierarchical<'a> { pub nodes: (HierarchicalNetIdentifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum PsOrHierarchicalPropertyIdentifier<'a> { PackageScope(PsOrHierarchicalPropertyIdentifierPackageScope<'a>), HierarchicalPropertyIdentifier(HierarchicalPropertyIdentifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PsOrHierarchicalPropertyIdentifierPackageScope<'a> { pub nodes: (Option>, PropertyIdentifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PsOrHierarchicalPropertyIdentifierHierarchical<'a> { pub nodes: (HierarchicalPropertyIdentifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum PsOrHierarchicalSequenceIdentifier<'a> { PackageScope(PsOrHierarchicalSequenceIdentifierPackageScope<'a>), HierarchicalSequenceIdentifier(HierarchicalSequenceIdentifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PsOrHierarchicalSequenceIdentifierPackageScope<'a> { pub nodes: (Option>, SequenceIdentifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PsOrHierarchicalSequenceIdentifierHierarchical<'a> { pub nodes: (HierarchicalSequenceIdentifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum PsOrHierarchicalTfIdentifier<'a> { PackageScope(PsOrHierarchicalTfIdentifierPackageScope<'a>), HierarchicalTfIdentifier(HierarchicalTfIdentifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PsOrHierarchicalTfIdentifierPackageScope<'a> { pub nodes: (Option>, TfIdentifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PsOrHierarchicalTfIdentifierHierarchical<'a> { pub nodes: (HierarchicalTfIdentifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum PsParameterIdentifier<'a> { Scope(PsParameterIdentifierScope<'a>), Generate(PsParameterIdentifierGenerate<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PsParameterIdentifierScope<'a> { pub nodes: ( Option>, @@ -425,7 +425,7 @@ pub struct PsParameterIdentifierScope<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PsParameterIdentifierGenerate<'a> { pub nodes: ( Vec<( @@ -437,7 +437,7 @@ pub struct PsParameterIdentifierGenerate<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PsTypeIdentifier<'a> { pub nodes: ( Option>, @@ -445,7 +445,7 @@ pub struct PsTypeIdentifier<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum LocalOrPackageScopeOrClassScope<'a> { Local(Local<'a>), PackageScope(PackageScope<'a>), @@ -517,26 +517,26 @@ pub struct VariableIdentifier<'a> { pub nodes: (Identifier<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ImplicitClassHandleOrClassScopeOrPackageScope<'a> { ImplicitClassHandle((ImplicitClassHandle<'a>, Symbol<'a>)), ClassScope(ClassScope<'a>), PackageScope(PackageScope<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ImplicitClassHandleOrPackageScope<'a> { ImplicitClassHandle((ImplicitClassHandle<'a>, Symbol<'a>)), PackageScope(PackageScope<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ImplicitClassHandleOrClassScope<'a> { ImplicitClassHandle((ImplicitClassHandle<'a>, Symbol<'a>)), ClassScope(ClassScope<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum PackageScopeOrClassScope<'a> { PackageScope(PackageScope<'a>), ClassScope(ClassScope<'a>), diff --git a/src/parser/instantiations/checker_instantiation.rs b/src/parser/instantiations/checker_instantiation.rs index 898c792..68f1adc 100644 --- a/src/parser/instantiations/checker_instantiation.rs +++ b/src/parser/instantiations/checker_instantiation.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; use nom::branch::*; use nom::combinator::*; @@ -6,7 +7,7 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CheckerInstantiation<'a> { pub nodes: ( PsCheckerIdentifier<'a>, @@ -16,34 +17,34 @@ pub struct CheckerInstantiation<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ListOfCheckerPortConnections<'a> { Ordered(ListOfCheckerPortConnectionsOrdered<'a>), Named(ListOfCheckerPortConnectionsNamed<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfCheckerPortConnectionsOrdered<'a> { pub nodes: (List, OrderedCheckerPortConnection<'a>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfCheckerPortConnectionsNamed<'a> { pub nodes: (List, NamedCheckerPortConnection<'a>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct OrderedCheckerPortConnection<'a> { pub nodes: (Vec>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum NamedCheckerPortConnection<'a> { Identifier(NamedCheckerPortConnectionIdentifier<'a>), Asterisk(NamedCheckerPortConnectionAsterisk<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NamedCheckerPortConnectionIdentifier<'a> { pub nodes: ( Vec>, @@ -53,7 +54,7 @@ pub struct NamedCheckerPortConnectionIdentifier<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NamedCheckerPortConnectionAsterisk<'a> { pub nodes: (Vec>, Symbol<'a>), } diff --git a/src/parser/instantiations/generated_instantiation.rs b/src/parser/instantiations/generated_instantiation.rs index 1549d33..f390f7a 100644 --- a/src/parser/instantiations/generated_instantiation.rs +++ b/src/parser/instantiations/generated_instantiation.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; use nom::branch::*; use nom::combinator::*; @@ -7,12 +8,12 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct GenerateRegion<'a> { pub nodes: (Symbol<'a>, Vec>, Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct LoopGenerateConstruct<'a> { pub nodes: ( Symbol<'a>, @@ -30,7 +31,7 @@ pub struct LoopGenerateConstruct<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct GenvarInitialization<'a> { pub nodes: ( Option>, @@ -40,19 +41,19 @@ pub struct GenvarInitialization<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct Genvar<'a> { pub nodes: (Symbol<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum GenvarIteration<'a> { Assignment(GenvarIterationAssignment<'a>), Prefix(GenvarIterationPrefix<'a>), Suffix(GenvarIterationSuffix<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct GenvarIterationAssignment<'a> { pub nodes: ( GenvarIdentifier<'a>, @@ -61,23 +62,23 @@ pub struct GenvarIterationAssignment<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct GenvarIterationPrefix<'a> { pub nodes: (IncOrDecOperator<'a>, GenvarIdentifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct GenvarIterationSuffix<'a> { pub nodes: (GenvarIdentifier<'a>, IncOrDecOperator<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ConditionalGenerateConstruct<'a> { If(IfGenerateConstruct<'a>), Case(CaseGenerateConstruct<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct IfGenerateConstruct<'a> { pub nodes: ( Symbol<'a>, @@ -87,7 +88,7 @@ pub struct IfGenerateConstruct<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CaseGenerateConstruct<'a> { pub nodes: ( Symbol<'a>, @@ -97,13 +98,13 @@ pub struct CaseGenerateConstruct<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum CaseGenerateItem<'a> { Nondefault(CaseGenerateItemNondefault<'a>), Default(CaseGenerateItemDefault<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CaseGenerateItemNondefault<'a> { pub nodes: ( List, ConstantExpression<'a>>, @@ -112,18 +113,18 @@ pub struct CaseGenerateItemNondefault<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CaseGenerateItemDefault<'a> { pub nodes: (Symbol<'a>, Option>, GenerateBlock<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum GenerateBlock<'a> { GenerateItem(GenerateItem<'a>), Multiple(GenerateBlockMultiple<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct GenerateBlockMultiple<'a> { pub nodes: ( Option<(GenerateBlockIdentifier<'a>, Symbol<'a>)>, @@ -135,7 +136,7 @@ pub struct GenerateBlockMultiple<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum GenerateItem<'a> { ModuleOrGenerateItem(ModuleOrGenerateItem<'a>), InterfaceOrGenerateItem(InterfaceOrGenerateItem<'a>), diff --git a/src/parser/instantiations/interface_instantiation.rs b/src/parser/instantiations/interface_instantiation.rs index f69d2d2..27e83f1 100644 --- a/src/parser/instantiations/interface_instantiation.rs +++ b/src/parser/instantiations/interface_instantiation.rs @@ -1,10 +1,11 @@ +use crate::ast::*; use crate::parser::*; use nom::combinator::*; use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InterfaceInstantiation<'a> { pub nodes: ( InterfaceIdentifier<'a>, diff --git a/src/parser/instantiations/module_instantiation.rs b/src/parser/instantiations/module_instantiation.rs index ba15e84..1f648dd 100644 --- a/src/parser/instantiations/module_instantiation.rs +++ b/src/parser/instantiations/module_instantiation.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; use nom::branch::*; use nom::combinator::*; @@ -6,7 +7,7 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModuleInstantiation<'a> { pub nodes: ( ModuleIdentifier<'a>, @@ -16,7 +17,7 @@ pub struct ModuleInstantiation<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ParameterValueAssignment<'a> { pub nodes: ( Symbol<'a>, @@ -24,28 +25,28 @@ pub struct ParameterValueAssignment<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ListOfParameterAssignments<'a> { Ordered(ListOfParameterAssignmentsOrdered<'a>), Named(ListOfParameterAssignmentsNamed<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfParameterAssignmentsOrdered<'a> { pub nodes: (List, OrderedParameterAssignment<'a>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfParameterAssignmentsNamed<'a> { pub nodes: (List, NamedParameterAssignment<'a>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct OrderedParameterAssignment<'a> { pub nodes: (ParamExpression<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NamedParameterAssignment<'a> { pub nodes: ( Symbol<'a>, @@ -54,7 +55,7 @@ pub struct NamedParameterAssignment<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct HierarchicalInstance<'a> { pub nodes: ( NameOfInstance<'a>, @@ -62,39 +63,39 @@ pub struct HierarchicalInstance<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NameOfInstance<'a> { pub nodes: (InstanceIdentifier<'a>, Vec>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ListOfPortConnections<'a> { Ordered(ListOfPortConnectionsOrdered<'a>), Named(ListOfPortConnectionsNamed<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfPortConnectionsOrdered<'a> { pub nodes: (List, OrderedPortConnection<'a>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfPortConnectionsNamed<'a> { pub nodes: (List, NamedPortConnection<'a>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct OrderedPortConnection<'a> { pub nodes: (Vec>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum NamedPortConnection<'a> { Identifier(NamedPortConnectionIdentifier<'a>), Asterisk(NamedPortConnectionAsterisk<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NamedPortConnectionIdentifier<'a> { pub nodes: ( Vec>, @@ -104,7 +105,7 @@ pub struct NamedPortConnectionIdentifier<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NamedPortConnectionAsterisk<'a> { pub nodes: (Vec>, Symbol<'a>), } diff --git a/src/parser/instantiations/program_instantiation.rs b/src/parser/instantiations/program_instantiation.rs index 22c4289..64c3907 100644 --- a/src/parser/instantiations/program_instantiation.rs +++ b/src/parser/instantiations/program_instantiation.rs @@ -1,10 +1,11 @@ +use crate::ast::*; use crate::parser::*; use nom::combinator::*; use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ProgramInstantiation<'a> { pub nodes: ( ProgramIdentifier<'a>, diff --git a/src/parser/source_text/checker_items.rs b/src/parser/source_text/checker_items.rs index b2b8f95..f979073 100644 --- a/src/parser/source_text/checker_items.rs +++ b/src/parser/source_text/checker_items.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; //use nom::branch::*; //use nom::combinator::*; @@ -6,16 +7,16 @@ use nom::{Err, IResult}; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CheckerPortList<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CheckerPortItem<'a> { pub nodes: ( Vec>, - Option, + Option>, PropertyFormalType<'a>, FormalPortIdentifier<'a>, Vec>, @@ -23,13 +24,13 @@ pub struct CheckerPortItem<'a> { ), } -#[derive(Debug)] -pub enum CheckerPortDirection { - Input, - Output, +#[derive(Debug, Node)] +pub enum CheckerPortDirection<'a> { + Input(Symbol<'a>), + Output(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum CheckerOrGenerateItem<'a> { CheckerOrGenerateItemDeclaration(CheckerOrGenerateItemDeclaration<'a>), InitialConstruct(InitialConstruct<'a>), @@ -40,7 +41,7 @@ pub enum CheckerOrGenerateItem<'a> { CheckerGenerateItem(CheckerGenerateItem<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum CheckerOrGenerateItemDeclaration<'a> { Data(CheckerOrGenerateItemDeclarationData<'a>), FunctionDeclaration(FunctionDeclaration<'a>), @@ -51,28 +52,30 @@ pub enum CheckerOrGenerateItemDeclaration<'a> { ClockingDeclaration(ClockingDeclaration<'a>), Clocking(CheckerOrGenerateItemDeclarationClocking<'a>), Expression(CheckerOrGenerateItemDeclarationExpression<'a>), - Empty, + Empty(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CheckerOrGenerateItemDeclarationData<'a> { - pub nodes: (Option, DataDeclaration<'a>), + pub nodes: (Option>, DataDeclaration<'a>), } -#[derive(Debug)] -pub struct Rand {} +#[derive(Debug, Node)] +pub struct Rand<'a> { + pub nodes: (Symbol<'a>), +} -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CheckerOrGenerateItemDeclarationClocking<'a> { pub nodes: (ClockingIdentifier<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CheckerOrGenerateItemDeclarationExpression<'a> { pub nodes: (ExpressionOrDist<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum CheckerGenerateItem<'a> { LoopGenerateConstruct(Box>), ConditionalGenerateConstruct(Box>), diff --git a/src/parser/source_text/class_items.rs b/src/parser/source_text/class_items.rs index 043e05a..70b602e 100644 --- a/src/parser/source_text/class_items.rs +++ b/src/parser/source_text/class_items.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; //use nom::branch::*; //use nom::combinator::*; @@ -6,7 +7,7 @@ use nom::{Err, IResult}; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ClassItem<'a> { Property(ClassItemProperty<'a>), Method(ClassItemMethod<'a>), @@ -15,56 +16,56 @@ pub enum ClassItem<'a> { Covergroup(ClassItemCovergroup<'a>), LocalParameterDeclaration(LocalParameterDeclaration<'a>), ParameterDeclaration(ParameterDeclaration<'a>), - Empty, + Empty(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClassItemProperty<'a> { pub nodes: (Vec>, ClassProperty<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClassItemMethod<'a> { pub nodes: (Vec>, ClassMethod<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClassItemConstraint<'a> { pub nodes: (Vec>, ClassConstraint<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClassItemDeclaration<'a> { pub nodes: (Vec>, ClassDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClassItemCovergroup<'a> { pub nodes: (Vec>, CovergroupDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ClassProperty<'a> { NonConst(ClassPropertyNonConst<'a>), Const(ClassPropertyConst<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClassPropertyNonConst<'a> { - pub nodes: (Vec, DataDeclaration<'a>), + pub nodes: (Vec>, DataDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClassPropertyConst<'a> { pub nodes: ( - Vec, + Vec>, DataType<'a>, ConstIdentifier<'a>, Option>, ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ClassMethod<'a> { Task(ClassMethodTask<'a>), Function(ClassMethodFunction<'a>), @@ -74,80 +75,80 @@ pub enum ClassMethod<'a> { ExternConstructor(ClassMethodExternConstructor<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClassMethodTask<'a> { - pub nodes: (Vec, TaskDeclaration<'a>), + pub nodes: (Vec>, TaskDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClassMethodFunction<'a> { - pub nodes: (Vec, FunctionDeclaration<'a>), + pub nodes: (Vec>, FunctionDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClassMethodPureVirtual<'a> { - pub nodes: (Vec, MethodPrototype<'a>), + pub nodes: (Vec>, MethodPrototype<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClassMethodExternMethod<'a> { - pub nodes: (Vec, MethodPrototype<'a>), + pub nodes: (Vec>, MethodPrototype<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClassMethodConstructor<'a> { - pub nodes: (Vec, ClassConstructorPrototype<'a>), + pub nodes: (Vec>, ClassConstructorPrototype<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClassMethodExternConstructor<'a> { - pub nodes: (Vec, ClassConstructorPrototype<'a>), + pub nodes: (Vec>, ClassConstructorPrototype<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClassConstructorPrototype<'a> { pub nodes: (Option>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ClassConstraint<'a> { ConstraintPrototype(ConstraintPrototype<'a>), ConstraintDeclaration(ConstraintDeclaration<'a>), } -#[derive(Debug)] -pub enum ClassItemQualifier { - Static, - Protected, - Local, +#[derive(Debug, Node)] +pub enum ClassItemQualifier<'a> { + Static(Symbol<'a>), + Protected(Symbol<'a>), + Local(Symbol<'a>), } -#[derive(Debug)] -pub enum PropertyQualifier { - RandomQualifier(RandomQualifier), - ClassItemQualifier(ClassItemQualifier), +#[derive(Debug, Node)] +pub enum PropertyQualifier<'a> { + RandomQualifier(RandomQualifier<'a>), + ClassItemQualifier(ClassItemQualifier<'a>), } -#[derive(Debug)] -pub enum RandomQualifier { - Rand, - Randc, +#[derive(Debug, Node)] +pub enum RandomQualifier<'a> { + Rand(Symbol<'a>), + Randc(Symbol<'a>), } -#[derive(Debug)] -pub enum MethodQualifier { - Virtual, - PureVirtual, - ClassItemQualifier(ClassItemQualifier), +#[derive(Debug, Node)] +pub enum MethodQualifier<'a> { + Virtual(Symbol<'a>), + PureVirtual(Symbol<'a>), + ClassItemQualifier(ClassItemQualifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum MethodPrototype<'a> { TaskPrototype(TaskPrototype<'a>), FunctionPrototype(FunctionPrototype<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClassConstructorDeclaration<'a> { pub nodes: ( Option>, @@ -155,12 +156,14 @@ pub struct ClassConstructorDeclaration<'a> { Vec>, Option>>, Vec>, - Option, + Option>, ), } -#[derive(Debug)] -pub struct New {} +#[derive(Debug, Node)] +pub struct New<'a> { + pub nodes: (Symbol<'a>,), +} // ----------------------------------------------------------------------------- diff --git a/src/parser/source_text/configuration_source_text.rs b/src/parser/source_text/configuration_source_text.rs index 2375582..97d7cee 100644 --- a/src/parser/source_text/configuration_source_text.rs +++ b/src/parser/source_text/configuration_source_text.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; //use nom::branch::*; //use nom::combinator::*; @@ -6,7 +7,7 @@ use nom::{Err, IResult}; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConfigDeclaration<'a> { pub nodes: ( ConfigIdentifier<'a>, @@ -17,12 +18,12 @@ pub struct ConfigDeclaration<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DesignStatement<'a> { pub nodes: (Vec<(Option>, CellIdentifier<'a>)>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ConfigRuleStatement<'a> { Default(ConfigRuleStatementDefault<'a>), InstLib(ConfigRuleStatementInstLib<'a>), @@ -31,87 +32,91 @@ pub enum ConfigRuleStatement<'a> { CellUse(ConfigRuleStatementCellUse<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConfigRuleStatementDefault<'a> { - pub nodes: (DefaultClause, LiblistClause<'a>), + pub nodes: (DefaultClause<'a>, LiblistClause<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConfigRuleStatementInstLib<'a> { pub nodes: (InstClause<'a>, LiblistClause<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConfigRuleStatementInstUse<'a> { pub nodes: (InstClause<'a>, UseClause<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConfigRuleStatementCellLib<'a> { pub nodes: (CellClause<'a>, LiblistClause<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConfigRuleStatementCellUse<'a> { pub nodes: (CellClause<'a>, UseClause<'a>), } -#[derive(Debug)] -pub struct DefaultClause {} +#[derive(Debug, Node)] +pub struct DefaultClause<'a> { + pub nodes: (Symbol<'a>,), +} -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InstClause<'a> { pub nodes: (InstName<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InstName<'a> { pub nodes: (TopmoduleIdentifier<'a>, Vec>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CellClause<'a> { pub nodes: (Option>, CellIdentifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct LiblistClause<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum UseClause<'a> { Cell(UseClauseCell<'a>), Named(UseClauseNamed<'a>), CellNamed(UseClauseCellNamed<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct UseClauseCell<'a> { pub nodes: ( Option>, CellIdentifier<'a>, - Option, + Option>, ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct UseClauseNamed<'a> { - pub nodes: (Vec>, Option), + pub nodes: (Vec>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct UseClauseCellNamed<'a> { pub nodes: ( Option>, CellIdentifier<'a>, Vec>, - Option, + Option>, ), } -#[derive(Debug)] -pub struct Config {} +#[derive(Debug, Node)] +pub struct Config<'a> { + pub nodes: (Symbol<'a>,), +} // ----------------------------------------------------------------------------- diff --git a/src/parser/source_text/constraints.rs b/src/parser/source_text/constraints.rs index 264ad6c..602a4bf 100644 --- a/src/parser/source_text/constraints.rs +++ b/src/parser/source_text/constraints.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; //use nom::branch::*; //use nom::combinator::*; @@ -6,40 +7,42 @@ use nom::{Err, IResult}; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstraintDeclaration<'a> { pub nodes: ( - Option, + Option>, ConstraintIdentifier<'a>, ConstraintBlock<'a>, ), } -#[derive(Debug)] -pub struct Static {} +#[derive(Debug, Node)] +pub struct Static<'a> { + pub nodes: (Symbol<'a>,), +} -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstraintBlock<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ConstraintBlockItem<'a> { Solve(ConstraintBlockItemSolve<'a>), ConstraintExpression(ConstraintExpression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstraintBlockItemSolve<'a> { pub nodes: (SolveBeforeList<'a>, SolveBeforeList<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SolveBeforeList<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstraintPrimary<'a> { pub nodes: ( Option>, @@ -48,7 +51,7 @@ pub struct ConstraintPrimary<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ConstraintExpression<'a> { Expression(ConstraintExpressionExpression<'a>), UniquenessConstraint(UniquenessConstraint<'a>), @@ -58,25 +61,27 @@ pub enum ConstraintExpression<'a> { Disable(ConstraintExpressionDisable<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstraintExpressionExpression<'a> { - pub nodes: (Option, ExpressionOrDist<'a>), + pub nodes: (Option>, ExpressionOrDist<'a>), } -#[derive(Debug)] -pub struct Soft {} +#[derive(Debug, Node)] +pub struct Soft<'a> { + pub nodes: (Symbol<'a>,), +} -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstraintExpressionArrow<'a> { pub nodes: (Expression<'a>, ConstraintSet<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstraintExpressionIf<'a> { pub nodes: (Expression<'a>, ConstraintSet<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstraintExpressionForeach<'a> { pub nodes: ( PsOrHierarchicalArrayIdentifier<'a>, @@ -85,79 +90,79 @@ pub struct ConstraintExpressionForeach<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstraintExpressionDisable<'a> { pub nodes: (ConstraintPrimary<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct UniquenessConstraint<'a> { pub nodes: (OpenRangeList<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ConstraintSet<'a> { ConstraintExpression(Box>), Bracket(ConstraintSetBracket<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstraintSetBracket<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DistList<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DistItem<'a> { pub nodes: (ValueRange<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum DistWeight<'a> { Equal(DistWeightEqual<'a>), Divide(DistWeightDivide<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DistWeightEqual<'a> { pub nodes: (Expression<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DistWeightDivide<'a> { pub nodes: (Expression<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ConstraintPrototype<'a> { pub nodes: ( - Option, - Option, + Option>, + Option>, ConstraintIdentifier<'a>, ), } -#[derive(Debug)] -pub enum ConstraintPrototypeQualifier { - Extern, - Pure, +#[derive(Debug, Node)] +pub enum ConstraintPrototypeQualifier<'a> { + Extern(Symbol<'a>), + Pure(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ExternConstraintDeclaration<'a> { pub nodes: ( - Option, + Option>, ClassScope<'a>, ConstraintIdentifier<'a>, ConstraintBlock<'a>, ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct IdentifierList<'a> { pub nodes: (Vec>,), } diff --git a/src/parser/source_text/interface_items.rs b/src/parser/source_text/interface_items.rs index 2edd055..b620b81 100644 --- a/src/parser/source_text/interface_items.rs +++ b/src/parser/source_text/interface_items.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; //use nom::branch::*; //use nom::combinator::*; @@ -6,45 +7,45 @@ use nom::{Err, IResult}; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum InterfaceOrGenerateItem<'a> { Module(InterfaceOrGenerateItemModule<'a>), Extern(InterfaceOrGenerateItemExtern<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InterfaceOrGenerateItemModule<'a> { pub nodes: (Vec>, ModuleCommonItem<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InterfaceOrGenerateItemExtern<'a> { pub nodes: (Vec>, ExternTfDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ExternTfDeclaration<'a> { Method(ExternTfDeclarationMethod<'a>), Task(ExternTfDeclarationTask<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ExternTfDeclarationMethod<'a> { pub nodes: (MethodPrototype<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ExternTfDeclarationTask<'a> { pub nodes: (TaskPrototype<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum InterfaceItem<'a> { PortDeclaration(PortDeclaration<'a>), NonPortInterfaceItem(NonPortInterfaceItem<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum NonPortInterfaceItem<'a> { GenerateRegion(GenerateRegion<'a>), InterfaceOrGenerateItem(InterfaceOrGenerateItem<'a>), diff --git a/src/parser/source_text/library_source_text.rs b/src/parser/source_text/library_source_text.rs index f49c274..c358c36 100644 --- a/src/parser/source_text/library_source_text.rs +++ b/src/parser/source_text/library_source_text.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; use nom::branch::*; use nom::combinator::*; @@ -7,12 +8,12 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct LibraryText<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum LibraryDescription<'a> { LibraryDeclaration(LibraryDeclaration<'a>), IncludeStatement(IncludeStatement<'a>), @@ -20,7 +21,7 @@ pub enum LibraryDescription<'a> { Null(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct LibraryDeclaration<'a> { pub nodes: ( Symbol<'a>, @@ -31,12 +32,12 @@ pub struct LibraryDeclaration<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct IncludeStatement<'a> { pub nodes: (Symbol<'a>, FilePathSpec<'a>, Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct FilePathSpec<'a> { pub nodes: (StringLiteral<'a>,), } diff --git a/src/parser/source_text/module_items.rs b/src/parser/source_text/module_items.rs index 46f5017..966f236 100644 --- a/src/parser/source_text/module_items.rs +++ b/src/parser/source_text/module_items.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; //use nom::branch::*; //use nom::combinator::*; @@ -6,7 +7,7 @@ use nom::{Err, IResult}; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ElaborationSystemTask<'a> { Fatal(ElaborationSystemTaskFatal<'a>), Error(ElaborationSystemTaskError<'a>), @@ -14,34 +15,34 @@ pub enum ElaborationSystemTask<'a> { Info(ElaborationSystemTaskInfo<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ElaborationSystemTaskFatal<'a> { - pub nodes: (Option<(FinishNumber, Option>)>,), + pub nodes: (Option<(FinishNumber<'a>, Option>)>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ElaborationSystemTaskError<'a> { pub nodes: (Option>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ElaborationSystemTaskWarning<'a> { pub nodes: (Option>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ElaborationSystemTaskInfo<'a> { pub nodes: (Option>>,), } -#[derive(Debug)] -pub enum FinishNumber { - Zero, - One, - Two, +#[derive(Debug, Node)] +pub enum FinishNumber<'a> { + Zero(Symbol<'a>), + One(Symbol<'a>), + Two(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ModuleCommonItem<'a> { ModuleOrGenerateItemDeclaration(ModuleOrGenerateItemDeclaration<'a>), InterfaceInstantiation(InterfaceInstantiation<'a>), @@ -58,13 +59,13 @@ pub enum ModuleCommonItem<'a> { ElaborationSystemTask(ElaborationSystemTask<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ModuleItem<'a> { PortDeclaratoin(PortDeclaration<'a>), NonPortModuleItem(NonPortModuleItem<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ModuleOrGenerateItem<'a> { Parameter(ModuleOrGenerateItemParameter<'a>), Gate(ModuleOrGenerateItemGate<'a>), @@ -73,32 +74,32 @@ pub enum ModuleOrGenerateItem<'a> { ModuleItem(Box>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModuleOrGenerateItemParameter<'a> { pub nodes: (Vec>, ParameterOverride<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModuleOrGenerateItemGate<'a> { pub nodes: (Vec>, GateInstantiation<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModuleOrGenerateItemUdp<'a> { pub nodes: (Vec>, UdpInstantiation<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModuleOrGenerateItemModule<'a> { pub nodes: (Vec>, ModuleInstantiation<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModuleOrGenerateItemModuleItem<'a> { pub nodes: (Vec>, ModuleCommonItem<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ModuleOrGenerateItemDeclaration<'a> { PackageOrGenerateItemDeclaration(PackageOrGenerateItemDeclaration<'a>), GenvarDeclaration(GenvarDeclaration<'a>), @@ -107,17 +108,17 @@ pub enum ModuleOrGenerateItemDeclaration<'a> { Expression(ModuleOrGenerateItemDeclarationExpression<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModuleOrGenerateItemDeclarationClocking<'a> { pub nodes: (ClockingIdentifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModuleOrGenerateItemDeclarationExpression<'a> { pub nodes: (ExpressionOrDist<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum NonPortModuleItem<'a> { GenerateRegion(GenerateRegion<'a>), ModuleOrGenerateItem(ModuleOrGenerateItem<'a>), @@ -129,23 +130,23 @@ pub enum NonPortModuleItem<'a> { TimeunitsDeclaration(TimeunitsDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NonPortModuleItemSpecparam<'a> { pub nodes: (Vec>, SpecparamDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ParameterOverride<'a> { pub nodes: (ListOfDefparamAssignments<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum BindDirective<'a> { Scope(BindDirectiveScope<'a>), Instance(BindDirectiveInstance<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BindDirectiveScope<'a> { pub nodes: ( BindTargetScope<'a>, @@ -154,28 +155,28 @@ pub struct BindDirectiveScope<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BindDirectiveInstance<'a> { pub nodes: (BindTargetInstanceList<'a>, BindInstantiation<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum BindTargetScope<'a> { ModuleIdentifier(ModuleIdentifier<'a>), InterfaceIdentifier(InterfaceIdentifier<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BindTargetInstance<'a> { pub nodes: (HierarchicalIdentifier<'a>, ConstantBitSelect<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct BindTargetInstanceList<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum BindInstantiation<'a> { ProgramInstantiation(ProgramInstantiation<'a>), ModuleInstantiation(ModuleInstantiation<'a>), diff --git a/src/parser/source_text/module_parameters_and_ports.rs b/src/parser/source_text/module_parameters_and_ports.rs index 5152687..4f54c1d 100644 --- a/src/parser/source_text/module_parameters_and_ports.rs +++ b/src/parser/source_text/module_parameters_and_ports.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; //use nom::branch::*; //use nom::combinator::*; @@ -6,14 +7,14 @@ use nom::{Err, IResult}; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ParameterPortList<'a> { Assignment(ParameterPortListAssignment<'a>), Declaration(ParameterPortListDeclaration<'a>), - Empty, + Empty(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ParameterPortListAssignment<'a> { pub nodes: ( ListOfParamAssignments<'a>, @@ -21,12 +22,12 @@ pub struct ParameterPortListAssignment<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ParameterPortListDeclaration<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ParameterPortDeclaration<'a> { ParameterDeclaration(ParameterDeclaration<'a>), LocalParameterDeclaration(LocalParameterDeclaration<'a>), @@ -34,27 +35,27 @@ pub enum ParameterPortDeclaration<'a> { TypeList(ParameterPortDeclarationTypeList<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ParameterPortDeclarationParamList<'a> { pub nodes: (DataType<'a>, ListOfParamAssignments<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ParameterPortDeclarationTypeList<'a> { pub nodes: (ListOfTypeAssignments<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfPorts<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ListOfPortDeclarations<'a> { pub nodes: (Option>, AnsiPortDeclaration<'a>)>>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum PortDeclaration<'a> { Inout(PortDeclarationInout<'a>), Input(PortDeclarationInput<'a>), @@ -63,110 +64,110 @@ pub enum PortDeclaration<'a> { Interface(PortDeclarationInterface<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PortDeclarationInout<'a> { pub nodes: (Vec>, InoutDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PortDeclarationInput<'a> { pub nodes: (Vec>, InputDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PortDeclarationOutput<'a> { pub nodes: (Vec>, OutputDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PortDeclarationRef<'a> { pub nodes: (Vec>, RefDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PortDeclarationInterface<'a> { pub nodes: (Vec>, InterfacePortDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum Port<'a> { NonNamed(PortNonNamed<'a>), Named(PortNamed<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PortNonNamed<'a> { pub nodes: (Option>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PortNamed<'a> { pub nodes: (PortIdentifier<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum PortExpression<'a> { PortReference(PortReference<'a>), Bracket(PortExpressionBracket<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PortExpressionBracket<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PortReference<'a> { pub nodes: (PortIdentifier<'a>, ConstantSelect<'a>), } -#[derive(Debug)] -pub enum PortDirection { - Input, - Output, - Inout, - Ref, +#[derive(Debug, Node)] +pub enum PortDirection<'a> { + Input(Symbol<'a>), + Output(Symbol<'a>), + Inout(Symbol<'a>), + Ref(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NetPortHeader<'a> { - pub nodes: (Option, NetPortType<'a>), + pub nodes: (Option>, NetPortType<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct VariablePortHeader<'a> { - pub nodes: (Option, VariablePortType<'a>), + pub nodes: (Option>, VariablePortType<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum InterfacePortHeader<'a> { Identifier(InterfacePortHeaderIdentifier<'a>), Interface(InterfacePortHeaderInterface<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InterfacePortHeaderIdentifier<'a> { pub nodes: (InterfaceIdentifier<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InterfacePortHeaderInterface<'a> { pub nodes: (Option>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum NetPortHeaderOrInterfacePortHeader<'a> { NetPortHeader(NetPortHeader<'a>), InterfacePortHeader(InterfacePortHeader<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum AnsiPortDeclaration<'a> { Net(AnsiPortDeclarationNet<'a>), Variable(AnsiPortDeclarationVariable<'a>), Paren(AnsiPortDeclarationParen<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct AnsiPortDeclarationNet<'a> { pub nodes: ( Option>, @@ -176,7 +177,7 @@ pub struct AnsiPortDeclarationNet<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct AnsiPortDeclarationVariable<'a> { pub nodes: ( Option>, @@ -186,10 +187,10 @@ pub struct AnsiPortDeclarationVariable<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct AnsiPortDeclarationParen<'a> { pub nodes: ( - Option, + Option>, PortIdentifier<'a>, Option>, ), diff --git a/src/parser/source_text/package_items.rs b/src/parser/source_text/package_items.rs index dc99274..1b31036 100644 --- a/src/parser/source_text/package_items.rs +++ b/src/parser/source_text/package_items.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; //use nom::branch::*; //use nom::combinator::*; @@ -6,7 +7,7 @@ use nom::{Err, IResult}; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum PackageItem<'a> { PackageOrGenerateItemDeclaration(PackageOrGenerateItemDeclaration<'a>), AnonymousProgram(AnonymousProgram<'a>), @@ -14,7 +15,7 @@ pub enum PackageItem<'a> { TimeunitsDeclaration(TimeunitsDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum PackageOrGenerateItemDeclaration<'a> { NetDeclaration(NetDeclaration<'a>), DataDeclaration(DataDeclaration<'a>), @@ -29,22 +30,22 @@ pub enum PackageOrGenerateItemDeclaration<'a> { ParameterDeclaration(ParameterDeclaration<'a>), CovergroupDeclaration(CovergroupDeclaration<'a>), AssertionItemDeclaration(AssertionItemDeclaration<'a>), - Empty, + Empty(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct AnonymousProgram<'a> { pub nodes: (Vec>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum AnonymousProgramItem<'a> { TaskDeclaration(TaskDeclaration<'a>), FunctionDeclaration(FunctionDeclaration<'a>), ClassDeclaration(ClassDeclaration<'a>), CovergroupDeclaration(CovergroupDeclaration<'a>), ClassConstructorDeclaration(ClassConstructorDeclaration<'a>), - Empty, + Empty(Symbol<'a>), } // ----------------------------------------------------------------------------- diff --git a/src/parser/source_text/program_items.rs b/src/parser/source_text/program_items.rs index f27f88e..b105a71 100644 --- a/src/parser/source_text/program_items.rs +++ b/src/parser/source_text/program_items.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; //use nom::branch::*; //use nom::combinator::*; @@ -6,13 +7,13 @@ use nom::{Err, IResult}; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ProgramItem<'a> { PortDeclaration(PortDeclaration<'a>), NonPortProgramItem(NonPortProgramItem<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum NonPortProgramItem<'a> { Assign(NonPortProgramItemAssign<'a>), Module(NonPortProgramItemModule<'a>), @@ -23,12 +24,12 @@ pub enum NonPortProgramItem<'a> { ProgramGenerateItem(ProgramGenerateItem<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NonPortProgramItemAssign<'a> { pub nodes: (Vec>, ContinuousAssign<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NonPortProgramItemModule<'a> { pub nodes: ( Vec>, @@ -36,22 +37,22 @@ pub struct NonPortProgramItemModule<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NonPortProgramItemInitial<'a> { pub nodes: (Vec>, InitialConstruct<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NonPortProgramItemFinal<'a> { pub nodes: (Vec>, FinalConstruct<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct NonPortProgramItemAssertion<'a> { pub nodes: (Vec>, ConcurrentAssertionItem<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ProgramGenerateItem<'a> { LoopGenerateConstuct(LoopGenerateConstruct<'a>), ConditionalGenerateConstruct(ConditionalGenerateConstruct<'a>), diff --git a/src/parser/source_text/system_verilog_source_text.rs b/src/parser/source_text/system_verilog_source_text.rs index 40d2f1c..cb6cb74 100644 --- a/src/parser/source_text/system_verilog_source_text.rs +++ b/src/parser/source_text/system_verilog_source_text.rs @@ -1,3 +1,4 @@ +use crate::ast::*; use crate::parser::*; use nom::branch::*; use nom::combinator::*; @@ -7,12 +8,12 @@ use nom::IResult; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SourceText<'a> { pub nodes: (Option>, Vec>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum Description<'a> { ModuleDeclaration(ModuleDeclaration<'a>), UdpDeclaration(UdpDeclaration<'a>), @@ -24,17 +25,17 @@ pub enum Description<'a> { ConfigDeclaration(ConfigDeclaration<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DescriptionPackageItem<'a> { pub nodes: (Vec>, PackageItem<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct DescriptionBindDirective<'a> { pub nodes: (Vec>, BindDirective<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModuleNonansiHeader<'a> { pub nodes: ( Vec>, @@ -48,7 +49,7 @@ pub struct ModuleNonansiHeader<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModuleAnsiHeader<'a> { pub nodes: ( Vec>, @@ -62,7 +63,7 @@ pub struct ModuleAnsiHeader<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ModuleDeclaration<'a> { Nonansi(ModuleDeclarationNonansi<'a>), Ansi(ModuleDeclarationAnsi<'a>), @@ -71,7 +72,7 @@ pub enum ModuleDeclaration<'a> { ExternAnsi(ModuleDeclarationExternAnsi<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModuleDeclarationNonansi<'a> { pub nodes: ( ModuleNonansiHeader<'a>, @@ -82,7 +83,7 @@ pub struct ModuleDeclarationNonansi<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModuleDeclarationAnsi<'a> { pub nodes: ( ModuleAnsiHeader<'a>, @@ -93,7 +94,7 @@ pub struct ModuleDeclarationAnsi<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModuleDeclarationWildcard<'a> { pub nodes: ( Vec>, @@ -109,23 +110,23 @@ pub struct ModuleDeclarationWildcard<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModuleDeclarationExternNonansi<'a> { pub nodes: (Symbol<'a>, ModuleNonansiHeader<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ModuleDeclarationExternAnsi<'a> { pub nodes: (Symbol<'a>, ModuleAnsiHeader<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ModuleKeyword<'a> { Module(Symbol<'a>), Macromodule(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum InterfaceDeclaration<'a> { Nonansi(InterfaceDeclarationNonansi<'a>), Ansi(InterfaceDeclarationAnsi<'a>), @@ -134,7 +135,7 @@ pub enum InterfaceDeclaration<'a> { ExternAnsi(InterfaceDeclarationExternAnsi<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InterfaceDeclarationNonansi<'a> { pub nodes: ( InterfaceNonansiHeader<'a>, @@ -145,7 +146,7 @@ pub struct InterfaceDeclarationNonansi<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InterfaceDeclarationAnsi<'a> { pub nodes: ( InterfaceAnsiHeader<'a>, @@ -156,7 +157,7 @@ pub struct InterfaceDeclarationAnsi<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InterfaceDeclarationWildcard<'a> { pub nodes: ( Vec>, @@ -172,17 +173,17 @@ pub struct InterfaceDeclarationWildcard<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InterfaceDeclarationExternNonansi<'a> { pub nodes: (Symbol<'a>, InterfaceNonansiHeader<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InterfaceDeclarationExternAnsi<'a> { pub nodes: (Symbol<'a>, InterfaceAnsiHeader<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InterfaceNonansiHeader<'a> { pub nodes: ( Vec>, @@ -196,7 +197,7 @@ pub struct InterfaceNonansiHeader<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InterfaceAnsiHeader<'a> { pub nodes: ( Vec>, @@ -210,7 +211,7 @@ pub struct InterfaceAnsiHeader<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum ProgramDeclaration<'a> { Nonansi(ProgramDeclarationNonansi<'a>), Ansi(ProgramDeclarationAnsi<'a>), @@ -219,7 +220,7 @@ pub enum ProgramDeclaration<'a> { ExternAnsi(ProgramDeclarationExternAnsi<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ProgramDeclarationNonansi<'a> { pub nodes: ( ProgramNonansiHeader<'a>, @@ -230,7 +231,7 @@ pub struct ProgramDeclarationNonansi<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ProgramDeclarationAnsi<'a> { pub nodes: ( ProgramAnsiHeader<'a>, @@ -241,7 +242,7 @@ pub struct ProgramDeclarationAnsi<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ProgramDeclarationWildcard<'a> { pub nodes: ( Vec>, @@ -256,17 +257,17 @@ pub struct ProgramDeclarationWildcard<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ProgramDeclarationExternNonansi<'a> { pub nodes: (Symbol<'a>, ProgramNonansiHeader<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ProgramDeclarationExternAnsi<'a> { pub nodes: (Symbol<'a>, ProgramAnsiHeader<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ProgramNonansiHeader<'a> { pub nodes: ( Vec>, @@ -280,7 +281,7 @@ pub struct ProgramNonansiHeader<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ProgramAnsiHeader<'a> { pub nodes: ( Vec>, @@ -294,7 +295,7 @@ pub struct ProgramAnsiHeader<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct CheckerDeclaration<'a> { pub nodes: ( Symbol<'a>, @@ -307,7 +308,7 @@ pub struct CheckerDeclaration<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct ClassDeclaration<'a> { pub nodes: ( Option>, @@ -328,17 +329,17 @@ pub struct ClassDeclaration<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct Virtual<'a> { pub nodes: (Symbol<'a>,), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InterfaceClassType<'a> { pub nodes: (PsClassIdentifier<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InterfaceClassDeclaration<'a> { pub nodes: ( Symbol<'a>, @@ -353,7 +354,7 @@ pub struct InterfaceClassDeclaration<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum InterfaceClassItem<'a> { TypeDeclaration(TypeDeclaration<'a>), Method(InterfaceClassItemMethod<'a>), @@ -362,17 +363,17 @@ pub enum InterfaceClassItem<'a> { Null(Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InterfaceClassItemMethod<'a> { pub nodes: (Vec>, InterfaceClassMethod<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct InterfaceClassMethod<'a> { pub nodes: (Symbol<'a>, Symbol<'a>, MethodPrototype<'a>, Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct PackageDeclaration<'a> { pub nodes: ( Vec>, @@ -387,7 +388,7 @@ pub struct PackageDeclaration<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub enum TimeunitsDeclaration<'a> { Timeunit(TimeunitsDeclarationTimeunit<'a>), Timeprecision(TimeunitsDeclarationTimeprecision<'a>), @@ -395,7 +396,7 @@ pub enum TimeunitsDeclaration<'a> { TimeprecisionTimeunit(TimeunitsDeclarationTimeprecisionTimeunit<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TimeunitsDeclarationTimeunit<'a> { pub nodes: ( Symbol<'a>, @@ -405,12 +406,12 @@ pub struct TimeunitsDeclarationTimeunit<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TimeunitsDeclarationTimeprecision<'a> { pub nodes: (Symbol<'a>, TimeLiteral<'a>, Symbol<'a>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TimeunitsDeclarationTimeunitTimeprecision<'a> { pub nodes: ( Symbol<'a>, @@ -422,7 +423,7 @@ pub struct TimeunitsDeclarationTimeunitTimeprecision<'a> { ), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct TimeunitsDeclarationTimeprecisionTimeunit<'a> { pub nodes: ( Symbol<'a>, diff --git a/src/parser/specify_section/specify_block_terminals.rs b/src/parser/specify_section/specify_block_terminals.rs index 4ba8149..71e52b7 100644 --- a/src/parser/specify_section/specify_block_terminals.rs +++ b/src/parser/specify_section/specify_block_terminals.rs @@ -7,12 +7,12 @@ use nom::{Err, IResult}; // ----------------------------------------------------------------------------- -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SpecifyInputTerminalDescriptor<'a> { pub nodes: (InputIdentifier<'a>, Option>), } -#[derive(Debug)] +#[derive(Debug, Node)] pub struct SpecifyOutputTerminalDescriptor<'a> { pub nodes: (OutputIdentifier<'a>, Option>), }