diff --git a/README.md b/README.md index af0df44..5381ee5 100644 --- a/README.md +++ b/README.md @@ -77,5 +77,12 @@ A parser library for System Verilog. | general | comments | x | x | x | | general | identifiers | x | x | x | +## Missing entry of specification + +* interface_class_declaration -> connect to description +* formal_identifier -> ignore +* covergroup_variable_identifier -> ignore +* array_identifier -> ignore + ## Test 6.25 diff --git a/src/ast.rs b/src/ast.rs index 704f898..3af2f73 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -1,5 +1,5 @@ pub mod any_node; pub mod node; -pub use any_node::*; -pub use node::*; -pub use sv_parser_macro::*; +pub(crate) use any_node::*; +pub(crate) use node::*; +pub(crate) use sv_parser_macro::*; diff --git a/src/ast/any_node.rs b/src/ast/any_node.rs index 7210edf..0b80c99 100644 --- a/src/ast/any_node.rs +++ b/src/ast/any_node.rs @@ -6,12 +6,12 @@ use core::convert::TryFrom; include!(concat!(env!("OUT_DIR"), "/any_node.rs")); -pub struct RefNodes<'a>(pub Vec>); +pub(crate) struct RefNodes<'a>(pub Vec>); // ----------------------------------------------------------------------------- pub struct Iter<'a> { - pub next: RefNodes<'a>, + pub(crate) next: RefNodes<'a>, } impl<'a> Iterator for Iter<'a> { diff --git a/src/ast/node.rs b/src/ast/node.rs index 3e54fd6..e8bbed3 100644 --- a/src/ast/node.rs +++ b/src/ast/node.rs @@ -1,7 +1,7 @@ use crate::ast::*; use crate::parser::*; -pub trait Node<'a> { +pub(crate) trait Node<'a> { fn next(&'a self) -> RefNodes<'a>; } diff --git a/src/lib.rs b/src/lib.rs index 22d1b62..180c807 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,25 @@ #![recursion_limit = "256"] pub mod ast; pub mod parser; +use ast::*; +use parser::*; use nom_packrat::storage; storage!(ast::AnyNode); + +pub fn parse_sv(s: &str) -> Result { + let s = Span::new_extra(s, Extra::default()); + match source_text(s) { + Ok((_, x)) => Ok(x), + Err(_) => Err(()), + } +} + +pub fn parse_lib(s: &str) -> Result { + let s = Span::new_extra(s, Extra::default()); + match library_text(s) { + Ok((_, x)) => Ok(x), + Err(_) => Err(()), + } +} diff --git a/src/parser.rs b/src/parser.rs index 539839a..9bd84c0 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -21,16 +21,16 @@ pub use source_text::*; pub use specify_section::*; pub use udp_declaration_and_instantiation::*; -pub const RECURSIVE_FLAG_WORDS: usize = 1; +pub(crate) const RECURSIVE_FLAG_WORDS: usize = 1; #[derive(Copy, Clone, Default, Debug, PartialEq)] -pub struct Extra { +pub(crate) struct Extra { #[cfg(feature = "trace")] pub depth: usize, pub recursive_flag: [u128; RECURSIVE_FLAG_WORDS], } -pub type Span<'a> = nom_locate::LocatedSpanEx<&'a str, Extra>; +pub(crate) type Span<'a> = nom_locate::LocatedSpanEx<&'a str, Extra>; #[derive(Copy, Clone, Default, Debug, PartialEq)] pub struct Locate { @@ -86,16 +86,4 @@ mod thread_context { RefCell::new(ParserIndex{index: HashMap::new(), allocated: [0;RECURSIVE_FLAG_WORDS]}) } ); - - thread_local!( - pub static FAILED_MEMO: RefCell> = { - RefCell::new(HashMap::new()) - } - ); - - //thread_local!( - // pub static MEMO: RefCell> = { - // RefCell::new(HashMap::new()) - // } - //); } diff --git a/src/parser/behavioral_statements/assertion_statements.rs b/src/parser/behavioral_statements/assertion_statements.rs index f176b46..e2f3925 100644 --- a/src/parser/behavioral_statements/assertion_statements.rs +++ b/src/parser/behavioral_statements/assertion_statements.rs @@ -87,7 +87,7 @@ pub enum AssertTiming { // ----------------------------------------------------------------------------- #[parser] -pub fn assertion_item(s: Span) -> IResult { +pub(crate) fn assertion_item(s: Span) -> IResult { alt(( map(concurrent_assertion_item, |x| { AssertionItem::Concurrent(Box::new(x)) @@ -99,14 +99,14 @@ pub fn assertion_item(s: Span) -> IResult { } #[parser] -pub fn deferred_immediate_assertion_item(s: Span) -> IResult { +pub(crate) fn deferred_immediate_assertion_item(s: Span) -> IResult { let (s, a) = opt(pair(block_identifier, symbol(":")))(s)?; let (s, b) = deferred_immediate_assertion_statement(s)?; Ok((s, DeferredImmediateAssetionItem { nodes: (a, b) })) } #[parser] -pub fn procedural_assertion_statement(s: Span) -> IResult { +pub(crate) fn procedural_assertion_statement(s: Span) -> IResult { alt(( map(concurrent_assertion_statement, |x| { ProceduralAssertionStatement::Concurrent(Box::new(x)) @@ -121,7 +121,7 @@ pub fn procedural_assertion_statement(s: Span) -> IResult IResult { +pub(crate) fn immediate_assertion_statement(s: Span) -> IResult { alt(( map(simple_immediate_assertion_statement, |x| { ImmediateAssetionStatement::Simple(Box::new(x)) @@ -133,7 +133,7 @@ pub fn immediate_assertion_statement(s: Span) -> IResult IResult { alt(( @@ -150,7 +150,7 @@ pub fn simple_immediate_assertion_statement( } #[parser] -pub fn simple_immediate_assert_statement(s: Span) -> IResult { +pub(crate) fn simple_immediate_assert_statement(s: Span) -> IResult { let (s, a) = keyword("assert")(s)?; let (s, b) = paren(expression)(s)?; let (s, c) = action_block(s)?; @@ -158,7 +158,7 @@ pub fn simple_immediate_assert_statement(s: Span) -> IResult IResult { +pub(crate) fn simple_immediate_assume_statement(s: Span) -> IResult { let (s, a) = keyword("assume")(s)?; let (s, b) = paren(expression)(s)?; let (s, c) = action_block(s)?; @@ -166,7 +166,7 @@ pub fn simple_immediate_assume_statement(s: Span) -> IResult IResult { +pub(crate) fn simple_immediate_cover_statement(s: Span) -> IResult { let (s, a) = keyword("cover")(s)?; let (s, b) = paren(expression)(s)?; let (s, c) = statement_or_null(s)?; @@ -174,7 +174,7 @@ pub fn simple_immediate_cover_statement(s: Span) -> IResult IResult { alt(( @@ -191,7 +191,7 @@ pub fn deferred_immediate_assertion_statement( } #[parser] -pub fn deferred_immediate_assert_statement( +pub(crate) fn deferred_immediate_assert_statement( s: Span, ) -> IResult { let (s, a) = keyword("assert")(s)?; @@ -207,7 +207,7 @@ pub fn deferred_immediate_assert_statement( } #[parser] -pub fn deferred_immediate_assume_statement( +pub(crate) fn deferred_immediate_assume_statement( s: Span, ) -> IResult { let (s, a) = keyword("assume")(s)?; @@ -223,7 +223,7 @@ pub fn deferred_immediate_assume_statement( } #[parser] -pub fn deferred_immediate_cover_statement( +pub(crate) fn deferred_immediate_cover_statement( s: Span, ) -> IResult { let (s, a) = keyword("cover")(s)?; @@ -239,7 +239,7 @@ pub fn deferred_immediate_cover_statement( } #[parser] -pub fn assert_timing(s: Span) -> IResult { +pub(crate) fn assert_timing(s: Span) -> IResult { alt(( map(symbol("#0"), |x| AssertTiming::Zero(Box::new(x))), map(keyword("final"), |x| AssertTiming::Final(Box::new(x))), diff --git a/src/parser/behavioral_statements/case_statements.rs b/src/parser/behavioral_statements/case_statements.rs index 12a1719..3844282 100644 --- a/src/parser/behavioral_statements/case_statements.rs +++ b/src/parser/behavioral_statements/case_statements.rs @@ -136,7 +136,7 @@ pub struct OpenValueRange { // ----------------------------------------------------------------------------- #[parser] -pub fn case_statement(s: Span) -> IResult { +pub(crate) fn case_statement(s: Span) -> IResult { alt(( case_statement_normal, case_statement_matches, @@ -145,7 +145,7 @@ pub fn case_statement(s: Span) -> IResult { } #[parser] -pub fn case_statement_normal(s: Span) -> IResult { +pub(crate) fn case_statement_normal(s: Span) -> IResult { let (s, a) = opt(unique_priority)(s)?; let (s, b) = case_keyword(s)?; let (s, c) = paren(case_expression)(s)?; @@ -161,7 +161,7 @@ pub fn case_statement_normal(s: Span) -> IResult { } #[parser] -pub fn case_statement_matches(s: Span) -> IResult { +pub(crate) fn case_statement_matches(s: Span) -> IResult { let (s, a) = opt(unique_priority)(s)?; let (s, b) = case_keyword(s)?; let (s, c) = paren(case_expression)(s)?; @@ -178,7 +178,7 @@ pub fn case_statement_matches(s: Span) -> IResult { } #[parser] -pub fn case_statement_inside(s: Span) -> IResult { +pub(crate) fn case_statement_inside(s: Span) -> IResult { let (s, a) = opt(unique_priority)(s)?; let (s, b) = keyword("case")(s)?; let (s, c) = paren(case_expression)(s)?; @@ -195,7 +195,7 @@ pub fn case_statement_inside(s: Span) -> IResult { } #[parser] -pub fn case_keyword(s: Span) -> IResult { +pub(crate) fn case_keyword(s: Span) -> IResult { alt(( map(keyword("casez"), |x| CaseKeyword::Casez(Box::new(x))), map(keyword("casex"), |x| CaseKeyword::Casex(Box::new(x))), @@ -204,13 +204,13 @@ pub fn case_keyword(s: Span) -> IResult { } #[parser] -pub fn case_expression(s: Span) -> IResult { +pub(crate) fn case_expression(s: Span) -> IResult { let (s, a) = expression(s)?; Ok((s, CaseExpression { nodes: (a,) })) } #[parser] -pub fn case_item(s: Span) -> IResult { +pub(crate) fn case_item(s: Span) -> IResult { alt(( case_item_nondefault, map(case_item_default, |x| CaseItem::Default(Box::new(x))), @@ -218,7 +218,7 @@ pub fn case_item(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn case_item_nondefault(s: Span) -> IResult { +pub(crate) fn case_item_nondefault(s: Span) -> IResult { let (s, a) = list(symbol(","), case_item_expression)(s)?; let (s, b) = symbol(":")(s)?; let (s, c) = statement_or_null(s)?; @@ -229,7 +229,7 @@ pub fn case_item_nondefault(s: Span) -> IResult { } #[parser] -pub fn case_item_default(s: Span) -> IResult { +pub(crate) fn case_item_default(s: Span) -> IResult { let (s, a) = keyword("default")(s)?; let (s, b) = opt(symbol(":"))(s)?; let (s, c) = statement_or_null(s)?; @@ -237,7 +237,7 @@ pub fn case_item_default(s: Span) -> IResult { } #[parser] -pub fn case_pattern_item(s: Span) -> IResult { +pub(crate) fn case_pattern_item(s: Span) -> IResult { alt(( case_pattern_item_nondefault, map(case_item_default, |x| CasePatternItem::Default(Box::new(x))), @@ -245,7 +245,7 @@ pub fn case_pattern_item(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn case_pattern_item_nondefault(s: Span) -> IResult { +pub(crate) fn case_pattern_item_nondefault(s: Span) -> IResult { let (s, a) = pattern(s)?; let (s, b) = opt(pair(symbol("&&&"), expression))(s)?; let (s, c) = symbol(":")(s)?; @@ -259,7 +259,7 @@ pub fn case_pattern_item_nondefault(s: Span) -> IResult { } #[parser] -pub fn case_inside_item(s: Span) -> IResult { +pub(crate) fn case_inside_item(s: Span) -> IResult { alt(( case_inside_item_nondefault, map(case_item_default, |x| CaseInsideItem::Default(Box::new(x))), @@ -267,7 +267,7 @@ pub fn case_inside_item(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn case_inside_item_nondefault(s: Span) -> IResult { +pub(crate) fn case_inside_item_nondefault(s: Span) -> IResult { let (s, a) = open_range_list(s)?; let (s, b) = symbol(":")(s)?; let (s, c) = statement_or_null(s)?; @@ -278,13 +278,13 @@ pub fn case_inside_item_nondefault(s: Span) -> IResult { } #[parser] -pub fn case_item_expression(s: Span) -> IResult { +pub(crate) fn case_item_expression(s: Span) -> IResult { let (s, a) = expression(s)?; Ok((s, CaseItemExpression { nodes: (a,) })) } #[parser] -pub fn randcase_statement(s: Span) -> IResult { +pub(crate) fn randcase_statement(s: Span) -> IResult { let (s, a) = keyword("randcase")(s)?; let (s, b) = randcase_item(s)?; let (s, c) = many0(randcase_item)(s)?; @@ -298,7 +298,7 @@ pub fn randcase_statement(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn randcase_item(s: Span) -> IResult { +pub(crate) fn randcase_item(s: Span) -> IResult { let (s, a) = expression(s)?; let (s, b) = symbol(":")(s)?; let (s, c) = statement_or_null(s)?; @@ -306,13 +306,13 @@ pub fn randcase_item(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn open_range_list(s: Span) -> IResult { +pub(crate) fn open_range_list(s: Span) -> IResult { let (s, a) = list(symbol(","), open_value_range)(s)?; Ok((s, OpenRangeList { nodes: (a,) })) } #[parser] -pub fn open_value_range(s: Span) -> IResult { +pub(crate) fn open_value_range(s: Span) -> IResult { let (s, a) = value_range(s)?; Ok((s, OpenValueRange { nodes: (a,) })) } diff --git a/src/parser/behavioral_statements/clocking_block.rs b/src/parser/behavioral_statements/clocking_block.rs index fc5e999..60e211e 100644 --- a/src/parser/behavioral_statements/clocking_block.rs +++ b/src/parser/behavioral_statements/clocking_block.rs @@ -189,12 +189,12 @@ pub struct ClockvarExpression { // ----------------------------------------------------------------------------- #[parser] -pub fn clocking_declaration(s: Span) -> IResult { +pub(crate) fn clocking_declaration(s: Span) -> IResult { alt((clocking_declaration_local, clocking_declaration_global))(s) } #[parser] -pub fn clocking_declaration_local(s: Span) -> IResult { +pub(crate) fn clocking_declaration_local(s: Span) -> IResult { let (s, a) = opt(default)(s)?; let (s, b) = keyword("clocking")(s)?; let (s, c) = opt(clocking_identifier)(s)?; @@ -212,13 +212,13 @@ pub fn clocking_declaration_local(s: Span) -> IResult } #[parser] -pub fn default(s: Span) -> IResult { +pub(crate) fn default(s: Span) -> IResult { let (s, a) = keyword("default")(s)?; Ok((s, Default { nodes: (a,) })) } #[parser] -pub fn clocking_declaration_global(s: Span) -> IResult { +pub(crate) fn clocking_declaration_global(s: Span) -> IResult { let (s, a) = keyword("global")(s)?; let (s, b) = keyword("clocking")(s)?; let (s, c) = opt(clocking_identifier)(s)?; @@ -235,12 +235,12 @@ pub fn clocking_declaration_global(s: Span) -> IResult IResult { +pub(crate) fn clocking_event(s: Span) -> IResult { alt((clocking_event_identifier, clocking_event_expression))(s) } #[parser] -pub fn clocking_event_identifier(s: Span) -> IResult { +pub(crate) fn clocking_event_identifier(s: Span) -> IResult { let (s, a) = symbol("@")(s)?; let (s, b) = identifier(s)?; Ok(( @@ -250,7 +250,7 @@ pub fn clocking_event_identifier(s: Span) -> IResult { } #[parser] -pub fn clocking_event_expression(s: Span) -> IResult { +pub(crate) fn clocking_event_expression(s: Span) -> IResult { let (s, a) = symbol("@")(s)?; let (s, b) = paren(event_expression)(s)?; Ok(( @@ -260,7 +260,7 @@ pub fn clocking_event_expression(s: Span) -> IResult { } #[parser] -pub fn clocking_item(s: Span) -> IResult { +pub(crate) fn clocking_item(s: Span) -> IResult { alt(( clocking_item_default, clocking_item_direction, @@ -269,7 +269,7 @@ pub fn clocking_item(s: Span) -> IResult { } #[parser] -pub fn clocking_item_default(s: Span) -> IResult { +pub(crate) fn clocking_item_default(s: Span) -> IResult { let (s, a) = keyword("default")(s)?; let (s, b) = default_skew(s)?; let (s, c) = symbol(";")(s)?; @@ -280,7 +280,7 @@ pub fn clocking_item_default(s: Span) -> IResult { } #[parser] -pub fn clocking_item_direction(s: Span) -> IResult { +pub(crate) fn clocking_item_direction(s: Span) -> IResult { let (s, a) = clocking_direction(s)?; let (s, b) = list_of_clocking_decl_assign(s)?; let (s, c) = symbol(";")(s)?; @@ -291,7 +291,7 @@ pub fn clocking_item_direction(s: Span) -> IResult { } #[parser] -pub fn clocking_item_assertion(s: Span) -> IResult { +pub(crate) fn clocking_item_assertion(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = assertion_item_declaration(s)?; Ok(( @@ -301,7 +301,7 @@ pub fn clocking_item_assertion(s: Span) -> IResult { } #[parser] -pub fn default_skew(s: Span) -> IResult { +pub(crate) fn default_skew(s: Span) -> IResult { alt(( default_skew_input, default_skew_output, @@ -310,7 +310,7 @@ pub fn default_skew(s: Span) -> IResult { } #[parser] -pub fn default_skew_input(s: Span) -> IResult { +pub(crate) fn default_skew_input(s: Span) -> IResult { let (s, a) = keyword("input")(s)?; let (s, b) = clocking_skew(s)?; Ok(( @@ -320,7 +320,7 @@ pub fn default_skew_input(s: Span) -> IResult { } #[parser] -pub fn default_skew_output(s: Span) -> IResult { +pub(crate) fn default_skew_output(s: Span) -> IResult { let (s, a) = keyword("output")(s)?; let (s, b) = clocking_skew(s)?; Ok(( @@ -330,7 +330,7 @@ pub fn default_skew_output(s: Span) -> IResult { } #[parser] -pub fn default_skew_input_output(s: Span) -> IResult { +pub(crate) fn default_skew_input_output(s: Span) -> IResult { let (s, a) = keyword("input")(s)?; let (s, b) = clocking_skew(s)?; let (s, c) = keyword("output")(s)?; @@ -344,7 +344,7 @@ pub fn default_skew_input_output(s: Span) -> IResult { } #[parser] -pub fn clocking_direction(s: Span) -> IResult { +pub(crate) fn clocking_direction(s: Span) -> IResult { alt(( clocking_direction_input, clocking_direction_output, @@ -354,7 +354,7 @@ pub fn clocking_direction(s: Span) -> IResult { } #[parser] -pub fn clocking_direction_input(s: Span) -> IResult { +pub(crate) fn clocking_direction_input(s: Span) -> IResult { let (s, a) = keyword("input")(s)?; let (s, b) = opt(clocking_skew)(s)?; Ok(( @@ -364,7 +364,7 @@ pub fn clocking_direction_input(s: Span) -> IResult { } #[parser] -pub fn clocking_direction_output(s: Span) -> IResult { +pub(crate) fn clocking_direction_output(s: Span) -> IResult { let (s, a) = keyword("output")(s)?; let (s, b) = opt(clocking_skew)(s)?; Ok(( @@ -374,7 +374,7 @@ pub fn clocking_direction_output(s: Span) -> IResult { } #[parser] -pub fn clocking_direction_input_output(s: Span) -> IResult { +pub(crate) fn clocking_direction_input_output(s: Span) -> IResult { let (s, a) = keyword("input")(s)?; let (s, b) = opt(clocking_skew)(s)?; let (s, c) = keyword("output")(s)?; @@ -388,26 +388,26 @@ pub fn clocking_direction_input_output(s: Span) -> IResult IResult { +pub(crate) fn clocking_direction_inout(s: Span) -> IResult { let (s, a) = keyword("inout")(s)?; Ok((s, ClockingDirection::Inout(Box::new(a)))) } #[parser] -pub fn list_of_clocking_decl_assign(s: Span) -> IResult { +pub(crate) fn list_of_clocking_decl_assign(s: Span) -> IResult { let (s, a) = list(symbol(","), clocking_decl_assign)(s)?; Ok((s, ListOfClockingDeclAssign { nodes: (a,) })) } #[parser] -pub fn clocking_decl_assign(s: Span) -> IResult { +pub(crate) fn clocking_decl_assign(s: Span) -> IResult { let (s, a) = signal_identifier(s)?; let (s, b) = opt(pair(symbol("="), expression))(s)?; Ok((s, ClockingDeclAssign { nodes: (a, b) })) } #[parser] -pub fn clocking_skew(s: Span) -> IResult { +pub(crate) fn clocking_skew(s: Span) -> IResult { alt(( clocking_skew_edge, map(delay_control, |x| ClockingSkew::DelayControl(Box::new(x))), @@ -415,7 +415,7 @@ pub fn clocking_skew(s: Span) -> IResult { } #[parser] -pub fn clocking_skew_edge(s: Span) -> IResult { +pub(crate) fn clocking_skew_edge(s: Span) -> IResult { let (s, a) = edge_identifier(s)?; let (s, b) = opt(delay_control)(s)?; Ok(( @@ -425,7 +425,7 @@ pub fn clocking_skew_edge(s: Span) -> IResult { } #[parser] -pub fn clocking_drive(s: Span) -> IResult { +pub(crate) fn clocking_drive(s: Span) -> IResult { let (s, a) = clockvar_expression(s)?; let (s, b) = symbol("<=")(s)?; let (s, c) = opt(cycle_delay)(s)?; @@ -439,7 +439,7 @@ pub fn clocking_drive(s: Span) -> IResult { } #[parser] -pub fn cycle_delay(s: Span) -> IResult { +pub(crate) fn cycle_delay(s: Span) -> IResult { alt(( cycle_delay_integral, cycle_delay_identifier, @@ -448,7 +448,7 @@ pub fn cycle_delay(s: Span) -> IResult { } #[parser] -pub fn cycle_delay_integral(s: Span) -> IResult { +pub(crate) fn cycle_delay_integral(s: Span) -> IResult { let (s, a) = symbol("##")(s)?; let (s, b) = integral_number(s)?; Ok(( @@ -458,7 +458,7 @@ pub fn cycle_delay_integral(s: Span) -> IResult { } #[parser] -pub fn cycle_delay_identifier(s: Span) -> IResult { +pub(crate) fn cycle_delay_identifier(s: Span) -> IResult { let (s, a) = symbol("##")(s)?; let (s, b) = identifier(s)?; Ok(( @@ -468,7 +468,7 @@ pub fn cycle_delay_identifier(s: Span) -> IResult { } #[parser] -pub fn cycle_delay_expression(s: Span) -> IResult { +pub(crate) fn cycle_delay_expression(s: Span) -> IResult { let (s, a) = symbol("##")(s)?; let (s, b) = paren(expression)(s)?; Ok(( @@ -478,13 +478,13 @@ pub fn cycle_delay_expression(s: Span) -> IResult { } #[parser] -pub fn clockvar(s: Span) -> IResult { +pub(crate) fn clockvar(s: Span) -> IResult { let (s, a) = hierarchical_identifier(s)?; Ok((s, Clockvar { nodes: (a,) })) } #[parser] -pub fn clockvar_expression(s: Span) -> IResult { +pub(crate) fn clockvar_expression(s: Span) -> IResult { let (s, a) = clockvar(s)?; let (s, b) = select(s)?; Ok((s, ClockvarExpression { nodes: (a, b) })) diff --git a/src/parser/behavioral_statements/conditional_statements.rs b/src/parser/behavioral_statements/conditional_statements.rs index 4441605..729f061 100644 --- a/src/parser/behavioral_statements/conditional_statements.rs +++ b/src/parser/behavioral_statements/conditional_statements.rs @@ -46,7 +46,7 @@ pub struct CondPattern { // ----------------------------------------------------------------------------- #[parser] -pub fn conditional_statement(s: Span) -> IResult { +pub(crate) fn conditional_statement(s: Span) -> IResult { let (s, a) = opt(unique_priority)(s)?; let (s, b) = keyword("if")(s)?; let (s, c) = paren(cond_predicate)(s)?; @@ -68,7 +68,7 @@ pub fn conditional_statement(s: Span) -> IResult { } #[parser] -pub fn unique_priority(s: Span) -> IResult { +pub(crate) fn unique_priority(s: Span) -> IResult { alt(( map(keyword("unique0"), |x| UniquePriority::Unique0(Box::new(x))), map(keyword("unique"), |x| UniquePriority::Unique(Box::new(x))), @@ -79,13 +79,13 @@ pub fn unique_priority(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn cond_predicate(s: Span) -> IResult { +pub(crate) fn cond_predicate(s: Span) -> IResult { let (s, a) = list(symbol("&&&"), expression_or_cond_pattern)(s)?; Ok((s, CondPredicate { nodes: (a,) })) } #[parser] -pub fn expression_or_cond_pattern(s: Span) -> IResult { +pub(crate) fn expression_or_cond_pattern(s: Span) -> IResult { alt(( map(expression, |x| { ExpressionOrCondPattern::Expression(Box::new(x)) @@ -97,7 +97,7 @@ pub fn expression_or_cond_pattern(s: Span) -> IResult IResult { +pub(crate) fn cond_pattern(s: Span) -> IResult { let (s, a) = expression(s)?; let (s, b) = keyword("matches")(s)?; let (s, c) = pattern(s)?; 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 66d1bcc..91e8be1 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 @@ -56,12 +56,12 @@ pub struct NetAssignment { // ----------------------------------------------------------------------------- #[parser] -pub fn continuous_assign(s: Span) -> IResult { +pub(crate) fn continuous_assign(s: Span) -> IResult { alt((continuous_assign_net, continuous_assign_variable))(s) } #[parser] -pub fn continuous_assign_net(s: Span) -> IResult { +pub(crate) fn continuous_assign_net(s: Span) -> IResult { let (s, a) = keyword("assign")(s)?; let (s, b) = opt(drive_strength)(s)?; let (s, c) = opt(delay3)(s)?; @@ -77,7 +77,7 @@ pub fn continuous_assign_net(s: Span) -> IResult { } #[parser] -pub fn continuous_assign_variable(s: Span) -> IResult { +pub(crate) fn continuous_assign_variable(s: Span) -> IResult { let (s, a) = keyword("assign")(s)?; let (s, b) = opt(delay_control)(s)?; let (s, c) = list_of_variable_assignments(s)?; @@ -92,19 +92,19 @@ pub fn continuous_assign_variable(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn list_of_net_assignments(s: Span) -> IResult { +pub(crate) fn list_of_net_assignments(s: Span) -> IResult { let (s, a) = list(symbol(","), net_assignment)(s)?; Ok((s, ListOfNetAssignments { nodes: (a,) })) } #[parser(MaybeRecursive)] -pub fn list_of_variable_assignments(s: Span) -> IResult { +pub(crate) fn list_of_variable_assignments(s: Span) -> IResult { let (s, a) = list(symbol(","), variable_assignment)(s)?; Ok((s, ListOfVariableAssignments { nodes: (a,) })) } #[parser] -pub fn net_alias(s: Span) -> IResult { +pub(crate) fn net_alias(s: Span) -> IResult { let (s, a) = keyword("alias")(s)?; let (s, b) = net_lvalue(s)?; let (s, c) = symbol("=")(s)?; @@ -120,7 +120,7 @@ pub fn net_alias(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn net_assignment(s: Span) -> IResult { +pub(crate) fn net_assignment(s: Span) -> IResult { let (s, a) = net_lvalue(s)?; let (s, b) = symbol("=")(s)?; let (s, c) = expression(s)?; diff --git a/src/parser/behavioral_statements/looping_statements.rs b/src/parser/behavioral_statements/looping_statements.rs index d594e56..b072d31 100644 --- a/src/parser/behavioral_statements/looping_statements.rs +++ b/src/parser/behavioral_statements/looping_statements.rs @@ -106,7 +106,7 @@ pub struct LoopVariables { // ----------------------------------------------------------------------------- #[parser] -pub fn loop_statement(s: Span) -> IResult { +pub(crate) fn loop_statement(s: Span) -> IResult { alt(( loop_statement_forever, loop_statement_repeat, @@ -118,7 +118,7 @@ pub fn loop_statement(s: Span) -> IResult { } #[parser] -pub fn loop_statement_forever(s: Span) -> IResult { +pub(crate) fn loop_statement_forever(s: Span) -> IResult { let (s, a) = keyword("forever")(s)?; let (s, b) = statement_or_null(s)?; Ok(( @@ -128,7 +128,7 @@ pub fn loop_statement_forever(s: Span) -> IResult { } #[parser] -pub fn loop_statement_repeat(s: Span) -> IResult { +pub(crate) fn loop_statement_repeat(s: Span) -> IResult { let (s, a) = keyword("repeat")(s)?; let (s, b) = paren(expression)(s)?; let (s, c) = statement_or_null(s)?; @@ -139,7 +139,7 @@ pub fn loop_statement_repeat(s: Span) -> IResult { } #[parser] -pub fn loop_statement_while(s: Span) -> IResult { +pub(crate) fn loop_statement_while(s: Span) -> IResult { let (s, a) = keyword("while")(s)?; let (s, b) = paren(expression)(s)?; let (s, c) = statement_or_null(s)?; @@ -150,7 +150,7 @@ pub fn loop_statement_while(s: Span) -> IResult { } #[parser] -pub fn loop_statement_for(s: Span) -> IResult { +pub(crate) fn loop_statement_for(s: Span) -> IResult { let (s, a) = keyword("for")(s)?; let (s, b) = paren(tuple(( opt(for_initialization), @@ -167,7 +167,7 @@ pub fn loop_statement_for(s: Span) -> IResult { } #[parser] -pub fn loop_statement_do_while(s: Span) -> IResult { +pub(crate) fn loop_statement_do_while(s: Span) -> IResult { let (s, a) = keyword("do")(s)?; let (s, b) = statement_or_null(s)?; let (s, c) = keyword("while")(s)?; @@ -182,7 +182,7 @@ pub fn loop_statement_do_while(s: Span) -> IResult { } #[parser] -pub fn loop_statement_foreach(s: Span) -> IResult { +pub(crate) fn loop_statement_foreach(s: Span) -> IResult { let (s, a) = keyword("foreach")(s)?; let (s, b) = paren(pair( ps_or_hierarchical_array_identifier, @@ -196,7 +196,7 @@ pub fn loop_statement_foreach(s: Span) -> IResult { } #[parser] -pub fn for_initialization(s: Span) -> IResult { +pub(crate) fn for_initialization(s: Span) -> IResult { alt(( map(list_of_variable_assignments, |x| { ForInitialization::ListOfVariableAssignments(Box::new(x)) @@ -206,7 +206,7 @@ pub fn for_initialization(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn for_initialization_declaration(s: Span) -> IResult { +pub(crate) fn for_initialization_declaration(s: Span) -> IResult { let (s, a) = list(symbol(","), for_variable_declaration)(s)?; Ok(( s, @@ -215,7 +215,7 @@ pub fn for_initialization_declaration(s: Span) -> IResult IResult { +pub(crate) fn for_variable_declaration(s: Span) -> IResult { let (s, a) = opt(var)(s)?; let (s, b) = data_type(s)?; let (s, c) = list( @@ -226,19 +226,19 @@ pub fn for_variable_declaration(s: Span) -> IResult IResult { +pub(crate) fn var(s: Span) -> IResult { let (s, a) = keyword("var")(s)?; Ok((s, Var { nodes: (a,) })) } #[parser(MaybeRecursive)] -pub fn for_step(s: Span) -> IResult { +pub(crate) fn for_step(s: Span) -> IResult { let (s, a) = list(symbol(","), for_step_assignment)(s)?; Ok((s, ForStep { nodes: (a,) })) } #[parser] -pub fn for_step_assignment(s: Span) -> IResult { +pub(crate) fn for_step_assignment(s: Span) -> IResult { alt(( map(operator_assignment, |x| { ForStepAssignment::OperatorAssignment(Box::new(x)) @@ -253,7 +253,7 @@ pub fn for_step_assignment(s: Span) -> IResult { } #[parser] -pub fn loop_variables(s: Span) -> IResult { +pub(crate) fn loop_variables(s: Span) -> IResult { let (s, a) = list(symbol(","), opt(index_variable_identifier))(s)?; Ok((s, LoopVariables { nodes: (a,) })) } diff --git a/src/parser/behavioral_statements/parallel_and_sequential_blocks.rs b/src/parser/behavioral_statements/parallel_and_sequential_blocks.rs index 3255fb5..a98e2a4 100644 --- a/src/parser/behavioral_statements/parallel_and_sequential_blocks.rs +++ b/src/parser/behavioral_statements/parallel_and_sequential_blocks.rs @@ -53,7 +53,7 @@ pub enum JoinKeyword { // ----------------------------------------------------------------------------- #[parser] -pub fn action_block(s: Span) -> IResult { +pub(crate) fn action_block(s: Span) -> IResult { alt(( map(statement_or_null, |x| { ActionBlock::StatementOrNull(Box::new(x)) @@ -63,7 +63,7 @@ pub fn action_block(s: Span) -> IResult { } #[parser] -pub fn action_block_else(s: Span) -> IResult { +pub(crate) fn action_block_else(s: Span) -> IResult { let (s, a) = opt(statement)(s)?; let (s, b) = keyword("else")(s)?; let (s, c) = statement_or_null(s)?; @@ -74,7 +74,7 @@ pub fn action_block_else(s: Span) -> IResult { } #[parser] -pub fn seq_block(s: Span) -> IResult { +pub(crate) fn seq_block(s: Span) -> IResult { let (s, a) = keyword("begin")(s)?; let (s, b) = opt(pair(symbol(":"), block_identifier))(s)?; let (s, c) = many0(block_item_declaration)(s)?; @@ -90,7 +90,7 @@ pub fn seq_block(s: Span) -> IResult { } #[parser] -pub fn par_block(s: Span) -> IResult { +pub(crate) fn par_block(s: Span) -> IResult { let (s, a) = keyword("fork")(s)?; let (s, b) = opt(pair(symbol(":"), block_identifier))(s)?; let (s, c) = many0(block_item_declaration)(s)?; @@ -106,7 +106,7 @@ pub fn par_block(s: Span) -> IResult { } #[parser] -pub fn join_keyword(s: Span) -> IResult { +pub(crate) fn join_keyword(s: Span) -> IResult { alt(( map(keyword("join_any"), |x| JoinKeyword::JoinAny(Box::new(x))), map(keyword("join_none"), |x| JoinKeyword::JoinNone(Box::new(x))), diff --git a/src/parser/behavioral_statements/patterns.rs b/src/parser/behavioral_statements/patterns.rs index c093d89..34f3323 100644 --- a/src/parser/behavioral_statements/patterns.rs +++ b/src/parser/behavioral_statements/patterns.rs @@ -115,7 +115,7 @@ pub struct AssignmentPatternVariableLvalue { // ----------------------------------------------------------------------------- #[parser] -pub fn pattern(s: Span) -> IResult { +pub(crate) fn pattern(s: Span) -> IResult { alt(( pattern_variable, map(symbol(".*"), |x| Pattern::Asterisk(Box::new(x))), @@ -129,7 +129,7 @@ pub fn pattern(s: Span) -> IResult { } #[parser] -pub fn pattern_variable(s: Span) -> IResult { +pub(crate) fn pattern_variable(s: Span) -> IResult { let (s, a) = symbol(".")(s)?; let (s, b) = variable_identifier(s)?; Ok(( @@ -139,7 +139,7 @@ pub fn pattern_variable(s: Span) -> IResult { } #[parser] -pub fn pattern_tagged(s: Span) -> IResult { +pub(crate) fn pattern_tagged(s: Span) -> IResult { let (s, a) = keyword("tagged")(s)?; let (s, b) = member_identifier(s)?; let (s, c) = opt(pattern)(s)?; @@ -150,13 +150,13 @@ pub fn pattern_tagged(s: Span) -> IResult { } #[parser] -pub fn pattern_list(s: Span) -> IResult { +pub(crate) fn pattern_list(s: Span) -> IResult { let (s, a) = apostrophe_brace(list(symbol(","), pattern))(s)?; Ok((s, Pattern::List(Box::new(PatternList { nodes: (a,) })))) } #[parser] -pub fn pattern_identifier_list(s: Span) -> IResult { +pub(crate) fn pattern_identifier_list(s: Span) -> IResult { let (s, a) = apostrophe_brace(list( symbol(","), triple(member_identifier, symbol(":"), pattern), @@ -168,7 +168,7 @@ pub fn pattern_identifier_list(s: Span) -> IResult { } #[parser] -pub fn assignment_pattern(s: Span) -> IResult { +pub(crate) fn assignment_pattern(s: Span) -> IResult { alt(( assignment_pattern_list, assignment_pattern_structure, @@ -178,7 +178,7 @@ pub fn assignment_pattern(s: Span) -> IResult { } #[parser] -pub fn assignment_pattern_list(s: Span) -> IResult { +pub(crate) fn assignment_pattern_list(s: Span) -> IResult { let (s, a) = apostrophe_brace(list(symbol(","), expression))(s)?; Ok(( s, @@ -187,7 +187,7 @@ pub fn assignment_pattern_list(s: Span) -> IResult { } #[parser] -pub fn assignment_pattern_structure(s: Span) -> IResult { +pub(crate) fn assignment_pattern_structure(s: Span) -> IResult { let (s, a) = apostrophe_brace(list( symbol(","), triple(structure_pattern_key, symbol(":"), expression), @@ -199,7 +199,7 @@ pub fn assignment_pattern_structure(s: Span) -> IResult } #[parser] -pub fn assignment_pattern_array(s: Span) -> IResult { +pub(crate) fn assignment_pattern_array(s: Span) -> IResult { let (s, a) = apostrophe_brace(list( symbol(","), triple(array_pattern_key, symbol(":"), expression), @@ -211,7 +211,7 @@ pub fn assignment_pattern_array(s: Span) -> IResult { } #[parser] -pub fn assignment_pattern_repeat(s: Span) -> IResult { +pub(crate) fn assignment_pattern_repeat(s: Span) -> IResult { let (s, a) = apostrophe_brace(pair( constant_expression, brace(list(symbol(","), expression)), @@ -223,7 +223,7 @@ pub fn assignment_pattern_repeat(s: Span) -> IResult { } #[parser] -pub fn structure_pattern_key(s: Span) -> IResult { +pub(crate) fn structure_pattern_key(s: Span) -> IResult { alt(( map(member_identifier, |x| { StructurePatternKey::MemberIdentifier(Box::new(x)) @@ -235,7 +235,7 @@ pub fn structure_pattern_key(s: Span) -> IResult { } #[parser] -pub fn array_pattern_key(s: Span) -> IResult { +pub(crate) fn array_pattern_key(s: Span) -> IResult { alt(( map(constant_expression, |x| { ArrayPatternKey::ConstantExpression(Box::new(x)) @@ -247,7 +247,7 @@ pub fn array_pattern_key(s: Span) -> IResult { } #[parser] -pub fn assignment_pattern_key(s: Span) -> IResult { +pub(crate) fn assignment_pattern_key(s: Span) -> IResult { alt(( map(simple_type, |x| { AssignmentPatternKey::SimpleType(Box::new(x)) @@ -260,14 +260,14 @@ pub fn assignment_pattern_key(s: Span) -> IResult { #[packrat_parser] #[parser] -pub fn assignment_pattern_expression(s: Span) -> IResult { +pub(crate) fn assignment_pattern_expression(s: Span) -> IResult { let (s, a) = opt(assignment_pattern_expression_type)(s)?; let (s, b) = assignment_pattern(s)?; Ok((s, AssignmentPatternExpression { nodes: (a, b) })) } #[parser] -pub fn assignment_pattern_expression_type( +pub(crate) fn assignment_pattern_expression_type( s: Span, ) -> IResult { alt(( @@ -287,7 +287,7 @@ pub fn assignment_pattern_expression_type( } #[parser] -pub fn constant_assignment_pattern_expression( +pub(crate) fn constant_assignment_pattern_expression( s: Span, ) -> IResult { let (s, a) = assignment_pattern_expression(s)?; @@ -295,13 +295,13 @@ pub fn constant_assignment_pattern_expression( } #[parser] -pub fn assignment_pattern_net_lvalue(s: Span) -> IResult { +pub(crate) fn assignment_pattern_net_lvalue(s: Span) -> IResult { let (s, a) = apostrophe_brace(list(symbol(","), net_lvalue))(s)?; Ok((s, AssignmentPatternNetLvalue { nodes: (a,) })) } #[parser] -pub fn assignment_pattern_variable_lvalue( +pub(crate) fn assignment_pattern_variable_lvalue( s: Span, ) -> IResult { let (s, a) = apostrophe_brace(list(symbol(","), variable_lvalue))(s)?; diff --git a/src/parser/behavioral_statements/procedural_blocks_and_assignments.rs b/src/parser/behavioral_statements/procedural_blocks_and_assignments.rs index b23a309..f960a79 100644 --- a/src/parser/behavioral_statements/procedural_blocks_and_assignments.rs +++ b/src/parser/behavioral_statements/procedural_blocks_and_assignments.rs @@ -126,21 +126,21 @@ pub struct VariableAssignment { // ----------------------------------------------------------------------------- #[parser] -pub fn initial_construct(s: Span) -> IResult { +pub(crate) fn initial_construct(s: Span) -> IResult { let (s, a) = keyword("initial")(s)?; let (s, b) = statement_or_null(s)?; Ok((s, InitialConstruct { nodes: (a, b) })) } #[parser] -pub fn always_construct(s: Span) -> IResult { +pub(crate) fn always_construct(s: Span) -> IResult { let (s, a) = always_keyword(s)?; let (s, b) = statement(s)?; Ok((s, AlwaysConstruct { nodes: (a, b) })) } #[parser] -pub fn always_keyword(s: Span) -> IResult { +pub(crate) fn always_keyword(s: Span) -> IResult { alt(( map(keyword("always_comb"), |x| { AlwaysKeyword::AlwaysComb(Box::new(x)) @@ -156,14 +156,14 @@ pub fn always_keyword(s: Span) -> IResult { } #[parser] -pub fn final_construct(s: Span) -> IResult { +pub(crate) fn final_construct(s: Span) -> IResult { let (s, a) = keyword("final")(s)?; let (s, b) = function_statement(s)?; Ok((s, FinalConstruct { nodes: (a, b) })) } #[parser] -pub fn blocking_assignment(s: Span) -> IResult { +pub(crate) fn blocking_assignment(s: Span) -> IResult { alt(( blocking_assignment_variable, blocking_assignment_nonrange_variable, @@ -175,7 +175,7 @@ pub fn blocking_assignment(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn blocking_assignment_variable(s: Span) -> IResult { +pub(crate) fn blocking_assignment_variable(s: Span) -> IResult { let (s, a) = variable_lvalue(s)?; let (s, b) = symbol("=")(s)?; let (s, c) = delay_or_event_control(s)?; @@ -189,7 +189,7 @@ pub fn blocking_assignment_variable(s: Span) -> IResult IResult { +pub(crate) fn blocking_assignment_nonrange_variable(s: Span) -> IResult { let (s, a) = nonrange_variable_lvalue(s)?; let (s, b) = symbol("=")(s)?; let (s, c) = dynamic_array_new(s)?; @@ -202,7 +202,7 @@ pub fn blocking_assignment_nonrange_variable(s: Span) -> IResult IResult { +pub(crate) fn blocking_assignment_hierarchical_variable(s: Span) -> IResult { let (s, a) = opt(implicit_class_handle_or_class_scope_or_package_scope)(s)?; let (s, b) = hierarchical_variable_identifier(s)?; let (s, c) = select(s)?; @@ -219,7 +219,7 @@ pub fn blocking_assignment_hierarchical_variable(s: Span) -> IResult IResult { +pub(crate) fn operator_assignment(s: Span) -> IResult { let (s, a) = variable_lvalue(s)?; let (s, b) = assignment_operator(s)?; let (s, c) = expression(s)?; @@ -227,7 +227,7 @@ pub fn operator_assignment(s: Span) -> IResult { } #[parser] -pub fn assignment_operator(s: Span) -> IResult { +pub(crate) fn assignment_operator(s: Span) -> IResult { alt(( map(symbol("="), |x| AssignmentOperator { nodes: (x,) }), map(symbol("+="), |x| AssignmentOperator { nodes: (x,) }), @@ -246,7 +246,7 @@ pub fn assignment_operator(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn nonblocking_assignment(s: Span) -> IResult { +pub(crate) fn nonblocking_assignment(s: Span) -> IResult { let (s, a) = variable_lvalue(s)?; let (s, b) = symbol("<=")(s)?; let (s, c) = opt(delay_or_event_control)(s)?; @@ -260,7 +260,7 @@ pub fn nonblocking_assignment(s: Span) -> IResult { } #[parser] -pub fn procedural_continuous_assignment(s: Span) -> IResult { +pub(crate) fn procedural_continuous_assignment(s: Span) -> IResult { alt(( procedural_continuous_assignment_assign, procedural_continuous_assignment_deassign, @@ -272,7 +272,7 @@ pub fn procedural_continuous_assignment(s: Span) -> IResult IResult { let (s, a) = keyword("assign")(s)?; @@ -286,7 +286,7 @@ pub fn procedural_continuous_assignment_assign( } #[parser] -pub fn procedural_continuous_assignment_deassign( +pub(crate) fn procedural_continuous_assignment_deassign( s: Span, ) -> IResult { let (s, a) = keyword("deassign")(s)?; @@ -300,7 +300,7 @@ pub fn procedural_continuous_assignment_deassign( } #[parser] -pub fn procedural_continuous_assignment_force_variable( +pub(crate) fn procedural_continuous_assignment_force_variable( s: Span, ) -> IResult { let (s, a) = keyword("force")(s)?; @@ -314,7 +314,7 @@ pub fn procedural_continuous_assignment_force_variable( } #[parser] -pub fn procedural_continuous_assignment_force_net( +pub(crate) fn procedural_continuous_assignment_force_net( s: Span, ) -> IResult { let (s, a) = keyword("force")(s)?; @@ -328,7 +328,7 @@ pub fn procedural_continuous_assignment_force_net( } #[parser] -pub fn procedural_continuous_assignment_release_variable( +pub(crate) fn procedural_continuous_assignment_release_variable( s: Span, ) -> IResult { let (s, a) = keyword("release")(s)?; @@ -342,7 +342,7 @@ pub fn procedural_continuous_assignment_release_variable( } #[parser] -pub fn procedural_continuous_assignment_release_net( +pub(crate) fn procedural_continuous_assignment_release_net( s: Span, ) -> IResult { let (s, a) = keyword("release")(s)?; @@ -356,7 +356,7 @@ pub fn procedural_continuous_assignment_release_net( } #[parser(MaybeRecursive)] -pub fn variable_assignment(s: Span) -> IResult { +pub(crate) fn variable_assignment(s: Span) -> IResult { let (s, a) = variable_lvalue(s)?; let (s, b) = symbol("=")(s)?; let (s, c) = expression(s)?; diff --git a/src/parser/behavioral_statements/randsequence.rs b/src/parser/behavioral_statements/randsequence.rs index c076dbf..b548b70 100644 --- a/src/parser/behavioral_statements/randsequence.rs +++ b/src/parser/behavioral_statements/randsequence.rs @@ -143,7 +143,7 @@ pub struct RsCaseItemDefault { // ----------------------------------------------------------------------------- #[parser] -pub fn randsequence_statement(s: Span) -> IResult { +pub(crate) fn randsequence_statement(s: Span) -> IResult { let (s, a) = keyword("randsequence")(s)?; let (s, b) = paren(opt(production_identifier))(s)?; let (s, c) = production(s)?; @@ -158,7 +158,7 @@ pub fn randsequence_statement(s: Span) -> IResult { } #[parser] -pub fn production(s: Span) -> IResult { +pub(crate) fn production(s: Span) -> IResult { let (s, a) = opt(data_type_or_void)(s)?; let (s, b) = production_identifier(s)?; let (s, c) = opt(paren(tf_port_list))(s)?; @@ -174,7 +174,7 @@ pub fn production(s: Span) -> IResult { } #[parser] -pub fn rs_rule(s: Span) -> IResult { +pub(crate) fn rs_rule(s: Span) -> IResult { let (s, a) = rs_production_list(s)?; let (s, b) = opt(triple( symbol(":="), @@ -185,12 +185,12 @@ pub fn rs_rule(s: Span) -> IResult { } #[parser] -pub fn rs_production_list(s: Span) -> IResult { +pub(crate) fn rs_production_list(s: Span) -> IResult { alt((rs_production_list_prod, rs_production_list_join))(s) } #[parser] -pub fn rs_production_list_prod(s: Span) -> IResult { +pub(crate) fn rs_production_list_prod(s: Span) -> IResult { let (s, a) = rs_prod(s)?; let (s, b) = many0(rs_prod)(s)?; Ok(( @@ -200,7 +200,7 @@ pub fn rs_production_list_prod(s: Span) -> IResult { } #[parser] -pub fn rs_production_list_join(s: Span) -> IResult { +pub(crate) fn rs_production_list_join(s: Span) -> IResult { let (s, a) = keyword("rand")(s)?; let (s, b) = keyword("join")(s)?; let (s, c) = opt(paren(expression))(s)?; @@ -216,7 +216,7 @@ pub fn rs_production_list_join(s: Span) -> IResult { } #[parser] -pub fn weight_specification(s: Span) -> IResult { +pub(crate) fn weight_specification(s: Span) -> IResult { alt(( map(integral_number, |x| { WeightSpecification::IntegralNumber(Box::new(x)) @@ -229,7 +229,7 @@ pub fn weight_specification(s: Span) -> IResult { } #[parser] -pub fn weight_specification_expression(s: Span) -> IResult { +pub(crate) fn weight_specification_expression(s: Span) -> IResult { let (s, a) = paren(expression)(s)?; Ok(( s, @@ -238,13 +238,13 @@ pub fn weight_specification_expression(s: Span) -> IResult IResult { +pub(crate) fn rs_code_block(s: Span) -> IResult { let (s, a) = brace(pair(many0(data_declaration), many0(statement_or_null)))(s)?; Ok((s, RsCodeBlock { nodes: (a,) })) } #[parser] -pub fn rs_prod(s: Span) -> IResult { +pub(crate) fn rs_prod(s: Span) -> IResult { alt(( map(production_item, |x| RsProd::ProductionItem(Box::new(x))), map(rs_code_block, |x| RsProd::RsCodeBlock(Box::new(x))), @@ -255,14 +255,14 @@ pub fn rs_prod(s: Span) -> IResult { } #[parser] -pub fn production_item(s: Span) -> IResult { +pub(crate) fn production_item(s: Span) -> IResult { let (s, a) = production_identifier(s)?; let (s, b) = opt(paren(list_of_arguments))(s)?; Ok((s, ProductionItem { nodes: (a, b) })) } #[parser] -pub fn rs_if_else(s: Span) -> IResult { +pub(crate) fn rs_if_else(s: Span) -> IResult { let (s, a) = keyword("if")(s)?; let (s, b) = paren(expression)(s)?; let (s, c) = production_item(s)?; @@ -276,7 +276,7 @@ pub fn rs_if_else(s: Span) -> IResult { } #[parser] -pub fn rs_repeat(s: Span) -> IResult { +pub(crate) fn rs_repeat(s: Span) -> IResult { let (s, a) = keyword("repeat")(s)?; let (s, b) = paren(expression)(s)?; let (s, c) = production_item(s)?; @@ -284,7 +284,7 @@ pub fn rs_repeat(s: Span) -> IResult { } #[parser] -pub fn rs_case(s: Span) -> IResult { +pub(crate) fn rs_case(s: Span) -> IResult { let (s, a) = keyword("case")(s)?; let (s, b) = paren(case_expression)(s)?; let (s, c) = rs_case_item(s)?; @@ -299,12 +299,12 @@ pub fn rs_case(s: Span) -> IResult { } #[parser] -pub fn rs_case_item(s: Span) -> IResult { +pub(crate) fn rs_case_item(s: Span) -> IResult { alt((rs_case_item_nondefault, rs_case_item_default))(s) } #[parser(MaybeRecursive)] -pub fn rs_case_item_nondefault(s: Span) -> IResult { +pub(crate) fn rs_case_item_nondefault(s: Span) -> IResult { let (s, a) = list(symbol(","), case_item_expression)(s)?; let (s, b) = symbol(":")(s)?; let (s, c) = production_item(s)?; @@ -318,7 +318,7 @@ pub fn rs_case_item_nondefault(s: Span) -> IResult { } #[parser] -pub fn rs_case_item_default(s: Span) -> IResult { +pub(crate) fn rs_case_item_default(s: Span) -> IResult { let (s, a) = keyword("default")(s)?; let (s, b) = opt(symbol(":"))(s)?; let (s, c) = production_item(s)?; diff --git a/src/parser/behavioral_statements/statements.rs b/src/parser/behavioral_statements/statements.rs index dabaa9a..5b48161 100644 --- a/src/parser/behavioral_statements/statements.rs +++ b/src/parser/behavioral_statements/statements.rs @@ -76,7 +76,7 @@ pub struct VariableIdentifierList { // ----------------------------------------------------------------------------- #[parser] -pub fn statement_or_null(s: Span) -> IResult { +pub(crate) fn statement_or_null(s: Span) -> IResult { alt(( map(statement, |x| StatementOrNull::Statement(Box::new(x))), statement_or_null_attribute, @@ -84,7 +84,7 @@ pub fn statement_or_null(s: Span) -> IResult { } #[parser] -pub fn statement_or_null_attribute(s: Span) -> IResult { +pub(crate) fn statement_or_null_attribute(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = symbol(";")(s)?; Ok(( @@ -94,7 +94,7 @@ pub fn statement_or_null_attribute(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn statement(s: Span) -> IResult { +pub(crate) fn statement(s: Span) -> IResult { let (s, a) = opt(pair(block_identifier, symbol(":")))(s)?; let (s, b) = many0(attribute_instance)(s)?; let (s, c) = statement_item(s)?; @@ -102,7 +102,7 @@ pub fn statement(s: Span) -> IResult { } #[parser] -pub fn statement_item(s: Span) -> IResult { +pub(crate) fn statement_item(s: Span) -> IResult { alt(( map(pair(blocking_assignment, symbol(";")), |x| { StatementItem::BlockingAssignment(Box::new(x)) @@ -162,13 +162,13 @@ pub fn statement_item(s: Span) -> IResult { } #[parser] -pub fn function_statement(s: Span) -> IResult { +pub(crate) fn function_statement(s: Span) -> IResult { let (s, a) = statement(s)?; Ok((s, FunctionStatement { nodes: (a,) })) } #[parser] -pub fn function_statement_or_null(s: Span) -> IResult { +pub(crate) fn function_statement_or_null(s: Span) -> IResult { alt(( map(function_statement, |x| { FunctionStatementOrNull::Statement(Box::new(x)) @@ -178,7 +178,7 @@ pub fn function_statement_or_null(s: Span) -> IResult IResult { +pub(crate) fn function_statement_or_null_attribute(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = symbol(";")(s)?; Ok(( @@ -190,7 +190,7 @@ pub fn function_statement_or_null_attribute(s: Span) -> IResult IResult { +pub(crate) fn variable_identifier_list(s: Span) -> IResult { let (s, a) = list(symbol(","), variable_identifier)(s)?; Ok((s, VariableIdentifierList { nodes: (a,) })) } diff --git a/src/parser/behavioral_statements/subroutine_call_statements.rs b/src/parser/behavioral_statements/subroutine_call_statements.rs index 5ad3f7e..553021a 100644 --- a/src/parser/behavioral_statements/subroutine_call_statements.rs +++ b/src/parser/behavioral_statements/subroutine_call_statements.rs @@ -21,7 +21,7 @@ pub struct SubroutineCallStatementFunction { // ----------------------------------------------------------------------------- #[parser] -pub fn subroutine_call_statement(s: Span) -> IResult { +pub(crate) fn subroutine_call_statement(s: Span) -> IResult { alt(( map(pair(subroutine_call, symbol(";")), |x| { SubroutineCallStatement::SubroutineCall(Box::new(x)) @@ -31,7 +31,7 @@ pub fn subroutine_call_statement(s: Span) -> IResult IResult { +pub(crate) fn subroutine_call_statement_function(s: Span) -> IResult { let (s, a) = keyword("void")(s)?; let (s, b) = symbol("'")(s)?; let (s, c) = paren(function_subroutine_call)(s)?; diff --git a/src/parser/behavioral_statements/timing_control_statements.rs b/src/parser/behavioral_statements/timing_control_statements.rs index 2714fe1..1b4ad3c 100644 --- a/src/parser/behavioral_statements/timing_control_statements.rs +++ b/src/parser/behavioral_statements/timing_control_statements.rs @@ -213,7 +213,7 @@ pub struct DisableStatementFork { // ----------------------------------------------------------------------------- #[parser] -pub fn procedural_timing_control_statement( +pub(crate) fn procedural_timing_control_statement( s: Span, ) -> IResult { let (s, a) = procedural_timing_control(s)?; @@ -222,7 +222,7 @@ pub fn procedural_timing_control_statement( } #[parser] -pub fn delay_or_event_control(s: Span) -> IResult { +pub(crate) fn delay_or_event_control(s: Span) -> IResult { alt(( map(delay_control, |x| DelayOrEventControl::Delay(Box::new(x))), map(event_control, |x| DelayOrEventControl::Event(Box::new(x))), @@ -231,7 +231,7 @@ pub fn delay_or_event_control(s: Span) -> IResult { } #[parser] -pub fn delay_or_event_control_repeat(s: Span) -> IResult { +pub(crate) fn delay_or_event_control_repeat(s: Span) -> IResult { let (s, a) = keyword("repeat")(s)?; let (s, b) = paren(expression)(s)?; let (s, c) = event_control(s)?; @@ -242,12 +242,12 @@ pub fn delay_or_event_control_repeat(s: Span) -> IResult IResult { +pub(crate) fn delay_control(s: Span) -> IResult { alt((delay_control_delay, delay_control_mintypmax))(s) } #[parser] -pub fn delay_control_delay(s: Span) -> IResult { +pub(crate) fn delay_control_delay(s: Span) -> IResult { let (s, a) = symbol("#")(s)?; let (s, b) = delay_value(s)?; Ok(( @@ -257,7 +257,7 @@ pub fn delay_control_delay(s: Span) -> IResult { } #[parser] -pub fn delay_control_mintypmax(s: Span) -> IResult { +pub(crate) fn delay_control_mintypmax(s: Span) -> IResult { let (s, a) = symbol("#")(s)?; let (s, b) = paren(mintypmax_expression)(s)?; Ok(( @@ -267,7 +267,7 @@ pub fn delay_control_mintypmax(s: Span) -> IResult { } #[parser] -pub fn event_control(s: Span) -> IResult { +pub(crate) fn event_control(s: Span) -> IResult { alt(( event_control_event_identifier, event_control_event_expression, @@ -278,7 +278,7 @@ pub fn event_control(s: Span) -> IResult { } #[parser] -pub fn event_control_event_identifier(s: Span) -> IResult { +pub(crate) fn event_control_event_identifier(s: Span) -> IResult { let (s, a) = symbol("@")(s)?; let (s, b) = hierarchical_event_identifier(s)?; Ok(( @@ -288,7 +288,7 @@ pub fn event_control_event_identifier(s: Span) -> IResult { } #[parser] -pub fn event_control_event_expression(s: Span) -> IResult { +pub(crate) fn event_control_event_expression(s: Span) -> IResult { let (s, a) = symbol("@")(s)?; let (s, b) = paren(event_expression)(s)?; Ok(( @@ -298,7 +298,7 @@ pub fn event_control_event_expression(s: Span) -> IResult { } #[parser] -pub fn event_control_asterisk(s: Span) -> IResult { +pub(crate) fn event_control_asterisk(s: Span) -> IResult { let (s, a) = symbol("@*")(s)?; Ok(( s, @@ -307,7 +307,7 @@ pub fn event_control_asterisk(s: Span) -> IResult { } #[parser] -pub fn event_control_paren_asterisk(s: Span) -> IResult { +pub(crate) fn event_control_paren_asterisk(s: Span) -> IResult { let (s, a) = symbol("@")(s)?; let (s, b) = paren(symbol("*"))(s)?; Ok(( @@ -317,7 +317,7 @@ pub fn event_control_paren_asterisk(s: Span) -> IResult { } #[parser] -pub fn event_control_sequence_identifier(s: Span) -> IResult { +pub(crate) fn event_control_sequence_identifier(s: Span) -> IResult { let (s, a) = symbol("@")(s)?; let (s, b) = ps_or_hierarchical_sequence_identifier(s)?; Ok(( @@ -329,7 +329,7 @@ pub fn event_control_sequence_identifier(s: Span) -> IResult } #[parser] -pub fn event_expression(s: Span) -> IResult { +pub(crate) fn event_expression(s: Span) -> IResult { alt(( event_expression_expression, event_expression_sequence, @@ -340,7 +340,7 @@ pub fn event_expression(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn event_expression_expression(s: Span) -> IResult { +pub(crate) fn event_expression_expression(s: Span) -> IResult { let (s, a) = opt(edge_identifier)(s)?; let (s, b) = expression(s)?; let (s, c) = opt(pair(keyword("iff"), expression))(s)?; @@ -351,7 +351,7 @@ pub fn event_expression_expression(s: Span) -> IResult { } #[parser] -pub fn event_expression_sequence(s: Span) -> IResult { +pub(crate) fn event_expression_sequence(s: Span) -> IResult { let (s, a) = sequence_instance(s)?; let (s, b) = opt(pair(keyword("iff"), expression))(s)?; Ok(( @@ -361,7 +361,7 @@ pub fn event_expression_sequence(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn event_expression_or(s: Span) -> IResult { +pub(crate) fn event_expression_or(s: Span) -> IResult { let (s, a) = event_expression(s)?; let (s, b) = keyword("or")(s)?; let (s, c) = event_expression(s)?; @@ -372,7 +372,7 @@ pub fn event_expression_or(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn event_expression_comma(s: Span) -> IResult { +pub(crate) fn event_expression_comma(s: Span) -> IResult { let (s, a) = event_expression(s)?; let (s, b) = symbol(",")(s)?; let (s, c) = event_expression(s)?; @@ -383,7 +383,7 @@ pub fn event_expression_comma(s: Span) -> IResult { } #[parser] -pub fn event_expression_paren(s: Span) -> IResult { +pub(crate) fn event_expression_paren(s: Span) -> IResult { let (s, a) = paren(event_expression)(s)?; Ok(( s, @@ -392,7 +392,7 @@ pub fn event_expression_paren(s: Span) -> IResult { } #[parser] -pub fn procedural_timing_control(s: Span) -> IResult { +pub(crate) fn procedural_timing_control(s: Span) -> IResult { alt(( map(delay_control, |x| { ProceduralTimingControl::DelayControl(Box::new(x)) @@ -407,7 +407,7 @@ pub fn procedural_timing_control(s: Span) -> IResult IResult { +pub(crate) fn jump_statement(s: Span) -> IResult { alt(( jump_statement_return, jump_statement_break, @@ -416,7 +416,7 @@ pub fn jump_statement(s: Span) -> IResult { } #[parser] -pub fn jump_statement_return(s: Span) -> IResult { +pub(crate) fn jump_statement_return(s: Span) -> IResult { let (s, a) = keyword("return")(s)?; let (s, b) = opt(expression)(s)?; let (s, c) = symbol(";")(s)?; @@ -427,7 +427,7 @@ pub fn jump_statement_return(s: Span) -> IResult { } #[parser] -pub fn jump_statement_break(s: Span) -> IResult { +pub(crate) fn jump_statement_break(s: Span) -> IResult { let (s, a) = keyword("break")(s)?; let (s, b) = symbol(";")(s)?; Ok(( @@ -437,7 +437,7 @@ pub fn jump_statement_break(s: Span) -> IResult { } #[parser] -pub fn jump_statement_continue(s: Span) -> IResult { +pub(crate) fn jump_statement_continue(s: Span) -> IResult { let (s, a) = keyword("continue")(s)?; let (s, b) = symbol(";")(s)?; Ok(( @@ -447,7 +447,7 @@ pub fn jump_statement_continue(s: Span) -> IResult { } #[parser] -pub fn wait_statement(s: Span) -> IResult { +pub(crate) fn wait_statement(s: Span) -> IResult { alt(( wait_statement_wait, wait_statement_fork, @@ -456,7 +456,7 @@ pub fn wait_statement(s: Span) -> IResult { } #[parser] -pub fn wait_statement_wait(s: Span) -> IResult { +pub(crate) fn wait_statement_wait(s: Span) -> IResult { let (s, a) = keyword("wait")(s)?; let (s, b) = paren(expression)(s)?; let (s, c) = statement_or_null(s)?; @@ -467,7 +467,7 @@ pub fn wait_statement_wait(s: Span) -> IResult { } #[parser] -pub fn wait_statement_fork(s: Span) -> IResult { +pub(crate) fn wait_statement_fork(s: Span) -> IResult { let (s, a) = keyword("wait")(s)?; let (s, b) = keyword("fork")(s)?; let (s, c) = symbol(";")(s)?; @@ -478,7 +478,7 @@ pub fn wait_statement_fork(s: Span) -> IResult { } #[parser] -pub fn wait_statement_order(s: Span) -> IResult { +pub(crate) fn wait_statement_order(s: Span) -> IResult { let (s, a) = keyword("wait_order")(s)?; let (s, b) = paren(list(symbol(","), hierarchical_identifier))(s)?; let (s, c) = action_block(s)?; @@ -489,12 +489,12 @@ pub fn wait_statement_order(s: Span) -> IResult { } #[parser] -pub fn event_trigger(s: Span) -> IResult { +pub(crate) fn event_trigger(s: Span) -> IResult { alt((event_trigger_named, event_trigger_nonblocking))(s) } #[parser] -pub fn event_trigger_named(s: Span) -> IResult { +pub(crate) fn event_trigger_named(s: Span) -> IResult { let (s, a) = symbol("->")(s)?; let (s, b) = hierarchical_event_identifier(s)?; let (s, c) = symbol(";")(s)?; @@ -505,7 +505,7 @@ pub fn event_trigger_named(s: Span) -> IResult { } #[parser] -pub fn event_trigger_nonblocking(s: Span) -> IResult { +pub(crate) fn event_trigger_nonblocking(s: Span) -> IResult { let (s, a) = symbol("->>")(s)?; let (s, b) = opt(delay_or_event_control)(s)?; let (s, c) = hierarchical_event_identifier(s)?; @@ -519,7 +519,7 @@ pub fn event_trigger_nonblocking(s: Span) -> IResult { } #[parser] -pub fn disable_statement(s: Span) -> IResult { +pub(crate) fn disable_statement(s: Span) -> IResult { alt(( disable_statement_task, disable_statement_block, @@ -528,7 +528,7 @@ pub fn disable_statement(s: Span) -> IResult { } #[parser] -pub fn disable_statement_task(s: Span) -> IResult { +pub(crate) fn disable_statement_task(s: Span) -> IResult { let (s, a) = keyword("disable")(s)?; let (s, b) = hierarchical_task_identifier(s)?; let (s, c) = symbol(";")(s)?; @@ -539,7 +539,7 @@ pub fn disable_statement_task(s: Span) -> IResult { } #[parser] -pub fn disable_statement_block(s: Span) -> IResult { +pub(crate) fn disable_statement_block(s: Span) -> IResult { let (s, a) = keyword("disable")(s)?; let (s, b) = hierarchical_block_identifier(s)?; let (s, c) = symbol(";")(s)?; @@ -550,7 +550,7 @@ pub fn disable_statement_block(s: Span) -> IResult { } #[parser] -pub fn disable_statement_fork(s: Span) -> IResult { +pub(crate) fn disable_statement_fork(s: Span) -> IResult { let (s, a) = keyword("disable")(s)?; let (s, b) = keyword("fork")(s)?; let (s, c) = symbol(";")(s)?; diff --git a/src/parser/declarations/assertion_declarations.rs b/src/parser/declarations/assertion_declarations.rs index cf1f554..756b3ec 100644 --- a/src/parser/declarations/assertion_declarations.rs +++ b/src/parser/declarations/assertion_declarations.rs @@ -670,7 +670,7 @@ pub struct AssertionVariableDeclaration { // ----------------------------------------------------------------------------- #[parser] -pub fn concurrent_assertion_item(s: Span) -> IResult { +pub(crate) fn concurrent_assertion_item(s: Span) -> IResult { alt(( concurrent_assertion_item_statement, map(checker_instantiation, |x| { @@ -680,7 +680,7 @@ pub fn concurrent_assertion_item(s: Span) -> IResult IResult { +pub(crate) fn concurrent_assertion_item_statement(s: Span) -> IResult { let (s, a) = opt(pair(block_identifier, symbol(":")))(s)?; let (s, b) = concurrent_assertion_statement(s)?; Ok(( @@ -692,7 +692,7 @@ pub fn concurrent_assertion_item_statement(s: Span) -> IResult IResult { +pub(crate) fn concurrent_assertion_statement(s: Span) -> IResult { alt(( map(assert_property_statement, |x| { ConcurrentAssertionStatement::AssertPropertyStatement(Box::new(x)) @@ -713,7 +713,7 @@ pub fn concurrent_assertion_statement(s: Span) -> IResult IResult { +pub(crate) fn assert_property_statement(s: Span) -> IResult { let (s, a) = keyword("assert")(s)?; let (s, b) = keyword("property")(s)?; let (s, c) = paren(property_spec)(s)?; @@ -727,7 +727,7 @@ pub fn assert_property_statement(s: Span) -> IResult IResult { +pub(crate) fn assume_property_statement(s: Span) -> IResult { let (s, a) = keyword("assume")(s)?; let (s, b) = keyword("property")(s)?; let (s, c) = paren(property_spec)(s)?; @@ -741,7 +741,7 @@ pub fn assume_property_statement(s: Span) -> IResult IResult { +pub(crate) fn cover_property_statement(s: Span) -> IResult { let (s, a) = keyword("cover")(s)?; let (s, b) = keyword("property")(s)?; let (s, c) = paren(property_spec)(s)?; @@ -755,7 +755,7 @@ pub fn cover_property_statement(s: Span) -> IResult IResult { +pub(crate) fn expect_property_statement(s: Span) -> IResult { let (s, a) = keyword("expect")(s)?; let (s, b) = paren(property_spec)(s)?; let (s, c) = action_block(s)?; @@ -763,7 +763,7 @@ pub fn expect_property_statement(s: Span) -> IResult IResult { +pub(crate) fn cover_sequence_statement(s: Span) -> IResult { let (s, a) = keyword("cover")(s)?; let (s, b) = keyword("sequence")(s)?; let (s, c) = paren(triple( @@ -785,7 +785,7 @@ pub fn cover_sequence_statement(s: Span) -> IResult IResult { +pub(crate) fn restrict_property_statement(s: Span) -> IResult { let (s, a) = keyword("restrict")(s)?; let (s, b) = keyword("property")(s)?; let (s, c) = paren(property_spec)(s)?; @@ -799,14 +799,14 @@ pub fn restrict_property_statement(s: Span) -> IResult IResult { +pub(crate) fn property_instance(s: Span) -> IResult { let (s, a) = ps_or_hierarchical_property_identifier(s)?; let (s, b) = opt(paren(opt(property_list_of_arguments)))(s)?; Ok((s, PropertyInstance { nodes: (a, b) })) } #[parser] -pub fn property_list_of_arguments(s: Span) -> IResult { +pub(crate) fn property_list_of_arguments(s: Span) -> IResult { alt(( property_list_of_arguments_ordered, property_list_of_arguments_named, @@ -814,7 +814,7 @@ pub fn property_list_of_arguments(s: Span) -> IResult IResult { +pub(crate) fn property_list_of_arguments_ordered(s: Span) -> IResult { let (s, a) = list(symbol(","), opt(property_actual_arg))(s)?; let (s, b) = many0(tuple(( symbol(","), @@ -831,7 +831,7 @@ pub fn property_list_of_arguments_ordered(s: Span) -> IResult IResult { +pub(crate) fn property_list_of_arguments_named(s: Span) -> IResult { let (s, a) = list( symbol(","), triple(symbol("."), identifier, paren(opt(property_actual_arg))), @@ -843,7 +843,7 @@ pub fn property_list_of_arguments_named(s: Span) -> IResult IResult { +pub(crate) fn property_actual_arg(s: Span) -> IResult { alt(( map(property_expr, |x| { PropertyActualArg::PropertyExpr(Box::new(x)) @@ -855,7 +855,7 @@ pub fn property_actual_arg(s: Span) -> IResult { } #[parser] -pub fn assertion_item_declaration(s: Span) -> IResult { +pub(crate) fn assertion_item_declaration(s: Span) -> IResult { alt(( map(property_declaration, |x| { AssertionItemDeclaration::PropertyDeclaration(Box::new(x)) @@ -870,7 +870,7 @@ pub fn assertion_item_declaration(s: Span) -> IResult IResult { +pub(crate) fn property_declaration(s: Span) -> IResult { let (s, a) = keyword("property")(s)?; let (s, b) = property_identifier(s)?; let (s, c) = opt(paren(opt(property_port_list)))(s)?; @@ -889,13 +889,13 @@ pub fn property_declaration(s: Span) -> IResult { } #[parser] -pub fn property_port_list(s: Span) -> IResult { +pub(crate) fn property_port_list(s: Span) -> IResult { let (s, a) = list(symbol(","), property_port_item)(s)?; Ok((s, PropertyPortList { nodes: (a,) })) } #[parser(Ambiguous)] -pub fn property_port_item(s: Span) -> IResult { +pub(crate) fn property_port_item(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = opt(pair(local, opt(property_lvar_port_direction)))(s)?; let (s, c) = ambiguous_opt(property_formal_type)(s)?; @@ -911,13 +911,13 @@ pub fn property_port_item(s: Span) -> IResult { } #[parser] -pub fn property_lvar_port_direction(s: Span) -> IResult { +pub(crate) fn property_lvar_port_direction(s: Span) -> IResult { let (s, a) = keyword("input")(s)?; Ok((s, PropertyLvarPortDirection::Input(Box::new(a)))) } #[parser] -pub fn property_formal_type(s: Span) -> IResult { +pub(crate) fn property_formal_type(s: Span) -> IResult { alt(( map(sequence_formal_type, |x| { PropertyFormalType::SequenceFormalType(Box::new(x)) @@ -929,7 +929,7 @@ pub fn property_formal_type(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn property_spec(s: Span) -> IResult { +pub(crate) fn property_spec(s: Span) -> IResult { let (s, a) = opt(clocking_event)(s)?; let (s, b) = opt(triple( keyword("disable"), @@ -941,7 +941,7 @@ pub fn property_spec(s: Span) -> IResult { } #[parser] -pub fn property_expr(s: Span) -> IResult { +pub(crate) fn property_expr(s: Span) -> IResult { alt(( alt(( map(sequence_expr, |x| PropertyExpr::SequenceExpr(Box::new(x))), @@ -984,7 +984,7 @@ pub fn property_expr(s: Span) -> IResult { } #[parser] -pub fn property_expr_strong(s: Span) -> IResult { +pub(crate) fn property_expr_strong(s: Span) -> IResult { let (s, a) = keyword("strong")(s)?; let (s, b) = paren(sequence_expr)(s)?; Ok(( @@ -994,7 +994,7 @@ pub fn property_expr_strong(s: Span) -> IResult { } #[parser] -pub fn property_expr_weak(s: Span) -> IResult { +pub(crate) fn property_expr_weak(s: Span) -> IResult { let (s, a) = keyword("weak")(s)?; let (s, b) = paren(sequence_expr)(s)?; Ok(( @@ -1004,7 +1004,7 @@ pub fn property_expr_weak(s: Span) -> IResult { } #[parser] -pub fn property_expr_paren(s: Span) -> IResult { +pub(crate) fn property_expr_paren(s: Span) -> IResult { let (s, a) = paren(sequence_expr)(s)?; Ok(( s, @@ -1013,7 +1013,7 @@ pub fn property_expr_paren(s: Span) -> IResult { } #[parser] -pub fn property_expr_not(s: Span) -> IResult { +pub(crate) fn property_expr_not(s: Span) -> IResult { let (s, a) = keyword("not")(s)?; let (s, b) = property_expr(s)?; Ok(( @@ -1023,7 +1023,7 @@ pub fn property_expr_not(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn property_expr_or(s: Span) -> IResult { +pub(crate) fn property_expr_or(s: Span) -> IResult { let (s, a) = property_expr(s)?; let (s, b) = keyword("or")(s)?; let (s, c) = property_expr(s)?; @@ -1034,7 +1034,7 @@ pub fn property_expr_or(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn property_expr_and(s: Span) -> IResult { +pub(crate) fn property_expr_and(s: Span) -> IResult { let (s, a) = property_expr(s)?; let (s, b) = keyword("and")(s)?; let (s, c) = property_expr(s)?; @@ -1045,7 +1045,7 @@ pub fn property_expr_and(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn property_expr_implication_overlapped(s: Span) -> IResult { +pub(crate) fn property_expr_implication_overlapped(s: Span) -> IResult { let (s, a) = sequence_expr(s)?; let (s, b) = symbol("|->")(s)?; let (s, c) = property_expr(s)?; @@ -1058,7 +1058,7 @@ pub fn property_expr_implication_overlapped(s: Span) -> IResult IResult { +pub(crate) fn property_expr_implication_nonoverlapped(s: Span) -> IResult { let (s, a) = sequence_expr(s)?; let (s, b) = symbol("|=>")(s)?; let (s, c) = property_expr(s)?; @@ -1071,7 +1071,7 @@ pub fn property_expr_implication_nonoverlapped(s: Span) -> IResult IResult { +pub(crate) fn property_expr_if(s: Span) -> IResult { let (s, a) = keyword("if")(s)?; let (s, b) = paren(expression_or_dist)(s)?; let (s, c) = property_expr(s)?; @@ -1085,7 +1085,7 @@ pub fn property_expr_if(s: Span) -> IResult { } #[parser] -pub fn property_expr_case(s: Span) -> IResult { +pub(crate) fn property_expr_case(s: Span) -> IResult { let (s, a) = keyword("case")(s)?; let (s, b) = paren(expression_or_dist)(s)?; let (s, c) = property_case_item(s)?; @@ -1100,7 +1100,7 @@ pub fn property_expr_case(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn property_expr_followed_by_overlapped(s: Span) -> IResult { +pub(crate) fn property_expr_followed_by_overlapped(s: Span) -> IResult { let (s, a) = sequence_expr(s)?; let (s, b) = symbol("#-#")(s)?; let (s, c) = property_expr(s)?; @@ -1113,7 +1113,7 @@ pub fn property_expr_followed_by_overlapped(s: Span) -> IResult IResult { +pub(crate) fn property_expr_followed_by_nonoverlapped(s: Span) -> IResult { let (s, a) = sequence_expr(s)?; let (s, b) = symbol("#=#")(s)?; let (s, c) = property_expr(s)?; @@ -1126,7 +1126,7 @@ pub fn property_expr_followed_by_nonoverlapped(s: Span) -> IResult IResult { +pub(crate) fn property_expr_nexttime(s: Span) -> IResult { let (s, a) = keyword("nexttime")(s)?; let (s, b) = opt(bracket(constant_expression))(s)?; let (s, c) = property_expr(s)?; @@ -1137,7 +1137,7 @@ pub fn property_expr_nexttime(s: Span) -> IResult { } #[parser] -pub fn property_expr_s_nexttime(s: Span) -> IResult { +pub(crate) fn property_expr_s_nexttime(s: Span) -> IResult { let (s, a) = keyword("s_nexttime")(s)?; let (s, b) = opt(bracket(constant_expression))(s)?; let (s, c) = property_expr(s)?; @@ -1148,7 +1148,7 @@ pub fn property_expr_s_nexttime(s: Span) -> IResult { } #[parser] -pub fn property_expr_always(s: Span) -> IResult { +pub(crate) fn property_expr_always(s: Span) -> IResult { let (s, a) = keyword("always")(s)?; let (s, b) = opt(bracket(cycle_delay_const_range_expression))(s)?; let (s, c) = property_expr(s)?; @@ -1159,7 +1159,7 @@ pub fn property_expr_always(s: Span) -> IResult { } #[parser] -pub fn property_expr_s_always(s: Span) -> IResult { +pub(crate) fn property_expr_s_always(s: Span) -> IResult { let (s, a) = keyword("s_always")(s)?; let (s, b) = bracket(cycle_delay_const_range_expression)(s)?; let (s, c) = property_expr(s)?; @@ -1170,7 +1170,7 @@ pub fn property_expr_s_always(s: Span) -> IResult { } #[parser] -pub fn property_expr_eventually(s: Span) -> IResult { +pub(crate) fn property_expr_eventually(s: Span) -> IResult { let (s, a) = keyword("eventually")(s)?; let (s, b) = bracket(constant_range)(s)?; let (s, c) = property_expr(s)?; @@ -1181,7 +1181,7 @@ pub fn property_expr_eventually(s: Span) -> IResult { } #[parser] -pub fn property_expr_s_eventually(s: Span) -> IResult { +pub(crate) fn property_expr_s_eventually(s: Span) -> IResult { let (s, a) = keyword("s_eventually")(s)?; let (s, b) = opt(bracket(cycle_delay_const_range_expression))(s)?; let (s, c) = property_expr(s)?; @@ -1192,7 +1192,7 @@ pub fn property_expr_s_eventually(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn property_expr_until(s: Span) -> IResult { +pub(crate) fn property_expr_until(s: Span) -> IResult { let (s, a) = property_expr(s)?; let (s, b) = keyword("until")(s)?; let (s, c) = property_expr(s)?; @@ -1203,7 +1203,7 @@ pub fn property_expr_until(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn property_expr_s_until(s: Span) -> IResult { +pub(crate) fn property_expr_s_until(s: Span) -> IResult { let (s, a) = property_expr(s)?; let (s, b) = keyword("s_until")(s)?; let (s, c) = property_expr(s)?; @@ -1214,7 +1214,7 @@ pub fn property_expr_s_until(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn property_expr_until_with(s: Span) -> IResult { +pub(crate) fn property_expr_until_with(s: Span) -> IResult { let (s, a) = property_expr(s)?; let (s, b) = keyword("until_with")(s)?; let (s, c) = property_expr(s)?; @@ -1225,7 +1225,7 @@ pub fn property_expr_until_with(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn property_expr_s_until_with(s: Span) -> IResult { +pub(crate) fn property_expr_s_until_with(s: Span) -> IResult { let (s, a) = property_expr(s)?; let (s, b) = keyword("s_until_with")(s)?; let (s, c) = property_expr(s)?; @@ -1236,7 +1236,7 @@ pub fn property_expr_s_until_with(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn property_expr_implies(s: Span) -> IResult { +pub(crate) fn property_expr_implies(s: Span) -> IResult { let (s, a) = property_expr(s)?; let (s, b) = keyword("implies")(s)?; let (s, c) = property_expr(s)?; @@ -1247,7 +1247,7 @@ pub fn property_expr_implies(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn property_expr_iff(s: Span) -> IResult { +pub(crate) fn property_expr_iff(s: Span) -> IResult { let (s, a) = property_expr(s)?; let (s, b) = keyword("iff")(s)?; let (s, c) = property_expr(s)?; @@ -1258,7 +1258,7 @@ pub fn property_expr_iff(s: Span) -> IResult { } #[parser] -pub fn property_expr_accept_on(s: Span) -> IResult { +pub(crate) fn property_expr_accept_on(s: Span) -> IResult { let (s, a) = keyword("accept_on")(s)?; let (s, b) = paren(expression_or_dist)(s)?; let (s, c) = property_expr(s)?; @@ -1269,7 +1269,7 @@ pub fn property_expr_accept_on(s: Span) -> IResult { } #[parser] -pub fn property_expr_reject_on(s: Span) -> IResult { +pub(crate) fn property_expr_reject_on(s: Span) -> IResult { let (s, a) = keyword("reject_on")(s)?; let (s, b) = paren(expression_or_dist)(s)?; let (s, c) = property_expr(s)?; @@ -1280,7 +1280,7 @@ pub fn property_expr_reject_on(s: Span) -> IResult { } #[parser] -pub fn property_expr_sync_accept_on(s: Span) -> IResult { +pub(crate) fn property_expr_sync_accept_on(s: Span) -> IResult { let (s, a) = keyword("sync_accept_on")(s)?; let (s, b) = paren(expression_or_dist)(s)?; let (s, c) = property_expr(s)?; @@ -1291,7 +1291,7 @@ pub fn property_expr_sync_accept_on(s: Span) -> IResult { } #[parser] -pub fn property_expr_sync_reject_on(s: Span) -> IResult { +pub(crate) fn property_expr_sync_reject_on(s: Span) -> IResult { let (s, a) = keyword("sync_reject_on")(s)?; let (s, b) = paren(expression_or_dist)(s)?; let (s, c) = property_expr(s)?; @@ -1302,7 +1302,7 @@ pub fn property_expr_sync_reject_on(s: Span) -> IResult { } #[parser] -pub fn property_expr_clocking_event(s: Span) -> IResult { +pub(crate) fn property_expr_clocking_event(s: Span) -> IResult { let (s, a) = clocking_event(s)?; let (s, b) = property_expr(s)?; Ok(( @@ -1312,12 +1312,12 @@ pub fn property_expr_clocking_event(s: Span) -> IResult { } #[parser] -pub fn property_case_item(s: Span) -> IResult { +pub(crate) fn property_case_item(s: Span) -> IResult { alt((property_case_item_nondefault, property_case_item_default))(s) } #[parser(MaybeRecursive)] -pub fn property_case_item_nondefault(s: Span) -> IResult { +pub(crate) fn property_case_item_nondefault(s: Span) -> IResult { let (s, a) = list(symbol(","), expression_or_dist)(s)?; let (s, b) = symbol(":")(s)?; let (s, c) = property_expr(s)?; @@ -1331,7 +1331,7 @@ pub fn property_case_item_nondefault(s: Span) -> IResult } #[parser] -pub fn property_case_item_default(s: Span) -> IResult { +pub(crate) fn property_case_item_default(s: Span) -> IResult { let (s, a) = keyword("default")(s)?; let (s, b) = opt(symbol(":"))(s)?; let (s, c) = property_expr(s)?; @@ -1345,7 +1345,7 @@ pub fn property_case_item_default(s: Span) -> IResult { } #[parser] -pub fn sequence_declaration(s: Span) -> IResult { +pub(crate) fn sequence_declaration(s: Span) -> IResult { let (s, a) = keyword("sequence")(s)?; let (s, b) = sequence_identifier(s)?; let (s, c) = opt(paren(opt(sequence_port_list)))(s)?; @@ -1364,13 +1364,13 @@ pub fn sequence_declaration(s: Span) -> IResult { } #[parser] -pub fn sequence_port_list(s: Span) -> IResult { +pub(crate) fn sequence_port_list(s: Span) -> IResult { let (s, a) = list(symbol(","), sequence_port_item)(s)?; Ok((s, SequencePortList { nodes: (a,) })) } #[parser(Ambiguous)] -pub fn sequence_port_item(s: Span) -> IResult { +pub(crate) fn sequence_port_item(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = opt(pair(local, opt(sequence_lvar_port_direction)))(s)?; let (s, c) = ambiguous_opt(sequence_formal_type)(s)?; @@ -1386,7 +1386,7 @@ pub fn sequence_port_item(s: Span) -> IResult { } #[parser] -pub fn sequence_lvar_port_direction(s: Span) -> IResult { +pub(crate) fn sequence_lvar_port_direction(s: Span) -> IResult { alt(( map(keyword("input"), |x| { SequenceLvarPortDirection::Input(Box::new(x)) @@ -1401,7 +1401,7 @@ pub fn sequence_lvar_port_direction(s: Span) -> IResult IResult { +pub(crate) fn sequence_formal_type(s: Span) -> IResult { alt(( map(data_type_or_implicit, |x| { SequenceFormalType::DataTypeOrImplicit(Box::new(x)) @@ -1416,7 +1416,7 @@ pub fn sequence_formal_type(s: Span) -> IResult { } #[parser] -pub fn sequence_expr(s: Span) -> IResult { +pub(crate) fn sequence_expr(s: Span) -> IResult { alt(( sequence_expr_cycle_delay_expr, sequence_expr_expr_cycle_delay_expr, @@ -1434,7 +1434,7 @@ pub fn sequence_expr(s: Span) -> IResult { } #[parser] -pub fn sequence_expr_cycle_delay_expr(s: Span) -> IResult { +pub(crate) fn sequence_expr_cycle_delay_expr(s: Span) -> IResult { let (s, a) = cycle_delay_range(s)?; let (s, b) = sequence_expr(s)?; let (s, c) = many0(pair(cycle_delay_range, sequence_expr))(s)?; @@ -1445,7 +1445,7 @@ pub fn sequence_expr_cycle_delay_expr(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn sequence_expr_expr_cycle_delay_expr(s: Span) -> IResult { +pub(crate) fn sequence_expr_expr_cycle_delay_expr(s: Span) -> IResult { let (s, a) = sequence_expr(s)?; let (s, b) = cycle_delay_range(s)?; let (s, c) = sequence_expr(s)?; @@ -1459,7 +1459,7 @@ pub fn sequence_expr_expr_cycle_delay_expr(s: Span) -> IResult IResult { +pub(crate) fn sequence_expr_expression(s: Span) -> IResult { let (s, a) = expression_or_dist(s)?; let (s, b) = opt(boolean_abbrev)(s)?; Ok(( @@ -1469,7 +1469,7 @@ pub fn sequence_expr_expression(s: Span) -> IResult { } #[parser] -pub fn sequence_expr_instance(s: Span) -> IResult { +pub(crate) fn sequence_expr_instance(s: Span) -> IResult { let (s, a) = sequence_instance(s)?; let (s, b) = opt(sequence_abbrev)(s)?; Ok(( @@ -1479,7 +1479,7 @@ pub fn sequence_expr_instance(s: Span) -> IResult { } #[parser] -pub fn sequence_expr_paren(s: Span) -> IResult { +pub(crate) fn sequence_expr_paren(s: Span) -> IResult { let (s, a) = paren(pair( sequence_expr, many0(pair(symbol(","), sequence_match_item)), @@ -1492,7 +1492,7 @@ pub fn sequence_expr_paren(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn sequence_expr_and(s: Span) -> IResult { +pub(crate) fn sequence_expr_and(s: Span) -> IResult { let (s, a) = sequence_expr(s)?; let (s, b) = keyword("and")(s)?; let (s, c) = sequence_expr(s)?; @@ -1503,7 +1503,7 @@ pub fn sequence_expr_and(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn sequence_expr_intersect(s: Span) -> IResult { +pub(crate) fn sequence_expr_intersect(s: Span) -> IResult { let (s, a) = sequence_expr(s)?; let (s, b) = keyword("intersect")(s)?; let (s, c) = sequence_expr(s)?; @@ -1514,7 +1514,7 @@ pub fn sequence_expr_intersect(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn sequence_expr_or(s: Span) -> IResult { +pub(crate) fn sequence_expr_or(s: Span) -> IResult { let (s, a) = sequence_expr(s)?; let (s, b) = keyword("or")(s)?; let (s, c) = sequence_expr(s)?; @@ -1525,7 +1525,7 @@ pub fn sequence_expr_or(s: Span) -> IResult { } #[parser] -pub fn sequence_expr_first_match(s: Span) -> IResult { +pub(crate) fn sequence_expr_first_match(s: Span) -> IResult { let (s, a) = keyword("first_match")(s)?; let (s, b) = paren(pair( sequence_expr, @@ -1538,7 +1538,7 @@ pub fn sequence_expr_first_match(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn sequence_expr_throughout(s: Span) -> IResult { +pub(crate) fn sequence_expr_throughout(s: Span) -> IResult { let (s, a) = expression_or_dist(s)?; let (s, b) = keyword("throughout")(s)?; let (s, c) = sequence_expr(s)?; @@ -1549,7 +1549,7 @@ pub fn sequence_expr_throughout(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn sequence_expr_within(s: Span) -> IResult { +pub(crate) fn sequence_expr_within(s: Span) -> IResult { let (s, a) = sequence_expr(s)?; let (s, b) = keyword("within")(s)?; let (s, c) = sequence_expr(s)?; @@ -1560,7 +1560,7 @@ pub fn sequence_expr_within(s: Span) -> IResult { } #[parser] -pub fn sequence_expr_clocking_event(s: Span) -> IResult { +pub(crate) fn sequence_expr_clocking_event(s: Span) -> IResult { let (s, a) = clocking_event(s)?; let (s, b) = sequence_expr(s)?; Ok(( @@ -1570,7 +1570,7 @@ pub fn sequence_expr_clocking_event(s: Span) -> IResult { } #[parser] -pub fn cycle_delay_range(s: Span) -> IResult { +pub(crate) fn cycle_delay_range(s: Span) -> IResult { alt(( cycle_delay_range_primary, cycle_delay_range_expression, @@ -1580,7 +1580,7 @@ pub fn cycle_delay_range(s: Span) -> IResult { } #[parser] -pub fn cycle_delay_range_primary(s: Span) -> IResult { +pub(crate) fn cycle_delay_range_primary(s: Span) -> IResult { let (s, a) = symbol("##")(s)?; let (s, b) = constant_primary(s)?; Ok(( @@ -1590,7 +1590,7 @@ pub fn cycle_delay_range_primary(s: Span) -> IResult { } #[parser] -pub fn cycle_delay_range_expression(s: Span) -> IResult { +pub(crate) fn cycle_delay_range_expression(s: Span) -> IResult { let (s, a) = symbol("##")(s)?; let (s, b) = bracket(cycle_delay_const_range_expression)(s)?; Ok(( @@ -1600,7 +1600,7 @@ pub fn cycle_delay_range_expression(s: Span) -> IResult { } #[parser] -pub fn cycle_delay_range_asterisk(s: Span) -> IResult { +pub(crate) fn cycle_delay_range_asterisk(s: Span) -> IResult { let (s, a) = symbol("##")(s)?; let (s, b) = bracket(symbol("*"))(s)?; Ok(( @@ -1610,7 +1610,7 @@ pub fn cycle_delay_range_asterisk(s: Span) -> IResult { } #[parser] -pub fn cycle_delay_range_plus(s: Span) -> IResult { +pub(crate) fn cycle_delay_range_plus(s: Span) -> IResult { let (s, a) = symbol("##")(s)?; let (s, b) = bracket(symbol("+"))(s)?; Ok(( @@ -1620,7 +1620,7 @@ pub fn cycle_delay_range_plus(s: Span) -> IResult { } #[parser] -pub fn sequence_method_call(s: Span) -> IResult { +pub(crate) fn sequence_method_call(s: Span) -> IResult { let (s, a) = sequence_instance(s)?; let (s, b) = symbol(".")(s)?; let (s, c) = method_identifier(s)?; @@ -1628,7 +1628,7 @@ pub fn sequence_method_call(s: Span) -> IResult { } #[parser] -pub fn sequence_match_item(s: Span) -> IResult { +pub(crate) fn sequence_match_item(s: Span) -> IResult { alt(( map(operator_assignment, |x| { SequenceMatchItem::OperatorAssignment(Box::new(x)) @@ -1643,14 +1643,14 @@ pub fn sequence_match_item(s: Span) -> IResult { } #[parser] -pub fn sequence_instance(s: Span) -> IResult { +pub(crate) fn sequence_instance(s: Span) -> IResult { let (s, a) = ps_or_hierarchical_sequence_identifier(s)?; let (s, b) = opt(paren(opt(sequence_list_of_arguments)))(s)?; Ok((s, SequenceInstance { nodes: (a, b) })) } #[parser] -pub fn sequence_list_of_arguments(s: Span) -> IResult { +pub(crate) fn sequence_list_of_arguments(s: Span) -> IResult { alt(( sequence_list_of_arguments_ordered, sequence_list_of_arguments_named, @@ -1658,7 +1658,7 @@ pub fn sequence_list_of_arguments(s: Span) -> IResult IResult { +pub(crate) fn sequence_list_of_arguments_ordered(s: Span) -> IResult { let (s, a) = list(symbol(","), opt(sequence_actual_arg))(s)?; let (s, b) = many0(tuple(( symbol(","), @@ -1675,7 +1675,7 @@ pub fn sequence_list_of_arguments_ordered(s: Span) -> IResult IResult { +pub(crate) fn sequence_list_of_arguments_named(s: Span) -> IResult { let (s, a) = list( symbol(","), triple(symbol("."), identifier, paren(opt(sequence_actual_arg))), @@ -1687,7 +1687,7 @@ pub fn sequence_list_of_arguments_named(s: Span) -> IResult IResult { +pub(crate) fn sequence_actual_arg(s: Span) -> IResult { alt(( map(event_expression, |x| { SequenceActualArg::EventExpression(Box::new(x)) @@ -1699,7 +1699,7 @@ pub fn sequence_actual_arg(s: Span) -> IResult { } #[parser] -pub fn boolean_abbrev(s: Span) -> IResult { +pub(crate) fn boolean_abbrev(s: Span) -> IResult { alt(( map(consecutive_repetition, |x| { BooleanAbbrev::ConsecutiveRepetition(Box::new(x)) @@ -1714,13 +1714,13 @@ pub fn boolean_abbrev(s: Span) -> IResult { } #[parser] -pub fn sequence_abbrev(s: Span) -> IResult { +pub(crate) fn sequence_abbrev(s: Span) -> IResult { let (s, a) = consecutive_repetition(s)?; Ok((s, SequenceAbbrev { nodes: (a,) })) } #[parser] -pub fn consecutive_repetition(s: Span) -> IResult { +pub(crate) fn consecutive_repetition(s: Span) -> IResult { alt(( consecutive_repetition_expression, consecutive_repetition_asterisk, @@ -1729,7 +1729,7 @@ pub fn consecutive_repetition(s: Span) -> IResult { } #[parser] -pub fn consecutive_repetition_expression(s: Span) -> IResult { +pub(crate) fn consecutive_repetition_expression(s: Span) -> IResult { let (s, a) = bracket(pair(symbol("*"), const_or_range_expression))(s)?; Ok(( s, @@ -1740,7 +1740,7 @@ pub fn consecutive_repetition_expression(s: Span) -> IResult IResult { +pub(crate) fn consecutive_repetition_asterisk(s: Span) -> IResult { let (s, a) = bracket(symbol("*"))(s)?; Ok(( s, @@ -1749,7 +1749,7 @@ pub fn consecutive_repetition_asterisk(s: Span) -> IResult IResult { +pub(crate) fn consecutive_repetition_plus(s: Span) -> IResult { let (s, a) = bracket(symbol("+"))(s)?; Ok(( s, @@ -1758,19 +1758,19 @@ pub fn consecutive_repetition_plus(s: Span) -> IResult IResult { +pub(crate) fn non_consecutive_repetition(s: Span) -> IResult { let (s, a) = bracket(pair(symbol("="), const_or_range_expression))(s)?; Ok((s, NonConsecutiveRepetition { nodes: (a,) })) } #[parser] -pub fn goto_repetition(s: Span) -> IResult { +pub(crate) fn goto_repetition(s: Span) -> IResult { let (s, a) = bracket(pair(symbol("->"), const_or_range_expression))(s)?; Ok((s, GotoRepetition { nodes: (a,) })) } #[parser] -pub fn const_or_range_expression(s: Span) -> IResult { +pub(crate) fn const_or_range_expression(s: Span) -> IResult { alt(( map(constant_expression, |x| { ConstOrRangeExpression::ConstantExpression(Box::new(x)) @@ -1782,7 +1782,7 @@ pub fn const_or_range_expression(s: Span) -> IResult IResult { alt(( @@ -1792,7 +1792,7 @@ pub fn cycle_delay_const_range_expression( } #[parser(MaybeRecursive)] -pub fn cycle_delay_const_range_expression_binary( +pub(crate) fn cycle_delay_const_range_expression_binary( s: Span, ) -> IResult { let (s, a) = constant_expression(s)?; @@ -1807,7 +1807,7 @@ pub fn cycle_delay_const_range_expression_binary( } #[parser(MaybeRecursive)] -pub fn cycle_delay_const_range_expression_dollar( +pub(crate) fn cycle_delay_const_range_expression_dollar( s: Span, ) -> IResult { let (s, a) = constant_expression(s)?; @@ -1822,14 +1822,14 @@ pub fn cycle_delay_const_range_expression_dollar( } #[parser(MaybeRecursive)] -pub fn expression_or_dist(s: Span) -> IResult { +pub(crate) fn expression_or_dist(s: Span) -> IResult { let (s, a) = expression(s)?; let (s, b) = opt(pair(keyword("dist"), brace(dist_list)))(s)?; Ok((s, ExpressionOrDist { nodes: (a, b) })) } #[parser] -pub fn assertion_variable_declaration(s: Span) -> IResult { +pub(crate) fn assertion_variable_declaration(s: Span) -> IResult { let (s, a) = var_data_type(s)?; let (s, b) = list_of_variable_decl_assignments(s)?; let (s, c) = symbol(";")(s)?; diff --git a/src/parser/declarations/block_item_declarations.rs b/src/parser/declarations/block_item_declarations.rs index 07d55ca..066b826 100644 --- a/src/parser/declarations/block_item_declarations.rs +++ b/src/parser/declarations/block_item_declarations.rs @@ -37,7 +37,7 @@ pub struct BlockItemDeclarationLet { // ----------------------------------------------------------------------------- #[parser] -pub fn block_item_declaration(s: Span) -> IResult { +pub(crate) fn block_item_declaration(s: Span) -> IResult { alt(( block_item_declaration_data, block_item_declaration_local_parameter, @@ -47,7 +47,7 @@ pub fn block_item_declaration(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn block_item_declaration_data(s: Span) -> IResult { +pub(crate) fn block_item_declaration_data(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = data_declaration(s)?; Ok(( @@ -57,7 +57,7 @@ pub fn block_item_declaration_data(s: Span) -> IResult IResult { +pub(crate) fn block_item_declaration_local_parameter(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = local_parameter_declaration(s)?; let (s, c) = symbol(";")(s)?; @@ -70,7 +70,7 @@ pub fn block_item_declaration_local_parameter(s: Span) -> IResult IResult { +pub(crate) fn block_item_declaration_parameter(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = parameter_declaration(s)?; let (s, c) = symbol(";")(s)?; @@ -83,7 +83,7 @@ pub fn block_item_declaration_parameter(s: Span) -> IResult IResult { +pub(crate) fn block_item_declaration_let(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = let_declaration(s)?; Ok(( diff --git a/src/parser/declarations/covergroup_declarations.rs b/src/parser/declarations/covergroup_declarations.rs index 11e39ac..64ebb9c 100644 --- a/src/parser/declarations/covergroup_declarations.rs +++ b/src/parser/declarations/covergroup_declarations.rs @@ -476,7 +476,7 @@ pub struct CovergroupExpression { // ----------------------------------------------------------------------------- #[parser] -pub fn covergroup_declaration(s: Span) -> IResult { +pub(crate) fn covergroup_declaration(s: Span) -> IResult { let (s, a) = keyword("covergroup")(s)?; let (s, b) = covergroup_identifier(s)?; let (s, c) = opt(paren(opt(tf_port_list)))(s)?; @@ -494,12 +494,12 @@ pub fn covergroup_declaration(s: Span) -> IResult { } #[parser] -pub fn coverage_spec_or_option(s: Span) -> IResult { +pub(crate) fn coverage_spec_or_option(s: Span) -> IResult { alt((coverage_spec_or_option_spec, coverage_spec_or_option_option))(s) } #[parser] -pub fn coverage_spec_or_option_spec(s: Span) -> IResult { +pub(crate) fn coverage_spec_or_option_spec(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = coverage_spec(s)?; Ok(( @@ -509,7 +509,7 @@ pub fn coverage_spec_or_option_spec(s: Span) -> IResult IResult { +pub(crate) fn coverage_spec_or_option_option(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = coverage_option(s)?; let (s, c) = symbol(";")(s)?; @@ -520,12 +520,12 @@ pub fn coverage_spec_or_option_option(s: Span) -> IResult IResult { +pub(crate) fn coverage_option(s: Span) -> IResult { alt((coverage_option_option, coverage_option_type_option))(s) } #[parser] -pub fn coverage_option_option(s: Span) -> IResult { +pub(crate) fn coverage_option_option(s: Span) -> IResult { let (s, a) = keyword("option")(s)?; let (s, b) = symbol(".")(s)?; let (s, c) = member_identifier(s)?; @@ -540,7 +540,7 @@ pub fn coverage_option_option(s: Span) -> IResult { } #[parser] -pub fn coverage_option_type_option(s: Span) -> IResult { +pub(crate) fn coverage_option_type_option(s: Span) -> IResult { let (s, a) = keyword("type_option")(s)?; let (s, b) = symbol(".")(s)?; let (s, c) = member_identifier(s)?; @@ -555,7 +555,7 @@ pub fn coverage_option_type_option(s: Span) -> IResult { } #[parser] -pub fn coverage_spec(s: Span) -> IResult { +pub(crate) fn coverage_spec(s: Span) -> IResult { alt(( map(cover_point, |x| CoverageSpec::CoverPoint(Box::new(x))), map(cover_cross, |x| CoverageSpec::CoverCross(Box::new(x))), @@ -563,7 +563,7 @@ pub fn coverage_spec(s: Span) -> IResult { } #[parser] -pub fn coverage_event(s: Span) -> IResult { +pub(crate) fn coverage_event(s: Span) -> IResult { alt(( map(clocking_event, |x| { CoverageEvent::ClockingEvent(Box::new(x)) @@ -574,7 +574,7 @@ pub fn coverage_event(s: Span) -> IResult { } #[parser] -pub fn coverage_event_sample(s: Span) -> IResult { +pub(crate) fn coverage_event_sample(s: Span) -> IResult { let (s, a) = keyword("with")(s)?; let (s, b) = keyword("function")(s)?; let (s, c) = keyword("sample")(s)?; @@ -588,7 +588,7 @@ pub fn coverage_event_sample(s: Span) -> IResult { } #[parser] -pub fn coverage_event_at(s: Span) -> IResult { +pub(crate) fn coverage_event_at(s: Span) -> IResult { let (s, a) = symbol("@@")(s)?; let (s, b) = paren(block_event_expression)(s)?; Ok(( @@ -598,7 +598,7 @@ pub fn coverage_event_at(s: Span) -> IResult { } #[parser] -pub fn block_event_expression(s: Span) -> IResult { +pub(crate) fn block_event_expression(s: Span) -> IResult { alt(( block_event_expression_or, block_event_expression_begin, @@ -607,7 +607,7 @@ pub fn block_event_expression(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn block_event_expression_or(s: Span) -> IResult { +pub(crate) fn block_event_expression_or(s: Span) -> IResult { let (s, a) = block_event_expression(s)?; let (s, b) = keyword("or")(s)?; let (s, c) = block_event_expression(s)?; @@ -618,7 +618,7 @@ pub fn block_event_expression_or(s: Span) -> IResult } #[parser] -pub fn block_event_expression_begin(s: Span) -> IResult { +pub(crate) fn block_event_expression_begin(s: Span) -> IResult { let (s, a) = keyword("begin")(s)?; let (s, b) = hierarchical_btf_identifier(s)?; Ok(( @@ -628,7 +628,7 @@ pub fn block_event_expression_begin(s: Span) -> IResult IResult { +pub(crate) fn block_event_expression_end(s: Span) -> IResult { let (s, a) = keyword("end")(s)?; let (s, b) = hierarchical_btf_identifier(s)?; Ok(( @@ -638,7 +638,7 @@ pub fn block_event_expression_end(s: Span) -> IResult IResult { +pub(crate) fn hierarchical_btf_identifier(s: Span) -> IResult { alt(( map(hierarchical_tf_identifier, |x| { HierarchicalBtfIdentifier::HierarchicalTfIdentifier(Box::new(x)) @@ -651,7 +651,7 @@ pub fn hierarchical_btf_identifier(s: Span) -> IResult IResult { +pub(crate) fn hierarchical_btf_identifier_method(s: Span) -> IResult { let (s, a) = opt(hierarchical_identifier_or_class_scope)(s)?; let (s, b) = method_identifier(s)?; Ok(( @@ -663,7 +663,7 @@ pub fn hierarchical_btf_identifier_method(s: Span) -> IResult IResult { alt(( @@ -677,7 +677,7 @@ pub fn hierarchical_identifier_or_class_scope( } #[parser(Ambiguous)] -pub fn cover_point(s: Span) -> IResult { +pub(crate) fn cover_point(s: Span) -> IResult { let (s, a) = opt(triple( ambiguous_opt(data_type_or_implicit), cover_point_identifier, @@ -696,7 +696,7 @@ pub fn cover_point(s: Span) -> IResult { } #[parser] -pub fn bins_or_empty(s: Span) -> IResult { +pub(crate) fn bins_or_empty(s: Span) -> IResult { alt(( bins_or_empty_non_empty, map(symbol(";"), |x| BinsOrEmpty::Empty(Box::new(x))), @@ -704,7 +704,7 @@ pub fn bins_or_empty(s: Span) -> IResult { } #[parser] -pub fn bins_or_empty_non_empty(s: Span) -> IResult { +pub(crate) fn bins_or_empty_non_empty(s: Span) -> IResult { let (s, a) = brace(pair( many0(attribute_instance), many0(pair(bins_or_options, symbol(";"))), @@ -716,7 +716,7 @@ pub fn bins_or_empty_non_empty(s: Span) -> IResult { } #[parser] -pub fn bins_or_options(s: Span) -> IResult { +pub(crate) fn bins_or_options(s: Span) -> IResult { alt(( map(coverage_option, |x| { BinsOrOptions::CoverageOption(Box::new(x)) @@ -731,7 +731,7 @@ pub fn bins_or_options(s: Span) -> IResult { } #[parser] -pub fn bins_or_options_covergroup(s: Span) -> IResult { +pub(crate) fn bins_or_options_covergroup(s: Span) -> IResult { let (s, a) = opt(wildcard)(s)?; let (s, b) = bins_keyword(s)?; let (s, c) = bin_identifier(s)?; @@ -749,13 +749,13 @@ pub fn bins_or_options_covergroup(s: Span) -> IResult { } #[parser] -pub fn wildcard(s: Span) -> IResult { +pub(crate) fn wildcard(s: Span) -> IResult { let (s, a) = keyword("wildcard")(s)?; Ok((s, Wildcard { nodes: (a,) })) } #[parser] -pub fn bins_or_options_cover_point(s: Span) -> IResult { +pub(crate) fn bins_or_options_cover_point(s: Span) -> IResult { let (s, a) = opt(wildcard)(s)?; let (s, b) = bins_keyword(s)?; let (s, c) = bin_identifier(s)?; @@ -774,7 +774,7 @@ pub fn bins_or_options_cover_point(s: Span) -> IResult { } #[parser] -pub fn bins_or_options_set_covergroup(s: Span) -> IResult { +pub(crate) fn bins_or_options_set_covergroup(s: Span) -> IResult { let (s, a) = opt(wildcard)(s)?; let (s, b) = bins_keyword(s)?; let (s, c) = bin_identifier(s)?; @@ -791,7 +791,7 @@ pub fn bins_or_options_set_covergroup(s: Span) -> IResult { } #[parser] -pub fn bins_or_options_trans_list(s: Span) -> IResult { +pub(crate) fn bins_or_options_trans_list(s: Span) -> IResult { let (s, a) = opt(wildcard)(s)?; let (s, b) = bins_keyword(s)?; let (s, c) = bin_identifier(s)?; @@ -808,7 +808,7 @@ pub fn bins_or_options_trans_list(s: Span) -> IResult { } #[parser] -pub fn bins_or_options_default(s: Span) -> IResult { +pub(crate) fn bins_or_options_default(s: Span) -> IResult { let (s, a) = bins_keyword(s)?; let (s, b) = bin_identifier(s)?; let (s, c) = opt(bracket(opt(covergroup_expression)))(s)?; @@ -824,7 +824,7 @@ pub fn bins_or_options_default(s: Span) -> IResult { } #[parser] -pub fn bins_or_options_default_sequence(s: Span) -> IResult { +pub(crate) fn bins_or_options_default_sequence(s: Span) -> IResult { let (s, a) = bins_keyword(s)?; let (s, b) = bin_identifier(s)?; let (s, c) = symbol("=")(s)?; @@ -840,7 +840,7 @@ pub fn bins_or_options_default_sequence(s: Span) -> IResult } #[parser] -pub fn bins_keyword(s: Span) -> IResult { +pub(crate) fn bins_keyword(s: Span) -> IResult { alt(( map(keyword("bins"), |x| BinsKeyword::Bins(Box::new(x))), map(keyword("illegal_bins"), |x| { @@ -853,19 +853,19 @@ pub fn bins_keyword(s: Span) -> IResult { } #[parser] -pub fn trans_list(s: Span) -> IResult { +pub(crate) fn trans_list(s: Span) -> IResult { let (s, a) = list(symbol(","), paren(trans_set))(s)?; Ok((s, TransList { nodes: (a,) })) } #[parser(MaybeRecursive)] -pub fn trans_set(s: Span) -> IResult { +pub(crate) fn trans_set(s: Span) -> IResult { let (s, a) = list(symbol("=>"), trans_range_list)(s)?; Ok((s, TransSet { nodes: (a,) })) } #[parser] -pub fn trans_range_list(s: Span) -> IResult { +pub(crate) fn trans_range_list(s: Span) -> IResult { alt(( map(trans_item, |x| TransRangeList::TransItem(Box::new(x))), trans_range_list_asterisk, @@ -875,7 +875,7 @@ pub fn trans_range_list(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn trans_range_list_asterisk(s: Span) -> IResult { +pub(crate) fn trans_range_list_asterisk(s: Span) -> IResult { let (s, a) = trans_item(s)?; let (s, b) = bracket(pair(symbol("*"), repeat_range))(s)?; Ok(( @@ -885,7 +885,7 @@ pub fn trans_range_list_asterisk(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn trans_range_list_arrow(s: Span) -> IResult { +pub(crate) fn trans_range_list_arrow(s: Span) -> IResult { let (s, a) = trans_item(s)?; let (s, b) = bracket(pair(symbol("->"), repeat_range))(s)?; Ok(( @@ -895,7 +895,7 @@ pub fn trans_range_list_arrow(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn trans_range_list_equal(s: Span) -> IResult { +pub(crate) fn trans_range_list_equal(s: Span) -> IResult { let (s, a) = trans_item(s)?; let (s, b) = bracket(pair(symbol("="), repeat_range))(s)?; Ok(( @@ -905,13 +905,13 @@ pub fn trans_range_list_equal(s: Span) -> IResult { } #[parser] -pub fn trans_item(s: Span) -> IResult { +pub(crate) fn trans_item(s: Span) -> IResult { let (s, a) = covergroup_range_list(s)?; Ok((s, TransItem { nodes: (a,) })) } #[parser] -pub fn repeat_range(s: Span) -> IResult { +pub(crate) fn repeat_range(s: Span) -> IResult { alt(( map(covergroup_expression, |x| { RepeatRange::CovergroupExpression(Box::new(x)) @@ -921,7 +921,7 @@ pub fn repeat_range(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn repeat_range_binary(s: Span) -> IResult { +pub(crate) fn repeat_range_binary(s: Span) -> IResult { let (s, a) = covergroup_expression(s)?; let (s, b) = symbol(":")(s)?; let (s, c) = covergroup_expression(s)?; @@ -932,7 +932,7 @@ pub fn repeat_range_binary(s: Span) -> IResult { } #[parser] -pub fn cover_cross(s: Span) -> IResult { +pub(crate) fn cover_cross(s: Span) -> IResult { let (s, a) = opt(pair(cross_identifier, symbol(":")))(s)?; let (s, b) = keyword("cross")(s)?; let (s, c) = list_of_cross_items(s)?; @@ -947,14 +947,14 @@ pub fn cover_cross(s: Span) -> IResult { } #[parser] -pub fn list_of_cross_items(s: Span) -> IResult { +pub(crate) fn list_of_cross_items(s: Span) -> IResult { let (s, a) = cross_item(s)?; let (s, b) = list(symbol(","), cross_item)(s)?; Ok((s, ListOfCrossItems { nodes: (a, b) })) } #[parser] -pub fn cross_item(s: Span) -> IResult { +pub(crate) fn cross_item(s: Span) -> IResult { alt(( map(cover_point_identifier, |x| { CrossItem::CoverPointIdentifier(Box::new(x)) @@ -966,7 +966,7 @@ pub fn cross_item(s: Span) -> IResult { } #[parser] -pub fn cross_body(s: Span) -> IResult { +pub(crate) fn cross_body(s: Span) -> IResult { alt(( cross_body_non_empty, map(symbol(";"), |x| CrossBody::Empty(Box::new(x))), @@ -974,7 +974,7 @@ pub fn cross_body(s: Span) -> IResult { } #[parser] -pub fn cross_body_non_empty(s: Span) -> IResult { +pub(crate) fn cross_body_non_empty(s: Span) -> IResult { let (s, a) = brace(many0(pair(cross_body_item, symbol(";"))))(s)?; Ok(( s, @@ -983,7 +983,7 @@ pub fn cross_body_non_empty(s: Span) -> IResult { } #[parser] -pub fn cross_body_item(s: Span) -> IResult { +pub(crate) fn cross_body_item(s: Span) -> IResult { alt(( map(function_declaration, |x| { CrossBodyItem::FunctionDeclaration(Box::new(x)) @@ -995,7 +995,7 @@ pub fn cross_body_item(s: Span) -> IResult { } #[parser] -pub fn bins_selection_or_option(s: Span) -> IResult { +pub(crate) fn bins_selection_or_option(s: Span) -> IResult { alt(( bins_selection_or_option_coverage, bins_selection_or_option_bins, @@ -1003,7 +1003,7 @@ pub fn bins_selection_or_option(s: Span) -> IResult } #[parser] -pub fn bins_selection_or_option_coverage(s: Span) -> IResult { +pub(crate) fn bins_selection_or_option_coverage(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = coverage_option(s)?; Ok(( @@ -1013,7 +1013,7 @@ pub fn bins_selection_or_option_coverage(s: Span) -> IResult IResult { +pub(crate) fn bins_selection_or_option_bins(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = bins_selection(s)?; Ok(( @@ -1023,7 +1023,7 @@ pub fn bins_selection_or_option_bins(s: Span) -> IResult IResult { +pub(crate) fn bins_selection(s: Span) -> IResult { let (s, a) = bins_keyword(s)?; let (s, b) = bin_identifier(s)?; let (s, c) = symbol("=")(s)?; @@ -1038,7 +1038,7 @@ pub fn bins_selection(s: Span) -> IResult { } #[parser] -pub fn select_expression(s: Span) -> IResult { +pub(crate) fn select_expression(s: Span) -> IResult { alt(( map(select_condition, |x| { SelectExpression::SelectCondition(Box::new(x)) @@ -1056,7 +1056,7 @@ pub fn select_expression(s: Span) -> IResult { } #[parser] -pub fn select_expression_not(s: Span) -> IResult { +pub(crate) fn select_expression_not(s: Span) -> IResult { let (s, a) = symbol("!")(s)?; let (s, b) = select_condition(s)?; Ok(( @@ -1066,7 +1066,7 @@ pub fn select_expression_not(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn select_expression_and(s: Span) -> IResult { +pub(crate) fn select_expression_and(s: Span) -> IResult { let (s, a) = select_expression(s)?; let (s, b) = symbol("&&")(s)?; let (s, c) = select_expression(s)?; @@ -1077,7 +1077,7 @@ pub fn select_expression_and(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn select_expression_or(s: Span) -> IResult { +pub(crate) fn select_expression_or(s: Span) -> IResult { let (s, a) = select_expression(s)?; let (s, b) = symbol("||")(s)?; let (s, c) = select_expression(s)?; @@ -1088,7 +1088,7 @@ pub fn select_expression_or(s: Span) -> IResult { } #[parser] -pub fn select_expression_paren(s: Span) -> IResult { +pub(crate) fn select_expression_paren(s: Span) -> IResult { let (s, a) = paren(select_expression)(s)?; Ok(( s, @@ -1097,7 +1097,7 @@ pub fn select_expression_paren(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn select_expression_with(s: Span) -> IResult { +pub(crate) fn select_expression_with(s: Span) -> IResult { let (s, a) = select_expression(s)?; let (s, b) = keyword("with")(s)?; let (s, c) = paren(with_covergroup_expression)(s)?; @@ -1111,7 +1111,7 @@ pub fn select_expression_with(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn select_expression_cross_set(s: Span) -> IResult { +pub(crate) fn select_expression_cross_set(s: Span) -> IResult { let (s, a) = cross_set_expression(s)?; let (s, b) = opt(pair(keyword("matches"), integer_covergroup_expression))(s)?; Ok(( @@ -1121,7 +1121,7 @@ pub fn select_expression_cross_set(s: Span) -> IResult { } #[parser] -pub fn select_condition(s: Span) -> IResult { +pub(crate) fn select_condition(s: Span) -> IResult { let (s, a) = keyword("binsof")(s)?; let (s, b) = paren(bins_expression)(s)?; let (s, c) = opt(pair(keyword("intersect"), brace(covergroup_range_list)))(s)?; @@ -1129,7 +1129,7 @@ pub fn select_condition(s: Span) -> IResult { } #[parser] -pub fn bins_expression(s: Span) -> IResult { +pub(crate) fn bins_expression(s: Span) -> IResult { alt(( map(variable_identifier, |x| { BinsExpression::VariableIdentifier(Box::new(x)) @@ -1139,7 +1139,7 @@ pub fn bins_expression(s: Span) -> IResult { } #[parser] -pub fn bins_expression_cover_point(s: Span) -> IResult { +pub(crate) fn bins_expression_cover_point(s: Span) -> IResult { let (s, a) = cover_point_identifier(s)?; let (s, b) = opt(pair(symbol("."), bin_identifier))(s)?; Ok(( @@ -1149,13 +1149,13 @@ pub fn bins_expression_cover_point(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn covergroup_range_list(s: Span) -> IResult { +pub(crate) fn covergroup_range_list(s: Span) -> IResult { let (s, a) = list(symbol(","), covergroup_value_range)(s)?; Ok((s, CovergroupRangeList { nodes: (a,) })) } #[parser] -pub fn covergroup_value_range(s: Span) -> IResult { +pub(crate) fn covergroup_value_range(s: Span) -> IResult { alt(( map(covergroup_expression, |x| { CovergroupValueRange::CovergroupExpression(Box::new(x)) @@ -1165,7 +1165,7 @@ pub fn covergroup_value_range(s: Span) -> IResult { } #[parser] -pub fn covergroup_value_range_binary(s: Span) -> IResult { +pub(crate) fn covergroup_value_range_binary(s: Span) -> IResult { let (s, a) = bracket(triple( covergroup_expression, symbol(":"), @@ -1178,31 +1178,31 @@ pub fn covergroup_value_range_binary(s: Span) -> IResult IResult { +pub(crate) fn with_covergroup_expression(s: Span) -> IResult { let (s, a) = covergroup_expression(s)?; Ok((s, WithCovergroupExpression { nodes: (a,) })) } #[parser] -pub fn set_covergroup_expression(s: Span) -> IResult { +pub(crate) fn set_covergroup_expression(s: Span) -> IResult { let (s, a) = covergroup_expression(s)?; Ok((s, SetCovergroupExpression { nodes: (a,) })) } #[parser] -pub fn integer_covergroup_expression(s: Span) -> IResult { +pub(crate) fn integer_covergroup_expression(s: Span) -> IResult { let (s, a) = covergroup_expression(s)?; Ok((s, IntegerCovergroupExpression { nodes: (a,) })) } #[parser] -pub fn cross_set_expression(s: Span) -> IResult { +pub(crate) fn cross_set_expression(s: Span) -> IResult { let (s, a) = covergroup_expression(s)?; Ok((s, CrossSetExpression { nodes: (a,) })) } #[parser] -pub fn covergroup_expression(s: Span) -> IResult { +pub(crate) fn covergroup_expression(s: Span) -> IResult { let (s, a) = expression(s)?; Ok((s, CovergroupExpression { nodes: (a,) })) } diff --git a/src/parser/declarations/declaration_assignments.rs b/src/parser/declarations/declaration_assignments.rs index c6b061d..fffcd5b 100644 --- a/src/parser/declarations/declaration_assignments.rs +++ b/src/parser/declarations/declaration_assignments.rs @@ -148,7 +148,7 @@ pub struct DynamicArrayNew { // ----------------------------------------------------------------------------- #[parser] -pub fn defparam_assignment(s: Span) -> IResult { +pub(crate) fn defparam_assignment(s: Span) -> IResult { let (s, a) = hierarchical_parameter_identifier(s)?; let (s, b) = symbol("=")(s)?; let (s, c) = constant_mintypmax_expression(s)?; @@ -156,7 +156,7 @@ pub fn defparam_assignment(s: Span) -> IResult { } #[parser] -pub fn net_decl_assignment(s: Span) -> IResult { +pub(crate) fn net_decl_assignment(s: Span) -> IResult { let (s, a) = net_identifier(s)?; let (s, b) = many0(unpacked_dimension)(s)?; let (s, c) = opt(pair(symbol("="), expression))(s)?; @@ -164,7 +164,7 @@ pub fn net_decl_assignment(s: Span) -> IResult { } #[parser] -pub fn param_assignment(s: Span) -> IResult { +pub(crate) fn param_assignment(s: Span) -> IResult { let (s, a) = parameter_identifier(s)?; let (s, b) = many0(unpacked_dimension)(s)?; let (s, c) = opt(pair(symbol("="), constant_param_expression))(s)?; @@ -172,7 +172,7 @@ pub fn param_assignment(s: Span) -> IResult { } #[parser] -pub fn specparam_assignment(s: Span) -> IResult { +pub(crate) fn specparam_assignment(s: Span) -> IResult { alt(( specparam_assignment_mintypmax, map(pulse_control_specparam, |x| { @@ -182,7 +182,7 @@ pub fn specparam_assignment(s: Span) -> IResult { } #[parser] -pub fn specparam_assignment_mintypmax(s: Span) -> IResult { +pub(crate) fn specparam_assignment_mintypmax(s: Span) -> IResult { let (s, a) = specparam_identifier(s)?; let (s, b) = symbol("=")(s)?; let (s, c) = constant_mintypmax_expression(s)?; @@ -193,14 +193,14 @@ pub fn specparam_assignment_mintypmax(s: Span) -> IResult IResult { +pub(crate) fn type_assignment(s: Span) -> IResult { let (s, a) = type_identifier(s)?; let (s, b) = opt(pair(symbol("="), data_type))(s)?; Ok((s, TypeAssignment { nodes: (a, b) })) } #[parser] -pub fn pulse_control_specparam(s: Span) -> IResult { +pub(crate) fn pulse_control_specparam(s: Span) -> IResult { alt(( pulse_control_specparam_without_descriptor, pulse_control_specparam_with_descriptor, @@ -208,7 +208,7 @@ pub fn pulse_control_specparam(s: Span) -> IResult } #[parser] -pub fn pulse_control_specparam_without_descriptor(s: Span) -> IResult { +pub(crate) fn pulse_control_specparam_without_descriptor(s: Span) -> IResult { let (s, a) = symbol("PATHPULSE$")(s)?; let (s, b) = symbol("=")(s)?; let (s, c) = paren(pair( @@ -224,7 +224,7 @@ pub fn pulse_control_specparam_without_descriptor(s: Span) -> IResult IResult { +pub(crate) fn pulse_control_specparam_with_descriptor(s: Span) -> IResult { let (s, a) = symbol("PATHPULSE$")(s)?; let (s, b) = specify_input_terminal_descriptor(s)?; let (s, c) = symbol("$")(s)?; @@ -243,25 +243,25 @@ pub fn pulse_control_specparam_with_descriptor(s: Span) -> IResult IResult { +pub(crate) fn error_limit_value(s: Span) -> IResult { let (s, a) = limit_value(s)?; Ok((s, ErrorLimitValue { nodes: (a,) })) } #[parser] -pub fn reject_limit_value(s: Span) -> IResult { +pub(crate) fn reject_limit_value(s: Span) -> IResult { let (s, a) = limit_value(s)?; Ok((s, RejectLimitValue { nodes: (a,) })) } #[parser] -pub fn limit_value(s: Span) -> IResult { +pub(crate) fn limit_value(s: Span) -> IResult { let (s, a) = constant_mintypmax_expression(s)?; Ok((s, LimitValue { nodes: (a,) })) } #[parser] -pub fn variable_decl_assignment(s: Span) -> IResult { +pub(crate) fn variable_decl_assignment(s: Span) -> IResult { alt(( variable_decl_assignment_variable, variable_decl_assignment_dynamic_array, @@ -270,7 +270,7 @@ pub fn variable_decl_assignment(s: Span) -> IResult IResult { +pub(crate) fn variable_decl_assignment_variable(s: Span) -> IResult { let (s, a) = variable_identifier(s)?; let (s, b) = many0(variable_dimension)(s)?; let (s, c) = opt(pair(symbol("="), expression))(s)?; @@ -283,7 +283,7 @@ pub fn variable_decl_assignment_variable(s: Span) -> IResult IResult { +pub(crate) fn variable_decl_assignment_dynamic_array(s: Span) -> IResult { let (s, a) = dynamic_array_variable_identifier(s)?; let (s, b) = unsized_dimension(s)?; let (s, c) = many0(variable_dimension)(s)?; @@ -297,7 +297,7 @@ pub fn variable_decl_assignment_dynamic_array(s: Span) -> IResult IResult { +pub(crate) fn variable_decl_assignment_class(s: Span) -> IResult { let (s, a) = class_variable_identifier(s)?; let (s, b) = opt(pair(symbol("="), class_new))(s)?; Ok(( @@ -307,12 +307,12 @@ pub fn variable_decl_assignment_class(s: Span) -> IResult IResult { +pub(crate) fn class_new(s: Span) -> IResult { alt((class_new_argument, class_new_expression))(s) } #[parser] -pub fn class_new_argument(s: Span) -> IResult { +pub(crate) fn class_new_argument(s: Span) -> IResult { let (s, a) = opt(class_scope)(s)?; let (s, b) = keyword("new")(s)?; let (s, c) = opt(paren(list_of_arguments))(s)?; @@ -323,7 +323,7 @@ pub fn class_new_argument(s: Span) -> IResult { } #[parser] -pub fn class_new_expression(s: Span) -> IResult { +pub(crate) fn class_new_expression(s: Span) -> IResult { let (s, a) = keyword("new")(s)?; let (s, b) = expression(s)?; Ok(( @@ -333,7 +333,7 @@ pub fn class_new_expression(s: Span) -> IResult { } #[parser] -pub fn dynamic_array_new(s: Span) -> IResult { +pub(crate) fn dynamic_array_new(s: Span) -> IResult { let (s, a) = keyword("new")(s)?; let (s, b) = bracket(expression)(s)?; let (s, c) = opt(paren(expression))(s)?; diff --git a/src/parser/declarations/declaration_lists.rs b/src/parser/declarations/declaration_lists.rs index c5e9138..df00936 100644 --- a/src/parser/declarations/declaration_lists.rs +++ b/src/parser/declarations/declaration_lists.rs @@ -93,19 +93,19 @@ pub struct ListOfVariablePortIdentifiers { // ----------------------------------------------------------------------------- #[parser] -pub fn list_of_defparam_assignments(s: Span) -> IResult { +pub(crate) fn list_of_defparam_assignments(s: Span) -> IResult { let (s, a) = list(symbol(","), defparam_assignment)(s)?; Ok((s, ListOfDefparamAssignments { nodes: (a,) })) } #[parser] -pub fn list_of_genvar_identifiers(s: Span) -> IResult { +pub(crate) fn list_of_genvar_identifiers(s: Span) -> IResult { let (s, a) = list(symbol(","), genvar_identifier)(s)?; Ok((s, ListOfGenvarIdentifiers { nodes: (a,) })) } #[parser] -pub fn list_of_interface_identifiers(s: Span) -> IResult { +pub(crate) fn list_of_interface_identifiers(s: Span) -> IResult { let (s, a) = list( symbol(","), pair(interface_identifier, many0(unpacked_dimension)), @@ -114,19 +114,19 @@ pub fn list_of_interface_identifiers(s: Span) -> IResult IResult { +pub(crate) fn list_of_net_decl_assignments(s: Span) -> IResult { let (s, a) = list(symbol(","), net_decl_assignment)(s)?; Ok((s, ListOfNetDeclAssignments { nodes: (a,) })) } #[parser] -pub fn list_of_param_assignments(s: Span) -> IResult { +pub(crate) fn list_of_param_assignments(s: Span) -> IResult { let (s, a) = list(symbol(","), param_assignment)(s)?; Ok((s, ListOfParamAssignments { nodes: (a,) })) } #[parser] -pub fn list_of_port_identifiers(s: Span) -> IResult { +pub(crate) fn list_of_port_identifiers(s: Span) -> IResult { let (s, a) = list( symbol(","), pair(port_identifier, many0(unpacked_dimension)), @@ -135,19 +135,19 @@ pub fn list_of_port_identifiers(s: Span) -> IResult } #[parser] -pub fn list_of_udp_port_identifiers(s: Span) -> IResult { +pub(crate) fn list_of_udp_port_identifiers(s: Span) -> IResult { let (s, a) = list(symbol(","), port_identifier)(s)?; Ok((s, ListOfUdpPortIdentifiers { nodes: (a,) })) } #[parser] -pub fn list_of_specparam_assignments(s: Span) -> IResult { +pub(crate) fn list_of_specparam_assignments(s: Span) -> IResult { let (s, a) = list(symbol(","), specparam_assignment)(s)?; Ok((s, ListOfSpecparamAssignments { nodes: (a,) })) } #[parser] -pub fn list_of_tf_variable_identifiers(s: Span) -> IResult { +pub(crate) fn list_of_tf_variable_identifiers(s: Span) -> IResult { let (s, a) = list( symbol(","), triple( @@ -160,19 +160,19 @@ pub fn list_of_tf_variable_identifiers(s: Span) -> IResult IResult { +pub(crate) fn list_of_type_assignments(s: Span) -> IResult { let (s, a) = list(symbol(","), type_assignment)(s)?; Ok((s, ListOfTypeAssignments { nodes: (a,) })) } #[parser] -pub fn list_of_variable_decl_assignments(s: Span) -> IResult { +pub(crate) fn list_of_variable_decl_assignments(s: Span) -> IResult { let (s, a) = list(symbol(","), variable_decl_assignment)(s)?; Ok((s, ListOfVariableDeclAssignments { nodes: (a,) })) } #[parser] -pub fn list_of_variable_identifiers(s: Span) -> IResult { +pub(crate) fn list_of_variable_identifiers(s: Span) -> IResult { let (s, a) = list( symbol(","), pair(variable_identifier, many0(variable_dimension)), @@ -181,7 +181,7 @@ pub fn list_of_variable_identifiers(s: Span) -> IResult IResult { +pub(crate) fn list_of_variable_port_identifiers(s: Span) -> IResult { let (s, a) = list( symbol(","), triple( diff --git a/src/parser/declarations/declaration_ranges.rs b/src/parser/declarations/declaration_ranges.rs index bc36fb1..98d9b83 100644 --- a/src/parser/declarations/declaration_ranges.rs +++ b/src/parser/declarations/declaration_ranges.rs @@ -71,12 +71,12 @@ pub struct UnsizedDimension { // ----------------------------------------------------------------------------- #[parser] -pub fn unpacked_dimension(s: Span) -> IResult { +pub(crate) fn unpacked_dimension(s: Span) -> IResult { alt((unpacked_dimension_range, unpacked_dimension_expression))(s) } #[parser] -pub fn unpacked_dimension_range(s: Span) -> IResult { +pub(crate) fn unpacked_dimension_range(s: Span) -> IResult { let (s, a) = bracket(constant_range)(s)?; Ok(( s, @@ -85,7 +85,7 @@ pub fn unpacked_dimension_range(s: Span) -> IResult { } #[parser] -pub fn unpacked_dimension_expression(s: Span) -> IResult { +pub(crate) fn unpacked_dimension_expression(s: Span) -> IResult { let (s, a) = bracket(constant_expression)(s)?; Ok(( s, @@ -94,7 +94,7 @@ pub fn unpacked_dimension_expression(s: Span) -> IResult IResult { +pub(crate) fn packed_dimension(s: Span) -> IResult { alt(( packed_dimension_range, map(unsized_dimension, |x| { @@ -104,7 +104,7 @@ pub fn packed_dimension(s: Span) -> IResult { } #[parser] -pub fn packed_dimension_range(s: Span) -> IResult { +pub(crate) fn packed_dimension_range(s: Span) -> IResult { let (s, a) = bracket(constant_range)(s)?; Ok(( s, @@ -113,7 +113,7 @@ pub fn packed_dimension_range(s: Span) -> IResult { } #[parser] -pub fn associative_dimension(s: Span) -> IResult { +pub(crate) fn associative_dimension(s: Span) -> IResult { alt(( associative_dimension_data_type, associative_dimension_asterisk, @@ -121,7 +121,7 @@ pub fn associative_dimension(s: Span) -> IResult { } #[parser] -pub fn associative_dimension_data_type(s: Span) -> IResult { +pub(crate) fn associative_dimension_data_type(s: Span) -> IResult { let (s, a) = bracket(data_type)(s)?; Ok(( s, @@ -130,7 +130,7 @@ pub fn associative_dimension_data_type(s: Span) -> IResult IResult { +pub(crate) fn associative_dimension_asterisk(s: Span) -> IResult { let (s, a) = bracket(symbol("*"))(s)?; Ok(( s, @@ -139,7 +139,7 @@ pub fn associative_dimension_asterisk(s: Span) -> IResult IResult { +pub(crate) fn variable_dimension(s: Span) -> IResult { alt(( map(unsized_dimension, |x| { VariableDimension::UnsizedDimension(Box::new(x)) @@ -157,7 +157,7 @@ pub fn variable_dimension(s: Span) -> IResult { } #[parser] -pub fn queue_dimension(s: Span) -> IResult { +pub(crate) fn queue_dimension(s: Span) -> IResult { let (s, a) = bracket(pair( symbol("$"), opt(pair(symbol(":"), constant_expression)), @@ -166,7 +166,7 @@ pub fn queue_dimension(s: Span) -> IResult { } #[parser] -pub fn unsized_dimension(s: Span) -> IResult { +pub(crate) fn unsized_dimension(s: Span) -> IResult { let (s, a) = symbol("[")(s)?; let (s, b) = symbol("]")(s)?; Ok((s, UnsizedDimension { nodes: (a, b) })) diff --git a/src/parser/declarations/delays.rs b/src/parser/declarations/delays.rs index b48cbe8..662ecd7 100644 --- a/src/parser/declarations/delays.rs +++ b/src/parser/declarations/delays.rs @@ -64,19 +64,19 @@ pub enum DelayValue { // ----------------------------------------------------------------------------- #[parser] -pub fn delay3(s: Span) -> IResult { +pub(crate) fn delay3(s: Span) -> IResult { alt((delay3_single, delay3_mintypmax))(s) } #[parser] -pub fn delay3_single(s: Span) -> IResult { +pub(crate) fn delay3_single(s: Span) -> IResult { let (s, a) = symbol("#")(s)?; let (s, b) = delay_value(s)?; Ok((s, Delay3::Single(Box::new(Delay3Single { nodes: (a, b) })))) } #[parser] -pub fn delay3_mintypmax(s: Span) -> IResult { +pub(crate) fn delay3_mintypmax(s: Span) -> IResult { let (s, a) = symbol("#")(s)?; let (s, b) = paren(pair( mintypmax_expression, @@ -93,19 +93,19 @@ pub fn delay3_mintypmax(s: Span) -> IResult { } #[parser] -pub fn delay2(s: Span) -> IResult { +pub(crate) fn delay2(s: Span) -> IResult { alt((delay2_single, delay2_mintypmax))(s) } #[parser] -pub fn delay2_single(s: Span) -> IResult { +pub(crate) fn delay2_single(s: Span) -> IResult { let (s, a) = symbol("#")(s)?; let (s, b) = delay_value(s)?; Ok((s, Delay2::Single(Box::new(Delay2Single { nodes: (a, b) })))) } #[parser] -pub fn delay2_mintypmax(s: Span) -> IResult { +pub(crate) fn delay2_mintypmax(s: Span) -> IResult { let (s, a) = symbol("#")(s)?; let (s, b) = paren(pair( mintypmax_expression, @@ -118,7 +118,7 @@ pub fn delay2_mintypmax(s: Span) -> IResult { } #[parser] -pub fn delay_value(s: Span) -> IResult { +pub(crate) fn delay_value(s: Span) -> IResult { alt(( map(unsigned_number, |x| DelayValue::UnsignedNumber(Box::new(x))), map(real_number, |x| DelayValue::RealNumber(Box::new(x))), diff --git a/src/parser/declarations/function_declarations.rs b/src/parser/declarations/function_declarations.rs index 928ed19..d198547 100644 --- a/src/parser/declarations/function_declarations.rs +++ b/src/parser/declarations/function_declarations.rs @@ -156,7 +156,7 @@ pub struct DpiTaskProto { // ----------------------------------------------------------------------------- #[parser] -pub fn function_data_type_or_implicit(s: Span) -> IResult { +pub(crate) fn function_data_type_or_implicit(s: Span) -> IResult { alt(( map(data_type_or_void, |x| { FunctionDataTypeOrImplicit::DataTypeOrVoid(Box::new(x)) @@ -168,7 +168,7 @@ pub fn function_data_type_or_implicit(s: Span) -> IResult IResult { +pub(crate) fn function_declaration(s: Span) -> IResult { let (s, a) = keyword("function")(s)?; let (s, b) = opt(lifetime)(s)?; let (s, c) = function_body_declaration(s)?; @@ -176,7 +176,7 @@ pub fn function_declaration(s: Span) -> IResult { } #[parser] -pub fn function_body_declaration(s: Span) -> IResult { +pub(crate) fn function_body_declaration(s: Span) -> IResult { alt(( function_body_declaration_without_port, function_body_declaration_with_port, @@ -184,7 +184,7 @@ pub fn function_body_declaration(s: Span) -> IResult IResult { +pub(crate) fn function_body_declaration_without_port(s: Span) -> IResult { let (s, a) = ambiguous_opt(function_data_type_or_implicit)(s)?; let (s, b) = opt(interface_identifier_or_class_scope)(s)?; let (s, c) = function_identifier(s)?; @@ -202,7 +202,7 @@ pub fn function_body_declaration_without_port(s: Span) -> IResult IResult { +pub(crate) fn function_body_declaration_with_port(s: Span) -> IResult { let (s, a) = ambiguous_opt(function_data_type_or_implicit)(s)?; let (s, b) = opt(interface_identifier_or_class_scope)(s)?; let (s, c) = function_identifier(s)?; @@ -221,7 +221,7 @@ pub fn function_body_declaration_with_port(s: Span) -> IResult IResult { alt(( @@ -235,7 +235,7 @@ pub fn interface_identifier_or_class_scope( } #[parser] -pub fn function_prototype(s: Span) -> IResult { +pub(crate) fn function_prototype(s: Span) -> IResult { let (s, a) = keyword("function")(s)?; let (s, b) = data_type_or_void(s)?; let (s, c) = function_identifier(s)?; @@ -249,7 +249,7 @@ pub fn function_prototype(s: Span) -> IResult { } #[parser] -pub fn dpi_import_export(s: Span) -> IResult { +pub(crate) fn dpi_import_export(s: Span) -> IResult { alt(( dpi_import_export_import_function, dpi_import_export_import_task, @@ -259,7 +259,7 @@ pub fn dpi_import_export(s: Span) -> IResult { } #[parser] -pub fn dpi_import_export_import_function(s: Span) -> IResult { +pub(crate) fn dpi_import_export_import_function(s: Span) -> IResult { let (s, a) = keyword("import")(s)?; let (s, b) = dpi_spec_string(s)?; let (s, c) = opt(dpi_function_import_property)(s)?; @@ -275,7 +275,7 @@ pub fn dpi_import_export_import_function(s: Span) -> IResult IResult { +pub(crate) fn dpi_import_export_import_task(s: Span) -> IResult { let (s, a) = keyword("import")(s)?; let (s, b) = dpi_spec_string(s)?; let (s, c) = opt(dpi_task_import_property)(s)?; @@ -291,7 +291,7 @@ pub fn dpi_import_export_import_task(s: Span) -> IResult } #[parser] -pub fn dpi_import_export_export_function(s: Span) -> IResult { +pub(crate) fn dpi_import_export_export_function(s: Span) -> IResult { let (s, a) = keyword("export")(s)?; let (s, b) = dpi_spec_string(s)?; let (s, c) = opt(pair(c_identifier, symbol("=")))(s)?; @@ -307,7 +307,7 @@ pub fn dpi_import_export_export_function(s: Span) -> IResult IResult { +pub(crate) fn dpi_import_export_export_task(s: Span) -> IResult { let (s, a) = keyword("export")(s)?; let (s, b) = dpi_spec_string(s)?; let (s, c) = opt(pair(c_identifier, symbol("=")))(s)?; @@ -323,7 +323,7 @@ pub fn dpi_import_export_export_task(s: Span) -> IResult } #[parser] -pub fn dpi_spec_string(s: Span) -> IResult { +pub(crate) fn dpi_spec_string(s: Span) -> IResult { alt(( map(keyword("DPI-C"), |x| DpiSpecString::DpiC(Box::new(x))), map(keyword("DPI"), |x| DpiSpecString::Dpi(Box::new(x))), @@ -331,7 +331,7 @@ pub fn dpi_spec_string(s: Span) -> IResult { } #[parser] -pub fn dpi_function_import_property(s: Span) -> IResult { +pub(crate) fn dpi_function_import_property(s: Span) -> IResult { alt(( map(keyword("context"), |x| { DpiFunctionImportProperty::Context(Box::new(x)) @@ -343,19 +343,19 @@ pub fn dpi_function_import_property(s: Span) -> IResult IResult { +pub(crate) fn dpi_task_import_property(s: Span) -> IResult { let (s, a) = keyword("context")(s)?; Ok((s, DpiTaskImportProperty::Context(Box::new(a)))) } #[parser] -pub fn dpi_function_proto(s: Span) -> IResult { +pub(crate) fn dpi_function_proto(s: Span) -> IResult { let (s, a) = function_prototype(s)?; Ok((s, DpiFunctionProto { nodes: (a,) })) } #[parser] -pub fn dpi_task_proto(s: Span) -> IResult { +pub(crate) fn dpi_task_proto(s: Span) -> IResult { let (s, a) = task_prototype(s)?; Ok((s, DpiTaskProto { nodes: (a,) })) } diff --git a/src/parser/declarations/interface_declarations.rs b/src/parser/declarations/interface_declarations.rs index a55307c..57200cd 100644 --- a/src/parser/declarations/interface_declarations.rs +++ b/src/parser/declarations/interface_declarations.rs @@ -88,7 +88,7 @@ pub enum ImportExport { // ----------------------------------------------------------------------------- #[parser] -pub fn modport_declaration(s: Span) -> IResult { +pub(crate) fn modport_declaration(s: Span) -> IResult { let (s, a) = keyword("modport")(s)?; let (s, b) = list(symbol(","), modport_item)(s)?; let (s, c) = symbol(";")(s)?; @@ -96,14 +96,14 @@ pub fn modport_declaration(s: Span) -> IResult { } #[parser] -pub fn modport_item(s: Span) -> IResult { +pub(crate) fn modport_item(s: Span) -> IResult { let (s, a) = modport_identifier(s)?; let (s, b) = paren(list(symbol(","), modport_ports_declaration))(s)?; Ok((s, ModportItem { nodes: (a, b) })) } #[parser] -pub fn modport_ports_declaration(s: Span) -> IResult { +pub(crate) fn modport_ports_declaration(s: Span) -> IResult { alt(( modport_ports_declaration_simple, modport_ports_declaration_tf, @@ -112,7 +112,7 @@ pub fn modport_ports_declaration(s: Span) -> IResult IResult { +pub(crate) fn modport_ports_declaration_simple(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = modport_simple_ports_declaration(s)?; Ok(( @@ -122,7 +122,7 @@ pub fn modport_ports_declaration_simple(s: Span) -> IResult IResult { +pub(crate) fn modport_ports_declaration_tf(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = modport_tf_ports_declaration(s)?; Ok(( @@ -132,7 +132,7 @@ pub fn modport_ports_declaration_tf(s: Span) -> IResult IResult { +pub(crate) fn modport_ports_declaration_clocking(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = modport_clocking_declaration(s)?; Ok(( @@ -144,26 +144,26 @@ pub fn modport_ports_declaration_clocking(s: Span) -> IResult IResult { +pub(crate) fn modport_clocking_declaration(s: Span) -> IResult { let (s, a) = keyword("clocking")(s)?; let (s, b) = clocking_identifier(s)?; Ok((s, ModportClockingDeclaration { nodes: (a, b) })) } #[parser] -pub fn modport_simple_ports_declaration(s: Span) -> IResult { +pub(crate) fn modport_simple_ports_declaration(s: Span) -> IResult { let (s, a) = port_direction(s)?; let (s, b) = list(symbol(","), modport_simple_port)(s)?; Ok((s, ModportSimplePortsDeclaration { nodes: (a, b) })) } #[parser] -pub fn modport_simple_port(s: Span) -> IResult { +pub(crate) fn modport_simple_port(s: Span) -> IResult { alt((modport_simple_port_ordered, modport_simple_port_named))(s) } #[parser] -pub fn modport_simple_port_ordered(s: Span) -> IResult { +pub(crate) fn modport_simple_port_ordered(s: Span) -> IResult { let (s, a) = port_identifier(s)?; Ok(( s, @@ -172,7 +172,7 @@ pub fn modport_simple_port_ordered(s: Span) -> IResult } #[parser] -pub fn modport_simple_port_named(s: Span) -> IResult { +pub(crate) fn modport_simple_port_named(s: Span) -> IResult { let (s, a) = symbol(".")(s)?; let (s, b) = port_identifier(s)?; let (s, c) = paren(opt(expression))(s)?; @@ -183,14 +183,14 @@ pub fn modport_simple_port_named(s: Span) -> IResult { } #[parser] -pub fn modport_tf_ports_declaration(s: Span) -> IResult { +pub(crate) fn modport_tf_ports_declaration(s: Span) -> IResult { let (s, a) = import_export(s)?; let (s, b) = list(symbol(","), modport_tf_port)(s)?; Ok((s, ModportTfPortsDeclaration { nodes: (a, b) })) } #[parser] -pub fn modport_tf_port(s: Span) -> IResult { +pub(crate) fn modport_tf_port(s: Span) -> IResult { alt(( map(method_prototype, |x| { ModportTfPort::MethodPrototype(Box::new(x)) @@ -200,7 +200,7 @@ pub fn modport_tf_port(s: Span) -> IResult { } #[parser] -pub fn import_export(s: Span) -> IResult { +pub(crate) fn import_export(s: Span) -> IResult { alt(( map(keyword("import"), |x| ImportExport::Import(Box::new(x))), map(keyword("export"), |x| ImportExport::Export(Box::new(x))), diff --git a/src/parser/declarations/let_declarations.rs b/src/parser/declarations/let_declarations.rs index c010711..068014e 100644 --- a/src/parser/declarations/let_declarations.rs +++ b/src/parser/declarations/let_declarations.rs @@ -83,7 +83,7 @@ pub struct LetActualArg { // ----------------------------------------------------------------------------- #[parser] -pub fn let_declaration(s: Span) -> IResult { +pub(crate) fn let_declaration(s: Span) -> IResult { let (s, a) = keyword("let")(s)?; let (s, b) = let_identifier(s)?; let (s, c) = opt(paren(opt(let_port_list)))(s)?; @@ -99,19 +99,19 @@ pub fn let_declaration(s: Span) -> IResult { } #[parser] -pub fn let_identifier(s: Span) -> IResult { +pub(crate) fn let_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, LetIdentifier { nodes: (a,) })) } #[parser] -pub fn let_port_list(s: Span) -> IResult { +pub(crate) fn let_port_list(s: Span) -> IResult { let (s, a) = list(symbol(","), let_port_item)(s)?; Ok((s, LetPortList { nodes: (a,) })) } #[parser(Ambiguous)] -pub fn let_port_item(s: Span) -> IResult { +pub(crate) fn let_port_item(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = ambiguous_opt(let_formal_type)(s)?; let (s, c) = formal_port_identifier(s)?; @@ -126,7 +126,7 @@ pub fn let_port_item(s: Span) -> IResult { } #[parser] -pub fn let_formal_type(s: Span) -> IResult { +pub(crate) fn let_formal_type(s: Span) -> IResult { alt(( map(data_type_or_implicit, |x| { LetFormalType::DataTypeOrImplicit(Box::new(x)) @@ -136,7 +136,7 @@ pub fn let_formal_type(s: Span) -> IResult { } #[parser] -pub fn let_expression(s: Span) -> IResult { +pub(crate) fn let_expression(s: Span) -> IResult { let (s, a) = opt(package_scope)(s)?; let (s, b) = let_identifier(s)?; let (s, c) = opt(paren(opt(let_list_of_arguments)))(s)?; @@ -144,12 +144,12 @@ pub fn let_expression(s: Span) -> IResult { } #[parser] -pub fn let_list_of_arguments(s: Span) -> IResult { +pub(crate) fn let_list_of_arguments(s: Span) -> IResult { alt((let_list_of_arguments_ordered, let_list_of_arguments_named))(s) } #[parser(MaybeRecursive)] -pub fn let_list_of_arguments_ordered(s: Span) -> IResult { +pub(crate) fn let_list_of_arguments_ordered(s: Span) -> IResult { let (s, a) = list(symbol(","), opt(let_actual_arg))(s)?; let (s, b) = many0(tuple(( symbol(","), @@ -164,7 +164,7 @@ pub fn let_list_of_arguments_ordered(s: Span) -> IResult IResult { +pub(crate) fn let_list_of_arguments_named(s: Span) -> IResult { let (s, a) = list( symbol(","), triple(symbol("."), identifier, paren(opt(let_actual_arg))), @@ -176,7 +176,7 @@ pub fn let_list_of_arguments_named(s: Span) -> IResult } #[parser] -pub fn let_actual_arg(s: Span) -> IResult { +pub(crate) fn let_actual_arg(s: Span) -> IResult { let (s, a) = expression(s)?; Ok((s, LetActualArg { nodes: (a,) })) } diff --git a/src/parser/declarations/module_parameter_declarations.rs b/src/parser/declarations/module_parameter_declarations.rs index 04d5f01..12f82bc 100644 --- a/src/parser/declarations/module_parameter_declarations.rs +++ b/src/parser/declarations/module_parameter_declarations.rs @@ -51,7 +51,7 @@ pub struct SpecparamDeclaration { // ----------------------------------------------------------------------------- #[parser] -pub fn local_parameter_declaration(s: Span) -> IResult { +pub(crate) fn local_parameter_declaration(s: Span) -> IResult { alt(( local_parameter_declaration_param, local_parameter_declaration_type, @@ -59,7 +59,7 @@ pub fn local_parameter_declaration(s: Span) -> IResult IResult { +pub(crate) fn local_parameter_declaration_param(s: Span) -> IResult { let (s, a) = keyword("localparam")(s)?; let (s, b) = ambiguous_opt(data_type_or_implicit)(s)?; let (s, c) = list_of_param_assignments(s)?; @@ -72,7 +72,7 @@ pub fn local_parameter_declaration_param(s: Span) -> IResult IResult { +pub(crate) fn local_parameter_declaration_type(s: Span) -> IResult { let (s, a) = keyword("localparam")(s)?; let (s, b) = keyword("type")(s)?; let (s, c) = list_of_type_assignments(s)?; @@ -85,12 +85,12 @@ pub fn local_parameter_declaration_type(s: Span) -> IResult IResult { +pub(crate) fn parameter_declaration(s: Span) -> IResult { alt((parameter_declaration_param, parameter_declaration_type))(s) } #[parser(Ambiguous)] -pub fn parameter_declaration_param(s: Span) -> IResult { +pub(crate) fn parameter_declaration_param(s: Span) -> IResult { let (s, a) = keyword("parameter")(s)?; let (s, b) = ambiguous_opt(data_type_or_implicit)(s)?; let (s, c) = list_of_param_assignments(s)?; @@ -101,7 +101,7 @@ pub fn parameter_declaration_param(s: Span) -> IResult IResult { +pub(crate) fn parameter_declaration_type(s: Span) -> IResult { let (s, a) = keyword("parameter")(s)?; let (s, b) = keyword("type")(s)?; let (s, c) = list_of_type_assignments(s)?; @@ -112,7 +112,7 @@ pub fn parameter_declaration_type(s: Span) -> IResult IResult { +pub(crate) fn specparam_declaration(s: Span) -> IResult { let (s, a) = keyword("specparam")(s)?; let (s, b) = opt(packed_dimension)(s)?; let (s, c) = list_of_specparam_assignments(s)?; diff --git a/src/parser/declarations/net_and_variable_types.rs b/src/parser/declarations/net_and_variable_types.rs index b797065..419458c 100644 --- a/src/parser/declarations/net_and_variable_types.rs +++ b/src/parser/declarations/net_and_variable_types.rs @@ -288,7 +288,7 @@ pub struct TypeReferenceDataType { #[packrat_parser] #[parser] -pub fn casting_type(s: Span) -> IResult { +pub(crate) fn casting_type(s: Span) -> IResult { alt(( map(simple_type, |x| CastingType::SimpleType(Box::new(x))), map(signing, |x| CastingType::Signing(Box::new(x))), @@ -301,7 +301,7 @@ pub fn casting_type(s: Span) -> IResult { } #[parser] -pub fn data_type(s: Span) -> IResult { +pub(crate) fn data_type(s: Span) -> IResult { alt(( data_type_vector, data_type_atom, @@ -322,7 +322,7 @@ pub fn data_type(s: Span) -> IResult { } #[parser] -pub fn data_type_vector(s: Span) -> IResult { +pub(crate) fn data_type_vector(s: Span) -> IResult { let (s, a) = integer_vector_type(s)?; let (s, b) = opt(signing)(s)?; let (s, c) = many0(packed_dimension)(s)?; @@ -333,14 +333,14 @@ pub fn data_type_vector(s: Span) -> IResult { } #[parser] -pub fn data_type_atom(s: Span) -> IResult { +pub(crate) fn data_type_atom(s: Span) -> IResult { let (s, a) = integer_atom_type(s)?; let (s, b) = opt(signing)(s)?; Ok((s, DataType::Atom(Box::new(DataTypeAtom { nodes: (a, b) })))) } #[parser] -pub fn data_type_struct_union(s: Span) -> IResult { +pub(crate) fn data_type_struct_union(s: Span) -> IResult { let (s, a) = struct_union(s)?; let (s, b) = opt(pair(packed, opt(signing)))(s)?; let (s, c) = brace(pair(struct_union_member, many0(struct_union_member)))(s)?; @@ -354,13 +354,13 @@ pub fn data_type_struct_union(s: Span) -> IResult { } #[parser] -pub fn packed(s: Span) -> IResult { +pub(crate) fn packed(s: Span) -> IResult { let (s, a) = keyword("packed")(s)?; Ok((s, Packed { nodes: (a,) })) } #[parser] -pub fn data_type_enum(s: Span) -> IResult { +pub(crate) fn data_type_enum(s: Span) -> IResult { let (s, a) = keyword("enum")(s)?; let (s, b) = opt(enum_base_type)(s)?; let (s, c) = brace(list(symbol(","), enum_name_declaration))(s)?; @@ -374,7 +374,7 @@ pub fn data_type_enum(s: Span) -> IResult { } #[parser] -pub fn data_type_virtual(s: Span) -> IResult { +pub(crate) fn data_type_virtual(s: Span) -> IResult { let (s, a) = keyword("virtual")(s)?; let (s, b) = opt(interface)(s)?; let (s, c) = interface_identifier(s)?; @@ -389,13 +389,13 @@ pub fn data_type_virtual(s: Span) -> IResult { } #[parser] -pub fn interface(s: Span) -> IResult { +pub(crate) fn interface(s: Span) -> IResult { let (s, a) = keyword("interface")(s)?; Ok((s, Interface { nodes: (a,) })) } #[parser] -pub fn data_type_type(s: Span) -> IResult { +pub(crate) fn data_type_type(s: Span) -> IResult { let (s, a) = opt(package_scope_or_class_scope)(s)?; let (s, b) = type_identifier(s)?; let (s, c) = many0(packed_dimension)(s)?; @@ -406,7 +406,7 @@ pub fn data_type_type(s: Span) -> IResult { } #[parser] -pub fn data_type_or_implicit(s: Span) -> IResult { +pub(crate) fn data_type_or_implicit(s: Span) -> IResult { alt(( map(data_type, |x| DataTypeOrImplicit::DataType(Box::new(x))), map(implicit_data_type, |x| { @@ -416,14 +416,14 @@ pub fn data_type_or_implicit(s: Span) -> IResult { } #[parser] -pub fn implicit_data_type(s: Span) -> IResult { +pub(crate) fn implicit_data_type(s: Span) -> IResult { let (s, a) = opt(signing)(s)?; let (s, b) = many0(packed_dimension)(s)?; Ok((s, ImplicitDataType { nodes: (a, b) })) } #[parser] -pub fn enum_base_type(s: Span) -> IResult { +pub(crate) fn enum_base_type(s: Span) -> IResult { alt(( enum_base_type_atom, enum_base_type_vector, @@ -432,7 +432,7 @@ pub fn enum_base_type(s: Span) -> IResult { } #[parser] -pub fn enum_base_type_atom(s: Span) -> IResult { +pub(crate) fn enum_base_type_atom(s: Span) -> IResult { let (s, a) = integer_atom_type(s)?; let (s, b) = opt(signing)(s)?; Ok(( @@ -442,7 +442,7 @@ pub fn enum_base_type_atom(s: Span) -> IResult { } #[parser] -pub fn enum_base_type_vector(s: Span) -> IResult { +pub(crate) fn enum_base_type_vector(s: Span) -> IResult { let (s, a) = integer_vector_type(s)?; let (s, b) = opt(signing)(s)?; let (s, c) = opt(packed_dimension)(s)?; @@ -453,7 +453,7 @@ pub fn enum_base_type_vector(s: Span) -> IResult { } #[parser] -pub fn enum_base_type_type(s: Span) -> IResult { +pub(crate) fn enum_base_type_type(s: Span) -> IResult { let (s, a) = type_identifier(s)?; let (s, b) = opt(packed_dimension)(s)?; Ok(( @@ -463,7 +463,7 @@ pub fn enum_base_type_type(s: Span) -> IResult { } #[parser] -pub fn enum_name_declaration(s: Span) -> IResult { +pub(crate) fn enum_name_declaration(s: Span) -> IResult { let (s, a) = enum_identifier(s)?; let (s, b) = opt(bracket(pair( integral_number, @@ -475,14 +475,14 @@ pub fn enum_name_declaration(s: Span) -> IResult { #[packrat_parser] #[parser] -pub fn class_scope(s: Span) -> IResult { +pub(crate) fn class_scope(s: Span) -> IResult { let (s, a) = class_type(s)?; let (s, b) = symbol("::")(s)?; Ok((s, ClassScope { nodes: (a, b) })) } #[parser] -pub fn class_type(s: Span) -> IResult { +pub(crate) fn class_type(s: Span) -> IResult { let (s, a) = ps_class_identifier(s)?; let (s, b) = opt(parameter_value_assignment)(s)?; let (s, c) = many0(triple( @@ -494,7 +494,7 @@ pub fn class_type(s: Span) -> IResult { } #[parser] -pub fn integer_type(s: Span) -> IResult { +pub(crate) fn integer_type(s: Span) -> IResult { alt(( map(integer_vector_type, |x| { IntegerType::IntegerVectorType(Box::new(x)) @@ -506,7 +506,7 @@ pub fn integer_type(s: Span) -> IResult { } #[parser] -pub fn integer_atom_type(s: Span) -> IResult { +pub(crate) fn integer_atom_type(s: Span) -> IResult { alt(( map(keyword("byte"), |x| IntegerAtomType::Byte(Box::new(x))), map(keyword("shortint"), |x| { @@ -524,7 +524,7 @@ pub fn integer_atom_type(s: Span) -> IResult { } #[parser] -pub fn integer_vector_type(s: Span) -> IResult { +pub(crate) fn integer_vector_type(s: Span) -> IResult { alt(( map(keyword("bit"), |x| IntegerVectorType::Bit(Box::new(x))), map(keyword("logic"), |x| IntegerVectorType::Logic(Box::new(x))), @@ -533,7 +533,7 @@ pub fn integer_vector_type(s: Span) -> IResult { } #[parser] -pub fn non_integer_type(s: Span) -> IResult { +pub(crate) fn non_integer_type(s: Span) -> IResult { alt(( map(keyword("shortreal"), |x| { NonIntegerType::Shortreal(Box::new(x)) @@ -546,7 +546,7 @@ pub fn non_integer_type(s: Span) -> IResult { } #[parser] -pub fn net_type(s: Span) -> IResult { +pub(crate) fn net_type(s: Span) -> IResult { alt(( map(keyword("supply0"), |x| NetType::Supply0(Box::new(x))), map(keyword("supply1"), |x| NetType::Supply1(Box::new(x))), @@ -564,7 +564,7 @@ pub fn net_type(s: Span) -> IResult { } #[parser] -pub fn net_port_type(s: Span) -> IResult { +pub(crate) fn net_port_type(s: Span) -> IResult { alt(( net_port_type_data_type, map(net_type_identifier, |x| { @@ -575,7 +575,7 @@ pub fn net_port_type(s: Span) -> IResult { } #[parser] -pub fn net_port_type_data_type(s: Span) -> IResult { +pub(crate) fn net_port_type_data_type(s: Span) -> IResult { let (s, a) = opt(net_type)(s)?; let (s, b) = data_type_or_implicit(s)?; Ok(( @@ -585,7 +585,7 @@ pub fn net_port_type_data_type(s: Span) -> IResult { } #[parser] -pub fn net_port_type_interconnect(s: Span) -> IResult { +pub(crate) fn net_port_type_interconnect(s: Span) -> IResult { let (s, a) = keyword("interconnect")(s)?; let (s, b) = implicit_data_type(s)?; Ok(( @@ -595,13 +595,13 @@ pub fn net_port_type_interconnect(s: Span) -> IResult { } #[parser] -pub fn variable_port_type(s: Span) -> IResult { +pub(crate) fn variable_port_type(s: Span) -> IResult { let (s, a) = var_data_type(s)?; Ok((s, VariablePortType { nodes: (a,) })) } #[parser] -pub fn var_data_type(s: Span) -> IResult { +pub(crate) fn var_data_type(s: Span) -> IResult { alt(( map(data_type, |x| VarDataType::DataType(Box::new(x))), var_data_type_var, @@ -609,7 +609,7 @@ pub fn var_data_type(s: Span) -> IResult { } #[parser] -pub fn var_data_type_var(s: Span) -> IResult { +pub(crate) fn var_data_type_var(s: Span) -> IResult { let (s, a) = keyword("var")(s)?; let (s, b) = data_type_or_implicit(s)?; Ok(( @@ -619,7 +619,7 @@ pub fn var_data_type_var(s: Span) -> IResult { } #[parser] -pub fn signing(s: Span) -> IResult { +pub(crate) fn signing(s: Span) -> IResult { alt(( map(keyword("signed"), |x| Signing::Signed(Box::new(x))), map(keyword("unsigned"), |x| Signing::Unsigned(Box::new(x))), @@ -628,7 +628,7 @@ pub fn signing(s: Span) -> IResult { #[packrat_parser] #[parser] -pub fn simple_type(s: Span) -> IResult { +pub(crate) fn simple_type(s: Span) -> IResult { alt(( map(integer_type, |x| SimpleType::IntegerType(Box::new(x))), map(non_integer_type, |x| { @@ -644,7 +644,7 @@ pub fn simple_type(s: Span) -> IResult { } #[parser] -pub fn struct_union_member(s: Span) -> IResult { +pub(crate) fn struct_union_member(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = opt(random_qualifier)(s)?; let (s, c) = data_type_or_void(s)?; @@ -659,7 +659,7 @@ pub fn struct_union_member(s: Span) -> IResult { } #[parser] -pub fn data_type_or_void(s: Span) -> IResult { +pub(crate) fn data_type_or_void(s: Span) -> IResult { alt(( map(data_type, |x| DataTypeOrVoid::DataType(Box::new(x))), map(keyword("void"), |x| DataTypeOrVoid::Void(Box::new(x))), @@ -667,7 +667,7 @@ pub fn data_type_or_void(s: Span) -> IResult { } #[parser] -pub fn struct_union(s: Span) -> IResult { +pub(crate) fn struct_union(s: Span) -> IResult { alt(( map(keyword("struct"), |x| StructUnion::Struct(Box::new(x))), map(pair(keyword("union"), keyword("tagged")), |x| { @@ -678,12 +678,12 @@ pub fn struct_union(s: Span) -> IResult { } #[parser] -pub fn type_reference(s: Span) -> IResult { +pub(crate) fn type_reference(s: Span) -> IResult { alt((type_reference_expression, type_reference_data_type))(s) } #[parser] -pub fn type_reference_expression(s: Span) -> IResult { +pub(crate) fn type_reference_expression(s: Span) -> IResult { let (s, a) = keyword("type")(s)?; let (s, b) = paren(expression)(s)?; Ok(( @@ -693,7 +693,7 @@ pub fn type_reference_expression(s: Span) -> IResult { } #[parser] -pub fn type_reference_data_type(s: Span) -> IResult { +pub(crate) fn type_reference_data_type(s: Span) -> IResult { let (s, a) = keyword("type")(s)?; let (s, b) = paren(data_type)(s)?; Ok(( diff --git a/src/parser/declarations/port_declarations.rs b/src/parser/declarations/port_declarations.rs index 5b1a9aa..25aa56a 100644 --- a/src/parser/declarations/port_declarations.rs +++ b/src/parser/declarations/port_declarations.rs @@ -41,7 +41,7 @@ pub struct OutputDeclarationNet { #[derive(Clone, Debug, Node)] pub struct OutputDeclarationVariable { - pub nodes: (Keyword, VariablePortType, ListOfVariableIdentifiers), + pub nodes: (Keyword, VariablePortType, ListOfVariablePortIdentifiers), } #[derive(Clone, Debug, Node)] @@ -61,7 +61,7 @@ pub struct RefDeclaration { // ----------------------------------------------------------------------------- #[parser(Ambiguous)] -pub fn inout_declaration(s: Span) -> IResult { +pub(crate) fn inout_declaration(s: Span) -> IResult { let (s, a) = keyword("inout")(s)?; let (s, b) = ambiguous_opt(net_port_type)(s)?; let (s, c) = list_of_port_identifiers(s)?; @@ -69,12 +69,12 @@ pub fn inout_declaration(s: Span) -> IResult { } #[parser] -pub fn input_declaration(s: Span) -> IResult { +pub(crate) fn input_declaration(s: Span) -> IResult { alt((input_declaration_net, input_declaration_variable))(s) } #[parser(Ambiguous)] -pub fn input_declaration_net(s: Span) -> IResult { +pub(crate) fn input_declaration_net(s: Span) -> IResult { let (s, a) = keyword("input")(s)?; let (s, b) = ambiguous_opt(net_port_type)(s)?; let (s, c) = list_of_port_identifiers(s)?; @@ -85,7 +85,7 @@ pub fn input_declaration_net(s: Span) -> IResult { } #[parser(Ambiguous)] -pub fn input_declaration_variable(s: Span) -> IResult { +pub(crate) fn input_declaration_variable(s: Span) -> IResult { let (s, a) = keyword("input")(s)?; let (s, b) = ambiguous_alt(variable_port_type, implicit_var)(s)?; let (s, c) = list_of_variable_identifiers(s)?; @@ -96,12 +96,12 @@ pub fn input_declaration_variable(s: Span) -> IResult { } #[parser] -pub fn output_declaration(s: Span) -> IResult { +pub(crate) fn output_declaration(s: Span) -> IResult { alt((output_declaration_net, output_declaration_variable))(s) } #[parser(Ambiguous)] -pub fn output_declaration_net(s: Span) -> IResult { +pub(crate) fn output_declaration_net(s: Span) -> IResult { let (s, a) = keyword("output")(s)?; let (s, b) = ambiguous_opt(net_port_type)(s)?; let (s, c) = list_of_port_identifiers(s)?; @@ -112,10 +112,10 @@ pub fn output_declaration_net(s: Span) -> IResult { } #[parser(Ambiguous)] -pub fn output_declaration_variable(s: Span) -> IResult { +pub(crate) fn output_declaration_variable(s: Span) -> IResult { let (s, a) = keyword("output")(s)?; let (s, b) = ambiguous_alt(variable_port_type, implicit_var)(s)?; - let (s, c) = list_of_variable_identifiers(s)?; + let (s, c) = list_of_variable_port_identifiers(s)?; Ok(( s, OutputDeclaration::Variable(Box::new(OutputDeclarationVariable { nodes: (a, b, c) })), @@ -123,7 +123,7 @@ pub fn output_declaration_variable(s: Span) -> IResult } #[parser] -pub fn interface_port_declaration(s: Span) -> IResult { +pub(crate) fn interface_port_declaration(s: Span) -> IResult { let (s, a) = interface_identifier(s)?; let (s, b) = opt(pair(symbol("."), modport_identifier))(s)?; let (s, c) = list_of_interface_identifiers(s)?; @@ -131,7 +131,7 @@ pub fn interface_port_declaration(s: Span) -> IResult IResult { +pub(crate) fn ref_declaration(s: Span) -> IResult { let (s, a) = keyword("ref")(s)?; let (s, b) = ambiguous_alt(variable_port_type, implicit_var)(s)?; let (s, c) = list_of_variable_identifiers(s)?; @@ -139,7 +139,7 @@ pub fn ref_declaration(s: Span) -> IResult { } #[parser] -pub fn implicit_var(s: Span) -> IResult { +pub(crate) fn implicit_var(s: Span) -> IResult { let (s, a) = keyword("var")(s)?; Ok(( s, diff --git a/src/parser/declarations/strengths.rs b/src/parser/declarations/strengths.rs index a38d5a3..300c3b6 100644 --- a/src/parser/declarations/strengths.rs +++ b/src/parser/declarations/strengths.rs @@ -87,7 +87,7 @@ pub struct ChargeStrengthLarge { // ----------------------------------------------------------------------------- #[parser] -pub fn drive_strength(s: Span) -> IResult { +pub(crate) fn drive_strength(s: Span) -> IResult { alt(( drive_strength01, drive_strength10, @@ -99,7 +99,7 @@ pub fn drive_strength(s: Span) -> IResult { } #[parser] -pub fn drive_strength01(s: Span) -> IResult { +pub(crate) fn drive_strength01(s: Span) -> IResult { let (s, a) = paren(triple(strength0, symbol(","), strength1))(s)?; Ok(( s, @@ -108,7 +108,7 @@ pub fn drive_strength01(s: Span) -> IResult { } #[parser] -pub fn drive_strength10(s: Span) -> IResult { +pub(crate) fn drive_strength10(s: Span) -> IResult { let (s, a) = paren(triple(strength1, symbol(","), strength0))(s)?; Ok(( s, @@ -117,7 +117,7 @@ pub fn drive_strength10(s: Span) -> IResult { } #[parser] -pub fn drive_strength0z(s: Span) -> IResult { +pub(crate) fn drive_strength0z(s: Span) -> IResult { let (s, a) = paren(triple(strength0, symbol(","), keyword("highz1")))(s)?; Ok(( s, @@ -126,7 +126,7 @@ pub fn drive_strength0z(s: Span) -> IResult { } #[parser] -pub fn drive_strength1z(s: Span) -> IResult { +pub(crate) fn drive_strength1z(s: Span) -> IResult { let (s, a) = paren(triple(strength1, symbol(","), keyword("highz0")))(s)?; Ok(( s, @@ -135,7 +135,7 @@ pub fn drive_strength1z(s: Span) -> IResult { } #[parser] -pub fn drive_strengthz1(s: Span) -> IResult { +pub(crate) fn drive_strengthz1(s: Span) -> IResult { let (s, a) = paren(triple(keyword("highz0"), symbol(","), strength1))(s)?; Ok(( s, @@ -144,7 +144,7 @@ pub fn drive_strengthz1(s: Span) -> IResult { } #[parser] -pub fn drive_strengthz0(s: Span) -> IResult { +pub(crate) fn drive_strengthz0(s: Span) -> IResult { let (s, a) = paren(triple(keyword("highz1"), symbol(","), strength0))(s)?; Ok(( s, @@ -153,7 +153,7 @@ pub fn drive_strengthz0(s: Span) -> IResult { } #[parser] -pub fn strength0(s: Span) -> IResult { +pub(crate) fn strength0(s: Span) -> IResult { alt(( map(keyword("supply0"), |x| Strength0::Supply0(Box::new(x))), map(keyword("strong0"), |x| Strength0::Strong0(Box::new(x))), @@ -163,7 +163,7 @@ pub fn strength0(s: Span) -> IResult { } #[parser] -pub fn strength1(s: Span) -> IResult { +pub(crate) fn strength1(s: Span) -> IResult { alt(( map(keyword("supply1"), |x| Strength1::Supply1(Box::new(x))), map(keyword("strong1"), |x| Strength1::Strong1(Box::new(x))), @@ -173,7 +173,7 @@ pub fn strength1(s: Span) -> IResult { } #[parser] -pub fn charge_strength(s: Span) -> IResult { +pub(crate) fn charge_strength(s: Span) -> IResult { alt(( charge_strength_small, charge_strength_medium, @@ -182,7 +182,7 @@ pub fn charge_strength(s: Span) -> IResult { } #[parser] -pub fn charge_strength_small(s: Span) -> IResult { +pub(crate) fn charge_strength_small(s: Span) -> IResult { let (s, a) = paren(keyword("small"))(s)?; Ok(( s, @@ -191,7 +191,7 @@ pub fn charge_strength_small(s: Span) -> IResult { } #[parser] -pub fn charge_strength_medium(s: Span) -> IResult { +pub(crate) fn charge_strength_medium(s: Span) -> IResult { let (s, a) = paren(keyword("medium"))(s)?; Ok(( s, @@ -200,7 +200,7 @@ pub fn charge_strength_medium(s: Span) -> IResult { } #[parser] -pub fn charge_strength_large(s: Span) -> IResult { +pub(crate) fn charge_strength_large(s: Span) -> IResult { let (s, a) = paren(keyword("large"))(s)?; Ok(( s, diff --git a/src/parser/declarations/task_declarations.rs b/src/parser/declarations/task_declarations.rs index 7bacc82..157ef62 100644 --- a/src/parser/declarations/task_declarations.rs +++ b/src/parser/declarations/task_declarations.rs @@ -98,7 +98,7 @@ pub struct TaskPrototype { // ----------------------------------------------------------------------------- #[parser] -pub fn task_declaration(s: Span) -> IResult { +pub(crate) fn task_declaration(s: Span) -> IResult { let (s, a) = keyword("task")(s)?; let (s, b) = opt(lifetime)(s)?; let (s, c) = task_body_declaration(s)?; @@ -106,7 +106,7 @@ pub fn task_declaration(s: Span) -> IResult { } #[parser] -pub fn task_body_declaration(s: Span) -> IResult { +pub(crate) fn task_body_declaration(s: Span) -> IResult { alt(( task_body_declaration_without_port, task_body_declaration_with_port, @@ -114,7 +114,7 @@ pub fn task_body_declaration(s: Span) -> IResult { } #[parser] -pub fn task_body_declaration_without_port(s: Span) -> IResult { +pub(crate) fn task_body_declaration_without_port(s: Span) -> IResult { let (s, a) = opt(interface_identifier_or_class_scope)(s)?; let (s, b) = task_identifier(s)?; let (s, c) = symbol(";")(s)?; @@ -131,7 +131,7 @@ pub fn task_body_declaration_without_port(s: Span) -> IResult IResult { +pub(crate) fn task_body_declaration_with_port(s: Span) -> IResult { let (s, a) = opt(interface_identifier_or_class_scope)(s)?; let (s, b) = task_identifier(s)?; let (s, c) = paren(opt(tf_port_list))(s)?; @@ -149,7 +149,7 @@ pub fn task_body_declaration_with_port(s: Span) -> IResult IResult { +pub(crate) fn tf_item_declaration(s: Span) -> IResult { alt(( map(block_item_declaration, |x| { TfItemDeclaration::BlockItemDeclaration(Box::new(x)) @@ -161,13 +161,13 @@ pub fn tf_item_declaration(s: Span) -> IResult { } #[parser] -pub fn tf_port_list(s: Span) -> IResult { +pub(crate) fn tf_port_list(s: Span) -> IResult { let (s, a) = list(symbol(","), tf_port_item)(s)?; Ok((s, TfPortList { nodes: (a,) })) } #[parser(Ambiguous)] -pub fn tf_port_item(s: Span) -> IResult { +pub(crate) fn tf_port_item(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = opt(tf_port_direction)(s)?; let (s, c) = opt(var)(s)?; @@ -186,7 +186,7 @@ pub fn tf_port_item(s: Span) -> IResult { } #[parser] -pub fn tf_port_direction(s: Span) -> IResult { +pub(crate) fn tf_port_direction(s: Span) -> IResult { alt(( map(port_direction, |x| { TfPortDirection::PortDirection(Box::new(x)) @@ -198,7 +198,7 @@ pub fn tf_port_direction(s: Span) -> IResult { } #[parser(Ambiguous)] -pub fn tf_port_declaration(s: Span) -> IResult { +pub(crate) fn tf_port_declaration(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = tf_port_direction(s)?; let (s, c) = opt(var)(s)?; @@ -214,7 +214,7 @@ pub fn tf_port_declaration(s: Span) -> IResult { } #[parser] -pub fn task_prototype(s: Span) -> IResult { +pub(crate) fn task_prototype(s: Span) -> IResult { let (s, a) = keyword("task")(s)?; let (s, b) = task_identifier(s)?; let (s, c) = opt(paren(opt(tf_port_list)))(s)?; diff --git a/src/parser/declarations/type_declarations.rs b/src/parser/declarations/type_declarations.rs index e3ee90d..62dd39d 100644 --- a/src/parser/declarations/type_declarations.rs +++ b/src/parser/declarations/type_declarations.rs @@ -217,7 +217,7 @@ pub enum Lifetime { // ----------------------------------------------------------------------------- #[parser] -pub fn data_declaration(s: Span) -> IResult { +pub(crate) fn data_declaration(s: Span) -> IResult { alt(( data_declaration_variable, map(type_declaration, |x| { @@ -233,7 +233,7 @@ pub fn data_declaration(s: Span) -> IResult { } #[parser(Ambiguous)] -pub fn data_declaration_variable(s: Span) -> IResult { +pub(crate) fn data_declaration_variable(s: Span) -> IResult { let (s, a) = opt(r#const)(s)?; let (s, b) = opt(var)(s)?; let (s, c) = opt(lifetime)(s)?; @@ -249,13 +249,13 @@ pub fn data_declaration_variable(s: Span) -> IResult { } #[parser] -pub fn r#const(s: Span) -> IResult { +pub(crate) fn r#const(s: Span) -> IResult { let (s, a) = keyword("const")(s)?; Ok((s, Const { nodes: (a,) })) } #[parser] -pub fn package_import_declaration(s: Span) -> IResult { +pub(crate) fn package_import_declaration(s: Span) -> IResult { let (s, a) = keyword("import")(s)?; let (s, b) = list(symbol(","), package_import_item)(s)?; let (s, c) = symbol(";")(s)?; @@ -263,12 +263,12 @@ pub fn package_import_declaration(s: Span) -> IResult IResult { +pub(crate) fn package_import_item(s: Span) -> IResult { alt((package_import_item_identifier, package_import_item_asterisk))(s) } #[parser] -pub fn package_import_item_identifier(s: Span) -> IResult { +pub(crate) fn package_import_item_identifier(s: Span) -> IResult { let (s, a) = package_identifier(s)?; let (s, b) = symbol("::")(s)?; let (s, c) = identifier(s)?; @@ -279,7 +279,7 @@ pub fn package_import_item_identifier(s: Span) -> IResult IResult { +pub(crate) fn package_import_item_asterisk(s: Span) -> IResult { let (s, a) = package_identifier(s)?; let (s, b) = symbol("::")(s)?; let (s, c) = symbol("*")(s)?; @@ -290,7 +290,7 @@ pub fn package_import_item_asterisk(s: Span) -> IResult } #[parser] -pub fn package_export_declaration(s: Span) -> IResult { +pub(crate) fn package_export_declaration(s: Span) -> IResult { alt(( package_export_declaration_asterisk, package_export_declaration_item, @@ -298,7 +298,7 @@ pub fn package_export_declaration(s: Span) -> IResult IResult { +pub(crate) fn package_export_declaration_asterisk(s: Span) -> IResult { let (s, a) = keyword("export")(s)?; let (s, b) = symbol("*::*")(s)?; let (s, c) = symbol(";")(s)?; @@ -311,7 +311,7 @@ pub fn package_export_declaration_asterisk(s: Span) -> IResult IResult { +pub(crate) fn package_export_declaration_item(s: Span) -> IResult { let (s, a) = keyword("export")(s)?; let (s, b) = list(symbol(","), package_import_item)(s)?; let (s, c) = symbol(";")(s)?; @@ -322,7 +322,7 @@ pub fn package_export_declaration_item(s: Span) -> IResult IResult { +pub(crate) fn genvar_declaration(s: Span) -> IResult { let (s, a) = keyword("genvar")(s)?; let (s, b) = list_of_genvar_identifiers(s)?; let (s, c) = symbol(";")(s)?; @@ -330,7 +330,7 @@ pub fn genvar_declaration(s: Span) -> IResult { } #[parser] -pub fn net_declaration(s: Span) -> IResult { +pub(crate) fn net_declaration(s: Span) -> IResult { alt(( net_declaration_interconnect, net_declaration_net_type, @@ -339,7 +339,7 @@ pub fn net_declaration(s: Span) -> IResult { } #[parser(Ambiguous)] -pub fn net_declaration_net_type(s: Span) -> IResult { +pub(crate) fn net_declaration_net_type(s: Span) -> IResult { let (s, a) = net_type(s)?; let (s, b) = opt(strength)(s)?; let (s, c) = opt(vector_scalar)(s)?; @@ -356,7 +356,7 @@ pub fn net_declaration_net_type(s: Span) -> IResult { } #[parser] -pub fn strength(s: Span) -> IResult { +pub(crate) fn strength(s: Span) -> IResult { alt(( map(drive_strength, |x| Strength::Drive(Box::new(x))), map(charge_strength, |x| Strength::Charge(Box::new(x))), @@ -364,7 +364,7 @@ pub fn strength(s: Span) -> IResult { } #[parser] -pub fn vector_scalar(s: Span) -> IResult { +pub(crate) fn vector_scalar(s: Span) -> IResult { alt(( map(keyword("vectored"), |x| VectorScalar::Vectored(Box::new(x))), map(keyword("scalared"), |x| VectorScalar::Scalared(Box::new(x))), @@ -372,7 +372,7 @@ pub fn vector_scalar(s: Span) -> IResult { } #[parser] -pub fn net_declaration_net_type_identifier(s: Span) -> IResult { +pub(crate) fn net_declaration_net_type_identifier(s: Span) -> IResult { let (s, a) = net_type_identifier(s)?; let (s, b) = opt(delay_control)(s)?; let (s, c) = list_of_net_decl_assignments(s)?; @@ -386,7 +386,7 @@ pub fn net_declaration_net_type_identifier(s: Span) -> IResult IResult { +pub(crate) fn net_declaration_interconnect(s: Span) -> IResult { let (s, a) = keyword("interconnect")(s)?; let (s, b) = implicit_data_type(s)?; let (s, c) = opt(pair(symbol("#"), delay_value))(s)?; @@ -407,7 +407,7 @@ pub fn net_declaration_interconnect(s: Span) -> IResult { } #[parser] -pub fn type_declaration(s: Span) -> IResult { +pub(crate) fn type_declaration(s: Span) -> IResult { alt(( type_declaration_data_type, type_declaration_interface, @@ -416,7 +416,7 @@ pub fn type_declaration(s: Span) -> IResult { } #[parser] -pub fn type_declaration_data_type(s: Span) -> IResult { +pub(crate) fn type_declaration_data_type(s: Span) -> IResult { let (s, a) = keyword("typedef")(s)?; let (s, b) = data_type(s)?; let (s, c) = type_identifier(s)?; @@ -431,7 +431,7 @@ pub fn type_declaration_data_type(s: Span) -> IResult { } #[parser] -pub fn type_declaration_interface(s: Span) -> IResult { +pub(crate) fn type_declaration_interface(s: Span) -> IResult { let (s, a) = keyword("typedef")(s)?; let (s, b) = interface_instance_identifier(s)?; let (s, c) = constant_bit_select(s)?; @@ -448,7 +448,7 @@ pub fn type_declaration_interface(s: Span) -> IResult { } #[parser] -pub fn type_declaration_reserved(s: Span) -> IResult { +pub(crate) fn type_declaration_reserved(s: Span) -> IResult { let (s, a) = keyword("typedef")(s)?; let (s, b) = opt(type_declaration_keyword)(s)?; let (s, c) = type_identifier(s)?; @@ -462,7 +462,7 @@ pub fn type_declaration_reserved(s: Span) -> IResult { } #[parser] -pub fn type_declaration_keyword(s: Span) -> IResult { +pub(crate) fn type_declaration_keyword(s: Span) -> IResult { alt(( map(keyword("enum"), |x| { TypeDeclarationKeyword::Enum(Box::new(x)) @@ -483,7 +483,7 @@ pub fn type_declaration_keyword(s: Span) -> IResult IResult { +pub(crate) fn net_type_declaration(s: Span) -> IResult { alt(( net_type_declaration_data_type, net_type_declaration_net_type, @@ -491,7 +491,7 @@ pub fn net_type_declaration(s: Span) -> IResult { } #[parser] -pub fn net_type_declaration_data_type(s: Span) -> IResult { +pub(crate) fn net_type_declaration_data_type(s: Span) -> IResult { let (s, a) = keyword("nettype")(s)?; let (s, b) = data_type(s)?; let (s, c) = net_type_identifier(s)?; @@ -510,7 +510,7 @@ pub fn net_type_declaration_data_type(s: Span) -> IResult IResult { +pub(crate) fn net_type_declaration_net_type(s: Span) -> IResult { let (s, a) = keyword("nettype")(s)?; let (s, b) = opt(package_scope_or_class_scope)(s)?; let (s, c) = net_type_identifier(s)?; @@ -525,7 +525,7 @@ pub fn net_type_declaration_net_type(s: Span) -> IResult IResult { +pub(crate) fn lifetime(s: Span) -> IResult { alt(( map(keyword("static"), |x| Lifetime::Static(Box::new(x))), map(keyword("automatic"), |x| Lifetime::Automatic(Box::new(x))), diff --git a/src/parser/expressions/concatenations.rs b/src/parser/expressions/concatenations.rs index 95bb580..cb05e24 100644 --- a/src/parser/expressions/concatenations.rs +++ b/src/parser/expressions/concatenations.rs @@ -94,31 +94,31 @@ pub struct EmptyUnpackedArrayConcatenation { // ----------------------------------------------------------------------------- #[parser] -pub fn concatenation(s: Span) -> IResult { +pub(crate) fn concatenation(s: Span) -> IResult { let (s, a) = brace(list(symbol(","), expression))(s)?; Ok((s, Concatenation { nodes: (a,) })) } #[parser] -pub fn constant_concatenation(s: Span) -> IResult { +pub(crate) fn constant_concatenation(s: Span) -> IResult { let (s, a) = brace(list(symbol(","), constant_expression))(s)?; Ok((s, ConstantConcatenation { nodes: (a,) })) } #[parser] -pub fn constant_multiple_concatenation(s: Span) -> IResult { +pub(crate) fn constant_multiple_concatenation(s: Span) -> IResult { let (s, a) = brace(pair(constant_expression, constant_concatenation))(s)?; Ok((s, ConstantMultipleConcatenation { nodes: (a,) })) } #[parser] -pub fn module_path_concatenation(s: Span) -> IResult { +pub(crate) fn module_path_concatenation(s: Span) -> IResult { let (s, a) = brace(list(symbol(","), module_path_expression))(s)?; Ok((s, ModulePathConcatenation { nodes: (a,) })) } #[parser] -pub fn module_path_multiple_concatenation( +pub(crate) fn module_path_multiple_concatenation( s: Span, ) -> IResult { let (s, a) = brace(pair(constant_expression, module_path_concatenation))(s)?; @@ -126,13 +126,13 @@ pub fn module_path_multiple_concatenation( } #[parser] -pub fn multiple_concatenation(s: Span) -> IResult { +pub(crate) fn multiple_concatenation(s: Span) -> IResult { let (s, a) = brace(pair(expression, concatenation))(s)?; Ok((s, MultipleConcatenation { nodes: (a,) })) } #[parser] -pub fn streaming_concatenation(s: Span) -> IResult { +pub(crate) fn streaming_concatenation(s: Span) -> IResult { let (s, a) = brace(triple( stream_operator, opt(slice_size), @@ -142,7 +142,7 @@ pub fn streaming_concatenation(s: Span) -> IResult } #[parser] -pub fn stream_operator(s: Span) -> IResult { +pub(crate) fn stream_operator(s: Span) -> IResult { alt(( map(symbol(">>"), |x| StreamOperator { nodes: (x,) }), map(symbol("<<"), |x| StreamOperator { nodes: (x,) }), @@ -150,7 +150,7 @@ pub fn stream_operator(s: Span) -> IResult { } #[parser] -pub fn slice_size(s: Span) -> IResult { +pub(crate) fn slice_size(s: Span) -> IResult { alt(( map(simple_type, |x| SliceSize::SimpleType(Box::new(x))), map(constant_expression, |x| { @@ -160,20 +160,20 @@ pub fn slice_size(s: Span) -> IResult { } #[parser] -pub fn stream_concatenation(s: Span) -> IResult { +pub(crate) fn stream_concatenation(s: Span) -> IResult { let (s, a) = brace(list(symbol(","), stream_expression))(s)?; Ok((s, StreamConcatenation { nodes: (a,) })) } #[parser(MaybeRecursive)] -pub fn stream_expression(s: Span) -> IResult { +pub(crate) fn stream_expression(s: Span) -> IResult { let (s, a) = expression(s)?; let (s, b) = opt(pair(keyword("with"), bracket(array_range_expression)))(s)?; Ok((s, StreamExpression { nodes: (a, b) })) } #[parser] -pub fn array_range_expression(s: Span) -> IResult { +pub(crate) fn array_range_expression(s: Span) -> IResult { alt(( map(expression, |x| { ArrayRangeExpression::Expression(Box::new(x)) @@ -185,7 +185,7 @@ pub fn array_range_expression(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn array_range_expression_colon(s: Span) -> IResult { +pub(crate) fn array_range_expression_colon(s: Span) -> IResult { let (s, a) = expression(s)?; let (s, b) = symbol(":")(s)?; let (s, c) = expression(s)?; @@ -196,7 +196,7 @@ pub fn array_range_expression_colon(s: Span) -> IResult IResult { +pub(crate) fn array_range_expression_plus_colon(s: Span) -> IResult { let (s, a) = expression(s)?; let (s, b) = symbol("+:")(s)?; let (s, c) = expression(s)?; @@ -209,7 +209,7 @@ pub fn array_range_expression_plus_colon(s: Span) -> IResult IResult { +pub(crate) fn array_range_expression_minus_colon(s: Span) -> IResult { let (s, a) = expression(s)?; let (s, b) = symbol("-:")(s)?; let (s, c) = expression(s)?; @@ -222,7 +222,7 @@ pub fn array_range_expression_minus_colon(s: Span) -> IResult IResult { let (s, a) = symbol("{")(s)?; diff --git a/src/parser/expressions/expression_leftside_values.rs b/src/parser/expressions/expression_leftside_values.rs index c06a761..2feb206 100644 --- a/src/parser/expressions/expression_leftside_values.rs +++ b/src/parser/expressions/expression_leftside_values.rs @@ -75,12 +75,12 @@ pub struct NonrangeVariableLvalue { #[packrat_parser] #[parser] -pub fn net_lvalue(s: Span) -> IResult { +pub(crate) fn net_lvalue(s: Span) -> IResult { alt((net_lvalue_identifier, net_lvalue_lvalue, net_lvalue_pattern))(s) } #[parser] -pub fn net_lvalue_identifier(s: Span) -> IResult { +pub(crate) fn net_lvalue_identifier(s: Span) -> IResult { let (s, a) = ps_or_hierarchical_net_identifier(s)?; let (s, b) = constant_select(s)?; Ok(( @@ -90,7 +90,7 @@ pub fn net_lvalue_identifier(s: Span) -> IResult { } #[parser] -pub fn net_lvalue_pattern(s: Span) -> IResult { +pub(crate) fn net_lvalue_pattern(s: Span) -> IResult { let (s, a) = opt(assignment_pattern_expression_type)(s)?; let (s, b) = assignment_pattern_net_lvalue(s)?; Ok(( @@ -100,7 +100,7 @@ pub fn net_lvalue_pattern(s: Span) -> IResult { } #[parser] -pub fn net_lvalue_lvalue(s: Span) -> IResult { +pub(crate) fn net_lvalue_lvalue(s: Span) -> IResult { let (s, a) = brace(list(symbol(","), net_lvalue))(s)?; Ok(( s, @@ -110,7 +110,7 @@ pub fn net_lvalue_lvalue(s: Span) -> IResult { #[packrat_parser] #[parser] -pub fn variable_lvalue(s: Span) -> IResult { +pub(crate) fn variable_lvalue(s: Span) -> IResult { alt(( variable_lvalue_identifier, variable_lvalue_lvalue, @@ -122,7 +122,7 @@ pub fn variable_lvalue(s: Span) -> IResult { } #[parser] -pub fn variable_lvalue_identifier(s: Span) -> IResult { +pub(crate) fn variable_lvalue_identifier(s: Span) -> IResult { let (s, a) = opt(implicit_class_handle_or_package_scope)(s)?; let (s, b) = hierarchical_variable_identifier(s)?; let (s, c) = select(s)?; @@ -133,7 +133,7 @@ pub fn variable_lvalue_identifier(s: Span) -> IResult { } #[parser] -pub fn variable_lvalue_pattern(s: Span) -> IResult { +pub(crate) fn variable_lvalue_pattern(s: Span) -> IResult { let (s, a) = opt(assignment_pattern_expression_type)(s)?; let (s, b) = assignment_pattern_variable_lvalue(s)?; Ok(( @@ -143,7 +143,7 @@ pub fn variable_lvalue_pattern(s: Span) -> IResult { } #[parser] -pub fn variable_lvalue_lvalue(s: Span) -> IResult { +pub(crate) fn variable_lvalue_lvalue(s: Span) -> IResult { let (s, a) = brace(list(symbol(","), variable_lvalue))(s)?; Ok(( s, @@ -152,7 +152,7 @@ pub fn variable_lvalue_lvalue(s: Span) -> IResult { } #[parser] -pub fn nonrange_variable_lvalue(s: Span) -> IResult { +pub(crate) fn nonrange_variable_lvalue(s: Span) -> IResult { let (s, a) = opt(implicit_class_handle_or_package_scope)(s)?; let (s, b) = hierarchical_variable_identifier(s)?; let (s, c) = nonrange_select(s)?; diff --git a/src/parser/expressions/expressions.rs b/src/parser/expressions/expressions.rs index 9c4bb74..7ef00bf 100644 --- a/src/parser/expressions/expressions.rs +++ b/src/parser/expressions/expressions.rs @@ -263,12 +263,12 @@ pub struct GenvarExpression { // ----------------------------------------------------------------------------- #[parser] -pub fn inc_or_dec_expression(s: Span) -> IResult { +pub(crate) fn inc_or_dec_expression(s: Span) -> IResult { alt((inc_or_dec_expression_prefix, inc_or_dec_expression_suffix))(s) } #[parser] -pub fn inc_or_dec_expression_prefix(s: Span) -> IResult { +pub(crate) fn inc_or_dec_expression_prefix(s: Span) -> IResult { let (s, a) = inc_or_dec_operator(s)?; let (s, b) = many0(attribute_instance)(s)?; let (s, c) = variable_lvalue(s)?; @@ -279,7 +279,7 @@ pub fn inc_or_dec_expression_prefix(s: Span) -> IResult IResult { +pub(crate) fn inc_or_dec_expression_suffix(s: Span) -> IResult { let (s, a) = variable_lvalue(s)?; let (s, b) = many0(attribute_instance)(s)?; let (s, c) = inc_or_dec_operator(s)?; @@ -290,7 +290,7 @@ pub fn inc_or_dec_expression_suffix(s: Span) -> IResult IResult { +pub(crate) fn conditional_expression(s: Span) -> IResult { let (s, a) = cond_predicate(s)?; let (s, b) = symbol("?")(s)?; let (s, c) = many0(attribute_instance)(s)?; @@ -307,7 +307,7 @@ pub fn conditional_expression(s: Span) -> IResult { #[packrat_parser] #[parser] -pub fn constant_expression(s: Span) -> IResult { +pub(crate) fn constant_expression(s: Span) -> IResult { alt(( constant_expression_unary, constant_expression_binary, @@ -319,7 +319,7 @@ pub fn constant_expression(s: Span) -> IResult { } #[parser] -pub fn constant_expression_unary(s: Span) -> IResult { +pub(crate) fn constant_expression_unary(s: Span) -> IResult { let (s, a) = unary_operator(s)?; let (s, b) = many0(attribute_instance)(s)?; let (s, c) = constant_primary(s)?; @@ -330,7 +330,7 @@ pub fn constant_expression_unary(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn constant_expression_binary(s: Span) -> IResult { +pub(crate) fn constant_expression_binary(s: Span) -> IResult { let (s, a) = constant_expression(s)?; let (s, b) = binary_operator(s)?; let (s, c) = many0(attribute_instance)(s)?; @@ -344,7 +344,7 @@ pub fn constant_expression_binary(s: Span) -> IResult } #[parser(MaybeRecursive)] -pub fn constant_expression_ternary(s: Span) -> IResult { +pub(crate) fn constant_expression_ternary(s: Span) -> IResult { let (s, a) = constant_expression(s)?; let (s, b) = symbol("?")(s)?; let (s, c) = many0(attribute_instance)(s)?; @@ -360,7 +360,7 @@ pub fn constant_expression_ternary(s: Span) -> IResult } #[parser] -pub fn constant_mintypmax_expression(s: Span) -> IResult { +pub(crate) fn constant_mintypmax_expression(s: Span) -> IResult { alt(( constant_mintypmax_expression_ternary, map(constant_expression, |x| { @@ -370,7 +370,7 @@ pub fn constant_mintypmax_expression(s: Span) -> IResult IResult { let (s, a) = constant_expression(s)?; @@ -387,7 +387,7 @@ pub fn constant_mintypmax_expression_ternary( } #[parser] -pub fn constant_param_expression(s: Span) -> IResult { +pub(crate) fn constant_param_expression(s: Span) -> IResult { alt(( map(symbol("$"), |x| { ConstantParamExpression::Dollar(Box::new(x)) @@ -402,7 +402,7 @@ pub fn constant_param_expression(s: Span) -> IResult IResult { +pub(crate) fn param_expression(s: Span) -> IResult { alt(( map(symbol("$"), |x| ParamExpression::Dollar(Box::new(x))), map(mintypmax_expression, |x| { @@ -413,7 +413,7 @@ pub fn param_expression(s: Span) -> IResult { } #[parser] -pub fn constant_range_expression(s: Span) -> IResult { +pub(crate) fn constant_range_expression(s: Span) -> IResult { alt(( map(constant_part_select_range, |x| { ConstantRangeExpression::ConstantPartSelectRange(Box::new(x)) @@ -425,7 +425,7 @@ pub fn constant_range_expression(s: Span) -> IResult IResult { +pub(crate) fn constant_part_select_range(s: Span) -> IResult { alt(( map(constant_range, |x| { ConstantPartSelectRange::ConstantRange(Box::new(x)) @@ -437,7 +437,7 @@ pub fn constant_part_select_range(s: Span) -> IResult IResult { +pub(crate) fn constant_range(s: Span) -> IResult { let (s, a) = constant_expression(s)?; let (s, b) = symbol(":")(s)?; let (s, c) = constant_expression(s)?; @@ -445,7 +445,7 @@ pub fn constant_range(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn constant_indexed_range(s: Span) -> IResult { +pub(crate) fn constant_indexed_range(s: Span) -> IResult { let (s, a) = constant_expression(s)?; let (s, b) = alt((symbol("+:"), symbol("-:")))(s)?; let (s, c) = constant_expression(s)?; @@ -454,7 +454,7 @@ pub fn constant_indexed_range(s: Span) -> IResult { #[packrat_parser] #[parser] -pub fn expression(s: Span) -> IResult { +pub(crate) fn expression(s: Span) -> IResult { alt(( expression_unary, map(inc_or_dec_expression, |x| { @@ -476,7 +476,7 @@ pub fn expression(s: Span) -> IResult { } #[parser] -pub fn expression_unary(s: Span) -> IResult { +pub(crate) fn expression_unary(s: Span) -> IResult { let (s, x) = unary_operator(s)?; let (s, y) = many0(attribute_instance)(s)?; let (s, z) = primary(s)?; @@ -487,7 +487,7 @@ pub fn expression_unary(s: Span) -> IResult { } #[parser] -pub fn expression_operator_assignment(s: Span) -> IResult { +pub(crate) fn expression_operator_assignment(s: Span) -> IResult { let (s, a) = paren(operator_assignment)(s)?; Ok(( s, @@ -496,7 +496,7 @@ pub fn expression_operator_assignment(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn expression_binary(s: Span) -> IResult { +pub(crate) fn expression_binary(s: Span) -> IResult { let (s, a) = expression(s)?; let (s, b) = binary_operator(s)?; let (s, c) = many0(attribute_instance)(s)?; @@ -510,7 +510,7 @@ pub fn expression_binary(s: Span) -> IResult { } #[parser] -pub fn tagged_union_expression(s: Span) -> IResult { +pub(crate) fn tagged_union_expression(s: Span) -> IResult { let (s, a) = keyword("tagged")(s)?; let (s, b) = member_identifier(s)?; let (s, c) = opt(expression)(s)?; @@ -518,7 +518,7 @@ pub fn tagged_union_expression(s: Span) -> IResult } #[parser(MaybeRecursive)] -pub fn inside_expression(s: Span) -> IResult { +pub(crate) fn inside_expression(s: Span) -> IResult { let (s, a) = expression(s)?; let (s, b) = keyword("inside")(s)?; let (s, c) = brace(open_range_list)(s)?; @@ -526,7 +526,7 @@ pub fn inside_expression(s: Span) -> IResult { } #[parser] -pub fn value_range(s: Span) -> IResult { +pub(crate) fn value_range(s: Span) -> IResult { alt(( value_range_binary, map(expression, |x| ValueRange::Expression(Box::new(x))), @@ -534,7 +534,7 @@ pub fn value_range(s: Span) -> IResult { } #[parser] -pub fn value_range_binary(s: Span) -> IResult { +pub(crate) fn value_range_binary(s: Span) -> IResult { let (s, a) = bracket(triple(expression, symbol(":"), expression))(s)?; Ok(( s, @@ -543,7 +543,7 @@ pub fn value_range_binary(s: Span) -> IResult { } #[parser] -pub fn mintypmax_expression(s: Span) -> IResult { +pub(crate) fn mintypmax_expression(s: Span) -> IResult { alt(( mintypmax_expression_ternary, map(expression, |x| MintypmaxExpression::Expression(Box::new(x))), @@ -551,7 +551,7 @@ pub fn mintypmax_expression(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn mintypmax_expression_ternary(s: Span) -> IResult { +pub(crate) fn mintypmax_expression_ternary(s: Span) -> IResult { let (s, a) = expression(s)?; let (s, b) = symbol(":")(s)?; let (s, c) = expression(s)?; @@ -566,7 +566,7 @@ pub fn mintypmax_expression_ternary(s: Span) -> IResult IResult { let (s, a) = module_path_expression(s)?; @@ -584,7 +584,7 @@ pub fn module_path_conditional_expression( } #[parser] -pub fn module_path_expression(s: Span) -> IResult { +pub(crate) fn module_path_expression(s: Span) -> IResult { alt(( map(module_path_primary, |x| { ModulePathExpression::ModulePathPrimary(Box::new(x)) @@ -598,7 +598,7 @@ pub fn module_path_expression(s: Span) -> IResult { } #[parser] -pub fn module_path_expression_unary(s: Span) -> IResult { +pub(crate) fn module_path_expression_unary(s: Span) -> IResult { let (s, a) = unary_module_path_operator(s)?; let (s, b) = many0(attribute_instance)(s)?; let (s, c) = module_path_primary(s)?; @@ -609,7 +609,7 @@ pub fn module_path_expression_unary(s: Span) -> IResult IResult { +pub(crate) fn module_path_expression_binary(s: Span) -> IResult { let (s, a) = module_path_expression(s)?; let (s, b) = binary_module_path_operator(s)?; let (s, c) = many0(attribute_instance)(s)?; @@ -623,7 +623,7 @@ pub fn module_path_expression_binary(s: Span) -> IResult IResult { +pub(crate) fn module_path_mintypmax_expression(s: Span) -> IResult { alt(( module_path_mintypmax_expression_ternary, map(module_path_expression, |x| { @@ -633,7 +633,7 @@ pub fn module_path_mintypmax_expression(s: Span) -> IResult IResult { let (s, a) = module_path_expression(s)?; @@ -650,7 +650,7 @@ pub fn module_path_mintypmax_expression_ternary( } #[parser] -pub fn part_select_range(s: Span) -> IResult { +pub(crate) fn part_select_range(s: Span) -> IResult { alt(( map(constant_range, |x| { PartSelectRange::ConstantRange(Box::new(x)) @@ -662,7 +662,7 @@ pub fn part_select_range(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn indexed_range(s: Span) -> IResult { +pub(crate) fn indexed_range(s: Span) -> IResult { let (s, a) = expression(s)?; let (s, b) = alt((symbol("+:"), symbol("-:")))(s)?; let (s, c) = constant_expression(s)?; @@ -670,7 +670,7 @@ pub fn indexed_range(s: Span) -> IResult { } #[parser] -pub fn genvar_expression(s: Span) -> IResult { +pub(crate) fn genvar_expression(s: Span) -> IResult { let (s, a) = constant_expression(s)?; Ok((s, GenvarExpression { nodes: (a,) })) } diff --git a/src/parser/expressions/numbers.rs b/src/parser/expressions/numbers.rs index fe7ab1c..859d30f 100644 --- a/src/parser/expressions/numbers.rs +++ b/src/parser/expressions/numbers.rs @@ -165,7 +165,7 @@ pub struct UnbasedUnsizedLiteral { #[packrat_parser] #[parser] -pub fn number(s: Span) -> IResult { +pub(crate) fn number(s: Span) -> IResult { alt(( map(real_number, |x| Number::RealNumber(Box::new(x))), map(integral_number, |x| Number::IntegralNumber(Box::new(x))), @@ -173,7 +173,7 @@ pub fn number(s: Span) -> IResult { } #[parser] -pub fn integral_number(s: Span) -> IResult { +pub(crate) fn integral_number(s: Span) -> IResult { alt(( map(octal_number, |x| IntegralNumber::OctalNumber(Box::new(x))), map(binary_number, |x| IntegralNumber::BinaryNumber(Box::new(x))), @@ -185,7 +185,7 @@ pub fn integral_number(s: Span) -> IResult { } #[parser] -pub fn decimal_number(s: Span) -> IResult { +pub(crate) fn decimal_number(s: Span) -> IResult { alt(( decimal_number_base_unsigned, decimal_number_base_x_number, @@ -197,7 +197,7 @@ pub fn decimal_number(s: Span) -> IResult { } #[parser] -pub fn decimal_number_base_unsigned(s: Span) -> IResult { +pub(crate) fn decimal_number_base_unsigned(s: Span) -> IResult { let (s, a) = opt(size)(s)?; let (s, b) = decimal_base(s)?; let (s, c) = unsigned_number(s)?; @@ -208,7 +208,7 @@ pub fn decimal_number_base_unsigned(s: Span) -> IResult { } #[parser] -pub fn decimal_number_base_x_number(s: Span) -> IResult { +pub(crate) fn decimal_number_base_x_number(s: Span) -> IResult { let (s, a) = opt(size)(s)?; let (s, b) = decimal_base(s)?; let (s, c) = x_number(s)?; @@ -219,7 +219,7 @@ pub fn decimal_number_base_x_number(s: Span) -> IResult { } #[parser] -pub fn decimal_number_base_z_number(s: Span) -> IResult { +pub(crate) fn decimal_number_base_z_number(s: Span) -> IResult { let (s, a) = opt(size)(s)?; let (s, b) = decimal_base(s)?; let (s, c) = z_number(s)?; @@ -230,7 +230,7 @@ pub fn decimal_number_base_z_number(s: Span) -> IResult { } #[parser] -pub fn binary_number(s: Span) -> IResult { +pub(crate) fn binary_number(s: Span) -> IResult { let (s, a) = opt(size)(s)?; let (s, b) = binary_base(s)?; let (s, c) = binary_value(s)?; @@ -238,7 +238,7 @@ pub fn binary_number(s: Span) -> IResult { } #[parser] -pub fn octal_number(s: Span) -> IResult { +pub(crate) fn octal_number(s: Span) -> IResult { let (s, a) = opt(size)(s)?; let (s, b) = octal_base(s)?; let (s, c) = octal_value(s)?; @@ -246,7 +246,7 @@ pub fn octal_number(s: Span) -> IResult { } #[parser] -pub fn hex_number(s: Span) -> IResult { +pub(crate) fn hex_number(s: Span) -> IResult { let (s, a) = opt(size)(s)?; let (s, b) = hex_base(s)?; let (s, c) = hex_value(s)?; @@ -254,7 +254,7 @@ pub fn hex_number(s: Span) -> IResult { } #[parser] -pub fn sign(s: Span) -> IResult { +pub(crate) fn sign(s: Span) -> IResult { alt(( map(symbol("+"), |x| Sign::Plus(Box::new(x))), map(symbol("-"), |x| Sign::Minus(Box::new(x))), @@ -262,19 +262,19 @@ pub fn sign(s: Span) -> IResult { } #[parser] -pub fn size(s: Span) -> IResult { +pub(crate) fn size(s: Span) -> IResult { let (s, a) = non_zero_unsigned_number(s)?; Ok((s, Size { nodes: (a,) })) } #[parser] -pub fn non_zero_unsigned_number(s: Span) -> IResult { +pub(crate) fn non_zero_unsigned_number(s: Span) -> IResult { let (s, a) = ws(non_zero_unsigned_number_impl)(s)?; Ok((s, NonZeroUnsignedNumber { nodes: a })) } #[parser] -pub fn non_zero_unsigned_number_impl(s: Span) -> IResult { +pub(crate) fn non_zero_unsigned_number_impl(s: Span) -> IResult { let (s, a) = is_a("123456789")(s)?; let (s, a) = fold_many0(alt((tag("_"), digit1)), a, |acc, item| { concat(acc, item).unwrap() @@ -283,7 +283,7 @@ pub fn non_zero_unsigned_number_impl(s: Span) -> IResult { } #[parser] -pub fn real_number(s: Span) -> IResult { +pub(crate) fn real_number(s: Span) -> IResult { alt(( real_number_floating, map(fixed_point_number, |x| { @@ -293,7 +293,7 @@ pub fn real_number(s: Span) -> IResult { } #[parser] -pub fn real_number_floating(s: Span) -> IResult { +pub(crate) fn real_number_floating(s: Span) -> IResult { let (s, a) = unsigned_number(s)?; let (s, b) = opt(pair(symbol("."), unsigned_number))(s)?; let (s, c) = exp(s)?; @@ -308,7 +308,7 @@ pub fn real_number_floating(s: Span) -> IResult { } #[parser] -pub fn fixed_point_number(s: Span) -> IResult { +pub(crate) fn fixed_point_number(s: Span) -> IResult { let (s, a) = unsigned_number(s)?; let (s, b) = map(tag("."), |x: Span| Symbol { nodes: (x.into(), vec![]), @@ -318,19 +318,19 @@ pub fn fixed_point_number(s: Span) -> IResult { } #[parser] -pub fn exp(s: Span) -> IResult { +pub(crate) fn exp(s: Span) -> IResult { let (s, a) = alt((symbol("e"), symbol("E")))(s)?; Ok((s, Exp { nodes: (a,) })) } #[parser] -pub fn unsigned_number(s: Span) -> IResult { +pub(crate) fn unsigned_number(s: Span) -> IResult { let (s, a) = ws(unsigned_number_impl)(s)?; Ok((s, UnsignedNumber { nodes: a })) } #[parser] -pub fn unsigned_number_impl(s: Span) -> IResult { +pub(crate) fn unsigned_number_impl(s: Span) -> IResult { let (s, a) = digit1(s)?; let (s, a) = fold_many0(alt((tag("_"), digit1)), a, |acc, item| { concat(acc, item).unwrap() @@ -339,13 +339,13 @@ pub fn unsigned_number_impl(s: Span) -> IResult { } #[parser] -pub fn binary_value(s: Span) -> IResult { +pub(crate) fn binary_value(s: Span) -> IResult { let (s, a) = ws(binary_value_impl)(s)?; Ok((s, BinaryValue { nodes: a })) } #[parser] -pub fn binary_value_impl(s: Span) -> IResult { +pub(crate) fn binary_value_impl(s: Span) -> IResult { let (s, a) = is_a("01xXzZ?")(s)?; let (s, a) = fold_many0(alt((tag("_"), is_a("01xXzZ?"))), a, |acc, item| { concat(acc, item).unwrap() @@ -354,13 +354,13 @@ pub fn binary_value_impl(s: Span) -> IResult { } #[parser] -pub fn octal_value(s: Span) -> IResult { +pub(crate) fn octal_value(s: Span) -> IResult { let (s, a) = ws(octal_value_impl)(s)?; Ok((s, OctalValue { nodes: a })) } #[parser] -pub fn octal_value_impl(s: Span) -> IResult { +pub(crate) fn octal_value_impl(s: Span) -> IResult { let (s, a) = is_a("01234567xXzZ?")(s)?; let (s, a) = fold_many0(alt((tag("_"), is_a("01234567xXzZ?"))), a, |acc, item| { concat(acc, item).unwrap() @@ -369,13 +369,13 @@ pub fn octal_value_impl(s: Span) -> IResult { } #[parser] -pub fn hex_value(s: Span) -> IResult { +pub(crate) fn hex_value(s: Span) -> IResult { let (s, a) = ws(hex_value_impl)(s)?; Ok((s, HexValue { nodes: a })) } #[parser] -pub fn hex_value_impl(s: Span) -> IResult { +pub(crate) fn hex_value_impl(s: Span) -> IResult { let (s, a) = is_a("0123456789abcdefABCDEFxXzZ?")(s)?; let (s, a) = fold_many0( alt((tag("_"), is_a("0123456789abcdefABCDEFxXzZ?"))), @@ -386,61 +386,61 @@ pub fn hex_value_impl(s: Span) -> IResult { } #[parser] -pub fn decimal_base(s: Span) -> IResult { +pub(crate) fn decimal_base(s: Span) -> IResult { let (s, a) = ws(decimal_base_impl)(s)?; Ok((s, DecimalBase { nodes: a })) } #[parser] -pub fn decimal_base_impl(s: Span) -> IResult { +pub(crate) fn decimal_base_impl(s: Span) -> IResult { let (s, a) = alt((tag_no_case("'d"), tag_no_case("'sd")))(s)?; Ok((s, a.into())) } #[parser] -pub fn binary_base(s: Span) -> IResult { +pub(crate) fn binary_base(s: Span) -> IResult { let (s, a) = ws(binary_base_impl)(s)?; Ok((s, BinaryBase { nodes: a })) } #[parser] -pub fn binary_base_impl(s: Span) -> IResult { +pub(crate) fn binary_base_impl(s: Span) -> IResult { let (s, a) = alt((tag_no_case("'b"), tag_no_case("'sb")))(s)?; Ok((s, a.into())) } #[parser] -pub fn octal_base(s: Span) -> IResult { +pub(crate) fn octal_base(s: Span) -> IResult { let (s, a) = ws(octal_base_impl)(s)?; Ok((s, OctalBase { nodes: a })) } #[parser] -pub fn octal_base_impl(s: Span) -> IResult { +pub(crate) fn octal_base_impl(s: Span) -> IResult { let (s, a) = alt((tag_no_case("'o"), tag_no_case("'so")))(s)?; Ok((s, a.into())) } #[parser] -pub fn hex_base(s: Span) -> IResult { +pub(crate) fn hex_base(s: Span) -> IResult { let (s, a) = ws(hex_base_impl)(s)?; Ok((s, HexBase { nodes: a })) } #[parser] -pub fn hex_base_impl(s: Span) -> IResult { +pub(crate) fn hex_base_impl(s: Span) -> IResult { let (s, a) = alt((tag_no_case("'h"), tag_no_case("'sh")))(s)?; Ok((s, a.into())) } #[parser] -pub fn x_number(s: Span) -> IResult { +pub(crate) fn x_number(s: Span) -> IResult { let (s, a) = ws(x_number_impl)(s)?; Ok((s, XNumber { nodes: a })) } #[parser] -pub fn x_number_impl(s: Span) -> IResult { +pub(crate) fn x_number_impl(s: Span) -> IResult { let (s, a) = tag_no_case("x")(s)?; let (s, a) = fold_many0(alt((tag("_"), is_a("_"))), a, |acc, item| { concat(acc, item).unwrap() @@ -449,13 +449,13 @@ pub fn x_number_impl(s: Span) -> IResult { } #[parser] -pub fn z_number(s: Span) -> IResult { +pub(crate) fn z_number(s: Span) -> IResult { let (s, a) = ws(z_number_impl)(s)?; Ok((s, ZNumber { nodes: a })) } #[parser] -pub fn z_number_impl(s: Span) -> IResult { +pub(crate) fn z_number_impl(s: Span) -> IResult { let (s, a) = alt((tag_no_case("z"), tag("?")))(s)?; let (s, a) = fold_many0(alt((tag("_"), is_a("_"))), a, |acc, item| { concat(acc, item).unwrap() @@ -464,7 +464,7 @@ pub fn z_number_impl(s: Span) -> IResult { } #[parser] -pub fn unbased_unsized_literal(s: Span) -> IResult { +pub(crate) fn unbased_unsized_literal(s: Span) -> IResult { let (s, a) = alt((symbol("'0"), symbol("'1"), symbol("'z"), symbol("'x")))(s)?; Ok((s, UnbasedUnsizedLiteral { nodes: (a,) })) } diff --git a/src/parser/expressions/operators.rs b/src/parser/expressions/operators.rs index 382744f..fdb08cc 100644 --- a/src/parser/expressions/operators.rs +++ b/src/parser/expressions/operators.rs @@ -35,7 +35,7 @@ pub struct BinaryModulePathOperator { #[packrat_parser] #[parser] -pub fn unary_operator(s: Span) -> IResult { +pub(crate) fn unary_operator(s: Span) -> IResult { let (s, a) = alt(( symbol("+"), symbol("-"), @@ -53,7 +53,7 @@ pub fn unary_operator(s: Span) -> IResult { } #[parser] -pub fn binary_operator(s: Span) -> IResult { +pub(crate) fn binary_operator(s: Span) -> IResult { let (s, a) = alt(( alt(( symbol("+"), @@ -93,13 +93,13 @@ pub fn binary_operator(s: Span) -> IResult { } #[parser] -pub fn inc_or_dec_operator(s: Span) -> IResult { +pub(crate) fn inc_or_dec_operator(s: Span) -> IResult { let (s, a) = alt((symbol("++"), symbol("--")))(s)?; Ok((s, IncOrDecOperator { nodes: (a,) })) } #[parser] -pub fn unary_module_path_operator(s: Span) -> IResult { +pub(crate) fn unary_module_path_operator(s: Span) -> IResult { let (s, a) = alt(( symbol("!"), symbol("&"), @@ -115,7 +115,7 @@ pub fn unary_module_path_operator(s: Span) -> IResult IResult { +pub(crate) fn binary_module_path_operator(s: Span) -> IResult { let (s, a) = alt(( symbol("=="), symbol("!="), diff --git a/src/parser/expressions/primaries.rs b/src/parser/expressions/primaries.rs index 74848ee..3886c84 100644 --- a/src/parser/expressions/primaries.rs +++ b/src/parser/expressions/primaries.rs @@ -254,7 +254,7 @@ pub struct Cast { #[packrat_parser] #[parser] -pub fn constant_primary(s: Span) -> IResult { +pub(crate) fn constant_primary(s: Span) -> IResult { alt(( map(keyword("null"), |x| ConstantPrimary::Null(Box::new(x))), map(primary_literal, |x| { @@ -289,7 +289,7 @@ pub fn constant_primary(s: Span) -> IResult { } #[parser] -pub fn constant_primary_ps_parameter(s: Span) -> IResult { +pub(crate) fn constant_primary_ps_parameter(s: Span) -> IResult { let (s, a) = ps_parameter_identifier(s)?; let (s, b) = constant_select(s)?; Ok(( @@ -299,7 +299,7 @@ pub fn constant_primary_ps_parameter(s: Span) -> IResult } #[parser] -pub fn constant_primary_specparam(s: Span) -> IResult { +pub(crate) fn constant_primary_specparam(s: Span) -> IResult { let (s, a) = specparam_identifier(s)?; let (s, b) = opt(bracket(constant_range_expression))(s)?; Ok(( @@ -309,7 +309,7 @@ pub fn constant_primary_specparam(s: Span) -> IResult { } #[parser] -pub fn constant_primary_formal_port(s: Span) -> IResult { +pub(crate) fn constant_primary_formal_port(s: Span) -> IResult { let (s, a) = formal_port_identifier(s)?; let (s, b) = constant_select(s)?; Ok(( @@ -319,7 +319,7 @@ pub fn constant_primary_formal_port(s: Span) -> IResult { } #[parser] -pub fn constant_primary_enum(s: Span) -> IResult { +pub(crate) fn constant_primary_enum(s: Span) -> IResult { let (s, a) = package_scope_or_class_scope(s)?; let (s, b) = enum_identifier(s)?; Ok(( @@ -329,7 +329,7 @@ pub fn constant_primary_enum(s: Span) -> IResult { } #[parser] -pub fn constant_primary_concatenation(s: Span) -> IResult { +pub(crate) fn constant_primary_concatenation(s: Span) -> IResult { let (s, a) = constant_concatenation(s)?; let (s, b) = opt(bracket(constant_range_expression))(s)?; Ok(( @@ -339,7 +339,7 @@ pub fn constant_primary_concatenation(s: Span) -> IResult } #[parser] -pub fn constant_primary_multiple_concatenation(s: Span) -> IResult { +pub(crate) fn constant_primary_multiple_concatenation(s: Span) -> IResult { let (s, a) = constant_multiple_concatenation(s)?; let (s, b) = opt(bracket(constant_range_expression))(s)?; Ok(( @@ -351,7 +351,7 @@ pub fn constant_primary_multiple_concatenation(s: Span) -> IResult IResult { +pub(crate) fn constant_primary_mintypmax_expression(s: Span) -> IResult { let (s, a) = paren(constant_mintypmax_expression)(s)?; Ok(( s, @@ -362,7 +362,7 @@ pub fn constant_primary_mintypmax_expression(s: Span) -> IResult IResult { +pub(crate) fn module_path_primary(s: Span) -> IResult { alt(( map(number, |x| ModulePathPrimary::Number(Box::new(x))), map(identifier, |x| ModulePathPrimary::Identifier(Box::new(x))), @@ -380,7 +380,9 @@ pub fn module_path_primary(s: Span) -> IResult { } #[parser] -pub fn module_path_primary_mintypmax_expression(s: Span) -> IResult { +pub(crate) fn module_path_primary_mintypmax_expression( + s: Span, +) -> IResult { let (s, a) = paren(module_path_mintypmax_expression)(s)?; Ok(( s, @@ -390,7 +392,7 @@ pub fn module_path_primary_mintypmax_expression(s: Span) -> IResult IResult { +pub(crate) fn primary(s: Span) -> IResult { alt(( map(keyword("this"), |x| Primary::This(Box::new(x))), map(symbol("$"), |x| Primary::Dollar(Box::new(x))), @@ -401,6 +403,7 @@ pub fn primary(s: Span) -> IResult { Primary::EmptyUnpackedArrayConcatenation(Box::new(x)) }), primary_concatenation, + primary_multiple_concatenation, map(function_subroutine_call, |x| { Primary::FunctionSubroutineCall(Box::new(x)) }), @@ -420,7 +423,7 @@ pub fn primary(s: Span) -> IResult { } #[parser] -pub fn primary_hierarchical(s: Span) -> IResult { +pub(crate) fn primary_hierarchical(s: Span) -> IResult { let (s, a) = opt(class_qualifier_or_package_scope)(s)?; let (s, b) = hierarchical_identifier(s)?; let (s, c) = select(s)?; @@ -431,7 +434,7 @@ pub fn primary_hierarchical(s: Span) -> IResult { } #[parser] -pub fn primary_concatenation(s: Span) -> IResult { +pub(crate) fn primary_concatenation(s: Span) -> IResult { let (s, a) = concatenation(s)?; let (s, b) = opt(bracket(range_expression))(s)?; Ok(( @@ -441,7 +444,7 @@ pub fn primary_concatenation(s: Span) -> IResult { } #[parser] -pub fn primary_multiple_concatenation(s: Span) -> IResult { +pub(crate) fn primary_multiple_concatenation(s: Span) -> IResult { let (s, a) = multiple_concatenation(s)?; let (s, b) = opt(bracket(range_expression))(s)?; Ok(( @@ -451,7 +454,7 @@ pub fn primary_multiple_concatenation(s: Span) -> IResult { } #[parser] -pub fn primary_mintypmax_expression(s: Span) -> IResult { +pub(crate) fn primary_mintypmax_expression(s: Span) -> IResult { let (s, a) = paren(mintypmax_expression)(s)?; Ok(( s, @@ -460,7 +463,9 @@ pub fn primary_mintypmax_expression(s: Span) -> IResult { } #[parser] -pub fn class_qualifier_or_package_scope(s: Span) -> IResult { +pub(crate) fn class_qualifier_or_package_scope( + s: Span, +) -> IResult { alt(( map(class_qualifier, |x| { ClassQualifierOrPackageScope::ClassQualifier(Box::new(x)) @@ -472,14 +477,14 @@ pub fn class_qualifier_or_package_scope(s: Span) -> IResult IResult { +pub(crate) fn class_qualifier(s: Span) -> IResult { let (s, a) = opt(local)(s)?; let (s, b) = opt(implicit_class_handle_or_class_scope)(s)?; Ok((s, ClassQualifier { nodes: (a, b) })) } #[parser] -pub fn range_expression(s: Span) -> IResult { +pub(crate) fn range_expression(s: Span) -> IResult { alt(( map(expression, |x| RangeExpression::Expression(Box::new(x))), map(part_select_range, |x| { @@ -490,7 +495,7 @@ pub fn range_expression(s: Span) -> IResult { #[packrat_parser] #[parser] -pub fn primary_literal(s: Span) -> IResult { +pub(crate) fn primary_literal(s: Span) -> IResult { alt(( map(time_literal, |x| PrimaryLiteral::TimeLiteral(Box::new(x))), map(number, |x| PrimaryLiteral::Number(Box::new(x))), @@ -504,12 +509,12 @@ pub fn primary_literal(s: Span) -> IResult { } #[parser] -pub fn time_literal(s: Span) -> IResult { +pub(crate) fn time_literal(s: Span) -> IResult { alt((time_literal_unsigned, time_literal_fixed_point))(s) } #[parser] -pub fn time_literal_unsigned(s: Span) -> IResult { +pub(crate) fn time_literal_unsigned(s: Span) -> IResult { let (s, a) = unsigned_number(s)?; let (s, b) = time_unit(s)?; Ok(( @@ -519,7 +524,7 @@ pub fn time_literal_unsigned(s: Span) -> IResult { } #[parser] -pub fn time_literal_fixed_point(s: Span) -> IResult { +pub(crate) fn time_literal_fixed_point(s: Span) -> IResult { let (s, a) = fixed_point_number(s)?; let (s, b) = time_unit(s)?; Ok(( @@ -529,7 +534,7 @@ pub fn time_literal_fixed_point(s: Span) -> IResult { } #[parser] -pub fn time_unit(s: Span) -> IResult { +pub(crate) fn time_unit(s: Span) -> IResult { alt(( map(keyword("s"), |x| TimeUnit::S(Box::new(x))), map(keyword("ms"), |x| TimeUnit::MS(Box::new(x))), @@ -541,7 +546,7 @@ pub fn time_unit(s: Span) -> IResult { } #[parser] -pub fn implicit_class_handle(s: Span) -> IResult { +pub(crate) fn implicit_class_handle(s: Span) -> IResult { alt(( map( triple(keyword("this"), symbol("."), keyword("super")), @@ -555,13 +560,13 @@ pub fn implicit_class_handle(s: Span) -> IResult { } #[parser] -pub fn bit_select(s: Span) -> IResult { +pub(crate) fn bit_select(s: Span) -> IResult { let (s, a) = many0(bracket(expression))(s)?; Ok((s, BitSelect { nodes: (a,) })) } #[parser] -pub fn select(s: Span) -> IResult { +pub(crate) fn select(s: Span) -> IResult { let (s, a) = opt(triple( many0(triple(symbol("."), member_identifier, bit_select)), symbol("."), @@ -573,7 +578,7 @@ pub fn select(s: Span) -> IResult { } #[parser] -pub fn nonrange_select(s: Span) -> IResult { +pub(crate) fn nonrange_select(s: Span) -> IResult { let (s, a) = opt(triple( many0(triple(symbol("."), member_identifier, bit_select)), symbol("."), @@ -584,13 +589,13 @@ pub fn nonrange_select(s: Span) -> IResult { } #[parser] -pub fn constant_bit_select(s: Span) -> IResult { +pub(crate) fn constant_bit_select(s: Span) -> IResult { let (s, a) = many0(bracket(constant_expression))(s)?; Ok((s, ConstantBitSelect { nodes: (a,) })) } #[parser] -pub fn constant_select(s: Span) -> IResult { +pub(crate) fn constant_select(s: Span) -> IResult { let (s, a) = opt(triple( many0(triple(symbol("."), member_identifier, constant_bit_select)), symbol("."), @@ -602,7 +607,7 @@ pub fn constant_select(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn constant_cast(s: Span) -> IResult { +pub(crate) fn constant_cast(s: Span) -> IResult { let (s, a) = casting_type(s)?; let (s, b) = symbol("'")(s)?; let (s, c) = paren(constant_expression)(s)?; @@ -610,13 +615,13 @@ pub fn constant_cast(s: Span) -> IResult { } #[parser] -pub fn constant_let_expression(s: Span) -> IResult { +pub(crate) fn constant_let_expression(s: Span) -> IResult { let (s, a) = let_expression(s)?; Ok((s, ConstantLetExpression { nodes: (a,) })) } #[parser(MaybeRecursive)] -pub fn cast(s: Span) -> IResult { +pub(crate) fn cast(s: Span) -> IResult { let (s, a) = casting_type(s)?; let (s, b) = symbol("'")(s)?; let (s, c) = paren(expression)(s)?; diff --git a/src/parser/expressions/strings.rs b/src/parser/expressions/strings.rs index f8c2581..0b1bc9a 100644 --- a/src/parser/expressions/strings.rs +++ b/src/parser/expressions/strings.rs @@ -16,13 +16,13 @@ pub struct StringLiteral { // ----------------------------------------------------------------------------- #[parser] -pub fn string_literal(s: Span) -> IResult { +pub(crate) fn string_literal(s: Span) -> IResult { let (s, a) = ws(string_literal_impl)(s)?; Ok((s, StringLiteral { nodes: a })) } #[parser] -pub fn string_literal_impl(s: Span) -> IResult { +pub(crate) fn string_literal_impl(s: Span) -> IResult { let (s, a) = tag("\"")(s)?; let (s, b) = many1(pair(is_not("\\\""), opt(pair(tag("\\"), take(1usize)))))(s)?; let (s, c) = tag("\"")(s)?; diff --git a/src/parser/expressions/subroutine_calls.rs b/src/parser/expressions/subroutine_calls.rs index 25a80c8..c4800c1 100644 --- a/src/parser/expressions/subroutine_calls.rs +++ b/src/parser/expressions/subroutine_calls.rs @@ -170,13 +170,13 @@ pub enum ArrayMethodName { // ----------------------------------------------------------------------------- #[parser] -pub fn constant_function_call(s: Span) -> IResult { +pub(crate) fn constant_function_call(s: Span) -> IResult { let (s, a) = function_subroutine_call(s)?; Ok((s, ConstantFunctionCall { nodes: (a,) })) } #[parser] -pub fn tf_call(s: Span) -> IResult { +pub(crate) fn tf_call(s: Span) -> IResult { let (s, a) = ps_or_hierarchical_tf_identifier(s)?; let (s, b) = many0(attribute_instance)(s)?; let (s, c) = opt(paren(list_of_arguments))(s)?; @@ -184,7 +184,7 @@ pub fn tf_call(s: Span) -> IResult { } #[parser] -pub fn system_tf_call(s: Span) -> IResult { +pub(crate) fn system_tf_call(s: Span) -> IResult { alt(( system_tf_call_arg_optional, system_tf_call_arg_data_type, @@ -193,7 +193,7 @@ pub fn system_tf_call(s: Span) -> IResult { } #[parser] -pub fn system_tf_call_arg_optional(s: Span) -> IResult { +pub(crate) fn system_tf_call_arg_optional(s: Span) -> IResult { let (s, a) = system_tf_identifier(s)?; let (s, b) = opt(paren(list_of_arguments))(s)?; Ok(( @@ -203,7 +203,7 @@ pub fn system_tf_call_arg_optional(s: Span) -> IResult { } #[parser] -pub fn system_tf_call_arg_data_type(s: Span) -> IResult { +pub(crate) fn system_tf_call_arg_data_type(s: Span) -> IResult { let (s, a) = system_tf_identifier(s)?; let (s, b) = paren(pair(data_type, opt(pair(symbol(","), expression))))(s)?; Ok(( @@ -213,7 +213,7 @@ pub fn system_tf_call_arg_data_type(s: Span) -> IResult { } #[parser] -pub fn system_tf_call_arg_expression(s: Span) -> IResult { +pub(crate) fn system_tf_call_arg_expression(s: Span) -> IResult { let (s, a) = system_tf_identifier(s)?; let (s, b) = paren(pair( list(symbol(","), opt(expression)), @@ -227,7 +227,7 @@ pub fn system_tf_call_arg_expression(s: Span) -> IResult { #[packrat_parser] #[parser] -pub fn subroutine_call(s: Span) -> IResult { +pub(crate) fn subroutine_call(s: Span) -> IResult { alt(( map(tf_call, |x| SubroutineCall::TfCall(Box::new(x))), map(system_tf_call, |x| { @@ -239,7 +239,7 @@ pub fn subroutine_call(s: Span) -> IResult { } #[parser] -pub fn subroutine_call_randomize(s: Span) -> IResult { +pub(crate) fn subroutine_call_randomize(s: Span) -> IResult { let (s, a) = opt(pair(keyword("std"), symbol("::")))(s)?; let (s, b) = randomize_call(s)?; Ok(( @@ -249,17 +249,17 @@ pub fn subroutine_call_randomize(s: Span) -> IResult { } #[parser] -pub fn function_subroutine_call(s: Span) -> IResult { +pub(crate) fn function_subroutine_call(s: Span) -> IResult { map(subroutine_call, |x| FunctionSubroutineCall { nodes: (x,) })(s) } #[parser] -pub fn list_of_arguments(s: Span) -> IResult { +pub(crate) fn list_of_arguments(s: Span) -> IResult { alt((list_of_arguments_ordered, list_of_arguments_named))(s) } #[parser(MaybeRecursive)] -pub fn list_of_arguments_ordered(s: Span) -> IResult { +pub(crate) fn list_of_arguments_ordered(s: Span) -> IResult { let (s, a) = list(symbol(","), opt(expression))(s)?; let (s, b) = many0(tuple(( symbol(","), @@ -274,7 +274,7 @@ pub fn list_of_arguments_ordered(s: Span) -> IResult { } #[parser] -pub fn list_of_arguments_named(s: Span) -> IResult { +pub(crate) fn list_of_arguments_named(s: Span) -> IResult { let (s, a) = symbol(".")(s)?; let (s, b) = identifier(s)?; let (s, c) = paren(opt(expression))(s)?; @@ -293,7 +293,7 @@ pub fn list_of_arguments_named(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn method_call(s: Span) -> IResult { +pub(crate) fn method_call(s: Span) -> IResult { let (s, a) = method_call_root(s)?; let (s, b) = symbol(".")(s)?; let (s, c) = method_call_body(s)?; @@ -302,7 +302,7 @@ pub fn method_call(s: Span) -> IResult { } #[parser] -pub fn method_call_body(s: Span) -> IResult { +pub(crate) fn method_call_body(s: Span) -> IResult { alt(( method_call_body_user, map(built_in_method_call, |x| { @@ -312,7 +312,7 @@ pub fn method_call_body(s: Span) -> IResult { } #[parser] -pub fn method_call_body_user(s: Span) -> IResult { +pub(crate) fn method_call_body_user(s: Span) -> IResult { let (s, a) = method_identifier(s)?; let (s, b) = many0(attribute_instance)(s)?; let (s, c) = opt(paren(list_of_arguments))(s)?; @@ -323,7 +323,7 @@ pub fn method_call_body_user(s: Span) -> IResult { } #[parser] -pub fn built_in_method_call(s: Span) -> IResult { +pub(crate) fn built_in_method_call(s: Span) -> IResult { alt(( map(array_manipulation_call, |x| { BuiltInMethodCall::ArrayManipulationCall(Box::new(x)) @@ -335,7 +335,7 @@ pub fn built_in_method_call(s: Span) -> IResult { } #[parser] -pub fn array_manipulation_call(s: Span) -> IResult { +pub(crate) fn array_manipulation_call(s: Span) -> IResult { let (s, a) = array_method_name(s)?; let (s, b) = many0(attribute_instance)(s)?; let (s, c) = opt(paren(list_of_arguments))(s)?; @@ -349,7 +349,7 @@ pub fn array_manipulation_call(s: Span) -> IResult } #[parser] -pub fn randomize_call(s: Span) -> IResult { +pub(crate) fn randomize_call(s: Span) -> IResult { let (s, a) = keyword("randomize")(s)?; let (s, b) = many0(attribute_instance)(s)?; let (s, c) = opt(paren(opt(variable_identifier_list_or_null)))(s)?; @@ -367,7 +367,7 @@ pub fn randomize_call(s: Span) -> IResult { } #[parser] -pub fn variable_identifier_list_or_null(s: Span) -> IResult { +pub(crate) fn variable_identifier_list_or_null(s: Span) -> IResult { alt(( map(variable_identifier_list, |x| { VariableIdentifierListOrNull::VariableIdentifierList(Box::new(x)) @@ -379,7 +379,7 @@ pub fn variable_identifier_list_or_null(s: Span) -> IResult IResult { +pub(crate) fn method_call_root(s: Span) -> IResult { alt(( map(primary, |x| MethodCallRoot::Primary(Box::new(x))), map(implicit_class_handle, |x| { @@ -389,7 +389,7 @@ pub fn method_call_root(s: Span) -> IResult { } #[parser] -pub fn array_method_name(s: Span) -> IResult { +pub(crate) fn array_method_name(s: Span) -> IResult { alt(( map(keyword("unique"), |x| ArrayMethodName::Unique(Box::new(x))), map(keyword("and"), |x| ArrayMethodName::And(Box::new(x))), diff --git a/src/parser/general/attributes.rs b/src/parser/general/attributes.rs index 1910a95..d7ec4ec 100644 --- a/src/parser/general/attributes.rs +++ b/src/parser/general/attributes.rs @@ -19,7 +19,7 @@ pub struct AttrSpec { // ----------------------------------------------------------------------------- #[parser] -pub fn attribute_instance(s: Span) -> IResult { +pub(crate) fn attribute_instance(s: Span) -> IResult { let (s, a) = symbol("(*")(s)?; let (s, b) = list(symbol(","), attr_spec)(s)?; let (s, c) = symbol("*)")(s)?; @@ -27,7 +27,7 @@ pub fn attribute_instance(s: Span) -> IResult { } #[parser] -pub fn attr_spec(s: Span) -> IResult { +pub(crate) fn attr_spec(s: Span) -> IResult { let (s, a) = identifier(s)?; let (s, b) = opt(pair(symbol("="), constant_expression))(s)?; Ok((s, AttrSpec { nodes: (a, b) })) diff --git a/src/parser/general/comments.rs b/src/parser/general/comments.rs index 97ec655..db40117 100644 --- a/src/parser/general/comments.rs +++ b/src/parser/general/comments.rs @@ -14,12 +14,12 @@ pub struct Comment { // ----------------------------------------------------------------------------- #[parser] -pub fn comment(s: Span) -> IResult { +pub(crate) fn comment(s: Span) -> IResult { alt((one_line_comment, block_comment))(s) } #[parser] -pub fn one_line_comment(s: Span) -> IResult { +pub(crate) fn one_line_comment(s: Span) -> IResult { let (s, a) = tag("//")(s)?; let (s, b) = is_not("\n")(s)?; let a = concat(a, b).unwrap(); @@ -27,7 +27,7 @@ pub fn one_line_comment(s: Span) -> IResult { } #[parser] -pub fn block_comment(s: Span) -> IResult { +pub(crate) fn block_comment(s: Span) -> IResult { let (s, a) = tag("/*")(s)?; let (s, b) = is_not("*/")(s)?; let (s, c) = tag("*/")(s)?; diff --git a/src/parser/general/identifiers.rs b/src/parser/general/identifiers.rs index fbab891..0118b4b 100644 --- a/src/parser/general/identifiers.rs +++ b/src/parser/general/identifiers.rs @@ -11,9 +11,10 @@ use nom_packrat::packrat_parser; // ----------------------------------------------------------------------------- -pub const AZ_: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_"; -pub const AZ09_: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"; -pub const AZ09_DOLLAR: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$"; +pub(crate) const AZ_: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_"; +pub(crate) const AZ09_: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"; +pub(crate) const AZ09_DOLLAR: &str = + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$"; #[derive(Clone, Debug, Node)] pub struct ArrayIdentifier { @@ -540,32 +541,33 @@ pub enum PackageScopeOrClassScope { // ----------------------------------------------------------------------------- +#[allow(dead_code)] #[parser] -pub fn array_identifier(s: Span) -> IResult { +pub(crate) fn array_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, ArrayIdentifier { nodes: (a,) })) } #[parser] -pub fn block_identifier(s: Span) -> IResult { +pub(crate) fn block_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, BlockIdentifier { nodes: (a,) })) } #[parser] -pub fn bin_identifier(s: Span) -> IResult { +pub(crate) fn bin_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, BinIdentifier { nodes: (a,) })) } #[parser] -pub fn c_identifier(s: Span) -> IResult { +pub(crate) fn c_identifier(s: Span) -> IResult { let (s, a) = ws(c_identifier_impl)(s)?; Ok((s, CIdentifier { nodes: a })) } #[parser] -pub fn c_identifier_impl(s: Span) -> IResult { +pub(crate) fn c_identifier_impl(s: Span) -> IResult { let (s, a) = is_a(AZ_)(s)?; let (s, b) = opt(is_a(AZ09_))(s)?; let a = if let Some(b) = b { @@ -581,154 +583,160 @@ pub fn c_identifier_impl(s: Span) -> IResult { } #[parser] -pub fn cell_identifier(s: Span) -> IResult { +pub(crate) fn cell_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, CellIdentifier { nodes: (a,) })) } #[parser] -pub fn checker_identifier(s: Span) -> IResult { +pub(crate) fn checker_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, CheckerIdentifier { nodes: (a,) })) } #[parser] -pub fn class_identifier(s: Span) -> IResult { +pub(crate) fn class_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, ClassIdentifier { nodes: (a,) })) } #[parser] -pub fn class_variable_identifier(s: Span) -> IResult { +pub(crate) fn class_variable_identifier(s: Span) -> IResult { let (s, a) = variable_identifier(s)?; Ok((s, ClassVariableIdentifier { nodes: (a,) })) } #[parser] -pub fn clocking_identifier(s: Span) -> IResult { +pub(crate) fn clocking_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, ClockingIdentifier { nodes: (a,) })) } #[parser] -pub fn config_identifier(s: Span) -> IResult { +pub(crate) fn config_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, ConfigIdentifier { nodes: (a,) })) } #[parser] -pub fn const_identifier(s: Span) -> IResult { +pub(crate) fn const_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, ConstIdentifier { nodes: (a,) })) } #[parser] -pub fn constraint_identifier(s: Span) -> IResult { +pub(crate) fn constraint_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, ConstraintIdentifier { nodes: (a,) })) } #[parser] -pub fn covergroup_identifier(s: Span) -> IResult { +pub(crate) fn covergroup_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, CovergroupIdentifier { nodes: (a,) })) } +#[allow(dead_code)] #[parser] -pub fn covergroup_variable_identifier(s: Span) -> IResult { +pub(crate) fn covergroup_variable_identifier( + s: Span, +) -> IResult { let (s, a) = variable_identifier(s)?; Ok((s, CovergroupVariableIdentifier { nodes: (a,) })) } #[parser] -pub fn cover_point_identifier(s: Span) -> IResult { +pub(crate) fn cover_point_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, CoverPointIdentifier { nodes: (a,) })) } #[parser] -pub fn cross_identifier(s: Span) -> IResult { +pub(crate) fn cross_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, CrossIdentifier { nodes: (a,) })) } #[parser] -pub fn dynamic_array_variable_identifier(s: Span) -> IResult { +pub(crate) fn dynamic_array_variable_identifier( + s: Span, +) -> IResult { let (s, a) = variable_identifier(s)?; Ok((s, DynamicArrayVariableIdentifier { nodes: (a,) })) } #[parser] -pub fn enum_identifier(s: Span) -> IResult { +pub(crate) fn enum_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, EnumIdentifier { nodes: (a,) })) } #[parser] -pub fn escaped_identifier(s: Span) -> IResult { +pub(crate) fn escaped_identifier(s: Span) -> IResult { let (s, a) = ws(escaped_identifier_impl)(s)?; Ok((s, EscapedIdentifier { nodes: a })) } #[parser] -pub fn escaped_identifier_impl(s: Span) -> IResult { +pub(crate) fn escaped_identifier_impl(s: Span) -> IResult { let (s, a) = tag("\\")(s)?; let (s, b) = is_not(" \t\r\n")(s)?; let a = concat(a, b).unwrap(); Ok((s, a.into())) } +#[allow(dead_code)] #[parser] -pub fn formal_identifier(s: Span) -> IResult { +pub(crate) fn formal_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, FormalIdentifier { nodes: (a,) })) } #[parser] -pub fn formal_port_identifier(s: Span) -> IResult { +pub(crate) fn formal_port_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, FormalPortIdentifier { nodes: (a,) })) } #[parser] -pub fn function_identifier(s: Span) -> IResult { +pub(crate) fn function_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, FunctionIdentifier { nodes: (a,) })) } #[parser] -pub fn generate_block_identifier(s: Span) -> IResult { +pub(crate) fn generate_block_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, GenerateBlockIdentifier { nodes: (a,) })) } #[parser] -pub fn genvar_identifier(s: Span) -> IResult { +pub(crate) fn genvar_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, GenvarIdentifier { nodes: (a,) })) } #[parser] -pub fn hierarchical_array_identifier(s: Span) -> IResult { +pub(crate) fn hierarchical_array_identifier(s: Span) -> IResult { let (s, a) = hierarchical_identifier(s)?; Ok((s, HierarchicalArrayIdentifier { nodes: (a,) })) } #[parser] -pub fn hierarchical_block_identifier(s: Span) -> IResult { +pub(crate) fn hierarchical_block_identifier(s: Span) -> IResult { let (s, a) = hierarchical_identifier(s)?; Ok((s, HierarchicalBlockIdentifier { nodes: (a,) })) } #[parser] -pub fn hierarchical_event_identifier(s: Span) -> IResult { +pub(crate) fn hierarchical_event_identifier(s: Span) -> IResult { let (s, a) = hierarchical_identifier(s)?; Ok((s, HierarchicalEventIdentifier { nodes: (a,) })) } #[packrat_parser] #[parser] -pub fn hierarchical_identifier(s: Span) -> IResult { +pub(crate) fn hierarchical_identifier(s: Span) -> IResult { let (s, a) = opt(root)(s)?; let (s, b) = many0(triple(identifier, constant_bit_select, symbol(".")))(s)?; let (s, c) = identifier(s)?; @@ -736,20 +744,20 @@ pub fn hierarchical_identifier(s: Span) -> IResult } #[parser] -pub fn root(s: Span) -> IResult { +pub(crate) fn root(s: Span) -> IResult { let (s, a) = keyword("$root")(s)?; let (s, b) = symbol(".")(s)?; Ok((s, Root { nodes: (a, b) })) } #[parser] -pub fn hierarchical_net_identifier(s: Span) -> IResult { +pub(crate) fn hierarchical_net_identifier(s: Span) -> IResult { let (s, a) = hierarchical_identifier(s)?; Ok((s, HierarchicalNetIdentifier { nodes: (a,) })) } #[parser] -pub fn hierarchical_parameter_identifier( +pub(crate) fn hierarchical_parameter_identifier( s: Span, ) -> IResult { let (s, a) = hierarchical_identifier(s)?; @@ -757,38 +765,44 @@ pub fn hierarchical_parameter_identifier( } #[parser] -pub fn hierarchical_property_identifier(s: Span) -> IResult { +pub(crate) fn hierarchical_property_identifier( + s: Span, +) -> IResult { let (s, a) = hierarchical_identifier(s)?; Ok((s, HierarchicalPropertyIdentifier { nodes: (a,) })) } #[parser] -pub fn hierarchical_sequence_identifier(s: Span) -> IResult { +pub(crate) fn hierarchical_sequence_identifier( + s: Span, +) -> IResult { let (s, a) = hierarchical_identifier(s)?; Ok((s, HierarchicalSequenceIdentifier { nodes: (a,) })) } #[parser] -pub fn hierarchical_task_identifier(s: Span) -> IResult { +pub(crate) fn hierarchical_task_identifier(s: Span) -> IResult { let (s, a) = hierarchical_identifier(s)?; Ok((s, HierarchicalTaskIdentifier { nodes: (a,) })) } #[parser] -pub fn hierarchical_tf_identifier(s: Span) -> IResult { +pub(crate) fn hierarchical_tf_identifier(s: Span) -> IResult { let (s, a) = hierarchical_identifier(s)?; Ok((s, HierarchicalTfIdentifier { nodes: (a,) })) } #[parser] -pub fn hierarchical_variable_identifier(s: Span) -> IResult { +pub(crate) fn hierarchical_variable_identifier( + s: Span, +) -> IResult { let (s, a) = hierarchical_identifier(s)?; Ok((s, HierarchicalVariableIdentifier { nodes: (a,) })) } #[packrat_parser] #[parser] -pub fn identifier(s: Span) -> IResult { +pub(crate) fn identifier(s: Span) -> IResult { alt(( map(escaped_identifier, |x| { Identifier::EscapedIdentifier(Box::new(x)) @@ -800,98 +814,98 @@ pub fn identifier(s: Span) -> IResult { } #[parser] -pub fn index_variable_identifier(s: Span) -> IResult { +pub(crate) fn index_variable_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, IndexVariableIdentifier { nodes: (a,) })) } #[parser] -pub fn interface_identifier(s: Span) -> IResult { +pub(crate) fn interface_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, InterfaceIdentifier { nodes: (a,) })) } #[parser] -pub fn interface_instance_identifier(s: Span) -> IResult { +pub(crate) fn interface_instance_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, InterfaceInstanceIdentifier { nodes: (a,) })) } #[parser] -pub fn inout_port_identifier(s: Span) -> IResult { +pub(crate) fn inout_port_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, InoutPortIdentifier { nodes: (a,) })) } #[parser] -pub fn input_port_identifier(s: Span) -> IResult { +pub(crate) fn input_port_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, InputPortIdentifier { nodes: (a,) })) } #[parser] -pub fn instance_identifier(s: Span) -> IResult { +pub(crate) fn instance_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, InstanceIdentifier { nodes: (a,) })) } #[parser] -pub fn library_identifier(s: Span) -> IResult { +pub(crate) fn library_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, LibraryIdentifier { nodes: (a,) })) } #[parser] -pub fn member_identifier(s: Span) -> IResult { +pub(crate) fn member_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, MemberIdentifier { nodes: (a,) })) } #[parser] -pub fn method_identifier(s: Span) -> IResult { +pub(crate) fn method_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, MethodIdentifier { nodes: (a,) })) } #[parser] -pub fn modport_identifier(s: Span) -> IResult { +pub(crate) fn modport_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, ModportIdentifier { nodes: (a,) })) } #[parser] -pub fn module_identifier(s: Span) -> IResult { +pub(crate) fn module_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, ModuleIdentifier { nodes: (a,) })) } #[parser] -pub fn net_identifier(s: Span) -> IResult { +pub(crate) fn net_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, NetIdentifier { nodes: (a,) })) } #[parser] -pub fn net_type_identifier(s: Span) -> IResult { +pub(crate) fn net_type_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, NetTypeIdentifier { nodes: (a,) })) } #[parser] -pub fn output_port_identifier(s: Span) -> IResult { +pub(crate) fn output_port_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, OutputPortIdentifier { nodes: (a,) })) } #[parser] -pub fn package_identifier(s: Span) -> IResult { +pub(crate) fn package_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, PackageIdentifier { nodes: (a,) })) } #[packrat_parser] #[parser] -pub fn package_scope(s: Span) -> IResult { +pub(crate) fn package_scope(s: Span) -> IResult { alt(( package_scope_package, map(unit, |x| PackageScope::Unit(Box::new(x))), @@ -899,7 +913,7 @@ pub fn package_scope(s: Span) -> IResult { } #[parser] -pub fn package_scope_package(s: Span) -> IResult { +pub(crate) fn package_scope_package(s: Span) -> IResult { let (s, a) = package_identifier(s)?; let (s, b) = symbol("::")(s)?; Ok(( @@ -909,72 +923,72 @@ pub fn package_scope_package(s: Span) -> IResult { } #[parser] -pub fn unit(s: Span) -> IResult { +pub(crate) fn unit(s: Span) -> IResult { let (s, a) = keyword("$unit")(s)?; let (s, b) = symbol("::")(s)?; Ok((s, Unit { nodes: (a, b) })) } #[parser] -pub fn parameter_identifier(s: Span) -> IResult { +pub(crate) fn parameter_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, ParameterIdentifier { nodes: (a,) })) } #[parser] -pub fn port_identifier(s: Span) -> IResult { +pub(crate) fn port_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, PortIdentifier { nodes: (a,) })) } #[parser] -pub fn production_identifier(s: Span) -> IResult { +pub(crate) fn production_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, ProductionIdentifier { nodes: (a,) })) } #[parser] -pub fn program_identifier(s: Span) -> IResult { +pub(crate) fn program_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, ProgramIdentifier { nodes: (a,) })) } #[parser] -pub fn property_identifier(s: Span) -> IResult { +pub(crate) fn property_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, PropertyIdentifier { nodes: (a,) })) } #[parser] -pub fn ps_class_identifier(s: Span) -> IResult { +pub(crate) fn ps_class_identifier(s: Span) -> IResult { let (s, a) = opt(package_scope)(s)?; let (s, b) = class_identifier(s)?; Ok((s, PsClassIdentifier { nodes: (a, b) })) } #[parser] -pub fn ps_covergroup_identifier(s: Span) -> IResult { +pub(crate) fn ps_covergroup_identifier(s: Span) -> IResult { let (s, a) = opt(package_scope)(s)?; let (s, b) = covergroup_identifier(s)?; Ok((s, PsCovergroupIdentifier { nodes: (a, b) })) } #[parser] -pub fn ps_checker_identifier(s: Span) -> IResult { +pub(crate) fn ps_checker_identifier(s: Span) -> IResult { let (s, a) = opt(package_scope)(s)?; let (s, b) = checker_identifier(s)?; Ok((s, PsCheckerIdentifier { nodes: (a, b) })) } #[parser] -pub fn ps_identifier(s: Span) -> IResult { +pub(crate) fn ps_identifier(s: Span) -> IResult { let (s, a) = opt(package_scope)(s)?; let (s, b) = identifier(s)?; Ok((s, PsIdentifier { nodes: (a, b) })) } #[parser] -pub fn ps_or_hierarchical_array_identifier( +pub(crate) fn ps_or_hierarchical_array_identifier( s: Span, ) -> IResult { let (s, a) = opt(implicit_class_handle_or_class_scope_or_package_scope)(s)?; @@ -983,7 +997,9 @@ pub fn ps_or_hierarchical_array_identifier( } #[parser] -pub fn ps_or_hierarchical_net_identifier(s: Span) -> IResult { +pub(crate) fn ps_or_hierarchical_net_identifier( + s: Span, +) -> IResult { alt(( ps_or_hierarchical_net_identifier_package_scope, map(hierarchical_net_identifier, |x| { @@ -993,7 +1009,7 @@ pub fn ps_or_hierarchical_net_identifier(s: Span) -> IResult IResult { let (s, a) = opt(package_scope)(s)?; @@ -1007,7 +1023,7 @@ pub fn ps_or_hierarchical_net_identifier_package_scope( } #[parser] -pub fn ps_or_hierarchical_property_identifier( +pub(crate) fn ps_or_hierarchical_property_identifier( s: Span, ) -> IResult { alt(( @@ -1019,7 +1035,7 @@ pub fn ps_or_hierarchical_property_identifier( } #[parser] -pub fn ps_or_hierarchical_property_identifier_package_scope( +pub(crate) fn ps_or_hierarchical_property_identifier_package_scope( s: Span, ) -> IResult { let (s, a) = opt(package_scope)(s)?; @@ -1033,7 +1049,7 @@ pub fn ps_or_hierarchical_property_identifier_package_scope( } #[parser] -pub fn ps_or_hierarchical_sequence_identifier( +pub(crate) fn ps_or_hierarchical_sequence_identifier( s: Span, ) -> IResult { alt(( @@ -1045,7 +1061,7 @@ pub fn ps_or_hierarchical_sequence_identifier( } #[parser] -pub fn ps_or_hierarchical_sequence_identifier_package_scope( +pub(crate) fn ps_or_hierarchical_sequence_identifier_package_scope( s: Span, ) -> IResult { let (s, a) = opt(package_scope)(s)?; @@ -1059,7 +1075,9 @@ pub fn ps_or_hierarchical_sequence_identifier_package_scope( } #[parser] -pub fn ps_or_hierarchical_tf_identifier(s: Span) -> IResult { +pub(crate) fn ps_or_hierarchical_tf_identifier( + s: Span, +) -> IResult { alt(( ps_or_hierarchical_tf_identifier_package_scope, map(hierarchical_tf_identifier, |x| { @@ -1069,7 +1087,7 @@ pub fn ps_or_hierarchical_tf_identifier(s: Span) -> IResult IResult { let (s, a) = opt(package_scope)(s)?; @@ -1084,7 +1102,7 @@ pub fn ps_or_hierarchical_tf_identifier_package_scope( #[packrat_parser] #[parser] -pub fn ps_parameter_identifier(s: Span) -> IResult { +pub(crate) fn ps_parameter_identifier(s: Span) -> IResult { alt(( ps_parameter_identifier_scope, ps_parameter_identifier_generate, @@ -1092,7 +1110,7 @@ pub fn ps_parameter_identifier(s: Span) -> IResult } #[parser] -pub fn ps_parameter_identifier_scope(s: Span) -> IResult { +pub(crate) fn ps_parameter_identifier_scope(s: Span) -> IResult { let (s, a) = opt(package_scope_or_class_scope)(s)?; let (s, b) = parameter_identifier(s)?; Ok(( @@ -1102,7 +1120,7 @@ pub fn ps_parameter_identifier_scope(s: Span) -> IResult IResult { +pub(crate) fn ps_parameter_identifier_generate(s: Span) -> IResult { let (s, a) = many0(triple( generate_block_identifier, opt(bracket(constant_expression)), @@ -1117,32 +1135,32 @@ pub fn ps_parameter_identifier_generate(s: Span) -> IResult IResult { +pub(crate) fn ps_type_identifier(s: Span) -> IResult { let (s, a) = opt(local_or_package_scope_or_class_scope)(s)?; let (s, b) = type_identifier(s)?; Ok((s, PsTypeIdentifier { nodes: (a, b) })) } #[parser] -pub fn sequence_identifier(s: Span) -> IResult { +pub(crate) fn sequence_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, SequenceIdentifier { nodes: (a,) })) } #[parser] -pub fn signal_identifier(s: Span) -> IResult { +pub(crate) fn signal_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, SignalIdentifier { nodes: (a,) })) } #[parser] -pub fn simple_identifier(s: Span) -> IResult { +pub(crate) fn simple_identifier(s: Span) -> IResult { let (s, a) = ws(simple_identifier_impl)(s)?; Ok((s, SimpleIdentifier { nodes: a })) } #[parser] -pub fn simple_identifier_impl(s: Span) -> IResult { +pub(crate) fn simple_identifier_impl(s: Span) -> IResult { let (s, a) = is_a(AZ_)(s)?; let (s, b) = opt(is_a(AZ09_DOLLAR))(s)?; let a = if let Some(b) = b { @@ -1158,19 +1176,19 @@ pub fn simple_identifier_impl(s: Span) -> IResult { } #[parser] -pub fn specparam_identifier(s: Span) -> IResult { +pub(crate) fn specparam_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, SpecparamIdentifier { nodes: (a,) })) } #[parser] -pub fn system_tf_identifier(s: Span) -> IResult { +pub(crate) fn system_tf_identifier(s: Span) -> IResult { let (s, a) = ws(system_tf_identifier_impl)(s)?; Ok((s, SystemTfIdentifier { nodes: a })) } #[parser] -pub fn system_tf_identifier_impl(s: Span) -> IResult { +pub(crate) fn system_tf_identifier_impl(s: Span) -> IResult { let (s, a) = tag("$")(s)?; let (s, b) = is_a(AZ09_DOLLAR)(s)?; let a = concat(a, b).unwrap(); @@ -1178,50 +1196,50 @@ pub fn system_tf_identifier_impl(s: Span) -> IResult { } #[parser] -pub fn task_identifier(s: Span) -> IResult { +pub(crate) fn task_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, TaskIdentifier { nodes: (a,) })) } #[parser] -pub fn tf_identifier(s: Span) -> IResult { +pub(crate) fn tf_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, TfIdentifier { nodes: (a,) })) } #[parser] -pub fn terminal_identifier(s: Span) -> IResult { +pub(crate) fn terminal_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, TerminalIdentifier { nodes: (a,) })) } #[parser] -pub fn topmodule_identifier(s: Span) -> IResult { +pub(crate) fn topmodule_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, TopmoduleIdentifier { nodes: (a,) })) } #[parser] -pub fn type_identifier(s: Span) -> IResult { +pub(crate) fn type_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, TypeIdentifier { nodes: (a,) })) } #[parser] -pub fn udp_identifier(s: Span) -> IResult { +pub(crate) fn udp_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, UdpIdentifier { nodes: (a,) })) } #[packrat_parser] #[parser] -pub fn variable_identifier(s: Span) -> IResult { +pub(crate) fn variable_identifier(s: Span) -> IResult { let (s, a) = identifier(s)?; Ok((s, VariableIdentifier { nodes: (a,) })) } #[parser] -pub fn implicit_class_handle_or_class_scope_or_package_scope( +pub(crate) fn implicit_class_handle_or_class_scope_or_package_scope( s: Span, ) -> IResult { alt(( @@ -1238,7 +1256,7 @@ pub fn implicit_class_handle_or_class_scope_or_package_scope( } #[parser] -pub fn implicit_class_handle_or_package_scope( +pub(crate) fn implicit_class_handle_or_package_scope( s: Span, ) -> IResult { alt(( @@ -1252,7 +1270,7 @@ pub fn implicit_class_handle_or_package_scope( } #[parser] -pub fn implicit_class_handle_or_class_scope( +pub(crate) fn implicit_class_handle_or_class_scope( s: Span, ) -> IResult { alt(( @@ -1266,7 +1284,7 @@ pub fn implicit_class_handle_or_class_scope( } #[parser] -pub fn package_scope_or_class_scope(s: Span) -> IResult { +pub(crate) fn package_scope_or_class_scope(s: Span) -> IResult { alt(( map(package_scope, |x| { PackageScopeOrClassScope::PackageScope(Box::new(x)) @@ -1278,7 +1296,7 @@ pub fn package_scope_or_class_scope(s: Span) -> IResult IResult { alt(( @@ -1295,7 +1313,7 @@ pub fn local_or_package_scope_or_class_scope( } #[parser] -pub fn local(s: Span) -> IResult { +pub(crate) fn local(s: Span) -> IResult { let (s, a) = keyword("local")(s)?; let (s, b) = symbol("::")(s)?; Ok((s, Local { nodes: (a, b) })) diff --git a/src/parser/instantiations/checker_instantiation.rs b/src/parser/instantiations/checker_instantiation.rs index 5a06a45..b21324e 100644 --- a/src/parser/instantiations/checker_instantiation.rs +++ b/src/parser/instantiations/checker_instantiation.rs @@ -62,7 +62,7 @@ pub struct NamedCheckerPortConnectionAsterisk { // ----------------------------------------------------------------------------- #[parser] -pub fn checker_instantiation(s: Span) -> IResult { +pub(crate) fn checker_instantiation(s: Span) -> IResult { let (s, a) = ps_checker_identifier(s)?; let (s, b) = name_of_instance(s)?; let (s, c) = paren(opt(list_of_checker_port_connections))(s)?; @@ -76,7 +76,7 @@ pub fn checker_instantiation(s: Span) -> IResult { } #[parser] -pub fn list_of_checker_port_connections(s: Span) -> IResult { +pub(crate) fn list_of_checker_port_connections(s: Span) -> IResult { alt(( list_of_checker_port_connections_ordered, list_of_checker_port_connections_named, @@ -84,7 +84,7 @@ pub fn list_of_checker_port_connections(s: Span) -> IResult IResult { let (s, a) = list(symbol(","), ordered_checker_port_connection)(s)?; @@ -97,7 +97,7 @@ pub fn list_of_checker_port_connections_ordered( } #[parser] -pub fn list_of_checker_port_connections_named( +pub(crate) fn list_of_checker_port_connections_named( s: Span, ) -> IResult { let (s, a) = list(symbol(","), named_checker_port_connection)(s)?; @@ -110,14 +110,14 @@ pub fn list_of_checker_port_connections_named( } #[parser(MaybeRecursive)] -pub fn ordered_checker_port_connection(s: Span) -> IResult { +pub(crate) fn ordered_checker_port_connection(s: Span) -> IResult { let (s, x) = many0(attribute_instance)(s)?; let (s, y) = opt(property_actual_arg)(s)?; Ok((s, OrderedCheckerPortConnection { nodes: (x, y) })) } #[parser] -pub fn named_checker_port_connection(s: Span) -> IResult { +pub(crate) fn named_checker_port_connection(s: Span) -> IResult { alt(( named_checker_port_connection_identifier, named_checker_port_connection_asterisk, @@ -125,7 +125,7 @@ pub fn named_checker_port_connection(s: Span) -> IResult IResult { let (s, a) = many0(attribute_instance)(s)?; @@ -141,7 +141,7 @@ pub fn named_checker_port_connection_identifier( } #[parser] -pub fn named_checker_port_connection_asterisk( +pub(crate) fn named_checker_port_connection_asterisk( s: Span, ) -> IResult { let (s, a) = many0(attribute_instance)(s)?; diff --git a/src/parser/instantiations/generated_instantiation.rs b/src/parser/instantiations/generated_instantiation.rs index b1c4731..21906d3 100644 --- a/src/parser/instantiations/generated_instantiation.rs +++ b/src/parser/instantiations/generated_instantiation.rs @@ -130,7 +130,7 @@ pub enum GenerateItem { // ----------------------------------------------------------------------------- #[parser] -pub fn generate_region(s: Span) -> IResult { +pub(crate) fn generate_region(s: Span) -> IResult { let (s, a) = keyword("generate")(s)?; let (s, b) = many0(generate_item)(s)?; let (s, c) = keyword("endgenerate")(s)?; @@ -138,7 +138,7 @@ pub fn generate_region(s: Span) -> IResult { } #[parser] -pub fn loop_generate_construct(s: Span) -> IResult { +pub(crate) fn loop_generate_construct(s: Span) -> IResult { let (s, a) = keyword("for")(s)?; let (s, b) = paren(tuple(( generate_initialization, @@ -152,7 +152,7 @@ pub fn loop_generate_construct(s: Span) -> IResult } #[parser] -pub fn generate_initialization(s: Span) -> IResult { +pub(crate) fn generate_initialization(s: Span) -> IResult { let (s, a) = opt(map(keyword("genvar"), |x| Genvar { nodes: (x,) }))(s)?; let (s, b) = genvar_identifier(s)?; let (s, c) = symbol("=")(s)?; @@ -166,7 +166,7 @@ pub fn generate_initialization(s: Span) -> IResult { } #[parser] -pub fn genvar_iteration(s: Span) -> IResult { +pub(crate) fn genvar_iteration(s: Span) -> IResult { alt(( genvar_iteration_assignment, genvar_iteration_prefix, @@ -175,7 +175,7 @@ pub fn genvar_iteration(s: Span) -> IResult { } #[parser] -pub fn genvar_iteration_assignment(s: Span) -> IResult { +pub(crate) fn genvar_iteration_assignment(s: Span) -> IResult { let (s, a) = genvar_identifier(s)?; let (s, b) = assignment_operator(s)?; let (s, c) = genvar_expression(s)?; @@ -186,7 +186,7 @@ pub fn genvar_iteration_assignment(s: Span) -> IResult { } #[parser] -pub fn genvar_iteration_prefix(s: Span) -> IResult { +pub(crate) fn genvar_iteration_prefix(s: Span) -> IResult { let (s, a) = inc_or_dec_operator(s)?; let (s, b) = genvar_identifier(s)?; Ok(( @@ -196,7 +196,7 @@ pub fn genvar_iteration_prefix(s: Span) -> IResult { } #[parser] -pub fn genvar_iteration_suffix(s: Span) -> IResult { +pub(crate) fn genvar_iteration_suffix(s: Span) -> IResult { let (s, a) = genvar_identifier(s)?; let (s, b) = inc_or_dec_operator(s)?; Ok(( @@ -206,7 +206,7 @@ pub fn genvar_iteration_suffix(s: Span) -> IResult { } #[parser] -pub fn conditional_generate_construct(s: Span) -> IResult { +pub(crate) fn conditional_generate_construct(s: Span) -> IResult { alt(( map(if_generate_construct, |x| { ConditionalGenerateConstruct::If(Box::new(x)) @@ -218,7 +218,7 @@ pub fn conditional_generate_construct(s: Span) -> IResult IResult { +pub(crate) fn if_generate_construct(s: Span) -> IResult { let (s, a) = keyword("if")(s)?; let (s, b) = paren(constant_expression)(s)?; let (s, c) = generate_block(s)?; @@ -232,7 +232,7 @@ pub fn if_generate_construct(s: Span) -> IResult { } #[parser] -pub fn case_generate_construct(s: Span) -> IResult { +pub(crate) fn case_generate_construct(s: Span) -> IResult { let (s, a) = keyword("case")(s)?; let (s, b) = paren(constant_expression)(s)?; let (s, c) = many1(case_generate_item)(s)?; @@ -246,12 +246,12 @@ pub fn case_generate_construct(s: Span) -> IResult } #[parser] -pub fn case_generate_item(s: Span) -> IResult { +pub(crate) fn case_generate_item(s: Span) -> IResult { alt((case_generate_item_nondefault, case_generate_item_default))(s) } #[parser(MaybeRecursive)] -pub fn case_generate_item_nondefault(s: Span) -> IResult { +pub(crate) fn case_generate_item_nondefault(s: Span) -> IResult { let (s, a) = list(symbol(","), constant_expression)(s)?; let (s, b) = symbol(":")(s)?; let (s, c) = generate_block(s)?; @@ -262,7 +262,7 @@ pub fn case_generate_item_nondefault(s: Span) -> IResult } #[parser] -pub fn case_generate_item_default(s: Span) -> IResult { +pub(crate) fn case_generate_item_default(s: Span) -> IResult { let (s, a) = keyword("default")(s)?; let (s, b) = opt(symbol(":"))(s)?; let (s, c) = generate_block(s)?; @@ -273,7 +273,7 @@ pub fn case_generate_item_default(s: Span) -> IResult { } #[parser] -pub fn generate_block(s: Span) -> IResult { +pub(crate) fn generate_block(s: Span) -> IResult { alt(( map(generate_item, |x| GenerateBlock::GenerateItem(Box::new(x))), generate_block_multiple, @@ -281,7 +281,7 @@ pub fn generate_block(s: Span) -> IResult { } #[parser] -pub fn generate_block_multiple(s: Span) -> IResult { +pub(crate) fn generate_block_multiple(s: Span) -> IResult { let (s, a) = opt(pair(generate_block_identifier, symbol(":")))(s)?; let (s, b) = keyword("begin")(s)?; let (s, c) = opt(pair(symbol(":"), generate_block_identifier))(s)?; @@ -297,7 +297,7 @@ pub fn generate_block_multiple(s: Span) -> IResult { } #[parser] -pub fn generate_item(s: Span) -> IResult { +pub(crate) fn generate_item(s: Span) -> IResult { alt(( map(module_or_generate_item, |x| { GenerateItem::ModuleOrGenerateItem(Box::new(x)) diff --git a/src/parser/instantiations/interface_instantiation.rs b/src/parser/instantiations/interface_instantiation.rs index f26d38d..24cfb46 100644 --- a/src/parser/instantiations/interface_instantiation.rs +++ b/src/parser/instantiations/interface_instantiation.rs @@ -18,7 +18,7 @@ pub struct InterfaceInstantiation { // ----------------------------------------------------------------------------- #[parser] -pub fn interface_instantiation(s: Span) -> IResult { +pub(crate) fn interface_instantiation(s: Span) -> IResult { let (s, a) = interface_identifier(s)?; let (s, b) = opt(parameter_value_assignment)(s)?; let (s, c) = list(symbol(","), hierarchical_instance)(s)?; diff --git a/src/parser/instantiations/module_instantiation.rs b/src/parser/instantiations/module_instantiation.rs index df884ea..269edc6 100644 --- a/src/parser/instantiations/module_instantiation.rs +++ b/src/parser/instantiations/module_instantiation.rs @@ -103,7 +103,7 @@ pub struct NamedPortConnectionAsterisk { // ----------------------------------------------------------------------------- #[parser] -pub fn module_instantiation(s: Span) -> IResult { +pub(crate) fn module_instantiation(s: Span) -> IResult { let (s, a) = module_identifier(s)?; let (s, b) = opt(parameter_value_assignment)(s)?; let (s, c) = list(symbol(","), hierarchical_instance)(s)?; @@ -117,14 +117,14 @@ pub fn module_instantiation(s: Span) -> IResult { } #[parser] -pub fn parameter_value_assignment(s: Span) -> IResult { +pub(crate) fn parameter_value_assignment(s: Span) -> IResult { let (s, a) = symbol("#")(s)?; let (s, b) = paren(opt(list_of_parameter_assignments))(s)?; Ok((s, ParameterValueAssignment { nodes: (a, b) })) } #[parser] -pub fn list_of_parameter_assignments(s: Span) -> IResult { +pub(crate) fn list_of_parameter_assignments(s: Span) -> IResult { alt(( list_of_parameter_assignments_ordered, list_of_parameter_assignments_named, @@ -132,7 +132,7 @@ pub fn list_of_parameter_assignments(s: Span) -> IResult IResult { +pub(crate) fn list_of_parameter_assignments_ordered(s: Span) -> IResult { let (s, a) = list(symbol(","), ordered_parameter_assignment)(s)?; Ok(( s, @@ -143,7 +143,7 @@ pub fn list_of_parameter_assignments_ordered(s: Span) -> IResult IResult { +pub(crate) fn list_of_parameter_assignments_named(s: Span) -> IResult { let (s, a) = list(symbol(","), named_parameter_assignment)(s)?; Ok(( s, @@ -154,13 +154,13 @@ pub fn list_of_parameter_assignments_named(s: Span) -> IResult IResult { +pub(crate) fn ordered_parameter_assignment(s: Span) -> IResult { let (s, x) = param_expression(s)?; Ok((s, OrderedParameterAssignment { nodes: (x,) })) } #[parser] -pub fn named_parameter_assignment(s: Span) -> IResult { +pub(crate) fn named_parameter_assignment(s: Span) -> IResult { let (s, a) = symbol(".")(s)?; let (s, b) = parameter_identifier(s)?; let (s, c) = paren(opt(param_expression))(s)?; @@ -168,21 +168,21 @@ pub fn named_parameter_assignment(s: Span) -> IResult IResult { +pub(crate) fn hierarchical_instance(s: Span) -> IResult { let (s, a) = name_of_instance(s)?; let (s, b) = paren(opt(list_of_port_connections))(s)?; Ok((s, HierarchicalInstance { nodes: (a, b) })) } #[parser] -pub fn name_of_instance(s: Span) -> IResult { +pub(crate) fn name_of_instance(s: Span) -> IResult { let (s, x) = instance_identifier(s)?; let (s, y) = many0(unpacked_dimension)(s)?; Ok((s, NameOfInstance { nodes: (x, y) })) } #[parser] -pub fn list_of_port_connections(s: Span) -> IResult { +pub(crate) fn list_of_port_connections(s: Span) -> IResult { alt(( list_of_port_connections_ordered, list_of_port_connections_named, @@ -190,7 +190,7 @@ pub fn list_of_port_connections(s: Span) -> IResult } #[parser(MaybeRecursive)] -pub fn list_of_port_connections_ordered(s: Span) -> IResult { +pub(crate) fn list_of_port_connections_ordered(s: Span) -> IResult { let (s, a) = list(symbol(","), ordered_port_connection)(s)?; Ok(( s, @@ -199,7 +199,7 @@ pub fn list_of_port_connections_ordered(s: Span) -> IResult IResult { +pub(crate) fn list_of_port_connections_named(s: Span) -> IResult { let (s, a) = list(symbol(","), named_port_connection)(s)?; Ok(( s, @@ -208,14 +208,14 @@ pub fn list_of_port_connections_named(s: Span) -> IResult IResult { +pub(crate) fn ordered_port_connection(s: Span) -> IResult { let (s, x) = many0(attribute_instance)(s)?; let (s, y) = opt(expression)(s)?; Ok((s, OrderedPortConnection { nodes: (x, y) })) } #[parser] -pub fn named_port_connection(s: Span) -> IResult { +pub(crate) fn named_port_connection(s: Span) -> IResult { alt(( named_port_connection_identifier, named_port_connection_asterisk, @@ -223,7 +223,7 @@ pub fn named_port_connection(s: Span) -> IResult { } #[parser] -pub fn named_port_connection_identifier(s: Span) -> IResult { +pub(crate) fn named_port_connection_identifier(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = symbol(".")(s)?; let (s, c) = port_identifier(s)?; @@ -237,7 +237,7 @@ pub fn named_port_connection_identifier(s: Span) -> IResult IResult { +pub(crate) fn named_port_connection_asterisk(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = symbol(".*")(s)?; Ok(( diff --git a/src/parser/instantiations/program_instantiation.rs b/src/parser/instantiations/program_instantiation.rs index 2298e27..93a5374 100644 --- a/src/parser/instantiations/program_instantiation.rs +++ b/src/parser/instantiations/program_instantiation.rs @@ -18,7 +18,7 @@ pub struct ProgramInstantiation { // ----------------------------------------------------------------------------- #[parser] -pub fn program_instantiation(s: Span) -> IResult { +pub(crate) fn program_instantiation(s: Span) -> IResult { let (s, a) = program_identifier(s)?; let (s, b) = opt(parameter_value_assignment)(s)?; let (s, c) = list(symbol(","), hierarchical_instance)(s)?; diff --git a/src/parser/primitive_instances/primitive_gate_and_switch_types.rs b/src/parser/primitive_instances/primitive_gate_and_switch_types.rs index 971c514..fbe2c33 100644 --- a/src/parser/primitive_instances/primitive_gate_and_switch_types.rs +++ b/src/parser/primitive_instances/primitive_gate_and_switch_types.rs @@ -43,13 +43,13 @@ pub struct PassSwitchtype { // ----------------------------------------------------------------------------- #[parser] -pub fn cmos_switchtype(s: Span) -> IResult { +pub(crate) fn cmos_switchtype(s: Span) -> IResult { let (s, a) = alt((keyword("cmos"), keyword("rcmos")))(s)?; Ok((s, CmosSwitchtype { nodes: (a,) })) } #[parser] -pub fn enable_gatetype(s: Span) -> IResult { +pub(crate) fn enable_gatetype(s: Span) -> IResult { let (s, a) = alt(( keyword("bufif0"), keyword("bufif1"), @@ -60,7 +60,7 @@ pub fn enable_gatetype(s: Span) -> IResult { } #[parser] -pub fn mos_switchtype(s: Span) -> IResult { +pub(crate) fn mos_switchtype(s: Span) -> IResult { let (s, a) = alt(( keyword("nmos"), keyword("pmos"), @@ -71,7 +71,7 @@ pub fn mos_switchtype(s: Span) -> IResult { } #[parser] -pub fn n_input_gatetype(s: Span) -> IResult { +pub(crate) fn n_input_gatetype(s: Span) -> IResult { let (s, a) = alt(( keyword("and"), keyword("nand"), @@ -84,13 +84,13 @@ pub fn n_input_gatetype(s: Span) -> IResult { } #[parser] -pub fn n_output_gatetype(s: Span) -> IResult { +pub(crate) fn n_output_gatetype(s: Span) -> IResult { let (s, a) = alt((keyword("buf"), keyword("not")))(s)?; Ok((s, NOutputGatetype { nodes: (a,) })) } #[parser] -pub fn pass_en_switchtype(s: Span) -> IResult { +pub(crate) fn pass_en_switchtype(s: Span) -> IResult { let (s, a) = alt(( keyword("tranif0"), keyword("tranif1"), @@ -101,7 +101,7 @@ pub fn pass_en_switchtype(s: Span) -> IResult { } #[parser] -pub fn pass_switchtype(s: Span) -> IResult { +pub(crate) fn pass_switchtype(s: Span) -> IResult { let (s, a) = alt((keyword("tran"), keyword("rtran")))(s)?; Ok((s, PassSwitchtype { nodes: (a,) })) } diff --git a/src/parser/primitive_instances/primitive_instantiation_and_instances.rs b/src/parser/primitive_instances/primitive_instantiation_and_instances.rs index a55b3da..f6cc30e 100644 --- a/src/parser/primitive_instances/primitive_instantiation_and_instances.rs +++ b/src/parser/primitive_instances/primitive_instantiation_and_instances.rs @@ -192,7 +192,7 @@ pub struct PullGateInstance { // ----------------------------------------------------------------------------- #[parser] -pub fn gate_instantiation(s: Span) -> IResult { +pub(crate) fn gate_instantiation(s: Span) -> IResult { alt(( gate_instantiation_cmos, gate_instantiation_enable, @@ -207,7 +207,7 @@ pub fn gate_instantiation(s: Span) -> IResult { } #[parser] -pub fn gate_instantiation_cmos(s: Span) -> IResult { +pub(crate) fn gate_instantiation_cmos(s: Span) -> IResult { let (s, a) = cmos_switchtype(s)?; let (s, b) = opt(delay3)(s)?; let (s, c) = list(symbol(","), cmos_switch_instance)(s)?; @@ -221,7 +221,7 @@ pub fn gate_instantiation_cmos(s: Span) -> IResult { } #[parser] -pub fn gate_instantiation_enable(s: Span) -> IResult { +pub(crate) fn gate_instantiation_enable(s: Span) -> IResult { let (s, a) = enable_gatetype(s)?; let (s, b) = opt(drive_strength)(s)?; let (s, c) = opt(delay3)(s)?; @@ -236,7 +236,7 @@ pub fn gate_instantiation_enable(s: Span) -> IResult { } #[parser] -pub fn gate_instantiation_mos(s: Span) -> IResult { +pub(crate) fn gate_instantiation_mos(s: Span) -> IResult { let (s, a) = mos_switchtype(s)?; let (s, b) = opt(delay3)(s)?; let (s, c) = list(symbol(","), mos_switch_instance)(s)?; @@ -250,7 +250,7 @@ pub fn gate_instantiation_mos(s: Span) -> IResult { } #[parser] -pub fn gate_instantiation_n_input(s: Span) -> IResult { +pub(crate) fn gate_instantiation_n_input(s: Span) -> IResult { let (s, a) = n_input_gatetype(s)?; let (s, b) = opt(drive_strength)(s)?; let (s, c) = opt(delay2)(s)?; @@ -265,7 +265,7 @@ pub fn gate_instantiation_n_input(s: Span) -> IResult { } #[parser] -pub fn gate_instantiation_n_output(s: Span) -> IResult { +pub(crate) fn gate_instantiation_n_output(s: Span) -> IResult { let (s, a) = n_output_gatetype(s)?; let (s, b) = opt(drive_strength)(s)?; let (s, c) = opt(delay2)(s)?; @@ -280,7 +280,7 @@ pub fn gate_instantiation_n_output(s: Span) -> IResult } #[parser] -pub fn gate_instantiation_pass_en(s: Span) -> IResult { +pub(crate) fn gate_instantiation_pass_en(s: Span) -> IResult { let (s, a) = pass_en_switchtype(s)?; let (s, b) = opt(delay2)(s)?; let (s, c) = list(symbol(","), pass_enable_switch_instance)(s)?; @@ -294,7 +294,7 @@ pub fn gate_instantiation_pass_en(s: Span) -> IResult { } #[parser] -pub fn gate_instantiation_pass(s: Span) -> IResult { +pub(crate) fn gate_instantiation_pass(s: Span) -> IResult { let (s, a) = pass_switchtype(s)?; let (s, b) = list(symbol(","), pass_switch_instance)(s)?; let (s, c) = symbol(";")(s)?; @@ -305,7 +305,7 @@ pub fn gate_instantiation_pass(s: Span) -> IResult { } #[parser] -pub fn gate_instantiation_pulldown(s: Span) -> IResult { +pub(crate) fn gate_instantiation_pulldown(s: Span) -> IResult { let (s, a) = keyword("pulldown")(s)?; let (s, b) = opt(pulldown_strength)(s)?; let (s, c) = list(symbol(","), pull_gate_instance)(s)?; @@ -319,7 +319,7 @@ pub fn gate_instantiation_pulldown(s: Span) -> IResult } #[parser] -pub fn gate_instantiation_pullup(s: Span) -> IResult { +pub(crate) fn gate_instantiation_pullup(s: Span) -> IResult { let (s, a) = keyword("pullup")(s)?; let (s, b) = opt(pullup_strength)(s)?; let (s, c) = list(symbol(","), pull_gate_instance)(s)?; @@ -333,7 +333,7 @@ pub fn gate_instantiation_pullup(s: Span) -> IResult { } #[parser] -pub fn cmos_switch_instance(s: Span) -> IResult { +pub(crate) fn cmos_switch_instance(s: Span) -> IResult { let (s, a) = opt(name_of_instance)(s)?; let (s, b) = paren(tuple(( output_terminal, @@ -348,7 +348,7 @@ pub fn cmos_switch_instance(s: Span) -> IResult { } #[parser] -pub fn enable_gate_instance(s: Span) -> IResult { +pub(crate) fn enable_gate_instance(s: Span) -> IResult { let (s, a) = opt(name_of_instance)(s)?; let (s, b) = paren(tuple(( output_terminal, @@ -361,7 +361,7 @@ pub fn enable_gate_instance(s: Span) -> IResult { } #[parser] -pub fn mos_switch_instance(s: Span) -> IResult { +pub(crate) fn mos_switch_instance(s: Span) -> IResult { let (s, a) = opt(name_of_instance)(s)?; let (s, b) = paren(tuple(( output_terminal, @@ -374,7 +374,7 @@ pub fn mos_switch_instance(s: Span) -> IResult { } #[parser] -pub fn n_input_gate_instance(s: Span) -> IResult { +pub(crate) fn n_input_gate_instance(s: Span) -> IResult { let (s, a) = opt(name_of_instance)(s)?; let (s, b) = paren(tuple(( output_terminal, @@ -385,7 +385,7 @@ pub fn n_input_gate_instance(s: Span) -> IResult { } #[parser] -pub fn n_output_gate_instance(s: Span) -> IResult { +pub(crate) fn n_output_gate_instance(s: Span) -> IResult { let (s, a) = opt(name_of_instance)(s)?; let (s, b) = paren(tuple(( list(symbol(","), output_terminal), @@ -396,14 +396,14 @@ pub fn n_output_gate_instance(s: Span) -> IResult { } #[parser] -pub fn pass_switch_instance(s: Span) -> IResult { +pub(crate) fn pass_switch_instance(s: Span) -> IResult { let (s, a) = opt(name_of_instance)(s)?; let (s, b) = paren(tuple((inout_terminal, symbol(","), inout_terminal)))(s)?; Ok((s, PassSwitchInstance { nodes: (a, b) })) } #[parser] -pub fn pass_enable_switch_instance(s: Span) -> IResult { +pub(crate) fn pass_enable_switch_instance(s: Span) -> IResult { let (s, a) = opt(name_of_instance)(s)?; let (s, b) = paren(tuple(( inout_terminal, @@ -416,7 +416,7 @@ pub fn pass_enable_switch_instance(s: Span) -> IResult IResult { +pub(crate) fn pull_gate_instance(s: Span) -> IResult { let (s, a) = opt(name_of_instance)(s)?; let (s, b) = paren(output_terminal)(s)?; Ok((s, PullGateInstance { nodes: (a, b) })) diff --git a/src/parser/primitive_instances/primitive_strengths.rs b/src/parser/primitive_instances/primitive_strengths.rs index 28a1b8b..161d0c2 100644 --- a/src/parser/primitive_instances/primitive_strengths.rs +++ b/src/parser/primitive_instances/primitive_strengths.rs @@ -52,12 +52,12 @@ pub struct PullupStrength1 { // ----------------------------------------------------------------------------- #[parser] -pub fn pulldown_strength(s: Span) -> IResult { +pub(crate) fn pulldown_strength(s: Span) -> IResult { alt((pulldown_strength01, pulldown_strength10, pulldown_strength0))(s) } #[parser] -pub fn pulldown_strength01(s: Span) -> IResult { +pub(crate) fn pulldown_strength01(s: Span) -> IResult { let (s, a) = paren(triple(strength0, symbol(","), strength1))(s)?; Ok(( s, @@ -66,7 +66,7 @@ pub fn pulldown_strength01(s: Span) -> IResult { } #[parser] -pub fn pulldown_strength10(s: Span) -> IResult { +pub(crate) fn pulldown_strength10(s: Span) -> IResult { let (s, a) = paren(triple(strength1, symbol(","), strength0))(s)?; Ok(( s, @@ -75,7 +75,7 @@ pub fn pulldown_strength10(s: Span) -> IResult { } #[parser] -pub fn pulldown_strength0(s: Span) -> IResult { +pub(crate) fn pulldown_strength0(s: Span) -> IResult { let (s, a) = paren(strength0)(s)?; Ok(( s, @@ -84,12 +84,12 @@ pub fn pulldown_strength0(s: Span) -> IResult { } #[parser] -pub fn pullup_strength(s: Span) -> IResult { +pub(crate) fn pullup_strength(s: Span) -> IResult { alt((pullup_strength01, pullup_strength10, pullup_strength1))(s) } #[parser] -pub fn pullup_strength01(s: Span) -> IResult { +pub(crate) fn pullup_strength01(s: Span) -> IResult { let (s, a) = paren(triple(strength0, symbol(","), strength1))(s)?; Ok(( s, @@ -98,7 +98,7 @@ pub fn pullup_strength01(s: Span) -> IResult { } #[parser] -pub fn pullup_strength10(s: Span) -> IResult { +pub(crate) fn pullup_strength10(s: Span) -> IResult { let (s, a) = paren(triple(strength1, symbol(","), strength0))(s)?; Ok(( s, @@ -107,7 +107,7 @@ pub fn pullup_strength10(s: Span) -> IResult { } #[parser] -pub fn pullup_strength1(s: Span) -> IResult { +pub(crate) fn pullup_strength1(s: Span) -> IResult { let (s, a) = paren(strength1)(s)?; Ok(( s, diff --git a/src/parser/primitive_instances/primitive_terminals.rs b/src/parser/primitive_instances/primitive_terminals.rs index ffb2760..e9f7baf 100644 --- a/src/parser/primitive_instances/primitive_terminals.rs +++ b/src/parser/primitive_instances/primitive_terminals.rs @@ -37,37 +37,37 @@ pub struct PcontrolTerminal { // ----------------------------------------------------------------------------- #[parser] -pub fn enable_terminal(s: Span) -> IResult { +pub(crate) fn enable_terminal(s: Span) -> IResult { let (s, a) = expression(s)?; Ok((s, EnableTerminal { nodes: (a,) })) } #[parser] -pub fn inout_terminal(s: Span) -> IResult { +pub(crate) fn inout_terminal(s: Span) -> IResult { let (s, a) = net_lvalue(s)?; Ok((s, InoutTerminal { nodes: (a,) })) } #[parser] -pub fn input_terminal(s: Span) -> IResult { +pub(crate) fn input_terminal(s: Span) -> IResult { let (s, a) = expression(s)?; Ok((s, InputTerminal { nodes: (a,) })) } #[parser] -pub fn ncontrol_terminal(s: Span) -> IResult { +pub(crate) fn ncontrol_terminal(s: Span) -> IResult { let (s, a) = expression(s)?; Ok((s, NcontrolTerminal { nodes: (a,) })) } #[parser] -pub fn output_terminal(s: Span) -> IResult { +pub(crate) fn output_terminal(s: Span) -> IResult { let (s, a) = net_lvalue(s)?; Ok((s, OutputTerminal { nodes: (a,) })) } #[parser] -pub fn pcontrol_terminal(s: Span) -> IResult { +pub(crate) fn pcontrol_terminal(s: Span) -> IResult { let (s, a) = expression(s)?; Ok((s, PcontrolTerminal { nodes: (a,) })) } diff --git a/src/parser/source_text/checker_items.rs b/src/parser/source_text/checker_items.rs index 02da5bd..cce9dc9 100644 --- a/src/parser/source_text/checker_items.rs +++ b/src/parser/source_text/checker_items.rs @@ -87,13 +87,13 @@ pub enum CheckerGenerateItem { // ----------------------------------------------------------------------------- #[parser] -pub fn checker_port_list(s: Span) -> IResult { +pub(crate) fn checker_port_list(s: Span) -> IResult { let (s, a) = list(symbol(","), checker_port_item)(s)?; Ok((s, CheckerPortList { nodes: (a,) })) } #[parser] -pub fn checker_port_item(s: Span) -> IResult { +pub(crate) fn checker_port_item(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = opt(checker_port_direction)(s)?; let (s, c) = property_formal_type(s)?; @@ -109,7 +109,7 @@ pub fn checker_port_item(s: Span) -> IResult { } #[parser] -pub fn checker_port_direction(s: Span) -> IResult { +pub(crate) fn checker_port_direction(s: Span) -> IResult { alt(( map(keyword("input"), |x| { CheckerPortDirection::Input(Box::new(x)) @@ -121,7 +121,7 @@ pub fn checker_port_direction(s: Span) -> IResult { } #[parser] -pub fn checker_or_generate_item(s: Span) -> IResult { +pub(crate) fn checker_or_generate_item(s: Span) -> IResult { alt(( map(checker_or_generate_item_declaration, |x| { CheckerOrGenerateItem::CheckerOrGenerateItemDeclaration(Box::new(x)) @@ -148,7 +148,7 @@ pub fn checker_or_generate_item(s: Span) -> IResult } #[parser] -pub fn checker_or_generate_item_declaration( +pub(crate) fn checker_or_generate_item_declaration( s: Span, ) -> IResult { alt(( @@ -180,7 +180,7 @@ pub fn checker_or_generate_item_declaration( } #[parser] -pub fn checker_or_generate_item_declaration_data( +pub(crate) fn checker_or_generate_item_declaration_data( s: Span, ) -> IResult { let (s, a) = opt(rand)(s)?; @@ -194,13 +194,13 @@ pub fn checker_or_generate_item_declaration_data( } #[parser] -pub fn rand(s: Span) -> IResult { +pub(crate) fn rand(s: Span) -> IResult { let (s, a) = keyword("rand")(s)?; Ok((s, Rand { nodes: (a,) })) } #[parser] -pub fn checker_or_generate_item_declaration_clocking( +pub(crate) fn checker_or_generate_item_declaration_clocking( s: Span, ) -> IResult { let (s, a) = keyword("default")(s)?; @@ -218,7 +218,7 @@ pub fn checker_or_generate_item_declaration_clocking( } #[parser] -pub fn checker_or_generate_item_declaration_disable( +pub(crate) fn checker_or_generate_item_declaration_disable( s: Span, ) -> IResult { let (s, a) = keyword("default")(s)?; @@ -237,7 +237,7 @@ pub fn checker_or_generate_item_declaration_disable( } #[parser] -pub fn checker_generate_item(s: Span) -> IResult { +pub(crate) fn checker_generate_item(s: Span) -> IResult { alt(( map(loop_generate_construct, |x| { CheckerGenerateItem::LoopGenerateConstruct(Box::new(x)) diff --git a/src/parser/source_text/class_items.rs b/src/parser/source_text/class_items.rs index 9f7435d..bbf024b 100644 --- a/src/parser/source_text/class_items.rs +++ b/src/parser/source_text/class_items.rs @@ -187,7 +187,7 @@ pub struct New { // ----------------------------------------------------------------------------- #[parser] -pub fn class_item(s: Span) -> IResult { +pub(crate) fn class_item(s: Span) -> IResult { alt(( class_item_property, class_item_method, @@ -205,7 +205,7 @@ pub fn class_item(s: Span) -> IResult { } #[parser] -pub fn class_item_property(s: Span) -> IResult { +pub(crate) fn class_item_property(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = class_property(s)?; Ok(( @@ -215,7 +215,7 @@ pub fn class_item_property(s: Span) -> IResult { } #[parser] -pub fn class_item_method(s: Span) -> IResult { +pub(crate) fn class_item_method(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = class_method(s)?; Ok(( @@ -225,7 +225,7 @@ pub fn class_item_method(s: Span) -> IResult { } #[parser] -pub fn class_item_constraint(s: Span) -> IResult { +pub(crate) fn class_item_constraint(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = class_constraint(s)?; Ok(( @@ -235,7 +235,7 @@ pub fn class_item_constraint(s: Span) -> IResult { } #[parser] -pub fn class_item_declaration(s: Span) -> IResult { +pub(crate) fn class_item_declaration(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = class_declaration(s)?; Ok(( @@ -245,7 +245,7 @@ pub fn class_item_declaration(s: Span) -> IResult { } #[parser] -pub fn class_item_covergroup(s: Span) -> IResult { +pub(crate) fn class_item_covergroup(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = covergroup_declaration(s)?; Ok(( @@ -255,12 +255,12 @@ pub fn class_item_covergroup(s: Span) -> IResult { } #[parser] -pub fn class_property(s: Span) -> IResult { +pub(crate) fn class_property(s: Span) -> IResult { alt((class_property_non_const, class_property_const))(s) } #[parser] -pub fn class_property_non_const(s: Span) -> IResult { +pub(crate) fn class_property_non_const(s: Span) -> IResult { let (s, a) = many0(property_qualifier)(s)?; let (s, b) = data_declaration(s)?; Ok(( @@ -270,7 +270,7 @@ pub fn class_property_non_const(s: Span) -> IResult { } #[parser] -pub fn class_property_const(s: Span) -> IResult { +pub(crate) fn class_property_const(s: Span) -> IResult { let (s, a) = keyword("const")(s)?; let (s, b) = many0(class_item_qualifier)(s)?; let (s, c) = data_type(s)?; @@ -286,7 +286,7 @@ pub fn class_property_const(s: Span) -> IResult { } #[parser] -pub fn class_method(s: Span) -> IResult { +pub(crate) fn class_method(s: Span) -> IResult { alt(( class_method_task, class_method_function, @@ -298,7 +298,7 @@ pub fn class_method(s: Span) -> IResult { } #[parser] -pub fn class_method_task(s: Span) -> IResult { +pub(crate) fn class_method_task(s: Span) -> IResult { let (s, a) = many0(method_qualifier)(s)?; let (s, b) = task_declaration(s)?; Ok(( @@ -308,7 +308,7 @@ pub fn class_method_task(s: Span) -> IResult { } #[parser] -pub fn class_method_function(s: Span) -> IResult { +pub(crate) fn class_method_function(s: Span) -> IResult { let (s, a) = many0(method_qualifier)(s)?; let (s, b) = function_declaration(s)?; Ok(( @@ -318,7 +318,7 @@ pub fn class_method_function(s: Span) -> IResult { } #[parser] -pub fn class_method_pure_virtual(s: Span) -> IResult { +pub(crate) fn class_method_pure_virtual(s: Span) -> IResult { let (s, a) = keyword("pure")(s)?; let (s, b) = keyword("virtual")(s)?; let (s, c) = many0(class_item_qualifier)(s)?; @@ -333,7 +333,7 @@ pub fn class_method_pure_virtual(s: Span) -> IResult { } #[parser] -pub fn class_method_extern_method(s: Span) -> IResult { +pub(crate) fn class_method_extern_method(s: Span) -> IResult { let (s, a) = keyword("extern")(s)?; let (s, b) = many0(method_qualifier)(s)?; let (s, c) = method_prototype(s)?; @@ -347,7 +347,7 @@ pub fn class_method_extern_method(s: Span) -> IResult { } #[parser] -pub fn class_method_constructor(s: Span) -> IResult { +pub(crate) fn class_method_constructor(s: Span) -> IResult { let (s, a) = many0(method_qualifier)(s)?; let (s, b) = class_constructor_declaration(s)?; Ok(( @@ -357,7 +357,7 @@ pub fn class_method_constructor(s: Span) -> IResult { } #[parser] -pub fn class_method_extern_constructor(s: Span) -> IResult { +pub(crate) fn class_method_extern_constructor(s: Span) -> IResult { let (s, a) = keyword("extern")(s)?; let (s, b) = many0(method_qualifier)(s)?; let (s, c) = class_constructor_prototype(s)?; @@ -368,7 +368,7 @@ pub fn class_method_extern_constructor(s: Span) -> IResult { } #[parser] -pub fn class_constructor_prototype(s: Span) -> IResult { +pub(crate) fn class_constructor_prototype(s: Span) -> IResult { let (s, a) = keyword("function")(s)?; let (s, b) = keyword("new")(s)?; let (s, c) = opt(paren(opt(tf_port_list)))(s)?; @@ -382,7 +382,7 @@ pub fn class_constructor_prototype(s: Span) -> IResult IResult { +pub(crate) fn class_constraint(s: Span) -> IResult { alt(( map(constraint_prototype, |x| { ClassConstraint::ConstraintPrototype(Box::new(x)) @@ -394,7 +394,7 @@ pub fn class_constraint(s: Span) -> IResult { } #[parser] -pub fn class_item_qualifier(s: Span) -> IResult { +pub(crate) fn class_item_qualifier(s: Span) -> IResult { alt(( map(keyword("static"), |x| { ClassItemQualifier::Static(Box::new(x)) @@ -407,7 +407,7 @@ pub fn class_item_qualifier(s: Span) -> IResult { } #[parser] -pub fn property_qualifier(s: Span) -> IResult { +pub(crate) fn property_qualifier(s: Span) -> IResult { alt(( map(random_qualifier, |x| { PropertyQualifier::RandomQualifier(Box::new(x)) @@ -419,7 +419,7 @@ pub fn property_qualifier(s: Span) -> IResult { } #[parser] -pub fn random_qualifier(s: Span) -> IResult { +pub(crate) fn random_qualifier(s: Span) -> IResult { alt(( map(keyword("randc"), |x| RandomQualifier::Randc(Box::new(x))), map(keyword("rand"), |x| RandomQualifier::Rand(Box::new(x))), @@ -427,7 +427,7 @@ pub fn random_qualifier(s: Span) -> IResult { } #[parser] -pub fn method_qualifier(s: Span) -> IResult { +pub(crate) fn method_qualifier(s: Span) -> IResult { alt(( map(pair(keyword("pure"), keyword("virtual")), |x| { MethodQualifier::PureVirtual(Box::new(x)) @@ -442,7 +442,7 @@ pub fn method_qualifier(s: Span) -> IResult { } #[parser] -pub fn method_prototype(s: Span) -> IResult { +pub(crate) fn method_prototype(s: Span) -> IResult { alt(( map(task_prototype, |x| { MethodPrototype::TaskPrototype(Box::new(x)) @@ -454,7 +454,7 @@ pub fn method_prototype(s: Span) -> IResult { } #[parser] -pub fn class_constructor_declaration(s: Span) -> IResult { +pub(crate) fn class_constructor_declaration(s: Span) -> IResult { let (s, a) = keyword("function")(s)?; let (s, b) = opt(class_scope)(s)?; let (s, c) = keyword("new")(s)?; @@ -480,7 +480,7 @@ pub fn class_constructor_declaration(s: Span) -> IResult IResult { +pub(crate) fn new(s: Span) -> IResult { let (s, a) = keyword("new")(s)?; Ok((s, New { nodes: (a,) })) } diff --git a/src/parser/source_text/configuration_source_text.rs b/src/parser/source_text/configuration_source_text.rs index 24c3f9c..0cdbcd1 100644 --- a/src/parser/source_text/configuration_source_text.rs +++ b/src/parser/source_text/configuration_source_text.rs @@ -135,7 +135,7 @@ pub struct Config { // ----------------------------------------------------------------------------- #[parser] -pub fn config_declaration(s: Span) -> IResult { +pub(crate) fn config_declaration(s: Span) -> IResult { let (s, a) = keyword("config")(s)?; let (s, b) = config_identifier(s)?; let (s, c) = symbol(";")(s)?; @@ -153,7 +153,7 @@ pub fn config_declaration(s: Span) -> IResult { } #[parser] -pub fn design_statement(s: Span) -> IResult { +pub(crate) fn design_statement(s: Span) -> IResult { let (s, a) = keyword("design")(s)?; let (s, b) = many0(pair( opt(pair(library_identifier, symbol("."))), @@ -164,7 +164,7 @@ pub fn design_statement(s: Span) -> IResult { } #[parser] -pub fn config_rule_statement(s: Span) -> IResult { +pub(crate) fn config_rule_statement(s: Span) -> IResult { alt(( config_rule_statement_default, config_rule_statement_inst_lib, @@ -175,7 +175,7 @@ pub fn config_rule_statement(s: Span) -> IResult { } #[parser] -pub fn config_rule_statement_default(s: Span) -> IResult { +pub(crate) fn config_rule_statement_default(s: Span) -> IResult { let (s, a) = default_clause(s)?; let (s, b) = liblist_clause(s)?; let (s, c) = symbol(";")(s)?; @@ -186,7 +186,7 @@ pub fn config_rule_statement_default(s: Span) -> IResult IResult { +pub(crate) fn config_rule_statement_inst_lib(s: Span) -> IResult { let (s, a) = inst_clause(s)?; let (s, b) = liblist_clause(s)?; let (s, c) = symbol(";")(s)?; @@ -197,7 +197,7 @@ pub fn config_rule_statement_inst_lib(s: Span) -> IResult IResult { +pub(crate) fn config_rule_statement_inst_use(s: Span) -> IResult { let (s, a) = inst_clause(s)?; let (s, b) = use_clause(s)?; let (s, c) = symbol(";")(s)?; @@ -208,7 +208,7 @@ pub fn config_rule_statement_inst_use(s: Span) -> IResult IResult { +pub(crate) fn config_rule_statement_cell_lib(s: Span) -> IResult { let (s, a) = cell_clause(s)?; let (s, b) = liblist_clause(s)?; let (s, c) = symbol(";")(s)?; @@ -219,7 +219,7 @@ pub fn config_rule_statement_cell_lib(s: Span) -> IResult IResult { +pub(crate) fn config_rule_statement_cell_use(s: Span) -> IResult { let (s, a) = cell_clause(s)?; let (s, b) = use_clause(s)?; let (s, c) = symbol(";")(s)?; @@ -230,27 +230,27 @@ pub fn config_rule_statement_cell_use(s: Span) -> IResult IResult { +pub(crate) fn default_clause(s: Span) -> IResult { let (s, a) = keyword("default")(s)?; Ok((s, DefaultClause { nodes: (a,) })) } #[parser] -pub fn inst_clause(s: Span) -> IResult { +pub(crate) fn inst_clause(s: Span) -> IResult { let (s, a) = keyword("instance")(s)?; let (s, b) = inst_name(s)?; Ok((s, InstClause { nodes: (a, b) })) } #[parser] -pub fn inst_name(s: Span) -> IResult { +pub(crate) fn inst_name(s: Span) -> IResult { let (s, a) = topmodule_identifier(s)?; let (s, b) = many0(pair(symbol("."), instance_identifier))(s)?; Ok((s, InstName { nodes: (a, b) })) } #[parser] -pub fn cell_clause(s: Span) -> IResult { +pub(crate) fn cell_clause(s: Span) -> IResult { let (s, a) = keyword("cell")(s)?; let (s, b) = opt(pair(library_identifier, symbol(".")))(s)?; let (s, c) = cell_identifier(s)?; @@ -258,19 +258,19 @@ pub fn cell_clause(s: Span) -> IResult { } #[parser] -pub fn liblist_clause(s: Span) -> IResult { +pub(crate) fn liblist_clause(s: Span) -> IResult { let (s, a) = keyword("liblist")(s)?; let (s, b) = many0(library_identifier)(s)?; Ok((s, LiblistClause { nodes: (a, b) })) } #[parser] -pub fn use_clause(s: Span) -> IResult { +pub(crate) fn use_clause(s: Span) -> IResult { alt((use_clause_cell, use_clause_named, use_clause_cell_named))(s) } #[parser] -pub fn use_clause_cell(s: Span) -> IResult { +pub(crate) fn use_clause_cell(s: Span) -> IResult { let (s, a) = keyword("use")(s)?; let (s, b) = opt(pair(library_identifier, symbol(".")))(s)?; let (s, c) = cell_identifier(s)?; @@ -284,7 +284,7 @@ pub fn use_clause_cell(s: Span) -> IResult { } #[parser] -pub fn use_clause_named(s: Span) -> IResult { +pub(crate) fn use_clause_named(s: Span) -> IResult { let (s, a) = keyword("use")(s)?; let (s, b) = list(symbol(","), named_parameter_assignment)(s)?; let (s, c) = opt(pair(symbol(":"), config))(s)?; @@ -295,7 +295,7 @@ pub fn use_clause_named(s: Span) -> IResult { } #[parser] -pub fn use_clause_cell_named(s: Span) -> IResult { +pub(crate) fn use_clause_cell_named(s: Span) -> IResult { let (s, a) = keyword("use")(s)?; let (s, b) = opt(pair(library_identifier, symbol(".")))(s)?; let (s, c) = cell_identifier(s)?; @@ -310,7 +310,7 @@ pub fn use_clause_cell_named(s: Span) -> IResult { } #[parser] -pub fn config(s: Span) -> IResult { +pub(crate) fn config(s: Span) -> IResult { let (s, a) = keyword("config")(s)?; Ok((s, Config { nodes: (a,) })) } diff --git a/src/parser/source_text/constraints.rs b/src/parser/source_text/constraints.rs index 96c4c9f..4c179cc 100644 --- a/src/parser/source_text/constraints.rs +++ b/src/parser/source_text/constraints.rs @@ -180,7 +180,7 @@ pub struct IdentifierList { // ----------------------------------------------------------------------------- #[parser] -pub fn constraint_declaration(s: Span) -> IResult { +pub(crate) fn constraint_declaration(s: Span) -> IResult { let (s, a) = opt(r#static)(s)?; let (s, b) = keyword("constraint")(s)?; let (s, c) = constraint_identifier(s)?; @@ -194,19 +194,19 @@ pub fn constraint_declaration(s: Span) -> IResult { } #[parser] -pub fn r#static(s: Span) -> IResult { +pub(crate) fn r#static(s: Span) -> IResult { let (s, a) = keyword("static")(s)?; Ok((s, Static { nodes: (a,) })) } #[parser] -pub fn constraint_block(s: Span) -> IResult { +pub(crate) fn constraint_block(s: Span) -> IResult { let (s, a) = brace(many0(constraint_block_item))(s)?; Ok((s, ConstraintBlock { nodes: (a,) })) } #[parser] -pub fn constraint_block_item(s: Span) -> IResult { +pub(crate) fn constraint_block_item(s: Span) -> IResult { alt(( constraint_block_item_solve, map(constraint_expression, |x| { @@ -216,7 +216,7 @@ pub fn constraint_block_item(s: Span) -> IResult { } #[parser] -pub fn constraint_block_item_solve(s: Span) -> IResult { +pub(crate) fn constraint_block_item_solve(s: Span) -> IResult { let (s, a) = keyword("solve")(s)?; let (s, b) = solve_before_list(s)?; let (s, c) = keyword("before")(s)?; @@ -231,13 +231,13 @@ pub fn constraint_block_item_solve(s: Span) -> IResult IResult { +pub(crate) fn solve_before_list(s: Span) -> IResult { let (s, a) = list(symbol(","), constraint_primary)(s)?; Ok((s, SolveBeforeList { nodes: (a,) })) } #[parser] -pub fn constraint_primary(s: Span) -> IResult { +pub(crate) fn constraint_primary(s: Span) -> IResult { let (s, a) = opt(implicit_class_handle_or_class_scope)(s)?; let (s, b) = hierarchical_identifier(s)?; let (s, c) = select(s)?; @@ -245,7 +245,7 @@ pub fn constraint_primary(s: Span) -> IResult { } #[parser] -pub fn constraint_expression(s: Span) -> IResult { +pub(crate) fn constraint_expression(s: Span) -> IResult { alt(( constraint_expression_expression, map(pair(uniqueness_constraint, symbol(";")), |x| { @@ -259,7 +259,7 @@ pub fn constraint_expression(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn constraint_expression_expression(s: Span) -> IResult { +pub(crate) fn constraint_expression_expression(s: Span) -> IResult { let (s, a) = opt(soft)(s)?; let (s, b) = expression_or_dist(s)?; let (s, c) = symbol(";")(s)?; @@ -272,13 +272,13 @@ pub fn constraint_expression_expression(s: Span) -> IResult IResult { +pub(crate) fn soft(s: Span) -> IResult { let (s, a) = keyword("soft")(s)?; Ok((s, Soft { nodes: (a,) })) } #[parser(MaybeRecursive)] -pub fn constraint_expression_arrow(s: Span) -> IResult { +pub(crate) fn constraint_expression_arrow(s: Span) -> IResult { let (s, a) = expression(s)?; let (s, b) = symbol("->")(s)?; let (s, c) = constraint_set(s)?; @@ -289,7 +289,7 @@ pub fn constraint_expression_arrow(s: Span) -> IResult IResult { +pub(crate) fn constraint_expression_if(s: Span) -> IResult { let (s, a) = keyword("if")(s)?; let (s, b) = paren(expression)(s)?; let (s, c) = constraint_set(s)?; @@ -303,7 +303,7 @@ pub fn constraint_expression_if(s: Span) -> IResult } #[parser] -pub fn constraint_expression_foreach(s: Span) -> IResult { +pub(crate) fn constraint_expression_foreach(s: Span) -> IResult { let (s, a) = keyword("foreach")(s)?; let (s, b) = paren(pair( ps_or_hierarchical_array_identifier, @@ -317,7 +317,7 @@ pub fn constraint_expression_foreach(s: Span) -> IResult IResult { +pub(crate) fn constraint_expression_disable(s: Span) -> IResult { let (s, a) = keyword("disable")(s)?; let (s, b) = keyword("soft")(s)?; let (s, c) = constraint_primary(s)?; @@ -331,14 +331,14 @@ pub fn constraint_expression_disable(s: Span) -> IResult IResult { +pub(crate) fn uniqueness_constraint(s: Span) -> IResult { let (s, a) = keyword("unique")(s)?; let (s, b) = brace(open_range_list)(s)?; Ok((s, UniquenessConstraint { nodes: (a, b) })) } #[parser] -pub fn constraint_set(s: Span) -> IResult { +pub(crate) fn constraint_set(s: Span) -> IResult { alt(( map(constraint_expression, |x| { ConstraintSet::ConstraintExpression(Box::new(x)) @@ -348,7 +348,7 @@ pub fn constraint_set(s: Span) -> IResult { } #[parser] -pub fn constraint_set_brace(s: Span) -> IResult { +pub(crate) fn constraint_set_brace(s: Span) -> IResult { let (s, a) = brace(many0(constraint_expression))(s)?; Ok(( s, @@ -357,25 +357,25 @@ pub fn constraint_set_brace(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn dist_list(s: Span) -> IResult { +pub(crate) fn dist_list(s: Span) -> IResult { let (s, a) = list(symbol(","), dist_item)(s)?; Ok((s, DistList { nodes: (a,) })) } #[parser(MaybeRecursive)] -pub fn dist_item(s: Span) -> IResult { +pub(crate) fn dist_item(s: Span) -> IResult { let (s, a) = value_range(s)?; let (s, b) = opt(dist_weight)(s)?; Ok((s, DistItem { nodes: (a, b) })) } #[parser] -pub fn dist_weight(s: Span) -> IResult { +pub(crate) fn dist_weight(s: Span) -> IResult { alt((dist_weight_equal, dist_weight_divide))(s) } #[parser] -pub fn dist_weight_equal(s: Span) -> IResult { +pub(crate) fn dist_weight_equal(s: Span) -> IResult { let (s, a) = symbol(":=")(s)?; let (s, b) = expression(s)?; Ok(( @@ -385,7 +385,7 @@ pub fn dist_weight_equal(s: Span) -> IResult { } #[parser] -pub fn dist_weight_divide(s: Span) -> IResult { +pub(crate) fn dist_weight_divide(s: Span) -> IResult { let (s, a) = symbol(":/")(s)?; let (s, b) = expression(s)?; Ok(( @@ -395,7 +395,7 @@ pub fn dist_weight_divide(s: Span) -> IResult { } #[parser] -pub fn constraint_prototype(s: Span) -> IResult { +pub(crate) fn constraint_prototype(s: Span) -> IResult { let (s, a) = opt(constraint_prototype_qualifier)(s)?; let (s, b) = opt(r#static)(s)?; let (s, c) = keyword("constraint")(s)?; @@ -410,7 +410,7 @@ pub fn constraint_prototype(s: Span) -> IResult { } #[parser] -pub fn constraint_prototype_qualifier(s: Span) -> IResult { +pub(crate) fn constraint_prototype_qualifier(s: Span) -> IResult { alt(( map(keyword("extern"), |x| { ConstraintPrototypeQualifier::Extern(Box::new(x)) @@ -422,7 +422,7 @@ pub fn constraint_prototype_qualifier(s: Span) -> IResult IResult { +pub(crate) fn extern_constraint_declaration(s: Span) -> IResult { let (s, a) = opt(r#static)(s)?; let (s, b) = keyword("constraint")(s)?; let (s, c) = class_scope(s)?; @@ -437,7 +437,7 @@ pub fn extern_constraint_declaration(s: Span) -> IResult IResult { +pub(crate) fn identifier_list(s: Span) -> IResult { let (s, a) = list(symbol(","), identifier)(s)?; Ok((s, IdentifierList { nodes: (a,) })) } diff --git a/src/parser/source_text/interface_items.rs b/src/parser/source_text/interface_items.rs index 7ae1fa8..e36278b 100644 --- a/src/parser/source_text/interface_items.rs +++ b/src/parser/source_text/interface_items.rs @@ -59,7 +59,7 @@ pub enum NonPortInterfaceItem { // ----------------------------------------------------------------------------- #[parser] -pub fn interface_or_generate_item(s: Span) -> IResult { +pub(crate) fn interface_or_generate_item(s: Span) -> IResult { alt(( interface_or_generate_item_module, interface_or_generate_item_extern, @@ -67,7 +67,7 @@ pub fn interface_or_generate_item(s: Span) -> IResult IResult { +pub(crate) fn interface_or_generate_item_module(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = module_common_item(s)?; Ok(( @@ -77,7 +77,7 @@ pub fn interface_or_generate_item_module(s: Span) -> IResult IResult { +pub(crate) fn interface_or_generate_item_extern(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = extern_tf_declaration(s)?; Ok(( @@ -87,12 +87,12 @@ pub fn interface_or_generate_item_extern(s: Span) -> IResult IResult { +pub(crate) fn extern_tf_declaration(s: Span) -> IResult { alt((extern_tf_declaration_method, extern_tf_declaration_task))(s) } #[parser] -pub fn extern_tf_declaration_method(s: Span) -> IResult { +pub(crate) fn extern_tf_declaration_method(s: Span) -> IResult { let (s, a) = keyword("extern")(s)?; let (s, b) = method_prototype(s)?; let (s, c) = symbol(";")(s)?; @@ -103,7 +103,7 @@ pub fn extern_tf_declaration_method(s: Span) -> IResult IResult { +pub(crate) fn extern_tf_declaration_task(s: Span) -> IResult { let (s, a) = keyword("extern")(s)?; let (s, b) = keyword("forkjoin")(s)?; let (s, c) = task_prototype(s)?; @@ -117,7 +117,7 @@ pub fn extern_tf_declaration_task(s: Span) -> IResult } #[parser] -pub fn interface_item(s: Span) -> IResult { +pub(crate) fn interface_item(s: Span) -> IResult { alt(( map(pair(port_declaration, symbol(";")), |x| { InterfaceItem::PortDeclaration(Box::new(x)) @@ -129,7 +129,7 @@ pub fn interface_item(s: Span) -> IResult { } #[parser] -pub fn non_port_interface_item(s: Span) -> IResult { +pub(crate) fn non_port_interface_item(s: Span) -> IResult { alt(( map(generate_region, |x| { NonPortInterfaceItem::GenerateRegion(Box::new(x)) diff --git a/src/parser/source_text/library_source_text.rs b/src/parser/source_text/library_source_text.rs index 1a976c4..cd7bf56 100644 --- a/src/parser/source_text/library_source_text.rs +++ b/src/parser/source_text/library_source_text.rs @@ -45,13 +45,13 @@ pub struct FilePathSpec { // ----------------------------------------------------------------------------- #[parser] -pub fn library_text(s: Span) -> IResult { +pub(crate) fn library_text(s: Span) -> IResult { let (s, a) = many0(library_description)(s)?; Ok((s, LibraryText { nodes: (a,) })) } #[parser] -pub fn library_description(s: Span) -> IResult { +pub(crate) fn library_description(s: Span) -> IResult { alt(( map(library_declaration, |x| { LibraryDescription::LibraryDeclaration(Box::new(x)) @@ -67,7 +67,7 @@ pub fn library_description(s: Span) -> IResult { } #[parser] -pub fn library_declaration(s: Span) -> IResult { +pub(crate) fn library_declaration(s: Span) -> IResult { let (s, a) = keyword("library")(s)?; let (s, b) = library_identifier(s)?; let (s, c) = list(symbol(","), file_path_spec)(s)?; @@ -82,7 +82,7 @@ pub fn library_declaration(s: Span) -> IResult { } #[parser] -pub fn include_statement(s: Span) -> IResult { +pub(crate) fn include_statement(s: Span) -> IResult { let (s, a) = keyword("include")(s)?; let (s, b) = file_path_spec(s)?; let (s, c) = symbol(";")(s)?; @@ -91,7 +91,7 @@ pub fn include_statement(s: Span) -> IResult { //TODO support non literal path #[parser] -pub fn file_path_spec(s: Span) -> IResult { +pub(crate) fn file_path_spec(s: Span) -> IResult { let (s, a) = string_literal(s)?; Ok((s, FilePathSpec { nodes: (a,) })) } diff --git a/src/parser/source_text/module_items.rs b/src/parser/source_text/module_items.rs index 8392d0b..0cf9ff4 100644 --- a/src/parser/source_text/module_items.rs +++ b/src/parser/source_text/module_items.rs @@ -194,7 +194,7 @@ pub enum BindInstantiation { // ----------------------------------------------------------------------------- #[parser] -pub fn elaboration_system_task(s: Span) -> IResult { +pub(crate) fn elaboration_system_task(s: Span) -> IResult { alt(( elaboration_system_task_fatal, elaboration_system_task_error, @@ -204,7 +204,7 @@ pub fn elaboration_system_task(s: Span) -> IResult } #[parser] -pub fn elaboration_system_task_fatal(s: Span) -> IResult { +pub(crate) fn elaboration_system_task_fatal(s: Span) -> IResult { let (s, a) = keyword("$fatal")(s)?; let (s, b) = opt(paren(pair( finish_number, @@ -218,7 +218,7 @@ pub fn elaboration_system_task_fatal(s: Span) -> IResult IResult { +pub(crate) fn elaboration_system_task_error(s: Span) -> IResult { let (s, a) = keyword("$error")(s)?; let (s, b) = opt(paren(opt(list_of_arguments)))(s)?; let (s, c) = symbol(";")(s)?; @@ -229,7 +229,7 @@ pub fn elaboration_system_task_error(s: Span) -> IResult IResult { +pub(crate) fn elaboration_system_task_warning(s: Span) -> IResult { let (s, a) = keyword("$warning")(s)?; let (s, b) = opt(paren(opt(list_of_arguments)))(s)?; let (s, c) = symbol(";")(s)?; @@ -242,7 +242,7 @@ pub fn elaboration_system_task_warning(s: Span) -> IResult IResult { +pub(crate) fn elaboration_system_task_info(s: Span) -> IResult { let (s, a) = keyword("$info")(s)?; let (s, b) = opt(paren(opt(list_of_arguments)))(s)?; let (s, c) = symbol(";")(s)?; @@ -253,7 +253,7 @@ pub fn elaboration_system_task_info(s: Span) -> IResult IResult { +pub(crate) fn finish_number(s: Span) -> IResult { alt(( map(symbol("0"), |x| FinishNumber::Zero(Box::new(x))), map(symbol("1"), |x| FinishNumber::One(Box::new(x))), @@ -262,7 +262,7 @@ pub fn finish_number(s: Span) -> IResult { } #[parser] -pub fn module_common_item(s: Span) -> IResult { +pub(crate) fn module_common_item(s: Span) -> IResult { alt(( map(module_or_generate_item_declaration, |x| { ModuleCommonItem::ModuleOrGenerateItemDeclaration(Box::new(x)) @@ -305,7 +305,7 @@ pub fn module_common_item(s: Span) -> IResult { } #[parser] -pub fn module_item(s: Span) -> IResult { +pub(crate) fn module_item(s: Span) -> IResult { alt(( map(pair(port_declaration, symbol(";")), |x| { ModuleItem::PortDeclaration(Box::new(x)) @@ -317,7 +317,7 @@ pub fn module_item(s: Span) -> IResult { } #[parser] -pub fn module_or_generate_item(s: Span) -> IResult { +pub(crate) fn module_or_generate_item(s: Span) -> IResult { alt(( module_or_generate_item_parameter, module_or_generate_item_gate, @@ -328,7 +328,7 @@ pub fn module_or_generate_item(s: Span) -> IResult { } #[parser] -pub fn module_or_generate_item_parameter(s: Span) -> IResult { +pub(crate) fn module_or_generate_item_parameter(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = parameter_override(s)?; Ok(( @@ -338,7 +338,7 @@ pub fn module_or_generate_item_parameter(s: Span) -> IResult IResult { +pub(crate) fn module_or_generate_item_gate(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = gate_instantiation(s)?; Ok(( @@ -348,7 +348,7 @@ pub fn module_or_generate_item_gate(s: Span) -> IResult IResult { +pub(crate) fn module_or_generate_item_udp(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = udp_instantiation(s)?; Ok(( @@ -358,7 +358,7 @@ pub fn module_or_generate_item_udp(s: Span) -> IResult IResult { +pub(crate) fn module_or_generate_item_module(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = module_instantiation(s)?; Ok(( @@ -368,7 +368,7 @@ pub fn module_or_generate_item_module(s: Span) -> IResult IResult { +pub(crate) fn module_or_generate_item_module_item(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = module_common_item(s)?; Ok(( @@ -380,7 +380,7 @@ pub fn module_or_generate_item_module_item(s: Span) -> IResult IResult { alt(( @@ -399,7 +399,7 @@ pub fn module_or_generate_item_declaration( } #[parser] -pub fn module_or_generate_item_declaration_clocking( +pub(crate) fn module_or_generate_item_declaration_clocking( s: Span, ) -> IResult { let (s, a) = keyword("default")(s)?; @@ -417,7 +417,7 @@ pub fn module_or_generate_item_declaration_clocking( } #[parser] -pub fn module_or_generate_item_declaration_disable( +pub(crate) fn module_or_generate_item_declaration_disable( s: Span, ) -> IResult { let (s, a) = keyword("default")(s)?; @@ -436,7 +436,7 @@ pub fn module_or_generate_item_declaration_disable( } #[parser] -pub fn non_port_module_item(s: Span) -> IResult { +pub(crate) fn non_port_module_item(s: Span) -> IResult { alt(( map(generate_region, |x| { NonPortModuleItem::GenerateRegion(Box::new(x)) @@ -464,7 +464,7 @@ pub fn non_port_module_item(s: Span) -> IResult { } #[parser] -pub fn non_port_module_item_specparam(s: Span) -> IResult { +pub(crate) fn non_port_module_item_specparam(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = specparam_declaration(s)?; Ok(( @@ -474,7 +474,7 @@ pub fn non_port_module_item_specparam(s: Span) -> IResult IResult { +pub(crate) fn parameter_override(s: Span) -> IResult { let (s, a) = keyword("defparam")(s)?; let (s, b) = list_of_defparam_assignments(s)?; let (s, c) = symbol(";")(s)?; @@ -482,12 +482,12 @@ pub fn parameter_override(s: Span) -> IResult { } #[parser] -pub fn bind_directive(s: Span) -> IResult { +pub(crate) fn bind_directive(s: Span) -> IResult { alt((bind_directive_scope, bind_directive_instance))(s) } #[parser] -pub fn bind_directive_scope(s: Span) -> IResult { +pub(crate) fn bind_directive_scope(s: Span) -> IResult { let (s, a) = keyword("bind")(s)?; let (s, b) = bind_target_scope(s)?; let (s, c) = opt(pair(symbol(":"), bind_target_instance_list))(s)?; @@ -502,7 +502,7 @@ pub fn bind_directive_scope(s: Span) -> IResult { } #[parser] -pub fn bind_directive_instance(s: Span) -> IResult { +pub(crate) fn bind_directive_instance(s: Span) -> IResult { let (s, a) = keyword("bind")(s)?; let (s, b) = bind_target_instance(s)?; let (s, c) = bind_instantiation(s)?; @@ -516,7 +516,7 @@ pub fn bind_directive_instance(s: Span) -> IResult { } #[parser] -pub fn bind_target_scope(s: Span) -> IResult { +pub(crate) fn bind_target_scope(s: Span) -> IResult { alt(( map(module_identifier, |x| { BindTargetScope::ModuleIdentifier(Box::new(x)) @@ -528,20 +528,20 @@ pub fn bind_target_scope(s: Span) -> IResult { } #[parser] -pub fn bind_target_instance(s: Span) -> IResult { +pub(crate) fn bind_target_instance(s: Span) -> IResult { let (s, a) = hierarchical_identifier(s)?; let (s, b) = constant_bit_select(s)?; Ok((s, BindTargetInstance { nodes: (a, b) })) } #[parser] -pub fn bind_target_instance_list(s: Span) -> IResult { +pub(crate) fn bind_target_instance_list(s: Span) -> IResult { let (s, a) = list(symbol(","), bind_target_instance)(s)?; Ok((s, BindTargetInstanceList { nodes: (a,) })) } #[parser] -pub fn bind_instantiation(s: Span) -> IResult { +pub(crate) fn bind_instantiation(s: Span) -> IResult { alt(( map(program_instantiation, |x| { BindInstantiation::ProgramInstantiation(Box::new(x)) diff --git a/src/parser/source_text/module_parameters_and_ports.rs b/src/parser/source_text/module_parameters_and_ports.rs index ba5d4e0..f92052d 100644 --- a/src/parser/source_text/module_parameters_and_ports.rs +++ b/src/parser/source_text/module_parameters_and_ports.rs @@ -204,7 +204,7 @@ pub struct AnsiPortDeclarationParen { // ----------------------------------------------------------------------------- #[parser] -pub fn parameter_port_list(s: Span) -> IResult { +pub(crate) fn parameter_port_list(s: Span) -> IResult { alt(( parameter_port_list_assignment, parameter_port_list_declaration, @@ -213,7 +213,7 @@ pub fn parameter_port_list(s: Span) -> IResult { } #[parser] -pub fn parameter_port_list_assignment(s: Span) -> IResult { +pub(crate) fn parameter_port_list_assignment(s: Span) -> IResult { let (s, a) = symbol("#")(s)?; let (s, b) = paren(pair( list_of_param_assignments, @@ -226,7 +226,7 @@ pub fn parameter_port_list_assignment(s: Span) -> IResult IResult { +pub(crate) fn parameter_port_list_declaration(s: Span) -> IResult { let (s, a) = symbol("#")(s)?; let (s, b) = paren(list(symbol(","), parameter_port_declaration))(s)?; Ok(( @@ -236,7 +236,7 @@ pub fn parameter_port_list_declaration(s: Span) -> IResult IResult { +pub(crate) fn parameter_port_list_empty(s: Span) -> IResult { let (s, a) = symbol("#")(s)?; let (s, b) = symbol("(")(s)?; let (s, c) = symbol(")")(s)?; @@ -244,7 +244,7 @@ pub fn parameter_port_list_empty(s: Span) -> IResult { } #[parser] -pub fn parameter_port_declaration(s: Span) -> IResult { +pub(crate) fn parameter_port_declaration(s: Span) -> IResult { alt(( map(parameter_declaration, |x| { ParameterPortDeclaration::ParameterDeclaration(Box::new(x)) @@ -258,7 +258,7 @@ pub fn parameter_port_declaration(s: Span) -> IResult IResult { +pub(crate) fn parameter_port_declaration_param_list(s: Span) -> IResult { let (s, a) = data_type(s)?; let (s, b) = list_of_param_assignments(s)?; Ok(( @@ -270,7 +270,7 @@ pub fn parameter_port_declaration_param_list(s: Span) -> IResult IResult { +pub(crate) fn parameter_port_declaration_type_list(s: Span) -> IResult { let (s, a) = keyword("type")(s)?; let (s, b) = list_of_type_assignments(s)?; Ok(( @@ -282,13 +282,13 @@ pub fn parameter_port_declaration_type_list(s: Span) -> IResult IResult { +pub(crate) fn list_of_ports(s: Span) -> IResult { let (s, a) = paren(list(symbol(","), port))(s)?; Ok((s, ListOfPorts { nodes: (a,) })) } #[parser] -pub fn list_of_port_declarations(s: Span) -> IResult { +pub(crate) fn list_of_port_declarations(s: Span) -> IResult { let (s, a) = paren(opt(list( symbol(","), pair(many0(attribute_instance), ansi_port_declaration), @@ -297,7 +297,7 @@ pub fn list_of_port_declarations(s: Span) -> IResult IResult { +pub(crate) fn port_declaration(s: Span) -> IResult { alt(( port_declaration_inout, port_declaration_input, @@ -308,7 +308,7 @@ pub fn port_declaration(s: Span) -> IResult { } #[parser] -pub fn port_declaration_inout(s: Span) -> IResult { +pub(crate) fn port_declaration_inout(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = inout_declaration(s)?; Ok(( @@ -318,7 +318,7 @@ pub fn port_declaration_inout(s: Span) -> IResult { } #[parser] -pub fn port_declaration_input(s: Span) -> IResult { +pub(crate) fn port_declaration_input(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = input_declaration(s)?; Ok(( @@ -328,7 +328,7 @@ pub fn port_declaration_input(s: Span) -> IResult { } #[parser] -pub fn port_declaration_output(s: Span) -> IResult { +pub(crate) fn port_declaration_output(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = output_declaration(s)?; Ok(( @@ -338,7 +338,7 @@ pub fn port_declaration_output(s: Span) -> IResult { } #[parser] -pub fn port_declaration_ref(s: Span) -> IResult { +pub(crate) fn port_declaration_ref(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = ref_declaration(s)?; Ok(( @@ -348,7 +348,7 @@ pub fn port_declaration_ref(s: Span) -> IResult { } #[parser] -pub fn port_declaration_interface(s: Span) -> IResult { +pub(crate) fn port_declaration_interface(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = interface_port_declaration(s)?; Ok(( @@ -358,18 +358,18 @@ pub fn port_declaration_interface(s: Span) -> IResult { } #[parser] -pub fn port(s: Span) -> IResult { +pub(crate) fn port(s: Span) -> IResult { alt((port_non_named, port_named))(s) } #[parser(MaybeRecursive)] -pub fn port_non_named(s: Span) -> IResult { +pub(crate) fn port_non_named(s: Span) -> IResult { let (s, a) = opt(port_expression)(s)?; Ok((s, Port::NonNamed(Box::new(PortNonNamed { nodes: (a,) })))) } #[parser] -pub fn port_named(s: Span) -> IResult { +pub(crate) fn port_named(s: Span) -> IResult { let (s, a) = symbol(".")(s)?; let (s, b) = port_identifier(s)?; let (s, c) = paren(opt(port_expression))(s)?; @@ -377,7 +377,7 @@ pub fn port_named(s: Span) -> IResult { } #[parser] -pub fn port_expression(s: Span) -> IResult { +pub(crate) fn port_expression(s: Span) -> IResult { alt(( map(port_reference, |x| { PortExpression::PortReference(Box::new(x)) @@ -387,7 +387,7 @@ pub fn port_expression(s: Span) -> IResult { } #[parser] -pub fn port_expressio_named(s: Span) -> IResult { +pub(crate) fn port_expressio_named(s: Span) -> IResult { let (s, a) = brace(list(symbol(","), port_reference))(s)?; Ok(( s, @@ -396,14 +396,14 @@ pub fn port_expressio_named(s: Span) -> IResult { } #[parser] -pub fn port_reference(s: Span) -> IResult { +pub(crate) fn port_reference(s: Span) -> IResult { let (s, a) = port_identifier(s)?; let (s, b) = constant_select(s)?; Ok((s, PortReference { nodes: (a, b) })) } #[parser] -pub fn port_direction(s: Span) -> IResult { +pub(crate) fn port_direction(s: Span) -> IResult { alt(( map(keyword("input"), |x| PortDirection::Input(Box::new(x))), map(keyword("output"), |x| PortDirection::Output(Box::new(x))), @@ -413,21 +413,21 @@ pub fn port_direction(s: Span) -> IResult { } #[parser] -pub fn net_port_header(s: Span) -> IResult { +pub(crate) fn net_port_header(s: Span) -> IResult { let (s, a) = opt(port_direction)(s)?; let (s, b) = net_port_type(s)?; Ok((s, NetPortHeader { nodes: (a, b) })) } #[parser] -pub fn variable_port_header(s: Span) -> IResult { +pub(crate) fn variable_port_header(s: Span) -> IResult { let (s, a) = opt(port_direction)(s)?; let (s, b) = variable_port_type(s)?; Ok((s, VariablePortHeader { nodes: (a, b) })) } #[parser] -pub fn interface_port_header(s: Span) -> IResult { +pub(crate) fn interface_port_header(s: Span) -> IResult { alt(( interface_port_header_identifier, interface_port_header_interface, @@ -435,7 +435,7 @@ pub fn interface_port_header(s: Span) -> IResult { } #[parser] -pub fn interface_port_header_identifier(s: Span) -> IResult { +pub(crate) fn interface_port_header_identifier(s: Span) -> IResult { let (s, a) = interface_identifier(s)?; let (s, b) = opt(pair(symbol("."), modport_identifier))(s)?; Ok(( @@ -445,7 +445,7 @@ pub fn interface_port_header_identifier(s: Span) -> IResult IResult { +pub(crate) fn interface_port_header_interface(s: Span) -> IResult { let (s, a) = keyword("interface")(s)?; let (s, b) = opt(pair(symbol("."), modport_identifier))(s)?; Ok(( @@ -455,7 +455,7 @@ pub fn interface_port_header_interface(s: Span) -> IResult IResult { +pub(crate) fn ansi_port_declaration(s: Span) -> IResult { alt(( ansi_port_declaration_net, ansi_port_declaration_port, @@ -464,7 +464,7 @@ pub fn ansi_port_declaration(s: Span) -> IResult { } #[parser] -pub fn ansi_port_declaration_net(s: Span) -> IResult { +pub(crate) fn ansi_port_declaration_net(s: Span) -> IResult { let (s, a) = opt(net_port_header_or_interface_port_header)(s)?; let (s, b) = port_identifier(s)?; let (s, c) = many0(unpacked_dimension)(s)?; @@ -478,7 +478,7 @@ pub fn ansi_port_declaration_net(s: Span) -> IResult } #[parser] -pub fn net_port_header_or_interface_port_header( +pub(crate) fn net_port_header_or_interface_port_header( s: Span, ) -> IResult { alt(( @@ -492,7 +492,7 @@ pub fn net_port_header_or_interface_port_header( } #[parser] -pub fn ansi_port_declaration_port(s: Span) -> IResult { +pub(crate) fn ansi_port_declaration_port(s: Span) -> IResult { let (s, a) = opt(variable_port_header)(s)?; let (s, b) = port_identifier(s)?; let (s, c) = many0(variable_dimension)(s)?; @@ -506,7 +506,7 @@ pub fn ansi_port_declaration_port(s: Span) -> IResult } #[parser] -pub fn ansi_port_declaration_paren(s: Span) -> IResult { +pub(crate) fn ansi_port_declaration_paren(s: Span) -> IResult { let (s, a) = opt(port_direction)(s)?; let (s, b) = symbol(".")(s)?; let (s, c) = port_identifier(s)?; diff --git a/src/parser/source_text/package_items.rs b/src/parser/source_text/package_items.rs index 54d791c..43612f7 100644 --- a/src/parser/source_text/package_items.rs +++ b/src/parser/source_text/package_items.rs @@ -52,7 +52,7 @@ pub enum AnonymousProgramItem { // ----------------------------------------------------------------------------- #[parser] -pub fn package_item(s: Span) -> IResult { +pub(crate) fn package_item(s: Span) -> IResult { alt(( map(package_or_generate_item_declaration, |x| { PackageItem::PackageOrGenerateItemDeclaration(Box::new(x)) @@ -70,7 +70,7 @@ pub fn package_item(s: Span) -> IResult { } #[parser] -pub fn package_or_generate_item_declaration( +pub(crate) fn package_or_generate_item_declaration( s: Span, ) -> IResult { alt(( @@ -120,7 +120,7 @@ pub fn package_or_generate_item_declaration( } #[parser] -pub fn anonymous_program(s: Span) -> IResult { +pub(crate) fn anonymous_program(s: Span) -> IResult { let (s, a) = keyword("program")(s)?; let (s, b) = symbol(";")(s)?; let (s, c) = many0(anonymous_program_item)(s)?; @@ -134,7 +134,7 @@ pub fn anonymous_program(s: Span) -> IResult { } #[parser] -pub fn anonymous_program_item(s: Span) -> IResult { +pub(crate) fn anonymous_program_item(s: Span) -> IResult { alt(( map(task_declaration, |x| { AnonymousProgramItem::TaskDeclaration(Box::new(x)) diff --git a/src/parser/source_text/program_items.rs b/src/parser/source_text/program_items.rs index b96f1a6..bb59786 100644 --- a/src/parser/source_text/program_items.rs +++ b/src/parser/source_text/program_items.rs @@ -61,7 +61,7 @@ pub enum ProgramGenerateItem { // ----------------------------------------------------------------------------- #[parser] -pub fn program_item(s: Span) -> IResult { +pub(crate) fn program_item(s: Span) -> IResult { alt(( map(pair(port_declaration, symbol(";")), |x| { ProgramItem::PortDeclaration(Box::new(x)) @@ -73,7 +73,7 @@ pub fn program_item(s: Span) -> IResult { } #[parser] -pub fn non_port_program_item(s: Span) -> IResult { +pub(crate) fn non_port_program_item(s: Span) -> IResult { alt(( non_port_program_item_assign, non_port_program_item_module, @@ -90,7 +90,7 @@ pub fn non_port_program_item(s: Span) -> IResult { } #[parser] -pub fn non_port_program_item_assign(s: Span) -> IResult { +pub(crate) fn non_port_program_item_assign(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = continuous_assign(s)?; Ok(( @@ -100,7 +100,7 @@ pub fn non_port_program_item_assign(s: Span) -> IResult IResult { +pub(crate) fn non_port_program_item_module(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = module_or_generate_item_declaration(s)?; Ok(( @@ -110,7 +110,7 @@ pub fn non_port_program_item_module(s: Span) -> IResult IResult { +pub(crate) fn non_port_program_item_initial(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = initial_construct(s)?; Ok(( @@ -120,7 +120,7 @@ pub fn non_port_program_item_initial(s: Span) -> IResult IResult { +pub(crate) fn non_port_program_item_final(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = final_construct(s)?; Ok(( @@ -130,7 +130,7 @@ pub fn non_port_program_item_final(s: Span) -> IResult } #[parser] -pub fn non_port_program_item_assertion(s: Span) -> IResult { +pub(crate) fn non_port_program_item_assertion(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = concurrent_assertion_item(s)?; Ok(( @@ -140,7 +140,7 @@ pub fn non_port_program_item_assertion(s: Span) -> IResult IResult { +pub(crate) fn program_generate_item(s: Span) -> IResult { alt(( map(loop_generate_construct, |x| { ProgramGenerateItem::LoopGenerateConstruct(Box::new(x)) diff --git a/src/parser/source_text/system_verilog_source_text.rs b/src/parser/source_text/system_verilog_source_text.rs index 00fe169..de29f5e 100644 --- a/src/parser/source_text/system_verilog_source_text.rs +++ b/src/parser/source_text/system_verilog_source_text.rs @@ -18,6 +18,7 @@ pub enum Description { ModuleDeclaration(Box), UdpDeclaration(Box), InterfaceDeclaration(Box), + InterfaceClassDeclaration(Box), ProgramDeclaration(Box), PackageDeclaration(Box), PackageItem(Box), @@ -415,14 +416,14 @@ pub struct TimeunitsDeclarationTimeprecisionTimeunit { // ----------------------------------------------------------------------------- #[parser] -pub fn source_text(s: Span) -> IResult { +pub(crate) fn source_text(s: Span) -> IResult { let (s, a) = opt(timeunits_declaration)(s)?; let (s, b) = many0(description)(s)?; Ok((s, SourceText { nodes: (a, b) })) } #[parser] -pub fn description(s: Span) -> IResult { +pub(crate) fn description(s: Span) -> IResult { alt(( map(module_declaration, |x| { Description::ModuleDeclaration(Box::new(x)) @@ -433,6 +434,9 @@ pub fn description(s: Span) -> IResult { map(interface_declaration, |x| { Description::InterfaceDeclaration(Box::new(x)) }), + map(interface_class_declaration, |x| { + Description::InterfaceClassDeclaration(Box::new(x)) + }), map(program_declaration, |x| { Description::ProgramDeclaration(Box::new(x)) }), @@ -448,7 +452,7 @@ pub fn description(s: Span) -> IResult { } #[parser(MaybeRecursive)] -pub fn description_package_item(s: Span) -> IResult { +pub(crate) fn description_package_item(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = package_item(s)?; Ok(( @@ -458,7 +462,7 @@ pub fn description_package_item(s: Span) -> IResult { } #[parser] -pub fn description_bind_directive(s: Span) -> IResult { +pub(crate) fn description_bind_directive(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = bind_directive(s)?; Ok(( @@ -468,7 +472,7 @@ pub fn description_bind_directive(s: Span) -> IResult { } #[parser] -pub fn module_nonansi_header(s: Span) -> IResult { +pub(crate) fn module_nonansi_header(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = module_keyword(s)?; let (s, c) = opt(lifetime)(s)?; @@ -486,7 +490,7 @@ pub fn module_nonansi_header(s: Span) -> IResult { } #[parser] -pub fn module_ansi_header(s: Span) -> IResult { +pub(crate) fn module_ansi_header(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = module_keyword(s)?; let (s, c) = opt(lifetime)(s)?; @@ -504,7 +508,7 @@ pub fn module_ansi_header(s: Span) -> IResult { } #[parser] -pub fn module_declaration(s: Span) -> IResult { +pub(crate) fn module_declaration(s: Span) -> IResult { alt(( module_declaration_nonansi, module_declaration_ansi, @@ -515,7 +519,7 @@ pub fn module_declaration(s: Span) -> IResult { } #[parser] -pub fn module_declaration_nonansi(s: Span) -> IResult { +pub(crate) fn module_declaration_nonansi(s: Span) -> IResult { let (s, a) = module_nonansi_header(s)?; let (s, b) = opt(timeunits_declaration)(s)?; let (s, c) = many0(module_item)(s)?; @@ -530,7 +534,7 @@ pub fn module_declaration_nonansi(s: Span) -> IResult { } #[parser] -pub fn module_declaration_ansi(s: Span) -> IResult { +pub(crate) fn module_declaration_ansi(s: Span) -> IResult { let (s, a) = module_ansi_header(s)?; let (s, b) = opt(timeunits_declaration)(s)?; let (s, c) = many0(non_port_module_item)(s)?; @@ -545,7 +549,7 @@ pub fn module_declaration_ansi(s: Span) -> IResult { } #[parser] -pub fn module_declaration_wildcard(s: Span) -> IResult { +pub(crate) fn module_declaration_wildcard(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = module_keyword(s)?; let (s, c) = opt(lifetime)(s)?; @@ -565,7 +569,7 @@ pub fn module_declaration_wildcard(s: Span) -> IResult } #[parser] -pub fn module_declaration_extern_nonansi(s: Span) -> IResult { +pub(crate) fn module_declaration_extern_nonansi(s: Span) -> IResult { let (s, a) = keyword("extern")(s)?; let (s, b) = module_nonansi_header(s)?; Ok(( @@ -577,7 +581,7 @@ pub fn module_declaration_extern_nonansi(s: Span) -> IResult IResult { +pub(crate) fn module_declaration_extern_ansi(s: Span) -> IResult { let (s, a) = keyword("extern")(s)?; let (s, b) = module_ansi_header(s)?; Ok(( @@ -587,7 +591,7 @@ pub fn module_declaration_extern_ansi(s: Span) -> IResult IResult { +pub(crate) fn module_keyword(s: Span) -> IResult { alt(( map(keyword("module"), |x| ModuleKeyword::Module(Box::new(x))), map(keyword("macromodule"), |x| { @@ -597,7 +601,7 @@ pub fn module_keyword(s: Span) -> IResult { } #[parser] -pub fn interface_declaration(s: Span) -> IResult { +pub(crate) fn interface_declaration(s: Span) -> IResult { alt(( interface_declaration_nonansi, interface_declaration_ansi, @@ -608,7 +612,7 @@ pub fn interface_declaration(s: Span) -> IResult { } #[parser] -pub fn interface_declaration_nonansi(s: Span) -> IResult { +pub(crate) fn interface_declaration_nonansi(s: Span) -> IResult { let (s, a) = interface_nonansi_header(s)?; let (s, b) = opt(timeunits_declaration)(s)?; let (s, c) = many0(interface_item)(s)?; @@ -623,7 +627,7 @@ pub fn interface_declaration_nonansi(s: Span) -> IResult IResult { +pub(crate) fn interface_declaration_ansi(s: Span) -> IResult { let (s, a) = interface_ansi_header(s)?; let (s, b) = opt(timeunits_declaration)(s)?; let (s, c) = many0(non_port_interface_item)(s)?; @@ -638,7 +642,7 @@ pub fn interface_declaration_ansi(s: Span) -> IResult IResult { +pub(crate) fn interface_declaration_wildcard(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = keyword("interface")(s)?; let (s, c) = opt(lifetime)(s)?; @@ -658,7 +662,7 @@ pub fn interface_declaration_wildcard(s: Span) -> IResult IResult { +pub(crate) fn interface_declaration_extern_nonansi(s: Span) -> IResult { let (s, a) = keyword("extern")(s)?; let (s, b) = interface_nonansi_header(s)?; Ok(( @@ -670,7 +674,7 @@ pub fn interface_declaration_extern_nonansi(s: Span) -> IResult IResult { +pub(crate) fn interface_declaration_extern_ansi(s: Span) -> IResult { let (s, a) = keyword("extern")(s)?; let (s, b) = interface_ansi_header(s)?; Ok(( @@ -682,7 +686,7 @@ pub fn interface_declaration_extern_ansi(s: Span) -> IResult IResult { +pub(crate) fn interface_nonansi_header(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = keyword("interface")(s)?; let (s, c) = opt(lifetime)(s)?; @@ -700,7 +704,7 @@ pub fn interface_nonansi_header(s: Span) -> IResult IResult { +pub(crate) fn interface_ansi_header(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = keyword("interface")(s)?; let (s, c) = opt(lifetime)(s)?; @@ -718,7 +722,7 @@ pub fn interface_ansi_header(s: Span) -> IResult { } #[parser] -pub fn program_declaration(s: Span) -> IResult { +pub(crate) fn program_declaration(s: Span) -> IResult { alt(( program_declaration_nonansi, program_declaration_ansi, @@ -729,7 +733,7 @@ pub fn program_declaration(s: Span) -> IResult { } #[parser] -pub fn program_declaration_nonansi(s: Span) -> IResult { +pub(crate) fn program_declaration_nonansi(s: Span) -> IResult { let (s, a) = program_nonansi_header(s)?; let (s, b) = opt(timeunits_declaration)(s)?; let (s, c) = many0(program_item)(s)?; @@ -744,7 +748,7 @@ pub fn program_declaration_nonansi(s: Span) -> IResult } #[parser] -pub fn program_declaration_ansi(s: Span) -> IResult { +pub(crate) fn program_declaration_ansi(s: Span) -> IResult { let (s, a) = program_ansi_header(s)?; let (s, b) = opt(timeunits_declaration)(s)?; let (s, c) = many0(non_port_program_item)(s)?; @@ -759,7 +763,7 @@ pub fn program_declaration_ansi(s: Span) -> IResult { } #[parser] -pub fn program_declaration_wildcard(s: Span) -> IResult { +pub(crate) fn program_declaration_wildcard(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = keyword("program")(s)?; let (s, c) = program_identifier(s)?; @@ -778,7 +782,7 @@ pub fn program_declaration_wildcard(s: Span) -> IResult IResult { +pub(crate) fn program_declaration_extern_nonansi(s: Span) -> IResult { let (s, a) = keyword("extern")(s)?; let (s, b) = program_nonansi_header(s)?; Ok(( @@ -790,7 +794,7 @@ pub fn program_declaration_extern_nonansi(s: Span) -> IResult IResult { +pub(crate) fn program_declaration_extern_ansi(s: Span) -> IResult { let (s, a) = keyword("extern")(s)?; let (s, b) = program_ansi_header(s)?; Ok(( @@ -800,7 +804,7 @@ pub fn program_declaration_extern_ansi(s: Span) -> IResult IResult { +pub(crate) fn program_nonansi_header(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = keyword("prgogram")(s)?; let (s, c) = opt(lifetime)(s)?; @@ -818,7 +822,7 @@ pub fn program_nonansi_header(s: Span) -> IResult { } #[parser] -pub fn program_ansi_header(s: Span) -> IResult { +pub(crate) fn program_ansi_header(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = keyword("program")(s)?; let (s, c) = opt(lifetime)(s)?; @@ -836,7 +840,7 @@ pub fn program_ansi_header(s: Span) -> IResult { } #[parser] -pub fn checker_declaration(s: Span) -> IResult { +pub(crate) fn checker_declaration(s: Span) -> IResult { let (s, a) = keyword("checker")(s)?; let (s, b) = checker_identifier(s)?; let (s, c) = opt(paren(opt(checker_port_list)))(s)?; @@ -853,7 +857,7 @@ pub fn checker_declaration(s: Span) -> IResult { } #[parser] -pub fn class_declaration(s: Span) -> IResult { +pub(crate) fn class_declaration(s: Span) -> IResult { let (s, a) = opt(map(keyword("virtual"), |x| Virtual { nodes: (x,) }))(s)?; let (s, b) = keyword("class")(s)?; let (s, c) = opt(lifetime)(s)?; @@ -881,14 +885,14 @@ pub fn class_declaration(s: Span) -> IResult { } #[parser] -pub fn interface_class_type(s: Span) -> IResult { +pub(crate) fn interface_class_type(s: Span) -> IResult { let (s, a) = ps_class_identifier(s)?; let (s, b) = opt(parameter_value_assignment)(s)?; Ok((s, InterfaceClassType { nodes: (a, b) })) } #[parser] -pub fn interface_class_declaration(s: Span) -> IResult { +pub(crate) fn interface_class_declaration(s: Span) -> IResult { let (s, a) = keyword("interface")(s)?; let (s, b) = keyword("class")(s)?; let (s, c) = class_identifier(s)?; @@ -910,7 +914,7 @@ pub fn interface_class_declaration(s: Span) -> IResult IResult { +pub(crate) fn interface_class_item(s: Span) -> IResult { alt(( map(type_declaration, |x| { InterfaceClassItem::TypeDeclaration(Box::new(x)) @@ -927,7 +931,7 @@ pub fn interface_class_item(s: Span) -> IResult { } #[parser] -pub fn interface_class_item_method(s: Span) -> IResult { +pub(crate) fn interface_class_item_method(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = interface_class_method(s)?; Ok(( @@ -937,7 +941,7 @@ pub fn interface_class_item_method(s: Span) -> IResult } #[parser] -pub fn interface_class_method(s: Span) -> IResult { +pub(crate) fn interface_class_method(s: Span) -> IResult { let (s, a) = keyword("pure")(s)?; let (s, b) = keyword("virtual")(s)?; let (s, c) = method_prototype(s)?; @@ -951,7 +955,7 @@ pub fn interface_class_method(s: Span) -> IResult { } #[parser] -pub fn package_declaration(s: Span) -> IResult { +pub(crate) fn package_declaration(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = keyword("package")(s)?; let (s, c) = opt(lifetime)(s)?; @@ -970,7 +974,7 @@ pub fn package_declaration(s: Span) -> IResult { } #[parser] -pub fn timeunits_declaration(s: Span) -> IResult { +pub(crate) fn timeunits_declaration(s: Span) -> IResult { alt(( timeunits_declaration_timeunit_timeprecision, timeunits_declaration_timeunit, @@ -980,7 +984,7 @@ pub fn timeunits_declaration(s: Span) -> IResult { } #[parser] -pub fn timeunits_declaration_timeunit(s: Span) -> IResult { +pub(crate) fn timeunits_declaration_timeunit(s: Span) -> IResult { let (s, a) = keyword("timeunit")(s)?; let (s, b) = time_literal(s)?; let (s, c) = opt(pair(symbol("/"), time_literal))(s)?; @@ -994,7 +998,7 @@ pub fn timeunits_declaration_timeunit(s: Span) -> IResult IResult { +pub(crate) fn timeunits_declaration_timeprecision(s: Span) -> IResult { let (s, a) = keyword("timeprecision")(s)?; let (s, b) = time_literal(s)?; let (s, c) = symbol(";")(s)?; @@ -1007,7 +1011,7 @@ pub fn timeunits_declaration_timeprecision(s: Span) -> IResult IResult { let (s, a) = keyword("timeunit")(s)?; @@ -1027,7 +1031,7 @@ pub fn timeunits_declaration_timeunit_timeprecision( } #[parser] -pub fn timeunits_declaration_timeprecision_timeunit( +pub(crate) fn timeunits_declaration_timeprecision_timeunit( s: Span, ) -> IResult { let (s, a) = keyword("timeprecision")(s)?; diff --git a/src/parser/specify_section/specify_block_declaration.rs b/src/parser/specify_section/specify_block_declaration.rs index bf1ae7e..cd56150 100644 --- a/src/parser/specify_section/specify_block_declaration.rs +++ b/src/parser/specify_section/specify_block_declaration.rs @@ -34,7 +34,7 @@ pub struct ShowcancelledDeclaration { // ----------------------------------------------------------------------------- #[parser] -pub fn specify_block(s: Span) -> IResult { +pub(crate) fn specify_block(s: Span) -> IResult { let (s, a) = keyword("specify")(s)?; let (s, b) = many0(specify_item)(s)?; let (s, c) = keyword("endspecify")(s)?; @@ -42,7 +42,7 @@ pub fn specify_block(s: Span) -> IResult { } #[parser] -pub fn specify_item(s: Span) -> IResult { +pub(crate) fn specify_item(s: Span) -> IResult { alt(( map(specparam_declaration, |x| { SpecifyItem::SpecparamDeclaration(Box::new(x)) @@ -63,7 +63,7 @@ pub fn specify_item(s: Span) -> IResult { } #[parser] -pub fn pulsestyle_declaration(s: Span) -> IResult { +pub(crate) fn pulsestyle_declaration(s: Span) -> IResult { let (s, a) = alt(( keyword("pulsestyle_onevent"), keyword("pulsestyle_ondetect"), @@ -74,7 +74,7 @@ pub fn pulsestyle_declaration(s: Span) -> IResult { } #[parser] -pub fn showcancelled_declaration(s: Span) -> IResult { +pub(crate) fn showcancelled_declaration(s: Span) -> IResult { let (s, a) = alt((keyword("showcalcelled"), keyword("noshowcancelled")))(s)?; let (s, b) = list_of_path_outputs(s)?; let (s, c) = symbol(";")(s)?; diff --git a/src/parser/specify_section/specify_block_terminals.rs b/src/parser/specify_section/specify_block_terminals.rs index f858d1b..ac0b9fb 100644 --- a/src/parser/specify_section/specify_block_terminals.rs +++ b/src/parser/specify_section/specify_block_terminals.rs @@ -43,14 +43,14 @@ pub struct OutputIdentifierInterface { // ----------------------------------------------------------------------------- #[parser] -pub fn specify_input_terminal_descriptor(s: Span) -> IResult { +pub(crate) fn specify_input_terminal_descriptor(s: Span) -> IResult { let (s, a) = input_identifier(s)?; let (s, b) = opt(bracket(constant_range_expression))(s)?; Ok((s, SpecifyInputTerminalDescriptor { nodes: (a, b) })) } #[parser] -pub fn specify_output_terminal_descriptor( +pub(crate) fn specify_output_terminal_descriptor( s: Span, ) -> IResult { let (s, a) = output_identifier(s)?; @@ -59,7 +59,7 @@ pub fn specify_output_terminal_descriptor( } #[parser] -pub fn input_identifier(s: Span) -> IResult { +pub(crate) fn input_identifier(s: Span) -> IResult { alt(( map(input_port_identifier, |x| { InputIdentifier::InputPortIdentifier(Box::new(x)) @@ -72,7 +72,7 @@ pub fn input_identifier(s: Span) -> IResult { } #[parser] -pub fn input_identifier_interface(s: Span) -> IResult { +pub(crate) fn input_identifier_interface(s: Span) -> IResult { let (s, a) = interface_identifier(s)?; let (s, b) = symbol(".")(s)?; let (s, c) = port_identifier(s)?; @@ -83,7 +83,7 @@ pub fn input_identifier_interface(s: Span) -> IResult { } #[parser] -pub fn output_identifier(s: Span) -> IResult { +pub(crate) fn output_identifier(s: Span) -> IResult { alt(( map(output_port_identifier, |x| { OutputIdentifier::OutputPortIdentifier(Box::new(x)) @@ -96,7 +96,7 @@ pub fn output_identifier(s: Span) -> IResult { } #[parser] -pub fn output_identifier_interface(s: Span) -> IResult { +pub(crate) fn output_identifier_interface(s: Span) -> IResult { let (s, a) = interface_identifier(s)?; let (s, b) = symbol(".")(s)?; let (s, c) = port_identifier(s)?; diff --git a/src/parser/specify_section/specify_path_declarations.rs b/src/parser/specify_section/specify_path_declarations.rs index c1af8f5..7120b06 100644 --- a/src/parser/specify_section/specify_path_declarations.rs +++ b/src/parser/specify_section/specify_path_declarations.rs @@ -67,7 +67,7 @@ pub struct ListOfPathOutputs { // ----------------------------------------------------------------------------- #[parser] -pub fn path_declaration(s: Span) -> IResult { +pub(crate) fn path_declaration(s: Span) -> IResult { alt(( map(pair(simple_path_declaration, symbol(";")), |x| { PathDeclaration::SimplePathDeclaration(Box::new(x)) @@ -82,7 +82,7 @@ pub fn path_declaration(s: Span) -> IResult { } #[parser] -pub fn simple_path_declaration(s: Span) -> IResult { +pub(crate) fn simple_path_declaration(s: Span) -> IResult { alt(( simple_path_declaration_parallel, simple_path_declaration_full, @@ -90,7 +90,7 @@ pub fn simple_path_declaration(s: Span) -> IResult } #[parser] -pub fn simple_path_declaration_parallel(s: Span) -> IResult { +pub(crate) fn simple_path_declaration_parallel(s: Span) -> IResult { let (s, a) = parallel_path_description(s)?; let (s, b) = symbol("=")(s)?; let (s, c) = path_delay_value(s)?; @@ -103,7 +103,7 @@ pub fn simple_path_declaration_parallel(s: Span) -> IResult IResult { +pub(crate) fn simple_path_declaration_full(s: Span) -> IResult { let (s, a) = full_path_description(s)?; let (s, b) = symbol("=")(s)?; let (s, c) = path_delay_value(s)?; @@ -114,7 +114,7 @@ pub fn simple_path_declaration_full(s: Span) -> IResult IResult { +pub(crate) fn parallel_path_description(s: Span) -> IResult { let (s, a) = paren(tuple(( specify_input_terminal_descriptor, opt(polarity_operator), @@ -125,7 +125,7 @@ pub fn parallel_path_description(s: Span) -> IResult IResult { +pub(crate) fn full_path_description(s: Span) -> IResult { let (s, a) = paren(tuple(( list_of_path_inputs, opt(polarity_operator), @@ -136,13 +136,13 @@ pub fn full_path_description(s: Span) -> IResult { } #[parser] -pub fn list_of_path_inputs(s: Span) -> IResult { +pub(crate) fn list_of_path_inputs(s: Span) -> IResult { let (s, a) = list(symbol(","), specify_input_terminal_descriptor)(s)?; Ok((s, ListOfPathInputs { nodes: (a,) })) } #[parser] -pub fn list_of_path_outputs(s: Span) -> IResult { +pub(crate) fn list_of_path_outputs(s: Span) -> IResult { let (s, a) = list(symbol(","), specify_output_terminal_descriptor)(s)?; Ok((s, ListOfPathOutputs { nodes: (a,) })) } diff --git a/src/parser/specify_section/specify_path_delays.rs b/src/parser/specify_section/specify_path_delays.rs index 7442703..fdbccbb 100644 --- a/src/parser/specify_section/specify_path_delays.rs +++ b/src/parser/specify_section/specify_path_delays.rs @@ -130,7 +130,7 @@ pub struct PolarityOperator { // ----------------------------------------------------------------------------- #[parser] -pub fn path_delay_value(s: Span) -> IResult { +pub(crate) fn path_delay_value(s: Span) -> IResult { alt(( map(list_of_path_delay_expressions, |x| { PathDelayValue::ListOfPathDelayExpressions(Box::new(x)) @@ -140,7 +140,7 @@ pub fn path_delay_value(s: Span) -> IResult { } #[parser] -pub fn path_delay_value_paren(s: Span) -> IResult { +pub(crate) fn path_delay_value_paren(s: Span) -> IResult { let (s, a) = paren(list_of_path_delay_expressions)(s)?; Ok(( s, @@ -149,25 +149,25 @@ pub fn path_delay_value_paren(s: Span) -> IResult { } #[parser] -pub fn list_of_path_delay_expressions(s: Span) -> IResult { +pub(crate) fn list_of_path_delay_expressions(s: Span) -> IResult { let (s, a) = list(symbol(","), t_path_delay_expression)(s)?; Ok((s, ListOfPathDelayExpressions { nodes: (a,) })) } #[parser] -pub fn t_path_delay_expression(s: Span) -> IResult { +pub(crate) fn t_path_delay_expression(s: Span) -> IResult { let (s, a) = path_delay_expression(s)?; Ok((s, TPathDelayExpression { nodes: (a,) })) } #[parser] -pub fn path_delay_expression(s: Span) -> IResult { +pub(crate) fn path_delay_expression(s: Span) -> IResult { let (s, a) = constant_mintypmax_expression(s)?; Ok((s, PathDelayExpression { nodes: (a,) })) } #[parser] -pub fn edge_sensitive_path_declaration(s: Span) -> IResult { +pub(crate) fn edge_sensitive_path_declaration(s: Span) -> IResult { alt(( edge_sensitive_path_declaration_parallel, edge_sensitive_path_declaration_full, @@ -175,7 +175,7 @@ pub fn edge_sensitive_path_declaration(s: Span) -> IResult IResult { let (s, a) = parallel_edge_sensitive_path_description(s)?; @@ -190,7 +190,7 @@ pub fn edge_sensitive_path_declaration_parallel( } #[parser] -pub fn edge_sensitive_path_declaration_full( +pub(crate) fn edge_sensitive_path_declaration_full( s: Span, ) -> IResult { let (s, a) = full_edge_sensitive_path_description(s)?; @@ -205,7 +205,7 @@ pub fn edge_sensitive_path_declaration_full( } #[parser] -pub fn parallel_edge_sensitive_path_description( +pub(crate) fn parallel_edge_sensitive_path_description( s: Span, ) -> IResult { let (s, a) = paren(tuple(( @@ -224,7 +224,7 @@ pub fn parallel_edge_sensitive_path_description( } #[parser] -pub fn full_edge_sensitive_path_description( +pub(crate) fn full_edge_sensitive_path_description( s: Span, ) -> IResult { let (s, a) = paren(tuple(( @@ -243,13 +243,13 @@ pub fn full_edge_sensitive_path_description( } #[parser] -pub fn data_source_expression(s: Span) -> IResult { +pub(crate) fn data_source_expression(s: Span) -> IResult { let (s, a) = expression(s)?; Ok((s, DataSourceExpression { nodes: (a,) })) } #[parser] -pub fn edge_identifier(s: Span) -> IResult { +pub(crate) fn edge_identifier(s: Span) -> IResult { alt(( map(keyword("posedge"), |x| EdgeIdentifier::Posedge(Box::new(x))), map(keyword("negedge"), |x| EdgeIdentifier::Negedge(Box::new(x))), @@ -258,7 +258,7 @@ pub fn edge_identifier(s: Span) -> IResult { } #[parser] -pub fn state_dependent_path_declaration(s: Span) -> IResult { +pub(crate) fn state_dependent_path_declaration(s: Span) -> IResult { alt(( state_dependent_path_declaration_if_simple, state_dependent_path_declaration_if_edge_sensitive, @@ -267,7 +267,7 @@ pub fn state_dependent_path_declaration(s: Span) -> IResult IResult { let (s, a) = keyword("if")(s)?; @@ -282,7 +282,7 @@ pub fn state_dependent_path_declaration_if_simple( } #[parser] -pub fn state_dependent_path_declaration_if_edge_sensitive( +pub(crate) fn state_dependent_path_declaration_if_edge_sensitive( s: Span, ) -> IResult { let (s, a) = keyword("if")(s)?; @@ -297,7 +297,7 @@ pub fn state_dependent_path_declaration_if_edge_sensitive( } #[parser] -pub fn state_dependent_path_declaration_if_none( +pub(crate) fn state_dependent_path_declaration_if_none( s: Span, ) -> IResult { let (s, a) = keyword("ifnone")(s)?; @@ -311,7 +311,7 @@ pub fn state_dependent_path_declaration_if_none( } #[parser] -pub fn polarity_operator(s: Span) -> IResult { +pub(crate) fn polarity_operator(s: Span) -> IResult { alt(( map(symbol("+"), |x| PolarityOperator { nodes: (x,) }), map(symbol("-"), |x| PolarityOperator { nodes: (x,) }), diff --git a/src/parser/specify_section/system_timing_check_command_arguments.rs b/src/parser/specify_section/system_timing_check_command_arguments.rs index b9d9ac1..1fe991b 100644 --- a/src/parser/specify_section/system_timing_check_command_arguments.rs +++ b/src/parser/specify_section/system_timing_check_command_arguments.rs @@ -91,25 +91,25 @@ pub struct TimingCheckLimit { // ----------------------------------------------------------------------------- #[parser] -pub fn timecheck_condition(s: Span) -> IResult { +pub(crate) fn timecheck_condition(s: Span) -> IResult { let (s, a) = mintypmax_expression(s)?; Ok((s, TimecheckCondition { nodes: (a,) })) } #[parser] -pub fn controlled_referecne_event(s: Span) -> IResult { +pub(crate) fn controlled_referecne_event(s: Span) -> IResult { let (s, a) = controlled_timing_check_event(s)?; Ok((s, ControlledReferenceEvent { nodes: (a,) })) } #[parser] -pub fn data_event(s: Span) -> IResult { +pub(crate) fn data_event(s: Span) -> IResult { let (s, a) = timing_check_event(s)?; Ok((s, DataEvent { nodes: (a,) })) } #[parser] -pub fn delayed_data(s: Span) -> IResult { +pub(crate) fn delayed_data(s: Span) -> IResult { alt(( map(terminal_identifier, |x| { DelayedData::TerminalIdentifier(Box::new(x)) @@ -119,7 +119,7 @@ pub fn delayed_data(s: Span) -> IResult { } #[parser] -pub fn delayed_data_with_mintypmax(s: Span) -> IResult { +pub(crate) fn delayed_data_with_mintypmax(s: Span) -> IResult { let (s, a) = terminal_identifier(s)?; let (s, b) = bracket(constant_mintypmax_expression)(s)?; Ok(( @@ -129,7 +129,7 @@ pub fn delayed_data_with_mintypmax(s: Span) -> IResult { } #[parser] -pub fn delayed_reference(s: Span) -> IResult { +pub(crate) fn delayed_reference(s: Span) -> IResult { alt(( map(terminal_identifier, |x| { DelayedReference::TerminalIdentifier(Box::new(x)) @@ -139,7 +139,7 @@ pub fn delayed_reference(s: Span) -> IResult { } #[parser] -pub fn delayed_reference_with_mintypmax(s: Span) -> IResult { +pub(crate) fn delayed_reference_with_mintypmax(s: Span) -> IResult { let (s, a) = terminal_identifier(s)?; let (s, b) = bracket(constant_mintypmax_expression)(s)?; Ok(( @@ -149,55 +149,55 @@ pub fn delayed_reference_with_mintypmax(s: Span) -> IResult IResult { +pub(crate) fn end_edge_offset(s: Span) -> IResult { let (s, a) = mintypmax_expression(s)?; Ok((s, EndEdgeOffset { nodes: (a,) })) } #[parser] -pub fn event_based_flag(s: Span) -> IResult { +pub(crate) fn event_based_flag(s: Span) -> IResult { let (s, a) = constant_expression(s)?; Ok((s, EventBasedFlag { nodes: (a,) })) } #[parser] -pub fn notifier(s: Span) -> IResult { +pub(crate) fn notifier(s: Span) -> IResult { let (s, a) = variable_identifier(s)?; Ok((s, Notifier { nodes: (a,) })) } #[parser] -pub fn referecne_event(s: Span) -> IResult { +pub(crate) fn referecne_event(s: Span) -> IResult { let (s, a) = timing_check_event(s)?; Ok((s, ReferenceEvent { nodes: (a,) })) } #[parser] -pub fn remain_active_flag(s: Span) -> IResult { +pub(crate) fn remain_active_flag(s: Span) -> IResult { let (s, a) = constant_mintypmax_expression(s)?; Ok((s, RemainActiveFlag { nodes: (a,) })) } #[parser] -pub fn timestamp_condition(s: Span) -> IResult { +pub(crate) fn timestamp_condition(s: Span) -> IResult { let (s, a) = mintypmax_expression(s)?; Ok((s, TimestampCondition { nodes: (a,) })) } #[parser] -pub fn start_edge_offset(s: Span) -> IResult { +pub(crate) fn start_edge_offset(s: Span) -> IResult { let (s, a) = mintypmax_expression(s)?; Ok((s, StartEdgeOffset { nodes: (a,) })) } #[parser] -pub fn threshold(s: Span) -> IResult { +pub(crate) fn threshold(s: Span) -> IResult { let (s, a) = constant_expression(s)?; Ok((s, Threshold { nodes: (a,) })) } #[parser] -pub fn timing_check_limit(s: Span) -> IResult { +pub(crate) fn timing_check_limit(s: Span) -> IResult { let (s, a) = expression(s)?; Ok((s, TimingCheckLimit { nodes: (a,) })) } diff --git a/src/parser/specify_section/system_timing_check_commands.rs b/src/parser/specify_section/system_timing_check_commands.rs index 82b367f..6f7ebef 100644 --- a/src/parser/specify_section/system_timing_check_commands.rs +++ b/src/parser/specify_section/system_timing_check_commands.rs @@ -272,7 +272,7 @@ pub struct NochargeTimingCheck { // ----------------------------------------------------------------------------- #[parser] -pub fn system_timing_check(s: Span) -> IResult { +pub(crate) fn system_timing_check(s: Span) -> IResult { alt(( map(setup_timing_check, |x| { SystemTimingCheck::SetupTimingCheck(Box::new(x)) @@ -314,7 +314,7 @@ pub fn system_timing_check(s: Span) -> IResult { } #[parser] -pub fn setup_timing_check(s: Span) -> IResult { +pub(crate) fn setup_timing_check(s: Span) -> IResult { let (s, a) = keyword("$setup")(s)?; let (s, b) = paren(tuple(( data_event, @@ -329,7 +329,7 @@ pub fn setup_timing_check(s: Span) -> IResult { } #[parser] -pub fn hold_timing_check(s: Span) -> IResult { +pub(crate) fn hold_timing_check(s: Span) -> IResult { let (s, a) = keyword("$setup")(s)?; let (s, b) = paren(tuple(( referecne_event, @@ -344,7 +344,7 @@ pub fn hold_timing_check(s: Span) -> IResult { } #[parser] -pub fn setuphold_timing_check(s: Span) -> IResult { +pub(crate) fn setuphold_timing_check(s: Span) -> IResult { let (s, a) = keyword("$setuphold")(s)?; let (s, b) = paren(tuple(( referecne_event, @@ -377,7 +377,7 @@ pub fn setuphold_timing_check(s: Span) -> IResult { } #[parser] -pub fn recovery_timing_check(s: Span) -> IResult { +pub(crate) fn recovery_timing_check(s: Span) -> IResult { let (s, a) = keyword("$recovery")(s)?; let (s, b) = paren(tuple(( referecne_event, @@ -392,7 +392,7 @@ pub fn recovery_timing_check(s: Span) -> IResult { } #[parser] -pub fn removal_timing_check(s: Span) -> IResult { +pub(crate) fn removal_timing_check(s: Span) -> IResult { let (s, a) = keyword("$removal")(s)?; let (s, b) = paren(tuple(( referecne_event, @@ -407,7 +407,7 @@ pub fn removal_timing_check(s: Span) -> IResult { } #[parser] -pub fn recrem_timing_check(s: Span) -> IResult { +pub(crate) fn recrem_timing_check(s: Span) -> IResult { let (s, a) = keyword("$recrem")(s)?; let (s, b) = paren(tuple(( referecne_event, @@ -440,7 +440,7 @@ pub fn recrem_timing_check(s: Span) -> IResult { } #[parser] -pub fn skew_timing_check(s: Span) -> IResult { +pub(crate) fn skew_timing_check(s: Span) -> IResult { let (s, a) = keyword("$skew")(s)?; let (s, b) = paren(tuple(( referecne_event, @@ -455,7 +455,7 @@ pub fn skew_timing_check(s: Span) -> IResult { } #[parser] -pub fn timeskew_timing_check(s: Span) -> IResult { +pub(crate) fn timeskew_timing_check(s: Span) -> IResult { let (s, a) = keyword("$timeskew")(s)?; let (s, b) = paren(tuple(( referecne_event, @@ -478,7 +478,7 @@ pub fn timeskew_timing_check(s: Span) -> IResult { } #[parser] -pub fn fullskew_timing_check(s: Span) -> IResult { +pub(crate) fn fullskew_timing_check(s: Span) -> IResult { let (s, a) = keyword("$fullskew")(s)?; let (s, b) = paren(tuple(( referecne_event, @@ -503,7 +503,7 @@ pub fn fullskew_timing_check(s: Span) -> IResult { } #[parser] -pub fn period_timing_check(s: Span) -> IResult { +pub(crate) fn period_timing_check(s: Span) -> IResult { let (s, a) = keyword("$period")(s)?; let (s, b) = paren(tuple(( controlled_referecne_event, @@ -516,7 +516,7 @@ pub fn period_timing_check(s: Span) -> IResult { } #[parser] -pub fn width_timing_check(s: Span) -> IResult { +pub(crate) fn width_timing_check(s: Span) -> IResult { let (s, a) = keyword("$width")(s)?; let (s, b) = paren(tuple(( controlled_referecne_event, @@ -531,7 +531,7 @@ pub fn width_timing_check(s: Span) -> IResult { } #[parser] -pub fn nocharge_timing_check(s: Span) -> IResult { +pub(crate) fn nocharge_timing_check(s: Span) -> IResult { let (s, a) = keyword("$nocharge")(s)?; let (s, b) = paren(tuple(( referecne_event, diff --git a/src/parser/specify_section/system_timing_check_event_definitions.rs b/src/parser/specify_section/system_timing_check_event_definitions.rs index 99db472..491ebcb 100644 --- a/src/parser/specify_section/system_timing_check_event_definitions.rs +++ b/src/parser/specify_section/system_timing_check_event_definitions.rs @@ -85,7 +85,7 @@ pub struct ScalarConstant { // ----------------------------------------------------------------------------- #[parser] -pub fn timing_check_event(s: Span) -> IResult { +pub(crate) fn timing_check_event(s: Span) -> IResult { let (s, a) = opt(timing_check_event_control)(s)?; let (s, b) = specify_terminal_descriptor(s)?; let (s, c) = opt(pair(symbol("&&&"), timing_check_condition))(s)?; @@ -93,7 +93,7 @@ pub fn timing_check_event(s: Span) -> IResult { } #[parser] -pub fn controlled_timing_check_event(s: Span) -> IResult { +pub(crate) fn controlled_timing_check_event(s: Span) -> IResult { let (s, a) = timing_check_event_control(s)?; let (s, b) = specify_terminal_descriptor(s)?; let (s, c) = opt(pair(symbol("&&&"), timing_check_condition))(s)?; @@ -101,7 +101,7 @@ pub fn controlled_timing_check_event(s: Span) -> IResult IResult { +pub(crate) fn timing_check_event_control(s: Span) -> IResult { alt(( map(keyword("posedge"), |x| { TimingCheckEventControl::Posedge(Box::new(x)) @@ -119,7 +119,7 @@ pub fn timing_check_event_control(s: Span) -> IResult IResult { +pub(crate) fn specify_terminal_descriptor(s: Span) -> IResult { alt(( map(specify_input_terminal_descriptor, |x| { SpecifyTerminalDescriptor::SpecifyInputTerminalDescriptor(Box::new(x)) @@ -131,14 +131,14 @@ pub fn specify_terminal_descriptor(s: Span) -> IResult IResult { +pub(crate) fn edge_control_specifier(s: Span) -> IResult { let (s, a) = keyword("edge")(s)?; let (s, b) = bracket(list(symbol(","), edge_descriptor))(s)?; Ok((s, EdgeControlSpecifier { nodes: (a, b) })) } #[parser] -pub fn edge_descriptor(s: Span) -> IResult { +pub(crate) fn edge_descriptor(s: Span) -> IResult { alt(( map(keyword("01"), |x| EdgeDescriptor { nodes: (x,) }), map(keyword("10"), |x| EdgeDescriptor { nodes: (x,) }), @@ -162,7 +162,7 @@ pub fn edge_descriptor(s: Span) -> IResult { } #[parser] -pub fn timing_check_condition(s: Span) -> IResult { +pub(crate) fn timing_check_condition(s: Span) -> IResult { alt(( map(scalar_timing_check_condition, |x| { TimingCheckCondition::ScalarTimingCheckCondition(Box::new(x)) @@ -172,7 +172,7 @@ pub fn timing_check_condition(s: Span) -> IResult { } #[parser] -pub fn timing_check_condition_paren(s: Span) -> IResult { +pub(crate) fn timing_check_condition_paren(s: Span) -> IResult { let (s, a) = paren(scalar_timing_check_condition)(s)?; Ok(( s, @@ -181,7 +181,7 @@ pub fn timing_check_condition_paren(s: Span) -> IResult IResult { +pub(crate) fn scalar_timing_check_condition(s: Span) -> IResult { alt(( map(expression, |x| { ScalarTimingCheckCondition::Expression(Box::new(x)) @@ -192,7 +192,7 @@ pub fn scalar_timing_check_condition(s: Span) -> IResult IResult { +pub(crate) fn scalar_timing_check_condition_unary(s: Span) -> IResult { let (s, a) = symbol("~")(s)?; let (s, b) = expression(s)?; Ok(( @@ -204,7 +204,7 @@ pub fn scalar_timing_check_condition_unary(s: Span) -> IResult IResult { +pub(crate) fn scalar_timing_check_condition_binary(s: Span) -> IResult { let (s, a) = expression(s)?; let (s, b) = alt((symbol("==="), symbol("=="), symbol("!=="), symbol("!=")))(s)?; let (s, c) = scalar_constant(s)?; @@ -217,7 +217,7 @@ pub fn scalar_timing_check_condition_binary(s: Span) -> IResult IResult { +pub(crate) fn scalar_constant(s: Span) -> IResult { alt(( map(keyword("1'b0"), |x| ScalarConstant { nodes: (x,) }), map(keyword("1'b1"), |x| ScalarConstant { nodes: (x,) }), diff --git a/src/parser/udp_declaration_and_instantiation/udp_body.rs b/src/parser/udp_declaration_and_instantiation/udp_body.rs index 7e2db96..fc90690 100644 --- a/src/parser/udp_declaration_and_instantiation/udp_body.rs +++ b/src/parser/udp_declaration_and_instantiation/udp_body.rs @@ -118,7 +118,7 @@ pub struct EdgeSymbol { // ----------------------------------------------------------------------------- #[parser] -pub fn udp_body(s: Span) -> IResult { +pub(crate) fn udp_body(s: Span) -> IResult { alt(( map(combinational_body, |x| { UdpBody::CombinationalBody(Box::new(x)) @@ -128,7 +128,7 @@ pub fn udp_body(s: Span) -> IResult { } #[parser] -pub fn combinational_body(s: Span) -> IResult { +pub(crate) fn combinational_body(s: Span) -> IResult { let (s, a) = keyword("table")(s)?; let (s, b) = combinational_entry(s)?; let (s, c) = many0(combinational_entry)(s)?; @@ -142,7 +142,7 @@ pub fn combinational_body(s: Span) -> IResult { } #[parser] -pub fn combinational_entry(s: Span) -> IResult { +pub(crate) fn combinational_entry(s: Span) -> IResult { let (s, a) = level_input_list(s)?; let (s, b) = symbol(":")(s)?; let (s, c) = output_symbol(s)?; @@ -156,7 +156,7 @@ pub fn combinational_entry(s: Span) -> IResult { } #[parser] -pub fn sequential_body(s: Span) -> IResult { +pub(crate) fn sequential_body(s: Span) -> IResult { let (s, a) = opt(udp_initial_statement)(s)?; let (s, b) = keyword("table")(s)?; let (s, c) = sequential_entry(s)?; @@ -171,7 +171,7 @@ pub fn sequential_body(s: Span) -> IResult { } #[parser] -pub fn udp_initial_statement(s: Span) -> IResult { +pub(crate) fn udp_initial_statement(s: Span) -> IResult { let (s, a) = keyword("initial")(s)?; let (s, b) = output_port_identifier(s)?; let (s, c) = symbol("=")(s)?; @@ -186,7 +186,7 @@ pub fn udp_initial_statement(s: Span) -> IResult { } #[parser] -pub fn init_val(s: Span) -> IResult { +pub(crate) fn init_val(s: Span) -> IResult { alt(( map(keyword("1'b0"), |x| InitVal { nodes: (x,) }), map(keyword("1'b1"), |x| InitVal { nodes: (x,) }), @@ -202,7 +202,7 @@ pub fn init_val(s: Span) -> IResult { } #[parser] -pub fn sequential_entry(s: Span) -> IResult { +pub(crate) fn sequential_entry(s: Span) -> IResult { let (s, a) = seq_input_list(s)?; let (s, b) = symbol(":")(s)?; let (s, c) = current_state(s)?; @@ -218,7 +218,7 @@ pub fn sequential_entry(s: Span) -> IResult { } #[parser] -pub fn seq_input_list(s: Span) -> IResult { +pub(crate) fn seq_input_list(s: Span) -> IResult { alt(( map(level_input_list, |x| { SeqInputList::LevelInputList(Box::new(x)) @@ -230,14 +230,14 @@ pub fn seq_input_list(s: Span) -> IResult { } #[parser] -pub fn level_input_list(s: Span) -> IResult { +pub(crate) fn level_input_list(s: Span) -> IResult { let (s, a) = level_symbol(s)?; let (s, b) = many0(level_symbol)(s)?; Ok((s, LevelInputList { nodes: (a, b) })) } #[parser] -pub fn edge_input_list(s: Span) -> IResult { +pub(crate) fn edge_input_list(s: Span) -> IResult { let (s, a) = many0(level_symbol)(s)?; let (s, b) = edge_indicator(s)?; let (s, c) = many0(level_symbol)(s)?; @@ -245,7 +245,7 @@ pub fn edge_input_list(s: Span) -> IResult { } #[parser] -pub fn edge_indicator(s: Span) -> IResult { +pub(crate) fn edge_indicator(s: Span) -> IResult { alt(( edge_indicator_paren, map(edge_symbol, |x| EdgeIndicator::EdgeSymbol(Box::new(x))), @@ -253,7 +253,7 @@ pub fn edge_indicator(s: Span) -> IResult { } #[parser] -pub fn edge_indicator_paren(s: Span) -> IResult { +pub(crate) fn edge_indicator_paren(s: Span) -> IResult { let (s, a) = paren(pair(level_symbol, level_symbol))(s)?; Ok(( s, @@ -262,13 +262,13 @@ pub fn edge_indicator_paren(s: Span) -> IResult { } #[parser] -pub fn current_state(s: Span) -> IResult { +pub(crate) fn current_state(s: Span) -> IResult { let (s, a) = level_symbol(s)?; Ok((s, CurrentState { nodes: (a,) })) } #[parser] -pub fn next_state(s: Span) -> IResult { +pub(crate) fn next_state(s: Span) -> IResult { alt(( map(output_symbol, |x| NextState::OutputSymbol(Box::new(x))), map(symbol("-"), |x| NextState::Minus(Box::new(x))), @@ -276,7 +276,7 @@ pub fn next_state(s: Span) -> IResult { } #[parser] -pub fn output_symbol(s: Span) -> IResult { +pub(crate) fn output_symbol(s: Span) -> IResult { alt(( map(keyword("0"), |x| OutputSymbol { nodes: (x,) }), map(keyword("1"), |x| OutputSymbol { nodes: (x,) }), @@ -286,7 +286,7 @@ pub fn output_symbol(s: Span) -> IResult { } #[parser] -pub fn level_symbol(s: Span) -> IResult { +pub(crate) fn level_symbol(s: Span) -> IResult { alt(( map(keyword("0"), |x| LevelSymbol { nodes: (x,) }), map(keyword("1"), |x| LevelSymbol { nodes: (x,) }), @@ -299,7 +299,7 @@ pub fn level_symbol(s: Span) -> IResult { } #[parser] -pub fn edge_symbol(s: Span) -> IResult { +pub(crate) fn edge_symbol(s: Span) -> IResult { alt(( map(keyword("r"), |x| EdgeSymbol { nodes: (x,) }), map(keyword("R"), |x| EdgeSymbol { nodes: (x,) }), diff --git a/src/parser/udp_declaration_and_instantiation/udp_declaration.rs b/src/parser/udp_declaration_and_instantiation/udp_declaration.rs index e4e109a..366242c 100644 --- a/src/parser/udp_declaration_and_instantiation/udp_declaration.rs +++ b/src/parser/udp_declaration_and_instantiation/udp_declaration.rs @@ -89,7 +89,7 @@ pub struct UdpDeclarationWildcard { // ----------------------------------------------------------------------------- #[parser] -pub fn udp_nonansi_declaration(s: Span) -> IResult { +pub(crate) fn udp_nonansi_declaration(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = keyword("primitive")(s)?; let (s, c) = udp_identifier(s)?; @@ -104,7 +104,7 @@ pub fn udp_nonansi_declaration(s: Span) -> IResult } #[parser] -pub fn udp_ansi_declaration(s: Span) -> IResult { +pub(crate) fn udp_ansi_declaration(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = keyword("primitive")(s)?; let (s, c) = udp_identifier(s)?; @@ -119,7 +119,7 @@ pub fn udp_ansi_declaration(s: Span) -> IResult { } #[parser] -pub fn udp_declaration(s: Span) -> IResult { +pub(crate) fn udp_declaration(s: Span) -> IResult { alt(( udp_declaration_nonansi, udp_declaration_ansi, @@ -130,7 +130,7 @@ pub fn udp_declaration(s: Span) -> IResult { } #[parser] -pub fn udp_declaration_nonansi(s: Span) -> IResult { +pub(crate) fn udp_declaration_nonansi(s: Span) -> IResult { let (s, a) = udp_nonansi_declaration(s)?; let (s, b) = udp_port_declaration(s)?; let (s, c) = many0(udp_port_declaration)(s)?; @@ -146,7 +146,7 @@ pub fn udp_declaration_nonansi(s: Span) -> IResult { } #[parser] -pub fn udp_declaration_ansi(s: Span) -> IResult { +pub(crate) fn udp_declaration_ansi(s: Span) -> IResult { let (s, a) = udp_ansi_declaration(s)?; let (s, b) = udp_body(s)?; let (s, c) = keyword("endprimitive")(s)?; @@ -160,7 +160,7 @@ pub fn udp_declaration_ansi(s: Span) -> IResult { } #[parser] -pub fn udp_declaration_extern_nonansi(s: Span) -> IResult { +pub(crate) fn udp_declaration_extern_nonansi(s: Span) -> IResult { let (s, a) = keyword("extern")(s)?; let (s, b) = udp_nonansi_declaration(s)?; Ok(( @@ -170,7 +170,7 @@ pub fn udp_declaration_extern_nonansi(s: Span) -> IResult } #[parser] -pub fn udp_declaration_extern_ansi(s: Span) -> IResult { +pub(crate) fn udp_declaration_extern_ansi(s: Span) -> IResult { let (s, a) = keyword("extern")(s)?; let (s, b) = udp_ansi_declaration(s)?; Ok(( @@ -180,7 +180,7 @@ pub fn udp_declaration_extern_ansi(s: Span) -> IResult { } #[parser] -pub fn udp_declaration_wildcard(s: Span) -> IResult { +pub(crate) fn udp_declaration_wildcard(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = keyword("primitive")(s)?; let (s, c) = udp_identifier(s)?; diff --git a/src/parser/udp_declaration_and_instantiation/udp_instantiation.rs b/src/parser/udp_declaration_and_instantiation/udp_instantiation.rs index 43a0a1a..8d91dcc 100644 --- a/src/parser/udp_declaration_and_instantiation/udp_instantiation.rs +++ b/src/parser/udp_declaration_and_instantiation/udp_instantiation.rs @@ -34,7 +34,7 @@ pub struct UdpInstance { // ----------------------------------------------------------------------------- #[parser] -pub fn udp_instantiation(s: Span) -> IResult { +pub(crate) fn udp_instantiation(s: Span) -> IResult { let (s, a) = udp_identifier(s)?; let (s, b) = opt(drive_strength)(s)?; let (s, c) = opt(delay2)(s)?; @@ -49,7 +49,7 @@ pub fn udp_instantiation(s: Span) -> IResult { } #[parser] -pub fn udp_instance(s: Span) -> IResult { +pub(crate) fn udp_instance(s: Span) -> IResult { let (s, a) = opt(name_of_instance)(s)?; let (s, b) = paren(tuple(( output_terminal, diff --git a/src/parser/udp_declaration_and_instantiation/udp_ports.rs b/src/parser/udp_declaration_and_instantiation/udp_ports.rs index 0f7f4ba..8a8f891 100644 --- a/src/parser/udp_declaration_and_instantiation/udp_ports.rs +++ b/src/parser/udp_declaration_and_instantiation/udp_ports.rs @@ -68,7 +68,7 @@ pub struct UdpRegDeclaration { // ----------------------------------------------------------------------------- #[parser] -pub fn udp_port_list(s: Span) -> IResult { +pub(crate) fn udp_port_list(s: Span) -> IResult { let (s, a) = output_port_identifier(s)?; let (s, b) = symbol(",")(s)?; let (s, c) = list(symbol(","), input_port_identifier)(s)?; @@ -76,7 +76,7 @@ pub fn udp_port_list(s: Span) -> IResult { } #[parser] -pub fn udp_declaration_port_list(s: Span) -> IResult { +pub(crate) fn udp_declaration_port_list(s: Span) -> IResult { let (s, a) = udp_output_declaration(s)?; let (s, b) = symbol(",")(s)?; let (s, c) = list(symbol(","), udp_input_declaration)(s)?; @@ -84,7 +84,7 @@ pub fn udp_declaration_port_list(s: Span) -> IResult IResult { +pub(crate) fn udp_port_declaration(s: Span) -> IResult { alt(( map(pair(udp_output_declaration, symbol(";")), |x| { UdpPortDeclaration::UdpOutputDeclaration(Box::new(x)) @@ -99,12 +99,12 @@ pub fn udp_port_declaration(s: Span) -> IResult { } #[parser] -pub fn udp_output_declaration(s: Span) -> IResult { +pub(crate) fn udp_output_declaration(s: Span) -> IResult { alt((udp_output_declaration_nonreg, udp_output_declaration_reg))(s) } #[parser] -pub fn udp_output_declaration_nonreg(s: Span) -> IResult { +pub(crate) fn udp_output_declaration_nonreg(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = keyword("output")(s)?; let (s, c) = port_identifier(s)?; @@ -115,7 +115,7 @@ pub fn udp_output_declaration_nonreg(s: Span) -> IResult IResult { +pub(crate) fn udp_output_declaration_reg(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = keyword("output")(s)?; let (s, c) = keyword("reg")(s)?; @@ -130,7 +130,7 @@ pub fn udp_output_declaration_reg(s: Span) -> IResult IResult { +pub(crate) fn udp_input_declaration(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = keyword("input")(s)?; let (s, c) = list_of_udp_port_identifiers(s)?; @@ -138,7 +138,7 @@ pub fn udp_input_declaration(s: Span) -> IResult { } #[parser] -pub fn udp_reg_declaration(s: Span) -> IResult { +pub(crate) fn udp_reg_declaration(s: Span) -> IResult { let (s, a) = many0(attribute_instance)(s)?; let (s, b) = keyword("reg")(s)?; let (s, c) = variable_identifier(s)?; diff --git a/src/parser/utils.rs b/src/parser/utils.rs index a6ca129..2ec0f8d 100644 --- a/src/parser/utils.rs +++ b/src/parser/utils.rs @@ -304,7 +304,7 @@ pub struct List { // ----------------------------------------------------------------------------- -pub fn ws<'a, O, F>(f: F) -> impl Fn(Span<'a>) -> IResult, (O, Vec)> +pub(crate) fn ws<'a, O, F>(f: F) -> impl Fn(Span<'a>) -> IResult, (O, Vec)> where F: Fn(Span<'a>) -> IResult, O>, { @@ -315,7 +315,7 @@ where } } -pub fn symbol<'a>(t: &'a str) -> impl Fn(Span<'a>) -> IResult, Symbol> { +pub(crate) fn symbol<'a>(t: &'a str) -> impl Fn(Span<'a>) -> IResult, Symbol> { move |s: Span<'a>| { #[cfg(feature = "trace")] let s = trace(s, &format!("symbol(\"{}\")", t)); @@ -326,7 +326,7 @@ pub fn symbol<'a>(t: &'a str) -> impl Fn(Span<'a>) -> IResult, Symbol> } } -pub fn keyword<'a>(t: &'a str) -> impl Fn(Span<'a>) -> IResult, Keyword> { +pub(crate) fn keyword<'a>(t: &'a str) -> impl Fn(Span<'a>) -> IResult, Keyword> { move |s: Span<'a>| { #[cfg(feature = "trace")] let s = trace(s, &format!("keyword(\"{}\")", t)); @@ -341,7 +341,7 @@ pub fn keyword<'a>(t: &'a str) -> impl Fn(Span<'a>) -> IResult, Keyword } } -pub fn paren<'a, O, F>(f: F) -> impl Fn(Span<'a>) -> IResult, Paren> +pub(crate) fn paren<'a, O, F>(f: F) -> impl Fn(Span<'a>) -> IResult, Paren> where F: Fn(Span<'a>) -> IResult, O>, { @@ -355,7 +355,7 @@ where } } -pub fn bracket<'a, O, F>(f: F) -> impl Fn(Span<'a>) -> IResult, Bracket> +pub(crate) fn bracket<'a, O, F>(f: F) -> impl Fn(Span<'a>) -> IResult, Bracket> where F: Fn(Span<'a>) -> IResult, O>, { @@ -369,7 +369,7 @@ where } } -pub fn brace<'a, O, F>(f: F) -> impl Fn(Span<'a>) -> IResult, Brace> +pub(crate) fn brace<'a, O, F>(f: F) -> impl Fn(Span<'a>) -> IResult, Brace> where F: Fn(Span<'a>) -> IResult, O>, { @@ -383,7 +383,7 @@ where } } -pub fn apostrophe_brace<'a, O, F>( +pub(crate) fn apostrophe_brace<'a, O, F>( f: F, ) -> impl Fn(Span<'a>) -> IResult, ApostropheBrace> where @@ -399,7 +399,10 @@ where } } -pub fn list<'a, O1, O2, F, G>(f: F, g: G) -> impl Fn(Span<'a>) -> IResult, List> +pub(crate) fn list<'a, O1, O2, F, G>( + f: F, + g: G, +) -> impl Fn(Span<'a>) -> IResult, List> where F: Fn(Span<'a>) -> IResult, O1>, G: Fn(Span<'a>) -> IResult, O2>, @@ -421,7 +424,7 @@ where } } -pub fn triple<'a, O1, O2, O3, F, G, H>( +pub(crate) fn triple<'a, O1, O2, O3, F, G, H>( f: F, g: G, h: H, @@ -439,14 +442,14 @@ where } } -pub fn none<'a, O, F>(_f: F) -> impl Fn(Span<'a>) -> IResult, Option> +pub(crate) fn none<'a, O, F>(_f: F) -> impl Fn(Span<'a>) -> IResult, Option> where F: Fn(Span<'a>) -> IResult, O>, { move |s: Span<'a>| Ok((s, None)) } -pub fn alt_left<'a, O, F, G>(f: F, _g: G) -> impl Fn(Span<'a>) -> IResult, O> +pub(crate) fn alt_left<'a, O, F, G>(f: F, _g: G) -> impl Fn(Span<'a>) -> IResult, O> where F: Fn(Span<'a>) -> IResult, O>, G: Fn(Span<'a>) -> IResult, O>, @@ -457,7 +460,7 @@ where } } -pub fn alt_right<'a, O, F, G>(_f: F, g: G) -> impl Fn(Span<'a>) -> IResult, O> +pub(crate) fn alt_right<'a, O, F, G>(_f: F, g: G) -> impl Fn(Span<'a>) -> IResult, O> where F: Fn(Span<'a>) -> IResult, O>, G: Fn(Span<'a>) -> IResult, O>, @@ -471,7 +474,7 @@ where // ----------------------------------------------------------------------------- #[parser] -pub fn white_space(s: Span) -> IResult { +pub(crate) fn white_space(s: Span) -> IResult { alt(( map(multispace1, |x: Span| WhiteSpace::Space(Box::new(x.into()))), map(comment, |x| WhiteSpace::Comment(Box::new(x))), @@ -480,7 +483,7 @@ pub fn white_space(s: Span) -> IResult { // ----------------------------------------------------------------------------- -pub fn concat<'a>(a: Span<'a>, b: Span<'a>) -> Option> { +pub(crate) fn concat<'a>(a: Span<'a>, b: Span<'a>) -> Option> { let c = str_concat::concat(a.fragment, b.fragment); if let Ok(c) = c { Some(Span { @@ -494,14 +497,14 @@ pub fn concat<'a>(a: Span<'a>, b: Span<'a>) -> Option> { } } -pub fn check_recursive_flag(s: Span, id: usize) -> bool { +pub(crate) fn check_recursive_flag(s: Span, id: usize) -> bool { let upper = id / 128; let lower = id % 128; ((s.extra.recursive_flag[upper] >> lower) & 1) == 1 } -pub fn set_recursive_flag(mut s: Span, id: usize, bit: bool) -> Span { +pub(crate) fn set_recursive_flag(mut s: Span, id: usize, bit: bool) -> Span { let upper = id / 128; let lower = id % 128; @@ -514,12 +517,12 @@ pub fn set_recursive_flag(mut s: Span, id: usize, bit: bool) -> Span { s } -pub fn clear_recursive_flags(mut s: Span) -> Span { +pub(crate) fn clear_recursive_flags(mut s: Span) -> Span { s.extra.recursive_flag = [0; RECURSIVE_FLAG_WORDS]; s } -pub fn is_keyword(s: &Span) -> bool { +pub(crate) fn is_keyword(s: &Span) -> bool { for k in KEYWORDS { if &s.fragment == k { return true; @@ -529,7 +532,7 @@ pub fn is_keyword(s: &Span) -> bool { } #[cfg(feature = "trace")] -pub fn trace<'a>(mut s: Span<'a>, name: &str) -> Span<'a> { +pub(crate) fn trace<'a>(mut s: Span<'a>, name: &str) -> Span<'a> { println!( "{:<128} : {:<4},{:>032x} : {}", format!("{}{}", " ".repeat(s.extra.depth), name),