Refine loop detection

This commit is contained in:
dalance 2019-07-17 10:48:15 +09:00
parent d0ed56e092
commit 6d2f7e729a
69 changed files with 1350 additions and 21 deletions

View File

@ -11,6 +11,10 @@ description = ""
edition = "2018" edition = "2018"
build = "build.rs" build = "build.rs"
[features]
default = []
trace = []
[dependencies] [dependencies]
nom = "5.0.0" nom = "5.0.0"
nom_locate = { git = "https://github.com/fflorent/nom_locate" } nom_locate = { git = "https://github.com/fflorent/nom_locate" }

View File

@ -123,8 +123,102 @@ pub fn trace(_attr: TokenStream, item: TokenStream) -> TokenStream {
fn impl_trace(item: &syn::ItemFn) -> TokenStream { fn impl_trace(item: &syn::ItemFn) -> TokenStream {
let ident = &item.ident; let ident = &item.ident;
let mut item = item.clone(); let mut item = item.clone();
let tracer = quote! { let tracer = quote! {
println!("{}: {:?}", stringify!(#ident), s); if cfg!(feature = "trace") {
println!("{:<48} : {:<4},{:>032x} : {}", stringify!(#ident), s.offset, s.extra, s.fragment);
}
};
let tracer: TokenStream = tracer.into();
let tracer = parse_macro_input!(tracer as syn::Stmt);
let checker = quote! {
if thread_context::TABLE.with(|t| {
if let Some(i) = t.borrow_mut().get_or_allocate(stringify!(#ident)) {
return check_bit(s, i);
} else {
return false
}
}) {
if cfg!(feature = "trace") {
println!("{:<48} : loop detect", stringify!(#ident));
}
return Err(nom::Err::Error(nom::error::make_error(s, nom::error::ErrorKind::Fix)));
}
};
let checker: TokenStream = checker.into();
let checker = parse_macro_input!(checker as syn::Stmt);
let before = quote! {
let s = thread_context::TABLE.with(|t| {
if let Some(i) = t.borrow_mut().get_or_allocate(stringify!(#ident)) {
//println!("{}:{} set", stringify!(#ident), i);
set_bit(s, i, true)
} else {
if cfg!(feature = "trace") {
println!("{:<48} : allocate failed", stringify!(#ident));
}
s
}
});
};
let before: TokenStream = before.into();
let before = parse_macro_input!(before as syn::Stmt);
let mut body = quote! {};
for s in &item.block.stmts {
body = quote! {
#body
#s
};
}
let body = quote! {
let (s, ret) = { #body }?;
};
let body: TokenStream = body.into();
let body = parse_macro_input!(body as syn::Stmt);
let after = quote! {
Ok((clear_bit(s), ret))
};
let after: TokenStream = after.into();
let after = parse_macro_input!(after as syn::Expr);
let after = syn::Stmt::Expr(after);
item.block.stmts.clear();
item.block.stmts.push(tracer);
item.block.stmts.push(checker);
item.block.stmts.push(before);
item.block.stmts.push(body);
item.block.stmts.push(after);
let gen = quote! {
#item
};
gen.into()
}
#[proc_macro_attribute]
pub fn rec(_attr: TokenStream, item: TokenStream) -> TokenStream {
let item = parse_macro_input!(item as ItemFn);
impl_rec(&item)
}
fn impl_rec(item: &syn::ItemFn) -> TokenStream {
let ident = &item.ident;
let mut item = item.clone();
let tracer = quote! {
if thread_context::MAP_MUT.with(|m| {
if let Some(x) = m.borrow().get(stringify!(#ident)) {
if *x == s.offset {
return true;
}
}
m.borrow_mut().insert(stringify!(#ident), s.offset);
false
}) {
return Err(nom::Err::Error(nom::error::make_error(s, nom::error::ErrorKind::Fix)));
}
}; };
let tracer: TokenStream = tracer.into(); let tracer: TokenStream = tracer.into();
let tracer = parse_macro_input!(tracer as syn::Stmt); let tracer = parse_macro_input!(tracer as syn::Stmt);

View File

@ -21,7 +21,68 @@ pub use source_text::*;
pub use specify_section::*; pub use specify_section::*;
pub use udp_declaration_and_instantiation::*; pub use udp_declaration_and_instantiation::*;
pub type Span<'a> = nom_locate::LocatedSpanEx<&'a str, u64>; pub type Span<'a> = nom_locate::LocatedSpanEx<&'a str, u128>;
// IDs for left recursion detection // IDs for left recursion detection
static REC_PRIMARY: u32 = 0; //static REC_PRIMARY: u32 = 0;
mod thread_context {
use std::cell::RefCell;
use std::collections::HashMap;
thread_local!(
pub static MAP_MUT: RefCell<HashMap<(&'static str, &'static str, u32, u32), usize>> = {
RefCell::new(HashMap::new())
}
);
#[derive(Debug)]
pub struct Table {
index: HashMap<&'static str, u32>,
offset: HashMap<&'static str, usize>,
allocated: u128,
}
impl Table {
pub fn get(&self, key: &'static str) -> Option<u32> {
if let Some(x) = self.index.get(key) {
Some(*x)
} else {
None
}
}
pub fn get_or_allocate(&mut self, key: &'static str) -> Option<u32> {
if let Some(x) = self.index.get(key) {
Some(*x)
} else {
let allocated = self.allocated;
for i in 0..128 {
if ((allocated >> i) & 1) == 0 {
let val = 1u128 << i;
let mask = !(1u128 << i);
self.allocated = (allocated & mask) | val;
self.index.insert(key, i);
return Some(i);
}
}
None
}
}
pub fn release(&mut self, key: &'static str) {
if let Some(x) = self.index.get(key) {
let mask = !(1u128 << *x);
self.allocated = self.allocated & mask;
self.index.remove(key);
}
}
}
thread_local!(
pub static TABLE: RefCell<Table> = {
RefCell::new(Table{index: HashMap::new(), offset: HashMap::new(), allocated: 0})
}
);
}

View File

@ -101,6 +101,7 @@ pub enum AssertTiming<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn assertion_item(s: Span) -> IResult<Span, AssertionItem> { pub fn assertion_item(s: Span) -> IResult<Span, AssertionItem> {
alt(( alt((
map(concurrent_assertion_item, |x| AssertionItem::Concurrent(x)), map(concurrent_assertion_item, |x| AssertionItem::Concurrent(x)),
@ -110,12 +111,14 @@ pub fn assertion_item(s: Span) -> IResult<Span, AssertionItem> {
))(s) ))(s)
} }
#[trace]
pub fn deferred_immediate_assertion_item(s: Span) -> IResult<Span, DeferredImmediateAssetionItem> { pub fn deferred_immediate_assertion_item(s: Span) -> IResult<Span, DeferredImmediateAssetionItem> {
let (s, a) = opt(pair(block_identifier, symbol(":")))(s)?; let (s, a) = opt(pair(block_identifier, symbol(":")))(s)?;
let (s, b) = deferred_immediate_assertion_statement(s)?; let (s, b) = deferred_immediate_assertion_statement(s)?;
Ok((s, DeferredImmediateAssetionItem { nodes: (a, b) })) Ok((s, DeferredImmediateAssetionItem { nodes: (a, b) }))
} }
#[trace]
pub fn procedural_assertion_statement(s: Span) -> IResult<Span, ProceduralAssertionStatement> { pub fn procedural_assertion_statement(s: Span) -> IResult<Span, ProceduralAssertionStatement> {
alt(( alt((
map(concurrent_assertion_statement, |x| { map(concurrent_assertion_statement, |x| {
@ -130,6 +133,7 @@ pub fn procedural_assertion_statement(s: Span) -> IResult<Span, ProceduralAssert
))(s) ))(s)
} }
#[trace]
pub fn immediate_assertion_statement(s: Span) -> IResult<Span, ImmediateAssetionStatement> { pub fn immediate_assertion_statement(s: Span) -> IResult<Span, ImmediateAssetionStatement> {
alt(( alt((
map(simple_immediate_assertion_statement, |x| { map(simple_immediate_assertion_statement, |x| {
@ -141,6 +145,7 @@ pub fn immediate_assertion_statement(s: Span) -> IResult<Span, ImmediateAssetion
))(s) ))(s)
} }
#[trace]
pub fn simple_immediate_assertion_statement( pub fn simple_immediate_assertion_statement(
s: Span, s: Span,
) -> IResult<Span, SimpleImmediateAssertionStatement> { ) -> IResult<Span, SimpleImmediateAssertionStatement> {
@ -157,6 +162,7 @@ pub fn simple_immediate_assertion_statement(
))(s) ))(s)
} }
#[trace]
pub fn simple_immediate_assert_statement(s: Span) -> IResult<Span, SimpleImmediateAssertStatement> { pub fn simple_immediate_assert_statement(s: Span) -> IResult<Span, SimpleImmediateAssertStatement> {
let (s, a) = symbol("assert")(s)?; let (s, a) = symbol("assert")(s)?;
let (s, b) = paren(expression)(s)?; let (s, b) = paren(expression)(s)?;
@ -164,6 +170,7 @@ pub fn simple_immediate_assert_statement(s: Span) -> IResult<Span, SimpleImmedia
Ok((s, SimpleImmediateAssertStatement { nodes: (a, b, c) })) Ok((s, SimpleImmediateAssertStatement { nodes: (a, b, c) }))
} }
#[trace]
pub fn simple_immediate_assume_statement(s: Span) -> IResult<Span, SimpleImmediateAssumeStatement> { pub fn simple_immediate_assume_statement(s: Span) -> IResult<Span, SimpleImmediateAssumeStatement> {
let (s, a) = symbol("assume")(s)?; let (s, a) = symbol("assume")(s)?;
let (s, b) = paren(expression)(s)?; let (s, b) = paren(expression)(s)?;
@ -171,6 +178,7 @@ pub fn simple_immediate_assume_statement(s: Span) -> IResult<Span, SimpleImmedia
Ok((s, SimpleImmediateAssumeStatement { nodes: (a, b, c) })) Ok((s, SimpleImmediateAssumeStatement { nodes: (a, b, c) }))
} }
#[trace]
pub fn simple_immediate_cover_statement(s: Span) -> IResult<Span, SimpleImmediateCoverStatement> { pub fn simple_immediate_cover_statement(s: Span) -> IResult<Span, SimpleImmediateCoverStatement> {
let (s, a) = symbol("cover")(s)?; let (s, a) = symbol("cover")(s)?;
let (s, b) = paren(expression)(s)?; let (s, b) = paren(expression)(s)?;
@ -178,6 +186,7 @@ pub fn simple_immediate_cover_statement(s: Span) -> IResult<Span, SimpleImmediat
Ok((s, SimpleImmediateCoverStatement { nodes: (a, b, c) })) Ok((s, SimpleImmediateCoverStatement { nodes: (a, b, c) }))
} }
#[trace]
pub fn deferred_immediate_assertion_statement( pub fn deferred_immediate_assertion_statement(
s: Span, s: Span,
) -> IResult<Span, DeferredImmediateAssertionStatement> { ) -> IResult<Span, DeferredImmediateAssertionStatement> {
@ -194,6 +203,7 @@ pub fn deferred_immediate_assertion_statement(
))(s) ))(s)
} }
#[trace]
pub fn deferred_immediate_assert_statement( pub fn deferred_immediate_assert_statement(
s: Span, s: Span,
) -> IResult<Span, DeferredImmediateAssertStatement> { ) -> IResult<Span, DeferredImmediateAssertStatement> {
@ -209,6 +219,7 @@ pub fn deferred_immediate_assert_statement(
)) ))
} }
#[trace]
pub fn deferred_immediate_assume_statement( pub fn deferred_immediate_assume_statement(
s: Span, s: Span,
) -> IResult<Span, DeferredImmediateAssumeStatement> { ) -> IResult<Span, DeferredImmediateAssumeStatement> {
@ -224,6 +235,7 @@ pub fn deferred_immediate_assume_statement(
)) ))
} }
#[trace]
pub fn deferred_immediate_cover_statement( pub fn deferred_immediate_cover_statement(
s: Span, s: Span,
) -> IResult<Span, DeferredImmediateCoverStatement> { ) -> IResult<Span, DeferredImmediateCoverStatement> {
@ -239,6 +251,7 @@ pub fn deferred_immediate_cover_statement(
)) ))
} }
#[trace]
pub fn assert_timing(s: Span) -> IResult<Span, AssertTiming> { pub fn assert_timing(s: Span) -> IResult<Span, AssertTiming> {
alt(( alt((
map(symbol("#0"), |x| AssertTiming::Zero(x)), map(symbol("#0"), |x| AssertTiming::Zero(x)),

View File

@ -144,6 +144,7 @@ pub struct OpenValueRange<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn case_statement(s: Span) -> IResult<Span, CaseStatement> { pub fn case_statement(s: Span) -> IResult<Span, CaseStatement> {
alt(( alt((
case_statement_normal, case_statement_normal,
@ -152,6 +153,7 @@ pub fn case_statement(s: Span) -> IResult<Span, CaseStatement> {
))(s) ))(s)
} }
#[trace]
pub fn case_statement_normal(s: Span) -> IResult<Span, CaseStatement> { pub fn case_statement_normal(s: Span) -> IResult<Span, CaseStatement> {
let (s, a) = opt(unique_priority)(s)?; let (s, a) = opt(unique_priority)(s)?;
let (s, b) = case_keyword(s)?; let (s, b) = case_keyword(s)?;
@ -167,6 +169,7 @@ pub fn case_statement_normal(s: Span) -> IResult<Span, CaseStatement> {
)) ))
} }
#[trace]
pub fn case_statement_matches(s: Span) -> IResult<Span, CaseStatement> { pub fn case_statement_matches(s: Span) -> IResult<Span, CaseStatement> {
let (s, a) = opt(unique_priority)(s)?; let (s, a) = opt(unique_priority)(s)?;
let (s, b) = case_keyword(s)?; let (s, b) = case_keyword(s)?;
@ -183,6 +186,7 @@ pub fn case_statement_matches(s: Span) -> IResult<Span, CaseStatement> {
)) ))
} }
#[trace]
pub fn case_statement_inside(s: Span) -> IResult<Span, CaseStatement> { pub fn case_statement_inside(s: Span) -> IResult<Span, CaseStatement> {
let (s, a) = opt(unique_priority)(s)?; let (s, a) = opt(unique_priority)(s)?;
let (s, b) = symbol("case")(s)?; let (s, b) = symbol("case")(s)?;
@ -199,6 +203,7 @@ pub fn case_statement_inside(s: Span) -> IResult<Span, CaseStatement> {
)) ))
} }
#[trace]
pub fn case_keyword(s: Span) -> IResult<Span, CaseKeyword> { pub fn case_keyword(s: Span) -> IResult<Span, CaseKeyword> {
alt(( alt((
map(symbol("casez"), |x| CaseKeyword::Casez(x)), map(symbol("casez"), |x| CaseKeyword::Casez(x)),
@ -207,11 +212,13 @@ pub fn case_keyword(s: Span) -> IResult<Span, CaseKeyword> {
))(s) ))(s)
} }
#[trace]
pub fn case_expression(s: Span) -> IResult<Span, CaseExpression> { pub fn case_expression(s: Span) -> IResult<Span, CaseExpression> {
let (s, a) = expression(s)?; let (s, a) = expression(s)?;
Ok((s, CaseExpression { nodes: (a,) })) Ok((s, CaseExpression { nodes: (a,) }))
} }
#[trace]
pub fn case_item(s: Span) -> IResult<Span, CaseItem> { pub fn case_item(s: Span) -> IResult<Span, CaseItem> {
alt(( alt((
case_item_nondefault, case_item_nondefault,
@ -219,6 +226,7 @@ pub fn case_item(s: Span) -> IResult<Span, CaseItem> {
))(s) ))(s)
} }
#[trace]
pub fn case_item_nondefault(s: Span) -> IResult<Span, CaseItem> { pub fn case_item_nondefault(s: Span) -> IResult<Span, CaseItem> {
let (s, a) = list(symbol(","), case_item_expression)(s)?; let (s, a) = list(symbol(","), case_item_expression)(s)?;
let (s, b) = symbol(":")(s)?; let (s, b) = symbol(":")(s)?;
@ -229,6 +237,7 @@ pub fn case_item_nondefault(s: Span) -> IResult<Span, CaseItem> {
)) ))
} }
#[trace]
pub fn case_item_default(s: Span) -> IResult<Span, CaseItemDefault> { pub fn case_item_default(s: Span) -> IResult<Span, CaseItemDefault> {
let (s, a) = symbol("default")(s)?; let (s, a) = symbol("default")(s)?;
let (s, b) = opt(symbol(":"))(s)?; let (s, b) = opt(symbol(":"))(s)?;
@ -236,6 +245,7 @@ pub fn case_item_default(s: Span) -> IResult<Span, CaseItemDefault> {
Ok((s, CaseItemDefault { nodes: (a, b, c) })) Ok((s, CaseItemDefault { nodes: (a, b, c) }))
} }
#[trace]
pub fn case_pattern_item(s: Span) -> IResult<Span, CasePatternItem> { pub fn case_pattern_item(s: Span) -> IResult<Span, CasePatternItem> {
alt(( alt((
case_pattern_item_nondefault, case_pattern_item_nondefault,
@ -243,6 +253,7 @@ pub fn case_pattern_item(s: Span) -> IResult<Span, CasePatternItem> {
))(s) ))(s)
} }
#[trace]
pub fn case_pattern_item_nondefault(s: Span) -> IResult<Span, CasePatternItem> { pub fn case_pattern_item_nondefault(s: Span) -> IResult<Span, CasePatternItem> {
let (s, a) = pattern(s)?; let (s, a) = pattern(s)?;
let (s, b) = opt(pair(symbol("&&&"), expression))(s)?; let (s, b) = opt(pair(symbol("&&&"), expression))(s)?;
@ -256,6 +267,7 @@ pub fn case_pattern_item_nondefault(s: Span) -> IResult<Span, CasePatternItem> {
)) ))
} }
#[trace]
pub fn case_inside_item(s: Span) -> IResult<Span, CaseInsideItem> { pub fn case_inside_item(s: Span) -> IResult<Span, CaseInsideItem> {
alt(( alt((
case_inside_item_nondefault, case_inside_item_nondefault,
@ -263,6 +275,7 @@ pub fn case_inside_item(s: Span) -> IResult<Span, CaseInsideItem> {
))(s) ))(s)
} }
#[trace]
pub fn case_inside_item_nondefault(s: Span) -> IResult<Span, CaseInsideItem> { pub fn case_inside_item_nondefault(s: Span) -> IResult<Span, CaseInsideItem> {
let (s, a) = open_range_list(s)?; let (s, a) = open_range_list(s)?;
let (s, b) = symbol(":")(s)?; let (s, b) = symbol(":")(s)?;
@ -273,11 +286,13 @@ pub fn case_inside_item_nondefault(s: Span) -> IResult<Span, CaseInsideItem> {
)) ))
} }
#[trace]
pub fn case_item_expression(s: Span) -> IResult<Span, CaseItemExpression> { pub fn case_item_expression(s: Span) -> IResult<Span, CaseItemExpression> {
let (s, a) = expression(s)?; let (s, a) = expression(s)?;
Ok((s, CaseItemExpression { nodes: (a,) })) Ok((s, CaseItemExpression { nodes: (a,) }))
} }
#[trace]
pub fn randcase_statement(s: Span) -> IResult<Span, RandcaseStatement> { pub fn randcase_statement(s: Span) -> IResult<Span, RandcaseStatement> {
let (s, a) = symbol("randcase")(s)?; let (s, a) = symbol("randcase")(s)?;
let (s, b) = randcase_item(s)?; let (s, b) = randcase_item(s)?;
@ -291,6 +306,7 @@ pub fn randcase_statement(s: Span) -> IResult<Span, RandcaseStatement> {
)) ))
} }
#[trace]
pub fn randcase_item(s: Span) -> IResult<Span, RandcaseItem> { pub fn randcase_item(s: Span) -> IResult<Span, RandcaseItem> {
let (s, a) = expression(s)?; let (s, a) = expression(s)?;
let (s, b) = symbol(":")(s)?; let (s, b) = symbol(":")(s)?;
@ -298,11 +314,13 @@ pub fn randcase_item(s: Span) -> IResult<Span, RandcaseItem> {
Ok((s, RandcaseItem { nodes: (a, b, c) })) Ok((s, RandcaseItem { nodes: (a, b, c) }))
} }
#[trace]
pub fn open_range_list(s: Span) -> IResult<Span, OpenRangeList> { pub fn open_range_list(s: Span) -> IResult<Span, OpenRangeList> {
let (s, a) = list(symbol(","), open_value_range)(s)?; let (s, a) = list(symbol(","), open_value_range)(s)?;
Ok((s, OpenRangeList { nodes: (a,) })) Ok((s, OpenRangeList { nodes: (a,) }))
} }
#[trace]
pub fn open_value_range(s: Span) -> IResult<Span, OpenValueRange> { pub fn open_value_range(s: Span) -> IResult<Span, OpenValueRange> {
let (s, a) = value_range(s)?; let (s, a) = value_range(s)?;
Ok((s, OpenValueRange { nodes: (a,) })) Ok((s, OpenValueRange { nodes: (a,) }))

View File

@ -202,10 +202,12 @@ pub struct ClockvarExpression<'a> {
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn clocking_declaration(s: Span) -> IResult<Span, ClockingDeclaration> { pub fn clocking_declaration(s: Span) -> IResult<Span, ClockingDeclaration> {
alt((clocking_declaration_local, clocking_declaration_global))(s) alt((clocking_declaration_local, clocking_declaration_global))(s)
} }
#[trace]
pub fn clocking_declaration_local(s: Span) -> IResult<Span, ClockingDeclaration> { pub fn clocking_declaration_local(s: Span) -> IResult<Span, ClockingDeclaration> {
let (s, a) = opt(default)(s)?; let (s, a) = opt(default)(s)?;
let (s, b) = symbol("clocking")(s)?; let (s, b) = symbol("clocking")(s)?;
@ -223,11 +225,13 @@ pub fn clocking_declaration_local(s: Span) -> IResult<Span, ClockingDeclaration>
)) ))
} }
#[trace]
pub fn default(s: Span) -> IResult<Span, Default> { pub fn default(s: Span) -> IResult<Span, Default> {
let (s, a) = symbol("default")(s)?; let (s, a) = symbol("default")(s)?;
Ok((s, Default { nodes: (a,) })) Ok((s, Default { nodes: (a,) }))
} }
#[trace]
pub fn clocking_declaration_global(s: Span) -> IResult<Span, ClockingDeclaration> { pub fn clocking_declaration_global(s: Span) -> IResult<Span, ClockingDeclaration> {
let (s, a) = symbol("global")(s)?; let (s, a) = symbol("global")(s)?;
let (s, b) = symbol("clocking")(s)?; let (s, b) = symbol("clocking")(s)?;
@ -244,10 +248,12 @@ pub fn clocking_declaration_global(s: Span) -> IResult<Span, ClockingDeclaration
)) ))
} }
#[trace]
pub fn clocking_event(s: Span) -> IResult<Span, ClockingEvent> { pub fn clocking_event(s: Span) -> IResult<Span, ClockingEvent> {
alt((clocking_event_identifier, clocking_event_expression))(s) alt((clocking_event_identifier, clocking_event_expression))(s)
} }
#[trace]
pub fn clocking_event_identifier(s: Span) -> IResult<Span, ClockingEvent> { pub fn clocking_event_identifier(s: Span) -> IResult<Span, ClockingEvent> {
let (s, a) = symbol("@")(s)?; let (s, a) = symbol("@")(s)?;
let (s, b) = identifier(s)?; let (s, b) = identifier(s)?;
@ -257,6 +263,7 @@ pub fn clocking_event_identifier(s: Span) -> IResult<Span, ClockingEvent> {
)) ))
} }
#[trace]
pub fn clocking_event_expression(s: Span) -> IResult<Span, ClockingEvent> { pub fn clocking_event_expression(s: Span) -> IResult<Span, ClockingEvent> {
let (s, a) = symbol("@")(s)?; let (s, a) = symbol("@")(s)?;
let (s, b) = paren(event_expression)(s)?; let (s, b) = paren(event_expression)(s)?;
@ -266,6 +273,7 @@ pub fn clocking_event_expression(s: Span) -> IResult<Span, ClockingEvent> {
)) ))
} }
#[trace]
pub fn clocking_item(s: Span) -> IResult<Span, ClockingItem> { pub fn clocking_item(s: Span) -> IResult<Span, ClockingItem> {
alt(( alt((
clocking_item_default, clocking_item_default,
@ -274,6 +282,7 @@ pub fn clocking_item(s: Span) -> IResult<Span, ClockingItem> {
))(s) ))(s)
} }
#[trace]
pub fn clocking_item_default(s: Span) -> IResult<Span, ClockingItem> { pub fn clocking_item_default(s: Span) -> IResult<Span, ClockingItem> {
let (s, a) = symbol("default")(s)?; let (s, a) = symbol("default")(s)?;
let (s, b) = default_skew(s)?; let (s, b) = default_skew(s)?;
@ -284,6 +293,7 @@ pub fn clocking_item_default(s: Span) -> IResult<Span, ClockingItem> {
)) ))
} }
#[trace]
pub fn clocking_item_direction(s: Span) -> IResult<Span, ClockingItem> { pub fn clocking_item_direction(s: Span) -> IResult<Span, ClockingItem> {
let (s, a) = clocking_direction(s)?; let (s, a) = clocking_direction(s)?;
let (s, b) = list_of_clocking_decl_assign(s)?; let (s, b) = list_of_clocking_decl_assign(s)?;
@ -294,6 +304,7 @@ pub fn clocking_item_direction(s: Span) -> IResult<Span, ClockingItem> {
)) ))
} }
#[trace]
pub fn clocking_item_assertion(s: Span) -> IResult<Span, ClockingItem> { pub fn clocking_item_assertion(s: Span) -> IResult<Span, ClockingItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = assertion_item_declaration(s)?; let (s, b) = assertion_item_declaration(s)?;
@ -303,6 +314,7 @@ pub fn clocking_item_assertion(s: Span) -> IResult<Span, ClockingItem> {
)) ))
} }
#[trace]
pub fn default_skew(s: Span) -> IResult<Span, DefaultSkew> { pub fn default_skew(s: Span) -> IResult<Span, DefaultSkew> {
alt(( alt((
default_skew_input, default_skew_input,
@ -311,18 +323,21 @@ pub fn default_skew(s: Span) -> IResult<Span, DefaultSkew> {
))(s) ))(s)
} }
#[trace]
pub fn default_skew_input(s: Span) -> IResult<Span, DefaultSkew> { pub fn default_skew_input(s: Span) -> IResult<Span, DefaultSkew> {
let (s, a) = symbol("input")(s)?; let (s, a) = symbol("input")(s)?;
let (s, b) = clocking_skew(s)?; let (s, b) = clocking_skew(s)?;
Ok((s, DefaultSkew::Input(DefaultSkewInput { nodes: (a, b) }))) Ok((s, DefaultSkew::Input(DefaultSkewInput { nodes: (a, b) })))
} }
#[trace]
pub fn default_skew_output(s: Span) -> IResult<Span, DefaultSkew> { pub fn default_skew_output(s: Span) -> IResult<Span, DefaultSkew> {
let (s, a) = symbol("output")(s)?; let (s, a) = symbol("output")(s)?;
let (s, b) = clocking_skew(s)?; let (s, b) = clocking_skew(s)?;
Ok((s, DefaultSkew::Output(DefaultSkewOutput { nodes: (a, b) }))) Ok((s, DefaultSkew::Output(DefaultSkewOutput { nodes: (a, b) })))
} }
#[trace]
pub fn default_skew_input_output(s: Span) -> IResult<Span, DefaultSkew> { pub fn default_skew_input_output(s: Span) -> IResult<Span, DefaultSkew> {
let (s, a) = symbol("input")(s)?; let (s, a) = symbol("input")(s)?;
let (s, b) = clocking_skew(s)?; let (s, b) = clocking_skew(s)?;
@ -336,6 +351,7 @@ pub fn default_skew_input_output(s: Span) -> IResult<Span, DefaultSkew> {
)) ))
} }
#[trace]
pub fn clocking_direction(s: Span) -> IResult<Span, ClockingDirection> { pub fn clocking_direction(s: Span) -> IResult<Span, ClockingDirection> {
alt(( alt((
clocking_direction_input, clocking_direction_input,
@ -345,6 +361,7 @@ pub fn clocking_direction(s: Span) -> IResult<Span, ClockingDirection> {
))(s) ))(s)
} }
#[trace]
pub fn clocking_direction_input(s: Span) -> IResult<Span, ClockingDirection> { pub fn clocking_direction_input(s: Span) -> IResult<Span, ClockingDirection> {
let (s, a) = symbol("input")(s)?; let (s, a) = symbol("input")(s)?;
let (s, b) = opt(clocking_skew)(s)?; let (s, b) = opt(clocking_skew)(s)?;
@ -354,6 +371,7 @@ pub fn clocking_direction_input(s: Span) -> IResult<Span, ClockingDirection> {
)) ))
} }
#[trace]
pub fn clocking_direction_output(s: Span) -> IResult<Span, ClockingDirection> { pub fn clocking_direction_output(s: Span) -> IResult<Span, ClockingDirection> {
let (s, a) = symbol("output")(s)?; let (s, a) = symbol("output")(s)?;
let (s, b) = opt(clocking_skew)(s)?; let (s, b) = opt(clocking_skew)(s)?;
@ -363,6 +381,7 @@ pub fn clocking_direction_output(s: Span) -> IResult<Span, ClockingDirection> {
)) ))
} }
#[trace]
pub fn clocking_direction_input_output(s: Span) -> IResult<Span, ClockingDirection> { pub fn clocking_direction_input_output(s: Span) -> IResult<Span, ClockingDirection> {
let (s, a) = symbol("input")(s)?; let (s, a) = symbol("input")(s)?;
let (s, b) = opt(clocking_skew)(s)?; let (s, b) = opt(clocking_skew)(s)?;
@ -376,22 +395,26 @@ pub fn clocking_direction_input_output(s: Span) -> IResult<Span, ClockingDirecti
)) ))
} }
#[trace]
pub fn clocking_direction_inout(s: Span) -> IResult<Span, ClockingDirection> { pub fn clocking_direction_inout(s: Span) -> IResult<Span, ClockingDirection> {
let (s, a) = symbol("inout")(s)?; let (s, a) = symbol("inout")(s)?;
Ok((s, ClockingDirection::Inout(a))) Ok((s, ClockingDirection::Inout(a)))
} }
#[trace]
pub fn list_of_clocking_decl_assign(s: Span) -> IResult<Span, ListOfClockingDeclAssign> { pub fn list_of_clocking_decl_assign(s: Span) -> IResult<Span, ListOfClockingDeclAssign> {
let (s, a) = list(symbol(","), clocking_decl_assign)(s)?; let (s, a) = list(symbol(","), clocking_decl_assign)(s)?;
Ok((s, ListOfClockingDeclAssign { nodes: (a,) })) Ok((s, ListOfClockingDeclAssign { nodes: (a,) }))
} }
#[trace]
pub fn clocking_decl_assign(s: Span) -> IResult<Span, ClockingDeclAssign> { pub fn clocking_decl_assign(s: Span) -> IResult<Span, ClockingDeclAssign> {
let (s, a) = signal_identifier(s)?; let (s, a) = signal_identifier(s)?;
let (s, b) = opt(pair(symbol("="), expression))(s)?; let (s, b) = opt(pair(symbol("="), expression))(s)?;
Ok((s, ClockingDeclAssign { nodes: (a, b) })) Ok((s, ClockingDeclAssign { nodes: (a, b) }))
} }
#[trace]
pub fn clocking_skew(s: Span) -> IResult<Span, ClockingSkew> { pub fn clocking_skew(s: Span) -> IResult<Span, ClockingSkew> {
alt(( alt((
clocking_skew_edge, clocking_skew_edge,
@ -399,12 +422,14 @@ pub fn clocking_skew(s: Span) -> IResult<Span, ClockingSkew> {
))(s) ))(s)
} }
#[trace]
pub fn clocking_skew_edge(s: Span) -> IResult<Span, ClockingSkew> { pub fn clocking_skew_edge(s: Span) -> IResult<Span, ClockingSkew> {
let (s, a) = edge_identifier(s)?; let (s, a) = edge_identifier(s)?;
let (s, b) = opt(delay_control)(s)?; let (s, b) = opt(delay_control)(s)?;
Ok((s, ClockingSkew::Edge(ClockingSkewEdge { nodes: (a, b) }))) Ok((s, ClockingSkew::Edge(ClockingSkewEdge { nodes: (a, b) })))
} }
#[trace]
pub fn clocking_drive(s: Span) -> IResult<Span, ClockingDrive> { pub fn clocking_drive(s: Span) -> IResult<Span, ClockingDrive> {
let (s, a) = clockvar_expression(s)?; let (s, a) = clockvar_expression(s)?;
let (s, b) = symbol("<=")(s)?; let (s, b) = symbol("<=")(s)?;
@ -418,6 +443,7 @@ pub fn clocking_drive(s: Span) -> IResult<Span, ClockingDrive> {
)) ))
} }
#[trace]
pub fn cycle_delay(s: Span) -> IResult<Span, CycleDelay> { pub fn cycle_delay(s: Span) -> IResult<Span, CycleDelay> {
alt(( alt((
cycle_delay_integral, cycle_delay_integral,
@ -426,6 +452,7 @@ pub fn cycle_delay(s: Span) -> IResult<Span, CycleDelay> {
))(s) ))(s)
} }
#[trace]
pub fn cycle_delay_integral(s: Span) -> IResult<Span, CycleDelay> { pub fn cycle_delay_integral(s: Span) -> IResult<Span, CycleDelay> {
let (s, a) = symbol("##")(s)?; let (s, a) = symbol("##")(s)?;
let (s, b) = integral_number(s)?; let (s, b) = integral_number(s)?;
@ -435,6 +462,7 @@ pub fn cycle_delay_integral(s: Span) -> IResult<Span, CycleDelay> {
)) ))
} }
#[trace]
pub fn cycle_delay_identifier(s: Span) -> IResult<Span, CycleDelay> { pub fn cycle_delay_identifier(s: Span) -> IResult<Span, CycleDelay> {
let (s, a) = symbol("##")(s)?; let (s, a) = symbol("##")(s)?;
let (s, b) = identifier(s)?; let (s, b) = identifier(s)?;
@ -444,6 +472,7 @@ pub fn cycle_delay_identifier(s: Span) -> IResult<Span, CycleDelay> {
)) ))
} }
#[trace]
pub fn cycle_delay_expression(s: Span) -> IResult<Span, CycleDelay> { pub fn cycle_delay_expression(s: Span) -> IResult<Span, CycleDelay> {
let (s, a) = symbol("##")(s)?; let (s, a) = symbol("##")(s)?;
let (s, b) = paren(expression)(s)?; let (s, b) = paren(expression)(s)?;
@ -453,11 +482,13 @@ pub fn cycle_delay_expression(s: Span) -> IResult<Span, CycleDelay> {
)) ))
} }
#[trace]
pub fn clockvar(s: Span) -> IResult<Span, Clockvar> { pub fn clockvar(s: Span) -> IResult<Span, Clockvar> {
let (s, a) = hierarchical_identifier(s)?; let (s, a) = hierarchical_identifier(s)?;
Ok((s, Clockvar { nodes: (a,) })) Ok((s, Clockvar { nodes: (a,) }))
} }
#[trace]
pub fn clockvar_expression(s: Span) -> IResult<Span, ClockvarExpression> { pub fn clockvar_expression(s: Span) -> IResult<Span, ClockvarExpression> {
let (s, a) = clockvar(s)?; let (s, a) = clockvar(s)?;
let (s, b) = select(s)?; let (s, b) = select(s)?;

View File

@ -50,6 +50,7 @@ pub struct CondPattern<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn conditional_statement(s: Span) -> IResult<Span, ConditionalStatement> { pub fn conditional_statement(s: Span) -> IResult<Span, ConditionalStatement> {
let (s, a) = opt(unique_priority)(s)?; let (s, a) = opt(unique_priority)(s)?;
let (s, b) = symbol("if")(s)?; let (s, b) = symbol("if")(s)?;
@ -71,6 +72,7 @@ pub fn conditional_statement(s: Span) -> IResult<Span, ConditionalStatement> {
)) ))
} }
#[trace]
pub fn unique_priority(s: Span) -> IResult<Span, UniquePriority> { pub fn unique_priority(s: Span) -> IResult<Span, UniquePriority> {
alt(( alt((
map(symbol("unique0"), |x| UniquePriority::Unique0(x)), map(symbol("unique0"), |x| UniquePriority::Unique0(x)),
@ -79,11 +81,13 @@ pub fn unique_priority(s: Span) -> IResult<Span, UniquePriority> {
))(s) ))(s)
} }
#[trace]
pub fn cond_predicate(s: Span) -> IResult<Span, CondPredicate> { pub fn cond_predicate(s: Span) -> IResult<Span, CondPredicate> {
let (s, a) = list(symbol("&&&"), expression_or_cond_pattern)(s)?; let (s, a) = list(symbol("&&&"), expression_or_cond_pattern)(s)?;
Ok((s, CondPredicate { nodes: (a,) })) Ok((s, CondPredicate { nodes: (a,) }))
} }
#[trace]
pub fn expression_or_cond_pattern(s: Span) -> IResult<Span, ExpressionOrCondPattern> { pub fn expression_or_cond_pattern(s: Span) -> IResult<Span, ExpressionOrCondPattern> {
alt(( alt((
map(expression, |x| ExpressionOrCondPattern::Expression(x)), map(expression, |x| ExpressionOrCondPattern::Expression(x)),
@ -91,6 +95,7 @@ pub fn expression_or_cond_pattern(s: Span) -> IResult<Span, ExpressionOrCondPatt
))(s) ))(s)
} }
#[trace]
pub fn cond_pattern(s: Span) -> IResult<Span, CondPattern> { pub fn cond_pattern(s: Span) -> IResult<Span, CondPattern> {
let (s, a) = expression(s)?; let (s, a) = expression(s)?;
let (s, b) = symbol("matches")(s)?; let (s, b) = symbol("matches")(s)?;

View File

@ -61,10 +61,12 @@ pub struct NetAssignment<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn continuous_assign(s: Span) -> IResult<Span, ContinuousAssign> { pub fn continuous_assign(s: Span) -> IResult<Span, ContinuousAssign> {
alt((continuous_assign_net, continuous_assign_variable))(s) alt((continuous_assign_net, continuous_assign_variable))(s)
} }
#[trace]
pub fn continuous_assign_net(s: Span) -> IResult<Span, ContinuousAssign> { pub fn continuous_assign_net(s: Span) -> IResult<Span, ContinuousAssign> {
let (s, a) = symbol("assign")(s)?; let (s, a) = symbol("assign")(s)?;
let (s, b) = opt(drive_strength)(s)?; let (s, b) = opt(drive_strength)(s)?;
@ -80,6 +82,7 @@ pub fn continuous_assign_net(s: Span) -> IResult<Span, ContinuousAssign> {
)) ))
} }
#[trace]
pub fn continuous_assign_variable(s: Span) -> IResult<Span, ContinuousAssign> { pub fn continuous_assign_variable(s: Span) -> IResult<Span, ContinuousAssign> {
let (s, a) = symbol("assign")(s)?; let (s, a) = symbol("assign")(s)?;
let (s, b) = opt(delay_control)(s)?; let (s, b) = opt(delay_control)(s)?;
@ -94,16 +97,19 @@ pub fn continuous_assign_variable(s: Span) -> IResult<Span, ContinuousAssign> {
)) ))
} }
#[trace]
pub fn list_of_net_assignments(s: Span) -> IResult<Span, ListOfNetAssignments> { pub fn list_of_net_assignments(s: Span) -> IResult<Span, ListOfNetAssignments> {
let (s, a) = list(symbol(","), net_assignment)(s)?; let (s, a) = list(symbol(","), net_assignment)(s)?;
Ok((s, ListOfNetAssignments { nodes: (a,) })) Ok((s, ListOfNetAssignments { nodes: (a,) }))
} }
#[trace]
pub fn list_of_variable_assignments(s: Span) -> IResult<Span, ListOfVariableAssignments> { pub fn list_of_variable_assignments(s: Span) -> IResult<Span, ListOfVariableAssignments> {
let (s, a) = list(symbol(","), variable_assignment)(s)?; let (s, a) = list(symbol(","), variable_assignment)(s)?;
Ok((s, ListOfVariableAssignments { nodes: (a,) })) Ok((s, ListOfVariableAssignments { nodes: (a,) }))
} }
#[trace]
pub fn net_alias(s: Span) -> IResult<Span, NetAlias> { pub fn net_alias(s: Span) -> IResult<Span, NetAlias> {
let (s, a) = symbol("alias")(s)?; let (s, a) = symbol("alias")(s)?;
let (s, b) = net_lvalue(s)?; let (s, b) = net_lvalue(s)?;
@ -119,6 +125,7 @@ pub fn net_alias(s: Span) -> IResult<Span, NetAlias> {
)) ))
} }
#[trace]
pub fn net_assignment(s: Span) -> IResult<Span, NetAssignment> { pub fn net_assignment(s: Span) -> IResult<Span, NetAssignment> {
let (s, a) = net_lvalue(s)?; let (s, a) = net_lvalue(s)?;
let (s, b) = symbol("=")(s)?; let (s, b) = symbol("=")(s)?;

View File

@ -120,6 +120,7 @@ pub struct LoopVariables<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn loop_statement(s: Span) -> IResult<Span, LoopStatement> { pub fn loop_statement(s: Span) -> IResult<Span, LoopStatement> {
alt(( alt((
loop_statement_forever, loop_statement_forever,
@ -131,6 +132,7 @@ pub fn loop_statement(s: Span) -> IResult<Span, LoopStatement> {
))(s) ))(s)
} }
#[trace]
pub fn loop_statement_forever(s: Span) -> IResult<Span, LoopStatement> { pub fn loop_statement_forever(s: Span) -> IResult<Span, LoopStatement> {
let (s, a) = symbol("forever")(s)?; let (s, a) = symbol("forever")(s)?;
let (s, b) = statement_or_null(s)?; let (s, b) = statement_or_null(s)?;
@ -140,6 +142,7 @@ pub fn loop_statement_forever(s: Span) -> IResult<Span, LoopStatement> {
)) ))
} }
#[trace]
pub fn loop_statement_repeat(s: Span) -> IResult<Span, LoopStatement> { pub fn loop_statement_repeat(s: Span) -> IResult<Span, LoopStatement> {
let (s, a) = symbol("repeat")(s)?; let (s, a) = symbol("repeat")(s)?;
let (s, b) = paren(expression)(s)?; let (s, b) = paren(expression)(s)?;
@ -150,6 +153,7 @@ pub fn loop_statement_repeat(s: Span) -> IResult<Span, LoopStatement> {
)) ))
} }
#[trace]
pub fn loop_statement_while(s: Span) -> IResult<Span, LoopStatement> { pub fn loop_statement_while(s: Span) -> IResult<Span, LoopStatement> {
let (s, a) = symbol("while")(s)?; let (s, a) = symbol("while")(s)?;
let (s, b) = paren(expression)(s)?; let (s, b) = paren(expression)(s)?;
@ -160,6 +164,7 @@ pub fn loop_statement_while(s: Span) -> IResult<Span, LoopStatement> {
)) ))
} }
#[trace]
pub fn loop_statement_for(s: Span) -> IResult<Span, LoopStatement> { pub fn loop_statement_for(s: Span) -> IResult<Span, LoopStatement> {
let (s, a) = symbol("for")(s)?; let (s, a) = symbol("for")(s)?;
let (s, b) = paren(tuple(( let (s, b) = paren(tuple((
@ -173,6 +178,7 @@ pub fn loop_statement_for(s: Span) -> IResult<Span, LoopStatement> {
Ok((s, LoopStatement::For(LoopStatementFor { nodes: (a, b, c) }))) Ok((s, LoopStatement::For(LoopStatementFor { nodes: (a, b, c) })))
} }
#[trace]
pub fn loop_statement_do_while(s: Span) -> IResult<Span, LoopStatement> { pub fn loop_statement_do_while(s: Span) -> IResult<Span, LoopStatement> {
let (s, a) = symbol("do")(s)?; let (s, a) = symbol("do")(s)?;
let (s, b) = statement_or_null(s)?; let (s, b) = statement_or_null(s)?;
@ -187,6 +193,7 @@ pub fn loop_statement_do_while(s: Span) -> IResult<Span, LoopStatement> {
)) ))
} }
#[trace]
pub fn loop_statement_foreach(s: Span) -> IResult<Span, LoopStatement> { pub fn loop_statement_foreach(s: Span) -> IResult<Span, LoopStatement> {
let (s, a) = symbol("foreach")(s)?; let (s, a) = symbol("foreach")(s)?;
let (s, b) = paren(pair( let (s, b) = paren(pair(
@ -200,6 +207,7 @@ pub fn loop_statement_foreach(s: Span) -> IResult<Span, LoopStatement> {
)) ))
} }
#[trace]
pub fn for_initialization(s: Span) -> IResult<Span, ForInitialization> { pub fn for_initialization(s: Span) -> IResult<Span, ForInitialization> {
alt(( alt((
map(list_of_variable_assignments, |x| { map(list_of_variable_assignments, |x| {
@ -209,6 +217,7 @@ pub fn for_initialization(s: Span) -> IResult<Span, ForInitialization> {
))(s) ))(s)
} }
#[trace]
pub fn for_initialization_declaration(s: Span) -> IResult<Span, ForInitialization> { pub fn for_initialization_declaration(s: Span) -> IResult<Span, ForInitialization> {
let (s, a) = list(symbol(","), for_variable_declaration)(s)?; let (s, a) = list(symbol(","), for_variable_declaration)(s)?;
Ok(( Ok((
@ -217,6 +226,7 @@ pub fn for_initialization_declaration(s: Span) -> IResult<Span, ForInitializatio
)) ))
} }
#[trace]
pub fn for_variable_declaration(s: Span) -> IResult<Span, ForVariableDeclaration> { pub fn for_variable_declaration(s: Span) -> IResult<Span, ForVariableDeclaration> {
let (s, a) = opt(var)(s)?; let (s, a) = opt(var)(s)?;
let (s, b) = data_type(s)?; let (s, b) = data_type(s)?;
@ -227,16 +237,19 @@ pub fn for_variable_declaration(s: Span) -> IResult<Span, ForVariableDeclaration
Ok((s, ForVariableDeclaration { nodes: (a, b, c) })) Ok((s, ForVariableDeclaration { nodes: (a, b, c) }))
} }
#[trace]
pub fn var(s: Span) -> IResult<Span, Var> { pub fn var(s: Span) -> IResult<Span, Var> {
let (s, a) = symbol("var")(s)?; let (s, a) = symbol("var")(s)?;
Ok((s, Var { nodes: (a,) })) Ok((s, Var { nodes: (a,) }))
} }
#[trace]
pub fn for_step(s: Span) -> IResult<Span, ForStep> { pub fn for_step(s: Span) -> IResult<Span, ForStep> {
let (s, a) = list(symbol(","), for_step_assignment)(s)?; let (s, a) = list(symbol(","), for_step_assignment)(s)?;
Ok((s, ForStep { nodes: (a,) })) Ok((s, ForStep { nodes: (a,) }))
} }
#[trace]
pub fn for_step_assignment(s: Span) -> IResult<Span, ForStepAssignment> { pub fn for_step_assignment(s: Span) -> IResult<Span, ForStepAssignment> {
alt(( alt((
map(operator_assignment, |x| { map(operator_assignment, |x| {
@ -251,6 +264,7 @@ pub fn for_step_assignment(s: Span) -> IResult<Span, ForStepAssignment> {
))(s) ))(s)
} }
#[trace]
pub fn loop_variables(s: Span) -> IResult<Span, LoopVariables> { pub fn loop_variables(s: Span) -> IResult<Span, LoopVariables> {
let (s, a) = list(symbol(","), opt(index_variable_identifier))(s)?; let (s, a) = list(symbol(","), opt(index_variable_identifier))(s)?;
Ok((s, LoopVariables { nodes: (a,) })) Ok((s, LoopVariables { nodes: (a,) }))

View File

@ -52,6 +52,7 @@ pub enum JoinKeyword<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn action_block(s: Span) -> IResult<Span, ActionBlock> { pub fn action_block(s: Span) -> IResult<Span, ActionBlock> {
alt(( alt((
map(statement_or_null, |x| ActionBlock::StatementOrNull(x)), map(statement_or_null, |x| ActionBlock::StatementOrNull(x)),
@ -59,6 +60,7 @@ pub fn action_block(s: Span) -> IResult<Span, ActionBlock> {
))(s) ))(s)
} }
#[trace]
pub fn action_block_else(s: Span) -> IResult<Span, ActionBlock> { pub fn action_block_else(s: Span) -> IResult<Span, ActionBlock> {
let (s, a) = opt(statement)(s)?; let (s, a) = opt(statement)(s)?;
let (s, b) = symbol("else")(s)?; let (s, b) = symbol("else")(s)?;
@ -66,6 +68,7 @@ pub fn action_block_else(s: Span) -> IResult<Span, ActionBlock> {
Ok((s, ActionBlock::Else(ActionBlockElse { nodes: (a, b, c) }))) Ok((s, ActionBlock::Else(ActionBlockElse { nodes: (a, b, c) })))
} }
#[trace]
pub fn seq_block(s: Span) -> IResult<Span, SeqBlock> { pub fn seq_block(s: Span) -> IResult<Span, SeqBlock> {
let (s, a) = symbol("begin")(s)?; let (s, a) = symbol("begin")(s)?;
let (s, b) = opt(pair(symbol(":"), block_identifier))(s)?; let (s, b) = opt(pair(symbol(":"), block_identifier))(s)?;
@ -81,6 +84,7 @@ pub fn seq_block(s: Span) -> IResult<Span, SeqBlock> {
)) ))
} }
#[trace]
pub fn par_block(s: Span) -> IResult<Span, ParBlock> { pub fn par_block(s: Span) -> IResult<Span, ParBlock> {
let (s, a) = symbol("fork")(s)?; let (s, a) = symbol("fork")(s)?;
let (s, b) = opt(pair(symbol(":"), block_identifier))(s)?; let (s, b) = opt(pair(symbol(":"), block_identifier))(s)?;
@ -96,6 +100,7 @@ pub fn par_block(s: Span) -> IResult<Span, ParBlock> {
)) ))
} }
#[trace]
pub fn join_keyword(s: Span) -> IResult<Span, JoinKeyword> { pub fn join_keyword(s: Span) -> IResult<Span, JoinKeyword> {
alt(( alt((
map(symbol("join_any"), |x| JoinKeyword::JoinAny(x)), map(symbol("join_any"), |x| JoinKeyword::JoinAny(x)),

View File

@ -132,6 +132,7 @@ pub struct AssignmentPatternVariableLvalue<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn pattern(s: Span) -> IResult<Span, Pattern> { pub fn pattern(s: Span) -> IResult<Span, Pattern> {
alt(( alt((
pattern_variable, pattern_variable,
@ -145,6 +146,7 @@ pub fn pattern(s: Span) -> IResult<Span, Pattern> {
))(s) ))(s)
} }
#[trace]
pub fn pattern_variable(s: Span) -> IResult<Span, Pattern> { pub fn pattern_variable(s: Span) -> IResult<Span, Pattern> {
let (s, a) = symbol(".")(s)?; let (s, a) = symbol(".")(s)?;
let (s, b) = variable_identifier(s)?; let (s, b) = variable_identifier(s)?;
@ -154,6 +156,7 @@ pub fn pattern_variable(s: Span) -> IResult<Span, Pattern> {
)) ))
} }
#[trace]
pub fn pattern_tagged(s: Span) -> IResult<Span, Pattern> { pub fn pattern_tagged(s: Span) -> IResult<Span, Pattern> {
let (s, a) = symbol("tagged")(s)?; let (s, a) = symbol("tagged")(s)?;
let (s, b) = member_identifier(s)?; let (s, b) = member_identifier(s)?;
@ -164,11 +167,13 @@ pub fn pattern_tagged(s: Span) -> IResult<Span, Pattern> {
)) ))
} }
#[trace]
pub fn pattern_list(s: Span) -> IResult<Span, Pattern> { pub fn pattern_list(s: Span) -> IResult<Span, Pattern> {
let (s, a) = apostrophe_brace(list(symbol(","), pattern))(s)?; let (s, a) = apostrophe_brace(list(symbol(","), pattern))(s)?;
Ok((s, Pattern::List(Box::new(PatternList { nodes: (a,) })))) Ok((s, Pattern::List(Box::new(PatternList { nodes: (a,) }))))
} }
#[trace]
pub fn pattern_identifier_list(s: Span) -> IResult<Span, Pattern> { pub fn pattern_identifier_list(s: Span) -> IResult<Span, Pattern> {
let (s, a) = apostrophe_brace(list( let (s, a) = apostrophe_brace(list(
symbol(","), symbol(","),
@ -180,6 +185,7 @@ pub fn pattern_identifier_list(s: Span) -> IResult<Span, Pattern> {
)) ))
} }
#[trace]
pub fn assignment_pattern(s: Span) -> IResult<Span, AssignmentPattern> { pub fn assignment_pattern(s: Span) -> IResult<Span, AssignmentPattern> {
alt(( alt((
assignment_pattern_list, assignment_pattern_list,
@ -189,6 +195,7 @@ pub fn assignment_pattern(s: Span) -> IResult<Span, AssignmentPattern> {
))(s) ))(s)
} }
#[trace]
pub fn assignment_pattern_list(s: Span) -> IResult<Span, AssignmentPattern> { pub fn assignment_pattern_list(s: Span) -> IResult<Span, AssignmentPattern> {
let (s, a) = apostrophe_brace(list(symbol(","), expression))(s)?; let (s, a) = apostrophe_brace(list(symbol(","), expression))(s)?;
Ok(( Ok((
@ -197,6 +204,7 @@ pub fn assignment_pattern_list(s: Span) -> IResult<Span, AssignmentPattern> {
)) ))
} }
#[trace]
pub fn assignment_pattern_structure(s: Span) -> IResult<Span, AssignmentPattern> { pub fn assignment_pattern_structure(s: Span) -> IResult<Span, AssignmentPattern> {
let (s, a) = apostrophe_brace(list( let (s, a) = apostrophe_brace(list(
symbol(","), symbol(","),
@ -208,6 +216,7 @@ pub fn assignment_pattern_structure(s: Span) -> IResult<Span, AssignmentPattern>
)) ))
} }
#[trace]
pub fn assignment_pattern_array(s: Span) -> IResult<Span, AssignmentPattern> { pub fn assignment_pattern_array(s: Span) -> IResult<Span, AssignmentPattern> {
let (s, a) = apostrophe_brace(list( let (s, a) = apostrophe_brace(list(
symbol(","), symbol(","),
@ -219,6 +228,7 @@ pub fn assignment_pattern_array(s: Span) -> IResult<Span, AssignmentPattern> {
)) ))
} }
#[trace]
pub fn assignment_pattern_repeat(s: Span) -> IResult<Span, AssignmentPattern> { pub fn assignment_pattern_repeat(s: Span) -> IResult<Span, AssignmentPattern> {
let (s, a) = apostrophe_brace(pair( let (s, a) = apostrophe_brace(pair(
constant_expression, constant_expression,
@ -230,6 +240,7 @@ pub fn assignment_pattern_repeat(s: Span) -> IResult<Span, AssignmentPattern> {
)) ))
} }
#[trace]
pub fn structure_pattern_key(s: Span) -> IResult<Span, StructurePatternKey> { pub fn structure_pattern_key(s: Span) -> IResult<Span, StructurePatternKey> {
alt(( alt((
map(member_identifier, |x| { map(member_identifier, |x| {
@ -241,6 +252,7 @@ pub fn structure_pattern_key(s: Span) -> IResult<Span, StructurePatternKey> {
))(s) ))(s)
} }
#[trace]
pub fn array_pattern_key(s: Span) -> IResult<Span, ArrayPatternKey> { pub fn array_pattern_key(s: Span) -> IResult<Span, ArrayPatternKey> {
alt(( alt((
map(constant_expression, |x| { map(constant_expression, |x| {
@ -252,6 +264,7 @@ pub fn array_pattern_key(s: Span) -> IResult<Span, ArrayPatternKey> {
))(s) ))(s)
} }
#[trace]
pub fn assignment_pattern_key(s: Span) -> IResult<Span, AssignmentPatternKey> { pub fn assignment_pattern_key(s: Span) -> IResult<Span, AssignmentPatternKey> {
alt(( alt((
map(simple_type, |x| AssignmentPatternKey::SimpleType(x)), map(simple_type, |x| AssignmentPatternKey::SimpleType(x)),
@ -259,12 +272,14 @@ pub fn assignment_pattern_key(s: Span) -> IResult<Span, AssignmentPatternKey> {
))(s) ))(s)
} }
#[trace]
pub fn assignment_pattern_expression(s: Span) -> IResult<Span, AssignmentPatternExpression> { pub fn assignment_pattern_expression(s: Span) -> IResult<Span, AssignmentPatternExpression> {
let (s, a) = opt(assignment_pattern_expression_type)(s)?; let (s, a) = opt(assignment_pattern_expression_type)(s)?;
let (s, b) = assignment_pattern(s)?; let (s, b) = assignment_pattern(s)?;
Ok((s, AssignmentPatternExpression { nodes: (a, b) })) Ok((s, AssignmentPatternExpression { nodes: (a, b) }))
} }
#[trace]
pub fn assignment_pattern_expression_type( pub fn assignment_pattern_expression_type(
s: Span, s: Span,
) -> IResult<Span, AssignmentPatternExpressionType> { ) -> IResult<Span, AssignmentPatternExpressionType> {
@ -284,6 +299,7 @@ pub fn assignment_pattern_expression_type(
))(s) ))(s)
} }
#[trace]
pub fn constant_assignment_pattern_expression( pub fn constant_assignment_pattern_expression(
s: Span, s: Span,
) -> IResult<Span, ConstantAssignmentPatternExpression> { ) -> IResult<Span, ConstantAssignmentPatternExpression> {
@ -291,11 +307,13 @@ pub fn constant_assignment_pattern_expression(
Ok((s, ConstantAssignmentPatternExpression { nodes: (a,) })) Ok((s, ConstantAssignmentPatternExpression { nodes: (a,) }))
} }
#[trace]
pub fn assignment_pattern_net_lvalue(s: Span) -> IResult<Span, AssignmentPatternNetLvalue> { pub fn assignment_pattern_net_lvalue(s: Span) -> IResult<Span, AssignmentPatternNetLvalue> {
let (s, a) = apostrophe_brace(list(symbol(","), net_lvalue))(s)?; let (s, a) = apostrophe_brace(list(symbol(","), net_lvalue))(s)?;
Ok((s, AssignmentPatternNetLvalue { nodes: (a,) })) Ok((s, AssignmentPatternNetLvalue { nodes: (a,) }))
} }
#[trace]
pub fn assignment_pattern_variable_lvalue( pub fn assignment_pattern_variable_lvalue(
s: Span, s: Span,
) -> IResult<Span, AssignmentPatternVariableLvalue> { ) -> IResult<Span, AssignmentPatternVariableLvalue> {

View File

@ -130,18 +130,21 @@ pub struct VariableAssignment<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn initial_construct(s: Span) -> IResult<Span, InitialConstruct> { pub fn initial_construct(s: Span) -> IResult<Span, InitialConstruct> {
let (s, a) = symbol("initial")(s)?; let (s, a) = symbol("initial")(s)?;
let (s, b) = statement_or_null(s)?; let (s, b) = statement_or_null(s)?;
Ok((s, InitialConstruct { nodes: (a, b) })) Ok((s, InitialConstruct { nodes: (a, b) }))
} }
#[trace]
pub fn always_construct(s: Span) -> IResult<Span, AlwaysConstruct> { pub fn always_construct(s: Span) -> IResult<Span, AlwaysConstruct> {
let (s, a) = always_keyword(s)?; let (s, a) = always_keyword(s)?;
let (s, b) = statement(s)?; let (s, b) = statement(s)?;
Ok((s, AlwaysConstruct { nodes: (a, b) })) Ok((s, AlwaysConstruct { nodes: (a, b) }))
} }
#[trace]
pub fn always_keyword(s: Span) -> IResult<Span, AlwaysKeyword> { pub fn always_keyword(s: Span) -> IResult<Span, AlwaysKeyword> {
alt(( alt((
map(symbol("always_comb"), |x| AlwaysKeyword::AlwaysComb(x)), map(symbol("always_comb"), |x| AlwaysKeyword::AlwaysComb(x)),
@ -151,12 +154,14 @@ pub fn always_keyword(s: Span) -> IResult<Span, AlwaysKeyword> {
))(s) ))(s)
} }
#[trace]
pub fn final_construct(s: Span) -> IResult<Span, FinalConstruct> { pub fn final_construct(s: Span) -> IResult<Span, FinalConstruct> {
let (s, a) = symbol("final")(s)?; let (s, a) = symbol("final")(s)?;
let (s, b) = function_statement(s)?; let (s, b) = function_statement(s)?;
Ok((s, FinalConstruct { nodes: (a, b) })) Ok((s, FinalConstruct { nodes: (a, b) }))
} }
#[trace]
pub fn blocking_assignment(s: Span) -> IResult<Span, BlockingAssignment> { pub fn blocking_assignment(s: Span) -> IResult<Span, BlockingAssignment> {
alt(( alt((
blocking_assignment_variable, blocking_assignment_variable,
@ -168,6 +173,7 @@ pub fn blocking_assignment(s: Span) -> IResult<Span, BlockingAssignment> {
))(s) ))(s)
} }
#[trace]
pub fn blocking_assignment_variable(s: Span) -> IResult<Span, BlockingAssignment> { pub fn blocking_assignment_variable(s: Span) -> IResult<Span, BlockingAssignment> {
let (s, a) = variable_lvalue(s)?; let (s, a) = variable_lvalue(s)?;
let (s, b) = symbol("=")(s)?; let (s, b) = symbol("=")(s)?;
@ -181,6 +187,7 @@ pub fn blocking_assignment_variable(s: Span) -> IResult<Span, BlockingAssignment
)) ))
} }
#[trace]
pub fn blocking_assignment_nonrange_variable(s: Span) -> IResult<Span, BlockingAssignment> { pub fn blocking_assignment_nonrange_variable(s: Span) -> IResult<Span, BlockingAssignment> {
let (s, a) = nonrange_variable_lvalue(s)?; let (s, a) = nonrange_variable_lvalue(s)?;
let (s, b) = symbol("=")(s)?; let (s, b) = symbol("=")(s)?;
@ -193,6 +200,7 @@ pub fn blocking_assignment_nonrange_variable(s: Span) -> IResult<Span, BlockingA
)) ))
} }
#[trace]
pub fn blocking_assignment_hierarchical_variable(s: Span) -> IResult<Span, BlockingAssignment> { pub fn blocking_assignment_hierarchical_variable(s: Span) -> IResult<Span, BlockingAssignment> {
let (s, a) = opt(implicit_class_handle_or_class_scope_or_package_scope)(s)?; let (s, a) = opt(implicit_class_handle_or_class_scope_or_package_scope)(s)?;
let (s, b) = hierarchical_variable_identifier(s)?; let (s, b) = hierarchical_variable_identifier(s)?;
@ -207,6 +215,7 @@ pub fn blocking_assignment_hierarchical_variable(s: Span) -> IResult<Span, Block
)) ))
} }
#[trace]
pub fn operator_assignment(s: Span) -> IResult<Span, OperatorAssignment> { pub fn operator_assignment(s: Span) -> IResult<Span, OperatorAssignment> {
let (s, a) = variable_lvalue(s)?; let (s, a) = variable_lvalue(s)?;
let (s, b) = assignment_operator(s)?; let (s, b) = assignment_operator(s)?;
@ -214,6 +223,7 @@ pub fn operator_assignment(s: Span) -> IResult<Span, OperatorAssignment> {
Ok((s, OperatorAssignment { nodes: (a, b, c) })) Ok((s, OperatorAssignment { nodes: (a, b, c) }))
} }
#[trace]
pub fn assignment_operator(s: Span) -> IResult<Span, AssignmentOperator> { pub fn assignment_operator(s: Span) -> IResult<Span, AssignmentOperator> {
alt(( alt((
map(symbol("="), |x| AssignmentOperator { nodes: (x,) }), map(symbol("="), |x| AssignmentOperator { nodes: (x,) }),
@ -232,6 +242,7 @@ pub fn assignment_operator(s: Span) -> IResult<Span, AssignmentOperator> {
))(s) ))(s)
} }
#[trace]
pub fn nonblocking_assignment(s: Span) -> IResult<Span, NonblockingAssignment> { pub fn nonblocking_assignment(s: Span) -> IResult<Span, NonblockingAssignment> {
let (s, a) = variable_lvalue(s)?; let (s, a) = variable_lvalue(s)?;
let (s, b) = symbol("<=")(s)?; let (s, b) = symbol("<=")(s)?;
@ -245,6 +256,7 @@ pub fn nonblocking_assignment(s: Span) -> IResult<Span, NonblockingAssignment> {
)) ))
} }
#[trace]
pub fn procedural_continuous_assignment(s: Span) -> IResult<Span, ProceduralContinuousAssignment> { pub fn procedural_continuous_assignment(s: Span) -> IResult<Span, ProceduralContinuousAssignment> {
alt(( alt((
procedural_continuous_assignment_assign, procedural_continuous_assignment_assign,
@ -256,6 +268,7 @@ pub fn procedural_continuous_assignment(s: Span) -> IResult<Span, ProceduralCont
))(s) ))(s)
} }
#[trace]
pub fn procedural_continuous_assignment_assign( pub fn procedural_continuous_assignment_assign(
s: Span, s: Span,
) -> IResult<Span, ProceduralContinuousAssignment> { ) -> IResult<Span, ProceduralContinuousAssignment> {
@ -269,6 +282,7 @@ pub fn procedural_continuous_assignment_assign(
)) ))
} }
#[trace]
pub fn procedural_continuous_assignment_deassign( pub fn procedural_continuous_assignment_deassign(
s: Span, s: Span,
) -> IResult<Span, ProceduralContinuousAssignment> { ) -> IResult<Span, ProceduralContinuousAssignment> {
@ -282,6 +296,7 @@ pub fn procedural_continuous_assignment_deassign(
)) ))
} }
#[trace]
pub fn procedural_continuous_assignment_force_variable( pub fn procedural_continuous_assignment_force_variable(
s: Span, s: Span,
) -> IResult<Span, ProceduralContinuousAssignment> { ) -> IResult<Span, ProceduralContinuousAssignment> {
@ -295,6 +310,7 @@ pub fn procedural_continuous_assignment_force_variable(
)) ))
} }
#[trace]
pub fn procedural_continuous_assignment_force_net( pub fn procedural_continuous_assignment_force_net(
s: Span, s: Span,
) -> IResult<Span, ProceduralContinuousAssignment> { ) -> IResult<Span, ProceduralContinuousAssignment> {
@ -308,6 +324,7 @@ pub fn procedural_continuous_assignment_force_net(
)) ))
} }
#[trace]
pub fn procedural_continuous_assignment_release_variable( pub fn procedural_continuous_assignment_release_variable(
s: Span, s: Span,
) -> IResult<Span, ProceduralContinuousAssignment> { ) -> IResult<Span, ProceduralContinuousAssignment> {
@ -321,6 +338,7 @@ pub fn procedural_continuous_assignment_release_variable(
)) ))
} }
#[trace]
pub fn procedural_continuous_assignment_release_net( pub fn procedural_continuous_assignment_release_net(
s: Span, s: Span,
) -> IResult<Span, ProceduralContinuousAssignment> { ) -> IResult<Span, ProceduralContinuousAssignment> {
@ -334,6 +352,7 @@ pub fn procedural_continuous_assignment_release_net(
)) ))
} }
#[trace]
pub fn variable_assignment(s: Span) -> IResult<Span, VariableAssignment> { pub fn variable_assignment(s: Span) -> IResult<Span, VariableAssignment> {
let (s, a) = variable_lvalue(s)?; let (s, a) = variable_lvalue(s)?;
let (s, b) = symbol("=")(s)?; let (s, b) = symbol("=")(s)?;

View File

@ -150,6 +150,7 @@ pub struct RsCaseItemDefault<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn randsequence_statement(s: Span) -> IResult<Span, RandsequenceStatement> { pub fn randsequence_statement(s: Span) -> IResult<Span, RandsequenceStatement> {
let (s, a) = symbol("randsequence")(s)?; let (s, a) = symbol("randsequence")(s)?;
let (s, b) = paren(opt(production_identifier))(s)?; let (s, b) = paren(opt(production_identifier))(s)?;
@ -164,6 +165,7 @@ pub fn randsequence_statement(s: Span) -> IResult<Span, RandsequenceStatement> {
)) ))
} }
#[trace]
pub fn production(s: Span) -> IResult<Span, Production> { pub fn production(s: Span) -> IResult<Span, Production> {
let (s, a) = opt(data_type_or_void)(s)?; let (s, a) = opt(data_type_or_void)(s)?;
let (s, b) = production_identifier(s)?; let (s, b) = production_identifier(s)?;
@ -179,6 +181,7 @@ pub fn production(s: Span) -> IResult<Span, Production> {
)) ))
} }
#[trace]
pub fn rs_rule(s: Span) -> IResult<Span, RsRule> { pub fn rs_rule(s: Span) -> IResult<Span, RsRule> {
let (s, a) = rs_production_list(s)?; let (s, a) = rs_production_list(s)?;
let (s, b) = opt(triple( let (s, b) = opt(triple(
@ -189,10 +192,12 @@ pub fn rs_rule(s: Span) -> IResult<Span, RsRule> {
Ok((s, RsRule { nodes: (a, b) })) Ok((s, RsRule { nodes: (a, b) }))
} }
#[trace]
pub fn rs_production_list(s: Span) -> IResult<Span, RsProductionList> { pub fn rs_production_list(s: Span) -> IResult<Span, RsProductionList> {
alt((rs_production_list_prod, rs_production_list_join))(s) alt((rs_production_list_prod, rs_production_list_join))(s)
} }
#[trace]
pub fn rs_production_list_prod(s: Span) -> IResult<Span, RsProductionList> { pub fn rs_production_list_prod(s: Span) -> IResult<Span, RsProductionList> {
let (s, a) = rs_prod(s)?; let (s, a) = rs_prod(s)?;
let (s, b) = many0(rs_prod)(s)?; let (s, b) = many0(rs_prod)(s)?;
@ -202,6 +207,7 @@ pub fn rs_production_list_prod(s: Span) -> IResult<Span, RsProductionList> {
)) ))
} }
#[trace]
pub fn rs_production_list_join(s: Span) -> IResult<Span, RsProductionList> { pub fn rs_production_list_join(s: Span) -> IResult<Span, RsProductionList> {
let (s, a) = symbol("rand")(s)?; let (s, a) = symbol("rand")(s)?;
let (s, b) = symbol("join")(s)?; let (s, b) = symbol("join")(s)?;
@ -217,6 +223,7 @@ pub fn rs_production_list_join(s: Span) -> IResult<Span, RsProductionList> {
)) ))
} }
#[trace]
pub fn weight_specification(s: Span) -> IResult<Span, WeightSpecification> { pub fn weight_specification(s: Span) -> IResult<Span, WeightSpecification> {
alt(( alt((
map(integral_number, |x| WeightSpecification::IntegralNumber(x)), map(integral_number, |x| WeightSpecification::IntegralNumber(x)),
@ -225,6 +232,7 @@ pub fn weight_specification(s: Span) -> IResult<Span, WeightSpecification> {
))(s) ))(s)
} }
#[trace]
pub fn weight_specification_expression(s: Span) -> IResult<Span, WeightSpecification> { pub fn weight_specification_expression(s: Span) -> IResult<Span, WeightSpecification> {
let (s, a) = paren(expression)(s)?; let (s, a) = paren(expression)(s)?;
Ok(( Ok((
@ -233,11 +241,13 @@ pub fn weight_specification_expression(s: Span) -> IResult<Span, WeightSpecifica
)) ))
} }
#[trace]
pub fn rs_code_block(s: Span) -> IResult<Span, RsCodeBlock> { pub fn rs_code_block(s: Span) -> IResult<Span, RsCodeBlock> {
let (s, a) = brace(pair(many0(data_declaration), many0(statement_or_null)))(s)?; let (s, a) = brace(pair(many0(data_declaration), many0(statement_or_null)))(s)?;
Ok((s, RsCodeBlock { nodes: (a,) })) Ok((s, RsCodeBlock { nodes: (a,) }))
} }
#[trace]
pub fn rs_prod(s: Span) -> IResult<Span, RsProd> { pub fn rs_prod(s: Span) -> IResult<Span, RsProd> {
alt(( alt((
map(production_item, |x| RsProd::ProductionItem(x)), map(production_item, |x| RsProd::ProductionItem(x)),
@ -248,12 +258,14 @@ pub fn rs_prod(s: Span) -> IResult<Span, RsProd> {
))(s) ))(s)
} }
#[trace]
pub fn production_item(s: Span) -> IResult<Span, ProductionItem> { pub fn production_item(s: Span) -> IResult<Span, ProductionItem> {
let (s, a) = production_identifier(s)?; let (s, a) = production_identifier(s)?;
let (s, b) = opt(paren(list_of_arguments))(s)?; let (s, b) = opt(paren(list_of_arguments))(s)?;
Ok((s, ProductionItem { nodes: (a, b) })) Ok((s, ProductionItem { nodes: (a, b) }))
} }
#[trace]
pub fn rs_if_else(s: Span) -> IResult<Span, RsIfElse> { pub fn rs_if_else(s: Span) -> IResult<Span, RsIfElse> {
let (s, a) = symbol("if")(s)?; let (s, a) = symbol("if")(s)?;
let (s, b) = paren(expression)(s)?; let (s, b) = paren(expression)(s)?;
@ -267,6 +279,7 @@ pub fn rs_if_else(s: Span) -> IResult<Span, RsIfElse> {
)) ))
} }
#[trace]
pub fn rs_repeat(s: Span) -> IResult<Span, RsRepeat> { pub fn rs_repeat(s: Span) -> IResult<Span, RsRepeat> {
let (s, a) = symbol("repeat")(s)?; let (s, a) = symbol("repeat")(s)?;
let (s, b) = paren(expression)(s)?; let (s, b) = paren(expression)(s)?;
@ -274,6 +287,7 @@ pub fn rs_repeat(s: Span) -> IResult<Span, RsRepeat> {
Ok((s, RsRepeat { nodes: (a, b, c) })) Ok((s, RsRepeat { nodes: (a, b, c) }))
} }
#[trace]
pub fn rs_case(s: Span) -> IResult<Span, RsCase> { pub fn rs_case(s: Span) -> IResult<Span, RsCase> {
let (s, a) = symbol("case")(s)?; let (s, a) = symbol("case")(s)?;
let (s, b) = paren(case_expression)(s)?; let (s, b) = paren(case_expression)(s)?;
@ -288,10 +302,12 @@ pub fn rs_case(s: Span) -> IResult<Span, RsCase> {
)) ))
} }
#[trace]
pub fn rs_case_item(s: Span) -> IResult<Span, RsCaseItem> { pub fn rs_case_item(s: Span) -> IResult<Span, RsCaseItem> {
alt((rs_case_item_nondefault, rs_case_item_default))(s) alt((rs_case_item_nondefault, rs_case_item_default))(s)
} }
#[trace]
pub fn rs_case_item_nondefault(s: Span) -> IResult<Span, RsCaseItem> { pub fn rs_case_item_nondefault(s: Span) -> IResult<Span, RsCaseItem> {
let (s, a) = list(symbol(","), case_item_expression)(s)?; let (s, a) = list(symbol(","), case_item_expression)(s)?;
let (s, b) = symbol(":")(s)?; let (s, b) = symbol(":")(s)?;
@ -305,6 +321,7 @@ pub fn rs_case_item_nondefault(s: Span) -> IResult<Span, RsCaseItem> {
)) ))
} }
#[trace]
pub fn rs_case_item_default(s: Span) -> IResult<Span, RsCaseItem> { pub fn rs_case_item_default(s: Span) -> IResult<Span, RsCaseItem> {
let (s, a) = symbol("default")(s)?; let (s, a) = symbol("default")(s)?;
let (s, b) = opt(symbol(":"))(s)?; let (s, b) = opt(symbol(":"))(s)?;

View File

@ -75,6 +75,7 @@ pub struct VariableIdentifierList<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn statement_or_null(s: Span) -> IResult<Span, StatementOrNull> { pub fn statement_or_null(s: Span) -> IResult<Span, StatementOrNull> {
alt(( alt((
map(statement, |x| StatementOrNull::Statement(x)), map(statement, |x| StatementOrNull::Statement(x)),
@ -82,6 +83,7 @@ pub fn statement_or_null(s: Span) -> IResult<Span, StatementOrNull> {
))(s) ))(s)
} }
#[trace]
pub fn statement_or_null_attribute(s: Span) -> IResult<Span, StatementOrNull> { pub fn statement_or_null_attribute(s: Span) -> IResult<Span, StatementOrNull> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = symbol(";")(s)?; let (s, b) = symbol(";")(s)?;
@ -91,6 +93,7 @@ pub fn statement_or_null_attribute(s: Span) -> IResult<Span, StatementOrNull> {
)) ))
} }
#[trace]
pub fn statement(s: Span) -> IResult<Span, Statement> { pub fn statement(s: Span) -> IResult<Span, Statement> {
let (s, a) = opt(pair(block_identifier, symbol(":")))(s)?; let (s, a) = opt(pair(block_identifier, symbol(":")))(s)?;
let (s, b) = many0(attribute_instance)(s)?; let (s, b) = many0(attribute_instance)(s)?;
@ -98,6 +101,7 @@ pub fn statement(s: Span) -> IResult<Span, Statement> {
Ok((s, Statement { nodes: (a, b, c) })) Ok((s, Statement { nodes: (a, b, c) }))
} }
#[trace]
pub fn statement_item(s: Span) -> IResult<Span, StatementItem> { pub fn statement_item(s: Span) -> IResult<Span, StatementItem> {
alt(( alt((
map(pair(blocking_assignment, symbol(";")), |x| { map(pair(blocking_assignment, symbol(";")), |x| {
@ -157,11 +161,13 @@ pub fn statement_item(s: Span) -> IResult<Span, StatementItem> {
))(s) ))(s)
} }
#[trace]
pub fn function_statement(s: Span) -> IResult<Span, FunctionStatement> { pub fn function_statement(s: Span) -> IResult<Span, FunctionStatement> {
let (s, a) = statement(s)?; let (s, a) = statement(s)?;
Ok((s, FunctionStatement { nodes: (a,) })) Ok((s, FunctionStatement { nodes: (a,) }))
} }
#[trace]
pub fn function_statement_or_null(s: Span) -> IResult<Span, FunctionStatementOrNull> { pub fn function_statement_or_null(s: Span) -> IResult<Span, FunctionStatementOrNull> {
alt(( alt((
map(function_statement, |x| { map(function_statement, |x| {
@ -171,6 +177,7 @@ pub fn function_statement_or_null(s: Span) -> IResult<Span, FunctionStatementOrN
))(s) ))(s)
} }
#[trace]
pub fn function_statement_or_null_attribute(s: Span) -> IResult<Span, FunctionStatementOrNull> { pub fn function_statement_or_null_attribute(s: Span) -> IResult<Span, FunctionStatementOrNull> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = symbol(";")(s)?; let (s, b) = symbol(";")(s)?;
@ -180,6 +187,7 @@ pub fn function_statement_or_null_attribute(s: Span) -> IResult<Span, FunctionSt
)) ))
} }
#[trace]
pub fn variable_identifier_list(s: Span) -> IResult<Span, VariableIdentifierList> { pub fn variable_identifier_list(s: Span) -> IResult<Span, VariableIdentifierList> {
let (s, a) = list(symbol(","), variable_identifier)(s)?; let (s, a) = list(symbol(","), variable_identifier)(s)?;
Ok((s, VariableIdentifierList { nodes: (a,) })) Ok((s, VariableIdentifierList { nodes: (a,) }))

View File

@ -25,6 +25,7 @@ pub struct SubroutineCallStatementFunction<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn subroutine_call_statement(s: Span) -> IResult<Span, SubroutineCallStatement> { pub fn subroutine_call_statement(s: Span) -> IResult<Span, SubroutineCallStatement> {
alt(( alt((
map(pair(subroutine_call, symbol(";")), |x| { map(pair(subroutine_call, symbol(";")), |x| {
@ -34,6 +35,7 @@ pub fn subroutine_call_statement(s: Span) -> IResult<Span, SubroutineCallStateme
))(s) ))(s)
} }
#[trace]
pub fn subroutine_call_statement_function(s: Span) -> IResult<Span, SubroutineCallStatement> { pub fn subroutine_call_statement_function(s: Span) -> IResult<Span, SubroutineCallStatement> {
let (s, a) = symbol("void")(s)?; let (s, a) = symbol("void")(s)?;
let (s, b) = symbol("'")(s)?; let (s, b) = symbol("'")(s)?;

View File

@ -212,6 +212,7 @@ pub struct DisableStatementFork<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn procedural_timing_control_statement( pub fn procedural_timing_control_statement(
s: Span, s: Span,
) -> IResult<Span, ProceduralTimingControlStatement> { ) -> IResult<Span, ProceduralTimingControlStatement> {
@ -220,6 +221,7 @@ pub fn procedural_timing_control_statement(
Ok((s, ProceduralTimingControlStatement { nodes: (a, b) })) Ok((s, ProceduralTimingControlStatement { nodes: (a, b) }))
} }
#[trace]
pub fn delay_or_event_control(s: Span) -> IResult<Span, DelayOrEventControl> { pub fn delay_or_event_control(s: Span) -> IResult<Span, DelayOrEventControl> {
alt(( alt((
map(delay_control, |x| DelayOrEventControl::Delay(x)), map(delay_control, |x| DelayOrEventControl::Delay(x)),
@ -228,6 +230,7 @@ pub fn delay_or_event_control(s: Span) -> IResult<Span, DelayOrEventControl> {
))(s) ))(s)
} }
#[trace]
pub fn delay_or_event_control_repeat(s: Span) -> IResult<Span, DelayOrEventControl> { pub fn delay_or_event_control_repeat(s: Span) -> IResult<Span, DelayOrEventControl> {
let (s, a) = symbol("repeat")(s)?; let (s, a) = symbol("repeat")(s)?;
let (s, b) = paren(expression)(s)?; let (s, b) = paren(expression)(s)?;
@ -238,16 +241,19 @@ pub fn delay_or_event_control_repeat(s: Span) -> IResult<Span, DelayOrEventContr
)) ))
} }
#[trace]
pub fn delay_control(s: Span) -> IResult<Span, DelayControl> { pub fn delay_control(s: Span) -> IResult<Span, DelayControl> {
alt((delay_control_delay, delay_control_mintypmax))(s) alt((delay_control_delay, delay_control_mintypmax))(s)
} }
#[trace]
pub fn delay_control_delay(s: Span) -> IResult<Span, DelayControl> { pub fn delay_control_delay(s: Span) -> IResult<Span, DelayControl> {
let (s, a) = symbol("#")(s)?; let (s, a) = symbol("#")(s)?;
let (s, b) = delay_value(s)?; let (s, b) = delay_value(s)?;
Ok((s, DelayControl::Delay(DelayControlDelay { nodes: (a, b) }))) Ok((s, DelayControl::Delay(DelayControlDelay { nodes: (a, b) })))
} }
#[trace]
pub fn delay_control_mintypmax(s: Span) -> IResult<Span, DelayControl> { pub fn delay_control_mintypmax(s: Span) -> IResult<Span, DelayControl> {
let (s, a) = symbol("#")(s)?; let (s, a) = symbol("#")(s)?;
let (s, b) = paren(mintypmax_expression)(s)?; let (s, b) = paren(mintypmax_expression)(s)?;
@ -257,6 +263,7 @@ pub fn delay_control_mintypmax(s: Span) -> IResult<Span, DelayControl> {
)) ))
} }
#[trace]
pub fn event_control(s: Span) -> IResult<Span, EventControl> { pub fn event_control(s: Span) -> IResult<Span, EventControl> {
alt(( alt((
event_control_event_identifier, event_control_event_identifier,
@ -267,6 +274,7 @@ pub fn event_control(s: Span) -> IResult<Span, EventControl> {
))(s) ))(s)
} }
#[trace]
pub fn event_control_event_identifier(s: Span) -> IResult<Span, EventControl> { pub fn event_control_event_identifier(s: Span) -> IResult<Span, EventControl> {
let (s, a) = symbol("@")(s)?; let (s, a) = symbol("@")(s)?;
let (s, b) = hierarchical_event_identifier(s)?; let (s, b) = hierarchical_event_identifier(s)?;
@ -276,6 +284,7 @@ pub fn event_control_event_identifier(s: Span) -> IResult<Span, EventControl> {
)) ))
} }
#[trace]
pub fn event_control_event_expression(s: Span) -> IResult<Span, EventControl> { pub fn event_control_event_expression(s: Span) -> IResult<Span, EventControl> {
let (s, a) = symbol("@")(s)?; let (s, a) = symbol("@")(s)?;
let (s, b) = paren(event_expression)(s)?; let (s, b) = paren(event_expression)(s)?;
@ -285,6 +294,7 @@ pub fn event_control_event_expression(s: Span) -> IResult<Span, EventControl> {
)) ))
} }
#[trace]
pub fn event_control_asterisk(s: Span) -> IResult<Span, EventControl> { pub fn event_control_asterisk(s: Span) -> IResult<Span, EventControl> {
let (s, a) = symbol("@*")(s)?; let (s, a) = symbol("@*")(s)?;
Ok(( Ok((
@ -293,6 +303,7 @@ pub fn event_control_asterisk(s: Span) -> IResult<Span, EventControl> {
)) ))
} }
#[trace]
pub fn event_control_paren_asterisk(s: Span) -> IResult<Span, EventControl> { pub fn event_control_paren_asterisk(s: Span) -> IResult<Span, EventControl> {
let (s, a) = symbol("@")(s)?; let (s, a) = symbol("@")(s)?;
let (s, b) = paren(symbol("*"))(s)?; let (s, b) = paren(symbol("*"))(s)?;
@ -302,6 +313,7 @@ pub fn event_control_paren_asterisk(s: Span) -> IResult<Span, EventControl> {
)) ))
} }
#[trace]
pub fn event_control_sequence_identifier(s: Span) -> IResult<Span, EventControl> { pub fn event_control_sequence_identifier(s: Span) -> IResult<Span, EventControl> {
let (s, a) = symbol("@")(s)?; let (s, a) = symbol("@")(s)?;
let (s, b) = ps_or_hierarchical_sequence_identifier(s)?; let (s, b) = ps_or_hierarchical_sequence_identifier(s)?;
@ -311,6 +323,7 @@ pub fn event_control_sequence_identifier(s: Span) -> IResult<Span, EventControl>
)) ))
} }
#[trace]
pub fn event_expression(s: Span) -> IResult<Span, EventExpression> { pub fn event_expression(s: Span) -> IResult<Span, EventExpression> {
alt(( alt((
event_expression_expression, event_expression_expression,
@ -321,6 +334,7 @@ pub fn event_expression(s: Span) -> IResult<Span, EventExpression> {
))(s) ))(s)
} }
#[trace]
pub fn event_expression_expression(s: Span) -> IResult<Span, EventExpression> { pub fn event_expression_expression(s: Span) -> IResult<Span, EventExpression> {
let (s, a) = opt(edge_identifier)(s)?; let (s, a) = opt(edge_identifier)(s)?;
let (s, b) = expression(s)?; let (s, b) = expression(s)?;
@ -331,6 +345,7 @@ pub fn event_expression_expression(s: Span) -> IResult<Span, EventExpression> {
)) ))
} }
#[trace]
pub fn event_expression_sequence(s: Span) -> IResult<Span, EventExpression> { pub fn event_expression_sequence(s: Span) -> IResult<Span, EventExpression> {
let (s, a) = sequence_instance(s)?; let (s, a) = sequence_instance(s)?;
let (s, b) = opt(pair(symbol("iff"), expression))(s)?; let (s, b) = opt(pair(symbol("iff"), expression))(s)?;
@ -340,6 +355,7 @@ pub fn event_expression_sequence(s: Span) -> IResult<Span, EventExpression> {
)) ))
} }
#[trace]
pub fn event_expression_or(s: Span) -> IResult<Span, EventExpression> { pub fn event_expression_or(s: Span) -> IResult<Span, EventExpression> {
let (s, a) = event_expression(s)?; let (s, a) = event_expression(s)?;
let (s, b) = symbol("or")(s)?; let (s, b) = symbol("or")(s)?;
@ -350,6 +366,7 @@ pub fn event_expression_or(s: Span) -> IResult<Span, EventExpression> {
)) ))
} }
#[trace]
pub fn event_expression_comma(s: Span) -> IResult<Span, EventExpression> { pub fn event_expression_comma(s: Span) -> IResult<Span, EventExpression> {
let (s, a) = event_expression(s)?; let (s, a) = event_expression(s)?;
let (s, b) = symbol(",")(s)?; let (s, b) = symbol(",")(s)?;
@ -360,6 +377,7 @@ pub fn event_expression_comma(s: Span) -> IResult<Span, EventExpression> {
)) ))
} }
#[trace]
pub fn event_expression_paren(s: Span) -> IResult<Span, EventExpression> { pub fn event_expression_paren(s: Span) -> IResult<Span, EventExpression> {
let (s, a) = paren(event_expression)(s)?; let (s, a) = paren(event_expression)(s)?;
Ok(( Ok((
@ -368,6 +386,7 @@ pub fn event_expression_paren(s: Span) -> IResult<Span, EventExpression> {
)) ))
} }
#[trace]
pub fn procedural_timing_control(s: Span) -> IResult<Span, ProceduralTimingControl> { pub fn procedural_timing_control(s: Span) -> IResult<Span, ProceduralTimingControl> {
alt(( alt((
map(delay_control, |x| ProceduralTimingControl::DelayControl(x)), map(delay_control, |x| ProceduralTimingControl::DelayControl(x)),
@ -376,6 +395,7 @@ pub fn procedural_timing_control(s: Span) -> IResult<Span, ProceduralTimingContr
))(s) ))(s)
} }
#[trace]
pub fn jump_statement(s: Span) -> IResult<Span, JumpStatement> { pub fn jump_statement(s: Span) -> IResult<Span, JumpStatement> {
alt(( alt((
jump_statement_return, jump_statement_return,
@ -384,6 +404,7 @@ pub fn jump_statement(s: Span) -> IResult<Span, JumpStatement> {
))(s) ))(s)
} }
#[trace]
pub fn jump_statement_return(s: Span) -> IResult<Span, JumpStatement> { pub fn jump_statement_return(s: Span) -> IResult<Span, JumpStatement> {
let (s, a) = symbol("return")(s)?; let (s, a) = symbol("return")(s)?;
let (s, b) = opt(expression)(s)?; let (s, b) = opt(expression)(s)?;
@ -394,6 +415,7 @@ pub fn jump_statement_return(s: Span) -> IResult<Span, JumpStatement> {
)) ))
} }
#[trace]
pub fn jump_statement_break(s: Span) -> IResult<Span, JumpStatement> { pub fn jump_statement_break(s: Span) -> IResult<Span, JumpStatement> {
let (s, a) = symbol("break")(s)?; let (s, a) = symbol("break")(s)?;
let (s, b) = symbol(";")(s)?; let (s, b) = symbol(";")(s)?;
@ -403,6 +425,7 @@ pub fn jump_statement_break(s: Span) -> IResult<Span, JumpStatement> {
)) ))
} }
#[trace]
pub fn jump_statement_continue(s: Span) -> IResult<Span, JumpStatement> { pub fn jump_statement_continue(s: Span) -> IResult<Span, JumpStatement> {
let (s, a) = symbol("continue")(s)?; let (s, a) = symbol("continue")(s)?;
let (s, b) = symbol(";")(s)?; let (s, b) = symbol(";")(s)?;
@ -412,6 +435,7 @@ pub fn jump_statement_continue(s: Span) -> IResult<Span, JumpStatement> {
)) ))
} }
#[trace]
pub fn wait_statement(s: Span) -> IResult<Span, WaitStatement> { pub fn wait_statement(s: Span) -> IResult<Span, WaitStatement> {
alt(( alt((
wait_statement_wait, wait_statement_wait,
@ -420,6 +444,7 @@ pub fn wait_statement(s: Span) -> IResult<Span, WaitStatement> {
))(s) ))(s)
} }
#[trace]
pub fn wait_statement_wait(s: Span) -> IResult<Span, WaitStatement> { pub fn wait_statement_wait(s: Span) -> IResult<Span, WaitStatement> {
let (s, a) = symbol("wait")(s)?; let (s, a) = symbol("wait")(s)?;
let (s, b) = paren(expression)(s)?; let (s, b) = paren(expression)(s)?;
@ -430,6 +455,7 @@ pub fn wait_statement_wait(s: Span) -> IResult<Span, WaitStatement> {
)) ))
} }
#[trace]
pub fn wait_statement_fork(s: Span) -> IResult<Span, WaitStatement> { pub fn wait_statement_fork(s: Span) -> IResult<Span, WaitStatement> {
let (s, a) = symbol("wait")(s)?; let (s, a) = symbol("wait")(s)?;
let (s, b) = symbol("fork")(s)?; let (s, b) = symbol("fork")(s)?;
@ -440,6 +466,7 @@ pub fn wait_statement_fork(s: Span) -> IResult<Span, WaitStatement> {
)) ))
} }
#[trace]
pub fn wait_statement_order(s: Span) -> IResult<Span, WaitStatement> { pub fn wait_statement_order(s: Span) -> IResult<Span, WaitStatement> {
let (s, a) = symbol("wait_order")(s)?; let (s, a) = symbol("wait_order")(s)?;
let (s, b) = paren(list(symbol(","), hierarchical_identifier))(s)?; let (s, b) = paren(list(symbol(","), hierarchical_identifier))(s)?;
@ -450,10 +477,12 @@ pub fn wait_statement_order(s: Span) -> IResult<Span, WaitStatement> {
)) ))
} }
#[trace]
pub fn event_trigger(s: Span) -> IResult<Span, EventTrigger> { pub fn event_trigger(s: Span) -> IResult<Span, EventTrigger> {
alt((event_trigger_named, event_trigger_nonblocking))(s) alt((event_trigger_named, event_trigger_nonblocking))(s)
} }
#[trace]
pub fn event_trigger_named(s: Span) -> IResult<Span, EventTrigger> { pub fn event_trigger_named(s: Span) -> IResult<Span, EventTrigger> {
let (s, a) = symbol("->")(s)?; let (s, a) = symbol("->")(s)?;
let (s, b) = hierarchical_event_identifier(s)?; let (s, b) = hierarchical_event_identifier(s)?;
@ -464,6 +493,7 @@ pub fn event_trigger_named(s: Span) -> IResult<Span, EventTrigger> {
)) ))
} }
#[trace]
pub fn event_trigger_nonblocking(s: Span) -> IResult<Span, EventTrigger> { pub fn event_trigger_nonblocking(s: Span) -> IResult<Span, EventTrigger> {
let (s, a) = symbol("->>")(s)?; let (s, a) = symbol("->>")(s)?;
let (s, b) = opt(delay_or_event_control)(s)?; let (s, b) = opt(delay_or_event_control)(s)?;
@ -477,6 +507,7 @@ pub fn event_trigger_nonblocking(s: Span) -> IResult<Span, EventTrigger> {
)) ))
} }
#[trace]
pub fn disable_statement(s: Span) -> IResult<Span, DisableStatement> { pub fn disable_statement(s: Span) -> IResult<Span, DisableStatement> {
alt(( alt((
disable_statement_task, disable_statement_task,
@ -485,6 +516,7 @@ pub fn disable_statement(s: Span) -> IResult<Span, DisableStatement> {
))(s) ))(s)
} }
#[trace]
pub fn disable_statement_task(s: Span) -> IResult<Span, DisableStatement> { pub fn disable_statement_task(s: Span) -> IResult<Span, DisableStatement> {
let (s, a) = symbol("disable")(s)?; let (s, a) = symbol("disable")(s)?;
let (s, b) = hierarchical_task_identifier(s)?; let (s, b) = hierarchical_task_identifier(s)?;
@ -495,6 +527,7 @@ pub fn disable_statement_task(s: Span) -> IResult<Span, DisableStatement> {
)) ))
} }
#[trace]
pub fn disable_statement_block(s: Span) -> IResult<Span, DisableStatement> { pub fn disable_statement_block(s: Span) -> IResult<Span, DisableStatement> {
let (s, a) = symbol("disable")(s)?; let (s, a) = symbol("disable")(s)?;
let (s, b) = hierarchical_block_identifier(s)?; let (s, b) = hierarchical_block_identifier(s)?;
@ -505,6 +538,7 @@ pub fn disable_statement_block(s: Span) -> IResult<Span, DisableStatement> {
)) ))
} }
#[trace]
pub fn disable_statement_fork(s: Span) -> IResult<Span, DisableStatement> { pub fn disable_statement_fork(s: Span) -> IResult<Span, DisableStatement> {
let (s, a) = symbol("disable")(s)?; let (s, a) = symbol("disable")(s)?;
let (s, b) = symbol("fork")(s)?; let (s, b) = symbol("fork")(s)?;

View File

@ -756,6 +756,7 @@ pub struct AssertionVariableDeclaration<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn concurrent_assertion_item(s: Span) -> IResult<Span, ConcurrentAssertionItem> { pub fn concurrent_assertion_item(s: Span) -> IResult<Span, ConcurrentAssertionItem> {
alt(( alt((
concurrent_assertion_item_statement, concurrent_assertion_item_statement,
@ -765,6 +766,7 @@ pub fn concurrent_assertion_item(s: Span) -> IResult<Span, ConcurrentAssertionIt
))(s) ))(s)
} }
#[trace]
pub fn concurrent_assertion_item_statement(s: Span) -> IResult<Span, ConcurrentAssertionItem> { pub fn concurrent_assertion_item_statement(s: Span) -> IResult<Span, ConcurrentAssertionItem> {
let (s, a) = opt(pair(block_identifier, symbol(":")))(s)?; let (s, a) = opt(pair(block_identifier, symbol(":")))(s)?;
let (s, b) = concurrent_assertion_statement(s)?; let (s, b) = concurrent_assertion_statement(s)?;
@ -774,6 +776,7 @@ pub fn concurrent_assertion_item_statement(s: Span) -> IResult<Span, ConcurrentA
)) ))
} }
#[trace]
pub fn concurrent_assertion_statement(s: Span) -> IResult<Span, ConcurrentAssertionStatement> { pub fn concurrent_assertion_statement(s: Span) -> IResult<Span, ConcurrentAssertionStatement> {
alt(( alt((
map(assert_property_statement, |x| { map(assert_property_statement, |x| {
@ -794,6 +797,7 @@ pub fn concurrent_assertion_statement(s: Span) -> IResult<Span, ConcurrentAssert
))(s) ))(s)
} }
#[trace]
pub fn assert_property_statement(s: Span) -> IResult<Span, AssertPropertyStatement> { pub fn assert_property_statement(s: Span) -> IResult<Span, AssertPropertyStatement> {
let (s, a) = symbol("assert")(s)?; let (s, a) = symbol("assert")(s)?;
let (s, b) = symbol("property")(s)?; let (s, b) = symbol("property")(s)?;
@ -807,6 +811,7 @@ pub fn assert_property_statement(s: Span) -> IResult<Span, AssertPropertyStateme
)) ))
} }
#[trace]
pub fn assume_property_statement(s: Span) -> IResult<Span, AssumePropertyStatement> { pub fn assume_property_statement(s: Span) -> IResult<Span, AssumePropertyStatement> {
let (s, a) = symbol("assume")(s)?; let (s, a) = symbol("assume")(s)?;
let (s, b) = symbol("property")(s)?; let (s, b) = symbol("property")(s)?;
@ -820,6 +825,7 @@ pub fn assume_property_statement(s: Span) -> IResult<Span, AssumePropertyStateme
)) ))
} }
#[trace]
pub fn cover_property_statement(s: Span) -> IResult<Span, CoverPropertyStatement> { pub fn cover_property_statement(s: Span) -> IResult<Span, CoverPropertyStatement> {
let (s, a) = symbol("cover")(s)?; let (s, a) = symbol("cover")(s)?;
let (s, b) = symbol("property")(s)?; let (s, b) = symbol("property")(s)?;
@ -833,6 +839,7 @@ pub fn cover_property_statement(s: Span) -> IResult<Span, CoverPropertyStatement
)) ))
} }
#[trace]
pub fn expect_property_statement(s: Span) -> IResult<Span, ExpectPropertyStatement> { pub fn expect_property_statement(s: Span) -> IResult<Span, ExpectPropertyStatement> {
let (s, a) = symbol("expect")(s)?; let (s, a) = symbol("expect")(s)?;
let (s, b) = paren(property_spec)(s)?; let (s, b) = paren(property_spec)(s)?;
@ -840,6 +847,7 @@ pub fn expect_property_statement(s: Span) -> IResult<Span, ExpectPropertyStateme
Ok((s, ExpectPropertyStatement { nodes: (a, b, c) })) Ok((s, ExpectPropertyStatement { nodes: (a, b, c) }))
} }
#[trace]
pub fn cover_sequence_statement(s: Span) -> IResult<Span, CoverSequenceStatement> { pub fn cover_sequence_statement(s: Span) -> IResult<Span, CoverSequenceStatement> {
let (s, a) = symbol("cover")(s)?; let (s, a) = symbol("cover")(s)?;
let (s, b) = symbol("sequence")(s)?; let (s, b) = symbol("sequence")(s)?;
@ -861,6 +869,7 @@ pub fn cover_sequence_statement(s: Span) -> IResult<Span, CoverSequenceStatement
)) ))
} }
#[trace]
pub fn restrict_property_statement(s: Span) -> IResult<Span, RestrictPropertyStatement> { pub fn restrict_property_statement(s: Span) -> IResult<Span, RestrictPropertyStatement> {
let (s, a) = symbol("restrict")(s)?; let (s, a) = symbol("restrict")(s)?;
let (s, b) = symbol("property")(s)?; let (s, b) = symbol("property")(s)?;
@ -874,12 +883,14 @@ pub fn restrict_property_statement(s: Span) -> IResult<Span, RestrictPropertySta
)) ))
} }
#[trace]
pub fn property_instance(s: Span) -> IResult<Span, PropertyInstance> { pub fn property_instance(s: Span) -> IResult<Span, PropertyInstance> {
let (s, a) = ps_or_hierarchical_property_identifier(s)?; let (s, a) = ps_or_hierarchical_property_identifier(s)?;
let (s, b) = opt(paren(opt(property_list_of_arguments)))(s)?; let (s, b) = opt(paren(opt(property_list_of_arguments)))(s)?;
Ok((s, PropertyInstance { nodes: (a, b) })) Ok((s, PropertyInstance { nodes: (a, b) }))
} }
#[trace]
pub fn property_list_of_arguments(s: Span) -> IResult<Span, PropertyListOfArguments> { pub fn property_list_of_arguments(s: Span) -> IResult<Span, PropertyListOfArguments> {
alt(( alt((
property_list_of_arguments_ordered, property_list_of_arguments_ordered,
@ -887,6 +898,7 @@ pub fn property_list_of_arguments(s: Span) -> IResult<Span, PropertyListOfArgume
))(s) ))(s)
} }
#[trace]
pub fn property_list_of_arguments_ordered(s: Span) -> IResult<Span, PropertyListOfArguments> { pub fn property_list_of_arguments_ordered(s: Span) -> IResult<Span, PropertyListOfArguments> {
let (s, a) = list(symbol(","), opt(property_actual_arg))(s)?; let (s, a) = list(symbol(","), opt(property_actual_arg))(s)?;
let (s, b) = many0(tuple(( let (s, b) = many0(tuple((
@ -901,6 +913,7 @@ pub fn property_list_of_arguments_ordered(s: Span) -> IResult<Span, PropertyList
)) ))
} }
#[trace]
pub fn property_list_of_arguments_named(s: Span) -> IResult<Span, PropertyListOfArguments> { pub fn property_list_of_arguments_named(s: Span) -> IResult<Span, PropertyListOfArguments> {
let (s, a) = list( let (s, a) = list(
symbol(","), symbol(","),
@ -912,6 +925,7 @@ pub fn property_list_of_arguments_named(s: Span) -> IResult<Span, PropertyListOf
)) ))
} }
#[trace]
pub fn property_actual_arg(s: Span) -> IResult<Span, PropertyActualArg> { pub fn property_actual_arg(s: Span) -> IResult<Span, PropertyActualArg> {
alt(( alt((
map(property_expr, |x| PropertyActualArg::PropertyExpr(x)), map(property_expr, |x| PropertyActualArg::PropertyExpr(x)),
@ -921,6 +935,7 @@ pub fn property_actual_arg(s: Span) -> IResult<Span, PropertyActualArg> {
))(s) ))(s)
} }
#[trace]
pub fn assertion_item_declaration(s: Span) -> IResult<Span, AssertionItemDeclaration> { pub fn assertion_item_declaration(s: Span) -> IResult<Span, AssertionItemDeclaration> {
alt(( alt((
map(property_declaration, |x| { map(property_declaration, |x| {
@ -935,6 +950,7 @@ pub fn assertion_item_declaration(s: Span) -> IResult<Span, AssertionItemDeclara
))(s) ))(s)
} }
#[trace]
pub fn property_declaration(s: Span) -> IResult<Span, PropertyDeclaration> { pub fn property_declaration(s: Span) -> IResult<Span, PropertyDeclaration> {
let (s, a) = symbol("property")(s)?; let (s, a) = symbol("property")(s)?;
let (s, b) = property_identifier(s)?; let (s, b) = property_identifier(s)?;
@ -953,11 +969,13 @@ pub fn property_declaration(s: Span) -> IResult<Span, PropertyDeclaration> {
)) ))
} }
#[trace]
pub fn property_port_list(s: Span) -> IResult<Span, PropertyPortList> { pub fn property_port_list(s: Span) -> IResult<Span, PropertyPortList> {
let (s, a) = list(symbol(","), property_port_item)(s)?; let (s, a) = list(symbol(","), property_port_item)(s)?;
Ok((s, PropertyPortList { nodes: (a,) })) Ok((s, PropertyPortList { nodes: (a,) }))
} }
#[trace]
pub fn property_port_item(s: Span) -> IResult<Span, PropertyPortItem> { pub fn property_port_item(s: Span) -> IResult<Span, PropertyPortItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = opt(pair(local, opt(property_lvar_port_direction)))(s)?; let (s, b) = opt(pair(local, opt(property_lvar_port_direction)))(s)?;
@ -973,11 +991,13 @@ pub fn property_port_item(s: Span) -> IResult<Span, PropertyPortItem> {
)) ))
} }
#[trace]
pub fn property_lvar_port_direction(s: Span) -> IResult<Span, PropertyLvarPortDirection> { pub fn property_lvar_port_direction(s: Span) -> IResult<Span, PropertyLvarPortDirection> {
let (s, a) = symbol("input")(s)?; let (s, a) = symbol("input")(s)?;
Ok((s, PropertyLvarPortDirection::Input(a))) Ok((s, PropertyLvarPortDirection::Input(a)))
} }
#[trace]
pub fn property_formal_type(s: Span) -> IResult<Span, PropertyFormalType> { pub fn property_formal_type(s: Span) -> IResult<Span, PropertyFormalType> {
alt(( alt((
map(sequence_formal_type, |x| { map(sequence_formal_type, |x| {
@ -987,6 +1007,7 @@ pub fn property_formal_type(s: Span) -> IResult<Span, PropertyFormalType> {
))(s) ))(s)
} }
#[trace]
pub fn property_spec(s: Span) -> IResult<Span, PropertySpec> { pub fn property_spec(s: Span) -> IResult<Span, PropertySpec> {
let (s, a) = opt(clocking_event)(s)?; let (s, a) = opt(clocking_event)(s)?;
let (s, b) = opt(triple( let (s, b) = opt(triple(
@ -998,6 +1019,7 @@ pub fn property_spec(s: Span) -> IResult<Span, PropertySpec> {
Ok((s, PropertySpec { nodes: (a, b, c) })) Ok((s, PropertySpec { nodes: (a, b, c) }))
} }
#[trace]
pub fn property_expr(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr(s: Span) -> IResult<Span, PropertyExpr> {
alt(( alt((
alt(( alt((
@ -1040,6 +1062,7 @@ pub fn property_expr(s: Span) -> IResult<Span, PropertyExpr> {
))(s) ))(s)
} }
#[trace]
pub fn property_expr_strong(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_strong(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = symbol("strong")(s)?; let (s, a) = symbol("strong")(s)?;
let (s, b) = paren(sequence_expr)(s)?; let (s, b) = paren(sequence_expr)(s)?;
@ -1049,6 +1072,7 @@ pub fn property_expr_strong(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_weak(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_weak(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = symbol("weak")(s)?; let (s, a) = symbol("weak")(s)?;
let (s, b) = paren(sequence_expr)(s)?; let (s, b) = paren(sequence_expr)(s)?;
@ -1058,6 +1082,7 @@ pub fn property_expr_weak(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_paren(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_paren(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = paren(sequence_expr)(s)?; let (s, a) = paren(sequence_expr)(s)?;
Ok(( Ok((
@ -1066,6 +1091,7 @@ pub fn property_expr_paren(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_not(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_not(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = symbol("not")(s)?; let (s, a) = symbol("not")(s)?;
let (s, b) = property_expr(s)?; let (s, b) = property_expr(s)?;
@ -1075,6 +1101,7 @@ pub fn property_expr_not(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_or(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_or(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = property_expr(s)?; let (s, a) = property_expr(s)?;
let (s, b) = symbol("or")(s)?; let (s, b) = symbol("or")(s)?;
@ -1085,6 +1112,7 @@ pub fn property_expr_or(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_and(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_and(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = property_expr(s)?; let (s, a) = property_expr(s)?;
let (s, b) = symbol("and")(s)?; let (s, b) = symbol("and")(s)?;
@ -1095,6 +1123,7 @@ pub fn property_expr_and(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_implication_overlapped(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_implication_overlapped(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = sequence_expr(s)?; let (s, a) = sequence_expr(s)?;
let (s, b) = symbol("|->")(s)?; let (s, b) = symbol("|->")(s)?;
@ -1107,6 +1136,7 @@ pub fn property_expr_implication_overlapped(s: Span) -> IResult<Span, PropertyEx
)) ))
} }
#[trace]
pub fn property_expr_implication_nonoverlapped(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_implication_nonoverlapped(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = sequence_expr(s)?; let (s, a) = sequence_expr(s)?;
let (s, b) = symbol("|=>")(s)?; let (s, b) = symbol("|=>")(s)?;
@ -1119,6 +1149,7 @@ pub fn property_expr_implication_nonoverlapped(s: Span) -> IResult<Span, Propert
)) ))
} }
#[trace]
pub fn property_expr_if(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_if(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = symbol("if")(s)?; let (s, a) = symbol("if")(s)?;
let (s, b) = paren(expression_or_dist)(s)?; let (s, b) = paren(expression_or_dist)(s)?;
@ -1132,6 +1163,7 @@ pub fn property_expr_if(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_case(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_case(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = symbol("case")(s)?; let (s, a) = symbol("case")(s)?;
let (s, b) = paren(expression_or_dist)(s)?; let (s, b) = paren(expression_or_dist)(s)?;
@ -1146,6 +1178,7 @@ pub fn property_expr_case(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_followed_by_overlapped(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_followed_by_overlapped(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = sequence_expr(s)?; let (s, a) = sequence_expr(s)?;
let (s, b) = symbol("#-#")(s)?; let (s, b) = symbol("#-#")(s)?;
@ -1158,6 +1191,7 @@ pub fn property_expr_followed_by_overlapped(s: Span) -> IResult<Span, PropertyEx
)) ))
} }
#[trace]
pub fn property_expr_followed_by_nonoverlapped(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_followed_by_nonoverlapped(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = sequence_expr(s)?; let (s, a) = sequence_expr(s)?;
let (s, b) = symbol("#=#")(s)?; let (s, b) = symbol("#=#")(s)?;
@ -1170,6 +1204,7 @@ pub fn property_expr_followed_by_nonoverlapped(s: Span) -> IResult<Span, Propert
)) ))
} }
#[trace]
pub fn property_expr_nexttime(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_nexttime(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = symbol("nexttime")(s)?; let (s, a) = symbol("nexttime")(s)?;
let (s, b) = opt(bracket(constant_expression))(s)?; let (s, b) = opt(bracket(constant_expression))(s)?;
@ -1180,6 +1215,7 @@ pub fn property_expr_nexttime(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_s_nexttime(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_s_nexttime(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = symbol("s_nexttime")(s)?; let (s, a) = symbol("s_nexttime")(s)?;
let (s, b) = opt(bracket(constant_expression))(s)?; let (s, b) = opt(bracket(constant_expression))(s)?;
@ -1190,6 +1226,7 @@ pub fn property_expr_s_nexttime(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_always(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_always(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = symbol("always")(s)?; let (s, a) = symbol("always")(s)?;
let (s, b) = opt(bracket(cycle_delay_const_range_expression))(s)?; let (s, b) = opt(bracket(cycle_delay_const_range_expression))(s)?;
@ -1200,6 +1237,7 @@ pub fn property_expr_always(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_s_always(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_s_always(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = symbol("s_always")(s)?; let (s, a) = symbol("s_always")(s)?;
let (s, b) = bracket(cycle_delay_const_range_expression)(s)?; let (s, b) = bracket(cycle_delay_const_range_expression)(s)?;
@ -1210,6 +1248,7 @@ pub fn property_expr_s_always(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_eventually(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_eventually(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = symbol("eventually")(s)?; let (s, a) = symbol("eventually")(s)?;
let (s, b) = bracket(constant_range)(s)?; let (s, b) = bracket(constant_range)(s)?;
@ -1220,6 +1259,7 @@ pub fn property_expr_eventually(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_s_eventually(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_s_eventually(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = symbol("s_eventually")(s)?; let (s, a) = symbol("s_eventually")(s)?;
let (s, b) = opt(bracket(cycle_delay_const_range_expression))(s)?; let (s, b) = opt(bracket(cycle_delay_const_range_expression))(s)?;
@ -1230,6 +1270,7 @@ pub fn property_expr_s_eventually(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_until(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_until(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = property_expr(s)?; let (s, a) = property_expr(s)?;
let (s, b) = symbol("until")(s)?; let (s, b) = symbol("until")(s)?;
@ -1240,6 +1281,7 @@ pub fn property_expr_until(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_s_until(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_s_until(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = property_expr(s)?; let (s, a) = property_expr(s)?;
let (s, b) = symbol("s_until")(s)?; let (s, b) = symbol("s_until")(s)?;
@ -1250,6 +1292,7 @@ pub fn property_expr_s_until(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_until_with(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_until_with(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = property_expr(s)?; let (s, a) = property_expr(s)?;
let (s, b) = symbol("until_with")(s)?; let (s, b) = symbol("until_with")(s)?;
@ -1260,6 +1303,7 @@ pub fn property_expr_until_with(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_s_until_with(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_s_until_with(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = property_expr(s)?; let (s, a) = property_expr(s)?;
let (s, b) = symbol("s_until_with")(s)?; let (s, b) = symbol("s_until_with")(s)?;
@ -1270,6 +1314,7 @@ pub fn property_expr_s_until_with(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_implies(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_implies(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = property_expr(s)?; let (s, a) = property_expr(s)?;
let (s, b) = symbol("implies")(s)?; let (s, b) = symbol("implies")(s)?;
@ -1280,6 +1325,7 @@ pub fn property_expr_implies(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_iff(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_iff(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = property_expr(s)?; let (s, a) = property_expr(s)?;
let (s, b) = symbol("iff")(s)?; let (s, b) = symbol("iff")(s)?;
@ -1290,6 +1336,7 @@ pub fn property_expr_iff(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_accept_on(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_accept_on(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = symbol("accept_on")(s)?; let (s, a) = symbol("accept_on")(s)?;
let (s, b) = paren(expression_or_dist)(s)?; let (s, b) = paren(expression_or_dist)(s)?;
@ -1300,6 +1347,7 @@ pub fn property_expr_accept_on(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_reject_on(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_reject_on(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = symbol("reject_on")(s)?; let (s, a) = symbol("reject_on")(s)?;
let (s, b) = paren(expression_or_dist)(s)?; let (s, b) = paren(expression_or_dist)(s)?;
@ -1310,6 +1358,7 @@ pub fn property_expr_reject_on(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_sync_accept_on(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_sync_accept_on(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = symbol("sync_accept_on")(s)?; let (s, a) = symbol("sync_accept_on")(s)?;
let (s, b) = paren(expression_or_dist)(s)?; let (s, b) = paren(expression_or_dist)(s)?;
@ -1320,6 +1369,7 @@ pub fn property_expr_sync_accept_on(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_sync_reject_on(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_sync_reject_on(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = symbol("sync_reject_on")(s)?; let (s, a) = symbol("sync_reject_on")(s)?;
let (s, b) = paren(expression_or_dist)(s)?; let (s, b) = paren(expression_or_dist)(s)?;
@ -1330,6 +1380,7 @@ pub fn property_expr_sync_reject_on(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_expr_clocking_event(s: Span) -> IResult<Span, PropertyExpr> { pub fn property_expr_clocking_event(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = clocking_event(s)?; let (s, a) = clocking_event(s)?;
let (s, b) = property_expr(s)?; let (s, b) = property_expr(s)?;
@ -1339,10 +1390,12 @@ pub fn property_expr_clocking_event(s: Span) -> IResult<Span, PropertyExpr> {
)) ))
} }
#[trace]
pub fn property_case_item(s: Span) -> IResult<Span, PropertyCaseItem> { pub fn property_case_item(s: Span) -> IResult<Span, PropertyCaseItem> {
alt((property_case_item_nondefault, property_case_item_default))(s) alt((property_case_item_nondefault, property_case_item_default))(s)
} }
#[trace]
pub fn property_case_item_nondefault(s: Span) -> IResult<Span, PropertyCaseItem> { pub fn property_case_item_nondefault(s: Span) -> IResult<Span, PropertyCaseItem> {
let (s, a) = list(symbol(","), expression_or_dist)(s)?; let (s, a) = list(symbol(","), expression_or_dist)(s)?;
let (s, b) = symbol(":")(s)?; let (s, b) = symbol(":")(s)?;
@ -1356,6 +1409,7 @@ pub fn property_case_item_nondefault(s: Span) -> IResult<Span, PropertyCaseItem>
)) ))
} }
#[trace]
pub fn property_case_item_default(s: Span) -> IResult<Span, PropertyCaseItem> { pub fn property_case_item_default(s: Span) -> IResult<Span, PropertyCaseItem> {
let (s, a) = symbol("default")(s)?; let (s, a) = symbol("default")(s)?;
let (s, b) = opt(symbol(":"))(s)?; let (s, b) = opt(symbol(":"))(s)?;
@ -1369,6 +1423,7 @@ pub fn property_case_item_default(s: Span) -> IResult<Span, PropertyCaseItem> {
)) ))
} }
#[trace]
pub fn sequence_declaration(s: Span) -> IResult<Span, SequenceDeclaration> { pub fn sequence_declaration(s: Span) -> IResult<Span, SequenceDeclaration> {
let (s, a) = symbol("sequence")(s)?; let (s, a) = symbol("sequence")(s)?;
let (s, b) = sequence_identifier(s)?; let (s, b) = sequence_identifier(s)?;
@ -1387,11 +1442,13 @@ pub fn sequence_declaration(s: Span) -> IResult<Span, SequenceDeclaration> {
)) ))
} }
#[trace]
pub fn sequence_port_list(s: Span) -> IResult<Span, SequencePortList> { pub fn sequence_port_list(s: Span) -> IResult<Span, SequencePortList> {
let (s, a) = list(symbol(","), sequence_port_item)(s)?; let (s, a) = list(symbol(","), sequence_port_item)(s)?;
Ok((s, SequencePortList { nodes: (a,) })) Ok((s, SequencePortList { nodes: (a,) }))
} }
#[trace]
pub fn sequence_port_item(s: Span) -> IResult<Span, SequencePortItem> { pub fn sequence_port_item(s: Span) -> IResult<Span, SequencePortItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = opt(pair(local, opt(sequence_lvar_port_direction)))(s)?; let (s, b) = opt(pair(local, opt(sequence_lvar_port_direction)))(s)?;
@ -1407,6 +1464,7 @@ pub fn sequence_port_item(s: Span) -> IResult<Span, SequencePortItem> {
)) ))
} }
#[trace]
pub fn sequence_lvar_port_direction(s: Span) -> IResult<Span, SequenceLvarPortDirection> { pub fn sequence_lvar_port_direction(s: Span) -> IResult<Span, SequenceLvarPortDirection> {
alt(( alt((
map(symbol("input"), |x| SequenceLvarPortDirection::Input(x)), map(symbol("input"), |x| SequenceLvarPortDirection::Input(x)),
@ -1415,6 +1473,7 @@ pub fn sequence_lvar_port_direction(s: Span) -> IResult<Span, SequenceLvarPortDi
))(s) ))(s)
} }
#[trace]
pub fn sequence_formal_type(s: Span) -> IResult<Span, SequenceFormalType> { pub fn sequence_formal_type(s: Span) -> IResult<Span, SequenceFormalType> {
alt(( alt((
map(data_type_or_implicit, |x| { map(data_type_or_implicit, |x| {
@ -1425,6 +1484,7 @@ pub fn sequence_formal_type(s: Span) -> IResult<Span, SequenceFormalType> {
))(s) ))(s)
} }
#[trace]
pub fn sequence_expr(s: Span) -> IResult<Span, SequenceExpr> { pub fn sequence_expr(s: Span) -> IResult<Span, SequenceExpr> {
alt(( alt((
sequence_expr_cycle_delay_expr, sequence_expr_cycle_delay_expr,
@ -1442,6 +1502,7 @@ pub fn sequence_expr(s: Span) -> IResult<Span, SequenceExpr> {
))(s) ))(s)
} }
#[trace]
pub fn sequence_expr_cycle_delay_expr(s: Span) -> IResult<Span, SequenceExpr> { pub fn sequence_expr_cycle_delay_expr(s: Span) -> IResult<Span, SequenceExpr> {
let (s, a) = cycle_delay_range(s)?; let (s, a) = cycle_delay_range(s)?;
let (s, b) = sequence_expr(s)?; let (s, b) = sequence_expr(s)?;
@ -1452,6 +1513,7 @@ pub fn sequence_expr_cycle_delay_expr(s: Span) -> IResult<Span, SequenceExpr> {
)) ))
} }
#[trace]
pub fn sequence_expr_expr_cycle_delay_expr(s: Span) -> IResult<Span, SequenceExpr> { pub fn sequence_expr_expr_cycle_delay_expr(s: Span) -> IResult<Span, SequenceExpr> {
let (s, a) = sequence_expr(s)?; let (s, a) = sequence_expr(s)?;
let (s, b) = cycle_delay_range(s)?; let (s, b) = cycle_delay_range(s)?;
@ -1465,6 +1527,7 @@ pub fn sequence_expr_expr_cycle_delay_expr(s: Span) -> IResult<Span, SequenceExp
)) ))
} }
#[trace]
pub fn sequence_expr_expression(s: Span) -> IResult<Span, SequenceExpr> { pub fn sequence_expr_expression(s: Span) -> IResult<Span, SequenceExpr> {
let (s, a) = expression_or_dist(s)?; let (s, a) = expression_or_dist(s)?;
let (s, b) = opt(boolean_abbrev)(s)?; let (s, b) = opt(boolean_abbrev)(s)?;
@ -1474,6 +1537,7 @@ pub fn sequence_expr_expression(s: Span) -> IResult<Span, SequenceExpr> {
)) ))
} }
#[trace]
pub fn sequence_expr_instance(s: Span) -> IResult<Span, SequenceExpr> { pub fn sequence_expr_instance(s: Span) -> IResult<Span, SequenceExpr> {
let (s, a) = sequence_instance(s)?; let (s, a) = sequence_instance(s)?;
let (s, b) = opt(sequence_abbrev)(s)?; let (s, b) = opt(sequence_abbrev)(s)?;
@ -1483,6 +1547,7 @@ pub fn sequence_expr_instance(s: Span) -> IResult<Span, SequenceExpr> {
)) ))
} }
#[trace]
pub fn sequence_expr_paren(s: Span) -> IResult<Span, SequenceExpr> { pub fn sequence_expr_paren(s: Span) -> IResult<Span, SequenceExpr> {
let (s, a) = paren(pair( let (s, a) = paren(pair(
sequence_expr, sequence_expr,
@ -1495,6 +1560,7 @@ pub fn sequence_expr_paren(s: Span) -> IResult<Span, SequenceExpr> {
)) ))
} }
#[trace]
pub fn sequence_expr_and(s: Span) -> IResult<Span, SequenceExpr> { pub fn sequence_expr_and(s: Span) -> IResult<Span, SequenceExpr> {
let (s, a) = sequence_expr(s)?; let (s, a) = sequence_expr(s)?;
let (s, b) = symbol("and")(s)?; let (s, b) = symbol("and")(s)?;
@ -1505,6 +1571,7 @@ pub fn sequence_expr_and(s: Span) -> IResult<Span, SequenceExpr> {
)) ))
} }
#[trace]
pub fn sequence_expr_intersect(s: Span) -> IResult<Span, SequenceExpr> { pub fn sequence_expr_intersect(s: Span) -> IResult<Span, SequenceExpr> {
let (s, a) = sequence_expr(s)?; let (s, a) = sequence_expr(s)?;
let (s, b) = symbol("intersect")(s)?; let (s, b) = symbol("intersect")(s)?;
@ -1515,6 +1582,7 @@ pub fn sequence_expr_intersect(s: Span) -> IResult<Span, SequenceExpr> {
)) ))
} }
#[trace]
pub fn sequence_expr_or(s: Span) -> IResult<Span, SequenceExpr> { pub fn sequence_expr_or(s: Span) -> IResult<Span, SequenceExpr> {
let (s, a) = sequence_expr(s)?; let (s, a) = sequence_expr(s)?;
let (s, b) = symbol("or")(s)?; let (s, b) = symbol("or")(s)?;
@ -1525,6 +1593,7 @@ pub fn sequence_expr_or(s: Span) -> IResult<Span, SequenceExpr> {
)) ))
} }
#[trace]
pub fn sequence_expr_first_match(s: Span) -> IResult<Span, SequenceExpr> { pub fn sequence_expr_first_match(s: Span) -> IResult<Span, SequenceExpr> {
let (s, a) = symbol("first_match")(s)?; let (s, a) = symbol("first_match")(s)?;
let (s, b) = paren(pair( let (s, b) = paren(pair(
@ -1537,6 +1606,7 @@ pub fn sequence_expr_first_match(s: Span) -> IResult<Span, SequenceExpr> {
)) ))
} }
#[trace]
pub fn sequence_expr_throughout(s: Span) -> IResult<Span, SequenceExpr> { pub fn sequence_expr_throughout(s: Span) -> IResult<Span, SequenceExpr> {
let (s, a) = expression_or_dist(s)?; let (s, a) = expression_or_dist(s)?;
let (s, b) = symbol("throughout")(s)?; let (s, b) = symbol("throughout")(s)?;
@ -1547,6 +1617,7 @@ pub fn sequence_expr_throughout(s: Span) -> IResult<Span, SequenceExpr> {
)) ))
} }
#[trace]
pub fn sequence_expr_within(s: Span) -> IResult<Span, SequenceExpr> { pub fn sequence_expr_within(s: Span) -> IResult<Span, SequenceExpr> {
let (s, a) = sequence_expr(s)?; let (s, a) = sequence_expr(s)?;
let (s, b) = symbol("within")(s)?; let (s, b) = symbol("within")(s)?;
@ -1557,6 +1628,7 @@ pub fn sequence_expr_within(s: Span) -> IResult<Span, SequenceExpr> {
)) ))
} }
#[trace]
pub fn sequence_expr_clocking_event(s: Span) -> IResult<Span, SequenceExpr> { pub fn sequence_expr_clocking_event(s: Span) -> IResult<Span, SequenceExpr> {
let (s, a) = clocking_event(s)?; let (s, a) = clocking_event(s)?;
let (s, b) = sequence_expr(s)?; let (s, b) = sequence_expr(s)?;
@ -1566,6 +1638,7 @@ pub fn sequence_expr_clocking_event(s: Span) -> IResult<Span, SequenceExpr> {
)) ))
} }
#[trace]
pub fn cycle_delay_range(s: Span) -> IResult<Span, CycleDelayRange> { pub fn cycle_delay_range(s: Span) -> IResult<Span, CycleDelayRange> {
alt(( alt((
cycle_delay_range_primary, cycle_delay_range_primary,
@ -1575,6 +1648,7 @@ pub fn cycle_delay_range(s: Span) -> IResult<Span, CycleDelayRange> {
))(s) ))(s)
} }
#[trace]
pub fn cycle_delay_range_primary(s: Span) -> IResult<Span, CycleDelayRange> { pub fn cycle_delay_range_primary(s: Span) -> IResult<Span, CycleDelayRange> {
let (s, a) = symbol("##")(s)?; let (s, a) = symbol("##")(s)?;
let (s, b) = constant_primary(s)?; let (s, b) = constant_primary(s)?;
@ -1584,6 +1658,7 @@ pub fn cycle_delay_range_primary(s: Span) -> IResult<Span, CycleDelayRange> {
)) ))
} }
#[trace]
pub fn cycle_delay_range_expression(s: Span) -> IResult<Span, CycleDelayRange> { pub fn cycle_delay_range_expression(s: Span) -> IResult<Span, CycleDelayRange> {
let (s, a) = symbol("##")(s)?; let (s, a) = symbol("##")(s)?;
let (s, b) = bracket(cycle_delay_const_range_expression)(s)?; let (s, b) = bracket(cycle_delay_const_range_expression)(s)?;
@ -1593,6 +1668,7 @@ pub fn cycle_delay_range_expression(s: Span) -> IResult<Span, CycleDelayRange> {
)) ))
} }
#[trace]
pub fn cycle_delay_range_asterisk(s: Span) -> IResult<Span, CycleDelayRange> { pub fn cycle_delay_range_asterisk(s: Span) -> IResult<Span, CycleDelayRange> {
let (s, a) = symbol("##")(s)?; let (s, a) = symbol("##")(s)?;
let (s, b) = bracket(symbol("*"))(s)?; let (s, b) = bracket(symbol("*"))(s)?;
@ -1602,6 +1678,7 @@ pub fn cycle_delay_range_asterisk(s: Span) -> IResult<Span, CycleDelayRange> {
)) ))
} }
#[trace]
pub fn cycle_delay_range_plus(s: Span) -> IResult<Span, CycleDelayRange> { pub fn cycle_delay_range_plus(s: Span) -> IResult<Span, CycleDelayRange> {
let (s, a) = symbol("##")(s)?; let (s, a) = symbol("##")(s)?;
let (s, b) = bracket(symbol("+"))(s)?; let (s, b) = bracket(symbol("+"))(s)?;
@ -1611,6 +1688,7 @@ pub fn cycle_delay_range_plus(s: Span) -> IResult<Span, CycleDelayRange> {
)) ))
} }
#[trace]
pub fn sequence_method_call(s: Span) -> IResult<Span, SequenceMethodCall> { pub fn sequence_method_call(s: Span) -> IResult<Span, SequenceMethodCall> {
let (s, a) = sequence_instance(s)?; let (s, a) = sequence_instance(s)?;
let (s, b) = symbol(".")(s)?; let (s, b) = symbol(".")(s)?;
@ -1618,6 +1696,7 @@ pub fn sequence_method_call(s: Span) -> IResult<Span, SequenceMethodCall> {
Ok((s, SequenceMethodCall { nodes: (a, b, c) })) Ok((s, SequenceMethodCall { nodes: (a, b, c) }))
} }
#[trace]
pub fn sequence_match_item(s: Span) -> IResult<Span, SequenceMatchItem> { pub fn sequence_match_item(s: Span) -> IResult<Span, SequenceMatchItem> {
alt(( alt((
map(operator_assignment, |x| { map(operator_assignment, |x| {
@ -1630,12 +1709,14 @@ pub fn sequence_match_item(s: Span) -> IResult<Span, SequenceMatchItem> {
))(s) ))(s)
} }
#[trace]
pub fn sequence_instance(s: Span) -> IResult<Span, SequenceInstance> { pub fn sequence_instance(s: Span) -> IResult<Span, SequenceInstance> {
let (s, a) = ps_or_hierarchical_sequence_identifier(s)?; let (s, a) = ps_or_hierarchical_sequence_identifier(s)?;
let (s, b) = opt(paren(opt(sequence_list_of_arguments)))(s)?; let (s, b) = opt(paren(opt(sequence_list_of_arguments)))(s)?;
Ok((s, SequenceInstance { nodes: (a, b) })) Ok((s, SequenceInstance { nodes: (a, b) }))
} }
#[trace]
pub fn sequence_list_of_arguments(s: Span) -> IResult<Span, SequenceListOfArguments> { pub fn sequence_list_of_arguments(s: Span) -> IResult<Span, SequenceListOfArguments> {
alt(( alt((
sequence_list_of_arguments_ordered, sequence_list_of_arguments_ordered,
@ -1643,6 +1724,7 @@ pub fn sequence_list_of_arguments(s: Span) -> IResult<Span, SequenceListOfArgume
))(s) ))(s)
} }
#[trace]
pub fn sequence_list_of_arguments_ordered(s: Span) -> IResult<Span, SequenceListOfArguments> { pub fn sequence_list_of_arguments_ordered(s: Span) -> IResult<Span, SequenceListOfArguments> {
let (s, a) = list(symbol(","), opt(sequence_actual_arg))(s)?; let (s, a) = list(symbol(","), opt(sequence_actual_arg))(s)?;
let (s, b) = many0(tuple(( let (s, b) = many0(tuple((
@ -1657,6 +1739,7 @@ pub fn sequence_list_of_arguments_ordered(s: Span) -> IResult<Span, SequenceList
)) ))
} }
#[trace]
pub fn sequence_list_of_arguments_named(s: Span) -> IResult<Span, SequenceListOfArguments> { pub fn sequence_list_of_arguments_named(s: Span) -> IResult<Span, SequenceListOfArguments> {
let (s, a) = list( let (s, a) = list(
symbol(","), symbol(","),
@ -1668,6 +1751,7 @@ pub fn sequence_list_of_arguments_named(s: Span) -> IResult<Span, SequenceListOf
)) ))
} }
#[trace]
pub fn sequence_actual_arg(s: Span) -> IResult<Span, SequenceActualArg> { pub fn sequence_actual_arg(s: Span) -> IResult<Span, SequenceActualArg> {
alt(( alt((
map(event_expression, |x| SequenceActualArg::EventExpression(x)), map(event_expression, |x| SequenceActualArg::EventExpression(x)),
@ -1675,6 +1759,7 @@ pub fn sequence_actual_arg(s: Span) -> IResult<Span, SequenceActualArg> {
))(s) ))(s)
} }
#[trace]
pub fn boolean_abbrev(s: Span) -> IResult<Span, BooleanAbbrev> { pub fn boolean_abbrev(s: Span) -> IResult<Span, BooleanAbbrev> {
alt(( alt((
map(consecutive_repetition, |x| { map(consecutive_repetition, |x| {
@ -1687,11 +1772,13 @@ pub fn boolean_abbrev(s: Span) -> IResult<Span, BooleanAbbrev> {
))(s) ))(s)
} }
#[trace]
pub fn sequence_abbrev(s: Span) -> IResult<Span, SequenceAbbrev> { pub fn sequence_abbrev(s: Span) -> IResult<Span, SequenceAbbrev> {
let (s, a) = consecutive_repetition(s)?; let (s, a) = consecutive_repetition(s)?;
Ok((s, SequenceAbbrev { nodes: (a,) })) Ok((s, SequenceAbbrev { nodes: (a,) }))
} }
#[trace]
pub fn consecutive_repetition(s: Span) -> IResult<Span, ConsecutiveRepetition> { pub fn consecutive_repetition(s: Span) -> IResult<Span, ConsecutiveRepetition> {
alt(( alt((
consecutive_repetition_expression, consecutive_repetition_expression,
@ -1700,6 +1787,7 @@ pub fn consecutive_repetition(s: Span) -> IResult<Span, ConsecutiveRepetition> {
))(s) ))(s)
} }
#[trace]
pub fn consecutive_repetition_expression(s: Span) -> IResult<Span, ConsecutiveRepetition> { pub fn consecutive_repetition_expression(s: Span) -> IResult<Span, ConsecutiveRepetition> {
let (s, a) = bracket(pair(symbol("*"), const_or_range_expression))(s)?; let (s, a) = bracket(pair(symbol("*"), const_or_range_expression))(s)?;
Ok(( Ok((
@ -1708,6 +1796,7 @@ pub fn consecutive_repetition_expression(s: Span) -> IResult<Span, ConsecutiveRe
)) ))
} }
#[trace]
pub fn consecutive_repetition_asterisk(s: Span) -> IResult<Span, ConsecutiveRepetition> { pub fn consecutive_repetition_asterisk(s: Span) -> IResult<Span, ConsecutiveRepetition> {
let (s, a) = bracket(symbol("*"))(s)?; let (s, a) = bracket(symbol("*"))(s)?;
Ok(( Ok((
@ -1716,6 +1805,7 @@ pub fn consecutive_repetition_asterisk(s: Span) -> IResult<Span, ConsecutiveRepe
)) ))
} }
#[trace]
pub fn consecutive_repetition_plus(s: Span) -> IResult<Span, ConsecutiveRepetition> { pub fn consecutive_repetition_plus(s: Span) -> IResult<Span, ConsecutiveRepetition> {
let (s, a) = bracket(symbol("+"))(s)?; let (s, a) = bracket(symbol("+"))(s)?;
Ok(( Ok((
@ -1724,16 +1814,19 @@ pub fn consecutive_repetition_plus(s: Span) -> IResult<Span, ConsecutiveRepetiti
)) ))
} }
#[trace]
pub fn non_consecutive_repetition(s: Span) -> IResult<Span, NonConsecutiveRepetition> { pub fn non_consecutive_repetition(s: Span) -> IResult<Span, NonConsecutiveRepetition> {
let (s, a) = bracket(pair(symbol("="), const_or_range_expression))(s)?; let (s, a) = bracket(pair(symbol("="), const_or_range_expression))(s)?;
Ok((s, NonConsecutiveRepetition { nodes: (a,) })) Ok((s, NonConsecutiveRepetition { nodes: (a,) }))
} }
#[trace]
pub fn goto_repetition(s: Span) -> IResult<Span, GotoRepetition> { pub fn goto_repetition(s: Span) -> IResult<Span, GotoRepetition> {
let (s, a) = bracket(pair(symbol("->"), const_or_range_expression))(s)?; let (s, a) = bracket(pair(symbol("->"), const_or_range_expression))(s)?;
Ok((s, GotoRepetition { nodes: (a,) })) Ok((s, GotoRepetition { nodes: (a,) }))
} }
#[trace]
pub fn const_or_range_expression(s: Span) -> IResult<Span, ConstOrRangeExpression> { pub fn const_or_range_expression(s: Span) -> IResult<Span, ConstOrRangeExpression> {
alt(( alt((
map(constant_expression, |x| { map(constant_expression, |x| {
@ -1745,6 +1838,7 @@ pub fn const_or_range_expression(s: Span) -> IResult<Span, ConstOrRangeExpressio
))(s) ))(s)
} }
#[trace]
pub fn cycle_delay_const_range_expression( pub fn cycle_delay_const_range_expression(
s: Span, s: Span,
) -> IResult<Span, CycleDelayConstRangeExpression> { ) -> IResult<Span, CycleDelayConstRangeExpression> {
@ -1754,6 +1848,7 @@ pub fn cycle_delay_const_range_expression(
))(s) ))(s)
} }
#[trace]
pub fn cycle_delay_const_range_expression_binary( pub fn cycle_delay_const_range_expression_binary(
s: Span, s: Span,
) -> IResult<Span, CycleDelayConstRangeExpression> { ) -> IResult<Span, CycleDelayConstRangeExpression> {
@ -1768,6 +1863,7 @@ pub fn cycle_delay_const_range_expression_binary(
)) ))
} }
#[trace]
pub fn cycle_delay_const_range_expression_dollar( pub fn cycle_delay_const_range_expression_dollar(
s: Span, s: Span,
) -> IResult<Span, CycleDelayConstRangeExpression> { ) -> IResult<Span, CycleDelayConstRangeExpression> {
@ -1782,12 +1878,14 @@ pub fn cycle_delay_const_range_expression_dollar(
)) ))
} }
#[trace]
pub fn expression_or_dist(s: Span) -> IResult<Span, ExpressionOrDist> { pub fn expression_or_dist(s: Span) -> IResult<Span, ExpressionOrDist> {
let (s, a) = expression(s)?; let (s, a) = expression(s)?;
let (s, b) = opt(pair(symbol("dist"), brace(dist_list)))(s)?; let (s, b) = opt(pair(symbol("dist"), brace(dist_list)))(s)?;
Ok((s, ExpressionOrDist { nodes: (a, b) })) Ok((s, ExpressionOrDist { nodes: (a, b) }))
} }
#[trace]
pub fn assertion_variable_declaration(s: Span) -> IResult<Span, AssertionVariableDeclaration> { pub fn assertion_variable_declaration(s: Span) -> IResult<Span, AssertionVariableDeclaration> {
let (s, a) = var_data_type(s)?; let (s, a) = var_data_type(s)?;
let (s, b) = list_of_variable_decl_assignments(s)?; let (s, b) = list_of_variable_decl_assignments(s)?;

View File

@ -44,6 +44,7 @@ pub struct BlockItemDeclarationLet<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn block_item_declaration(s: Span) -> IResult<Span, BlockItemDeclaration> { pub fn block_item_declaration(s: Span) -> IResult<Span, BlockItemDeclaration> {
alt(( alt((
block_item_declaration_data, block_item_declaration_data,
@ -53,6 +54,7 @@ pub fn block_item_declaration(s: Span) -> IResult<Span, BlockItemDeclaration> {
))(s) ))(s)
} }
#[trace]
pub fn block_item_declaration_data(s: Span) -> IResult<Span, BlockItemDeclaration> { pub fn block_item_declaration_data(s: Span) -> IResult<Span, BlockItemDeclaration> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = data_declaration(s)?; let (s, b) = data_declaration(s)?;
@ -62,6 +64,7 @@ pub fn block_item_declaration_data(s: Span) -> IResult<Span, BlockItemDeclaratio
)) ))
} }
#[trace]
pub fn block_item_declaration_local_parameter(s: Span) -> IResult<Span, BlockItemDeclaration> { pub fn block_item_declaration_local_parameter(s: Span) -> IResult<Span, BlockItemDeclaration> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = local_parameter_declaration(s)?; let (s, b) = local_parameter_declaration(s)?;
@ -74,6 +77,7 @@ pub fn block_item_declaration_local_parameter(s: Span) -> IResult<Span, BlockIte
)) ))
} }
#[trace]
pub fn block_item_declaration_parameter(s: Span) -> IResult<Span, BlockItemDeclaration> { pub fn block_item_declaration_parameter(s: Span) -> IResult<Span, BlockItemDeclaration> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = parameter_declaration(s)?; let (s, b) = parameter_declaration(s)?;
@ -84,6 +88,7 @@ pub fn block_item_declaration_parameter(s: Span) -> IResult<Span, BlockItemDecla
)) ))
} }
#[trace]
pub fn block_item_declaration_let(s: Span) -> IResult<Span, BlockItemDeclaration> { pub fn block_item_declaration_let(s: Span) -> IResult<Span, BlockItemDeclaration> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = let_declaration(s)?; let (s, b) = let_declaration(s)?;

View File

@ -521,6 +521,7 @@ pub struct CovergroupExpression<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn covergroup_declaration(s: Span) -> IResult<Span, CovergroupDeclaration> { pub fn covergroup_declaration(s: Span) -> IResult<Span, CovergroupDeclaration> {
let (s, a) = symbol("covergroup")(s)?; let (s, a) = symbol("covergroup")(s)?;
let (s, b) = covergroup_identifier(s)?; let (s, b) = covergroup_identifier(s)?;
@ -538,10 +539,12 @@ pub fn covergroup_declaration(s: Span) -> IResult<Span, CovergroupDeclaration> {
)) ))
} }
#[trace]
pub fn coverage_spec_or_option(s: Span) -> IResult<Span, CoverageSpecOrOption> { pub fn coverage_spec_or_option(s: Span) -> IResult<Span, CoverageSpecOrOption> {
alt((coverage_spec_or_option_spec, coverage_spec_or_option_option))(s) alt((coverage_spec_or_option_spec, coverage_spec_or_option_option))(s)
} }
#[trace]
pub fn coverage_spec_or_option_spec(s: Span) -> IResult<Span, CoverageSpecOrOption> { pub fn coverage_spec_or_option_spec(s: Span) -> IResult<Span, CoverageSpecOrOption> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = coverage_spec(s)?; let (s, b) = coverage_spec(s)?;
@ -551,6 +554,7 @@ pub fn coverage_spec_or_option_spec(s: Span) -> IResult<Span, CoverageSpecOrOpti
)) ))
} }
#[trace]
pub fn coverage_spec_or_option_option(s: Span) -> IResult<Span, CoverageSpecOrOption> { pub fn coverage_spec_or_option_option(s: Span) -> IResult<Span, CoverageSpecOrOption> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = coverage_option(s)?; let (s, b) = coverage_option(s)?;
@ -561,10 +565,12 @@ pub fn coverage_spec_or_option_option(s: Span) -> IResult<Span, CoverageSpecOrOp
)) ))
} }
#[trace]
pub fn coverage_option(s: Span) -> IResult<Span, CoverageOption> { pub fn coverage_option(s: Span) -> IResult<Span, CoverageOption> {
alt((coverage_option_option, coverage_option_type_option))(s) alt((coverage_option_option, coverage_option_type_option))(s)
} }
#[trace]
pub fn coverage_option_option(s: Span) -> IResult<Span, CoverageOption> { pub fn coverage_option_option(s: Span) -> IResult<Span, CoverageOption> {
let (s, a) = symbol("option")(s)?; let (s, a) = symbol("option")(s)?;
let (s, b) = symbol(".")(s)?; let (s, b) = symbol(".")(s)?;
@ -579,6 +585,7 @@ pub fn coverage_option_option(s: Span) -> IResult<Span, CoverageOption> {
)) ))
} }
#[trace]
pub fn coverage_option_type_option(s: Span) -> IResult<Span, CoverageOption> { pub fn coverage_option_type_option(s: Span) -> IResult<Span, CoverageOption> {
let (s, a) = symbol("type_option")(s)?; let (s, a) = symbol("type_option")(s)?;
let (s, b) = symbol(".")(s)?; let (s, b) = symbol(".")(s)?;
@ -593,6 +600,7 @@ pub fn coverage_option_type_option(s: Span) -> IResult<Span, CoverageOption> {
)) ))
} }
#[trace]
pub fn coverage_spec(s: Span) -> IResult<Span, CoverageSpec> { pub fn coverage_spec(s: Span) -> IResult<Span, CoverageSpec> {
alt(( alt((
map(cover_point, |x| CoverageSpec::CoverPoint(x)), map(cover_point, |x| CoverageSpec::CoverPoint(x)),
@ -600,6 +608,7 @@ pub fn coverage_spec(s: Span) -> IResult<Span, CoverageSpec> {
))(s) ))(s)
} }
#[trace]
pub fn coverage_event(s: Span) -> IResult<Span, CoverageEvent> { pub fn coverage_event(s: Span) -> IResult<Span, CoverageEvent> {
alt(( alt((
map(clocking_event, |x| CoverageEvent::ClockingEvent(x)), map(clocking_event, |x| CoverageEvent::ClockingEvent(x)),
@ -608,6 +617,7 @@ pub fn coverage_event(s: Span) -> IResult<Span, CoverageEvent> {
))(s) ))(s)
} }
#[trace]
pub fn coverage_event_sample(s: Span) -> IResult<Span, CoverageEvent> { pub fn coverage_event_sample(s: Span) -> IResult<Span, CoverageEvent> {
let (s, a) = symbol("with")(s)?; let (s, a) = symbol("with")(s)?;
let (s, b) = symbol("function")(s)?; let (s, b) = symbol("function")(s)?;
@ -621,12 +631,14 @@ pub fn coverage_event_sample(s: Span) -> IResult<Span, CoverageEvent> {
)) ))
} }
#[trace]
pub fn coverage_event_at(s: Span) -> IResult<Span, CoverageEvent> { pub fn coverage_event_at(s: Span) -> IResult<Span, CoverageEvent> {
let (s, a) = symbol("@@")(s)?; let (s, a) = symbol("@@")(s)?;
let (s, b) = paren(block_event_expression)(s)?; let (s, b) = paren(block_event_expression)(s)?;
Ok((s, CoverageEvent::At(CoverageEventAt { nodes: (a, b) }))) Ok((s, CoverageEvent::At(CoverageEventAt { nodes: (a, b) })))
} }
#[trace]
pub fn block_event_expression(s: Span) -> IResult<Span, BlockEventExpression> { pub fn block_event_expression(s: Span) -> IResult<Span, BlockEventExpression> {
alt(( alt((
block_event_expression_or, block_event_expression_or,
@ -635,6 +647,7 @@ pub fn block_event_expression(s: Span) -> IResult<Span, BlockEventExpression> {
))(s) ))(s)
} }
#[trace]
pub fn block_event_expression_or(s: Span) -> IResult<Span, BlockEventExpression> { pub fn block_event_expression_or(s: Span) -> IResult<Span, BlockEventExpression> {
let (s, a) = block_event_expression(s)?; let (s, a) = block_event_expression(s)?;
let (s, b) = symbol("or")(s)?; let (s, b) = symbol("or")(s)?;
@ -645,6 +658,7 @@ pub fn block_event_expression_or(s: Span) -> IResult<Span, BlockEventExpression>
)) ))
} }
#[trace]
pub fn block_event_expression_begin(s: Span) -> IResult<Span, BlockEventExpression> { pub fn block_event_expression_begin(s: Span) -> IResult<Span, BlockEventExpression> {
let (s, a) = symbol("begin")(s)?; let (s, a) = symbol("begin")(s)?;
let (s, b) = hierarchical_btf_identifier(s)?; let (s, b) = hierarchical_btf_identifier(s)?;
@ -654,6 +668,7 @@ pub fn block_event_expression_begin(s: Span) -> IResult<Span, BlockEventExpressi
)) ))
} }
#[trace]
pub fn block_event_expression_end(s: Span) -> IResult<Span, BlockEventExpression> { pub fn block_event_expression_end(s: Span) -> IResult<Span, BlockEventExpression> {
let (s, a) = symbol("end")(s)?; let (s, a) = symbol("end")(s)?;
let (s, b) = hierarchical_btf_identifier(s)?; let (s, b) = hierarchical_btf_identifier(s)?;
@ -663,6 +678,7 @@ pub fn block_event_expression_end(s: Span) -> IResult<Span, BlockEventExpression
)) ))
} }
#[trace]
pub fn hierarchical_btf_identifier(s: Span) -> IResult<Span, HierarchicalBtfIdentifier> { pub fn hierarchical_btf_identifier(s: Span) -> IResult<Span, HierarchicalBtfIdentifier> {
alt(( alt((
map(hierarchical_tf_identifier, |x| { map(hierarchical_tf_identifier, |x| {
@ -675,6 +691,7 @@ pub fn hierarchical_btf_identifier(s: Span) -> IResult<Span, HierarchicalBtfIden
))(s) ))(s)
} }
#[trace]
pub fn hierarchical_btf_identifier_method(s: Span) -> IResult<Span, HierarchicalBtfIdentifier> { pub fn hierarchical_btf_identifier_method(s: Span) -> IResult<Span, HierarchicalBtfIdentifier> {
let (s, a) = opt(hierarchical_identifier_or_class_scope)(s)?; let (s, a) = opt(hierarchical_identifier_or_class_scope)(s)?;
let (s, b) = method_identifier(s)?; let (s, b) = method_identifier(s)?;
@ -684,6 +701,7 @@ pub fn hierarchical_btf_identifier_method(s: Span) -> IResult<Span, Hierarchical
)) ))
} }
#[trace]
pub fn hierarchical_identifier_or_class_scope( pub fn hierarchical_identifier_or_class_scope(
s: Span, s: Span,
) -> IResult<Span, HierarchicalIdentifierOrClassScope> { ) -> IResult<Span, HierarchicalIdentifierOrClassScope> {
@ -697,6 +715,7 @@ pub fn hierarchical_identifier_or_class_scope(
))(s) ))(s)
} }
#[trace]
pub fn cover_point(s: Span) -> IResult<Span, CoverPoint> { pub fn cover_point(s: Span) -> IResult<Span, CoverPoint> {
let (s, a) = opt(triple( let (s, a) = opt(triple(
opt(data_type_or_implicit), opt(data_type_or_implicit),
@ -715,6 +734,7 @@ pub fn cover_point(s: Span) -> IResult<Span, CoverPoint> {
)) ))
} }
#[trace]
pub fn bins_or_empty(s: Span) -> IResult<Span, BinsOrEmpty> { pub fn bins_or_empty(s: Span) -> IResult<Span, BinsOrEmpty> {
alt(( alt((
bins_or_empty_non_empty, bins_or_empty_non_empty,
@ -722,6 +742,7 @@ pub fn bins_or_empty(s: Span) -> IResult<Span, BinsOrEmpty> {
))(s) ))(s)
} }
#[trace]
pub fn bins_or_empty_non_empty(s: Span) -> IResult<Span, BinsOrEmpty> { pub fn bins_or_empty_non_empty(s: Span) -> IResult<Span, BinsOrEmpty> {
let (s, a) = brace(pair( let (s, a) = brace(pair(
many0(attribute_instance), many0(attribute_instance),
@ -733,6 +754,7 @@ pub fn bins_or_empty_non_empty(s: Span) -> IResult<Span, BinsOrEmpty> {
)) ))
} }
#[trace]
pub fn bins_or_options(s: Span) -> IResult<Span, BinsOrOptions> { pub fn bins_or_options(s: Span) -> IResult<Span, BinsOrOptions> {
alt(( alt((
map(coverage_option, |x| BinsOrOptions::CoverageOption(x)), map(coverage_option, |x| BinsOrOptions::CoverageOption(x)),
@ -745,6 +767,7 @@ pub fn bins_or_options(s: Span) -> IResult<Span, BinsOrOptions> {
))(s) ))(s)
} }
#[trace]
pub fn bins_or_options_covergroup(s: Span) -> IResult<Span, BinsOrOptions> { pub fn bins_or_options_covergroup(s: Span) -> IResult<Span, BinsOrOptions> {
let (s, a) = opt(wildcard)(s)?; let (s, a) = opt(wildcard)(s)?;
let (s, b) = bins_keyword(s)?; let (s, b) = bins_keyword(s)?;
@ -762,11 +785,13 @@ pub fn bins_or_options_covergroup(s: Span) -> IResult<Span, BinsOrOptions> {
)) ))
} }
#[trace]
pub fn wildcard(s: Span) -> IResult<Span, Wildcard> { pub fn wildcard(s: Span) -> IResult<Span, Wildcard> {
let (s, a) = symbol("wildcard")(s)?; let (s, a) = symbol("wildcard")(s)?;
Ok((s, Wildcard { nodes: (a,) })) Ok((s, Wildcard { nodes: (a,) }))
} }
#[trace]
pub fn bins_or_options_cover_point(s: Span) -> IResult<Span, BinsOrOptions> { pub fn bins_or_options_cover_point(s: Span) -> IResult<Span, BinsOrOptions> {
let (s, a) = opt(wildcard)(s)?; let (s, a) = opt(wildcard)(s)?;
let (s, b) = bins_keyword(s)?; let (s, b) = bins_keyword(s)?;
@ -785,6 +810,7 @@ pub fn bins_or_options_cover_point(s: Span) -> IResult<Span, BinsOrOptions> {
)) ))
} }
#[trace]
pub fn bins_or_options_set_covergroup(s: Span) -> IResult<Span, BinsOrOptions> { pub fn bins_or_options_set_covergroup(s: Span) -> IResult<Span, BinsOrOptions> {
let (s, a) = opt(wildcard)(s)?; let (s, a) = opt(wildcard)(s)?;
let (s, b) = bins_keyword(s)?; let (s, b) = bins_keyword(s)?;
@ -801,6 +827,7 @@ pub fn bins_or_options_set_covergroup(s: Span) -> IResult<Span, BinsOrOptions> {
)) ))
} }
#[trace]
pub fn bins_or_options_trans_list(s: Span) -> IResult<Span, BinsOrOptions> { pub fn bins_or_options_trans_list(s: Span) -> IResult<Span, BinsOrOptions> {
let (s, a) = opt(wildcard)(s)?; let (s, a) = opt(wildcard)(s)?;
let (s, b) = bins_keyword(s)?; let (s, b) = bins_keyword(s)?;
@ -817,6 +844,7 @@ pub fn bins_or_options_trans_list(s: Span) -> IResult<Span, BinsOrOptions> {
)) ))
} }
#[trace]
pub fn bins_or_options_default(s: Span) -> IResult<Span, BinsOrOptions> { pub fn bins_or_options_default(s: Span) -> IResult<Span, BinsOrOptions> {
let (s, a) = bins_keyword(s)?; let (s, a) = bins_keyword(s)?;
let (s, b) = bin_identifier(s)?; let (s, b) = bin_identifier(s)?;
@ -832,6 +860,7 @@ pub fn bins_or_options_default(s: Span) -> IResult<Span, BinsOrOptions> {
)) ))
} }
#[trace]
pub fn bins_or_options_default_sequence(s: Span) -> IResult<Span, BinsOrOptions> { pub fn bins_or_options_default_sequence(s: Span) -> IResult<Span, BinsOrOptions> {
let (s, a) = bins_keyword(s)?; let (s, a) = bins_keyword(s)?;
let (s, b) = bin_identifier(s)?; let (s, b) = bin_identifier(s)?;
@ -847,6 +876,7 @@ pub fn bins_or_options_default_sequence(s: Span) -> IResult<Span, BinsOrOptions>
)) ))
} }
#[trace]
pub fn bins_keyword(s: Span) -> IResult<Span, BinsKeyword> { pub fn bins_keyword(s: Span) -> IResult<Span, BinsKeyword> {
alt(( alt((
map(symbol("bins"), |x| BinsKeyword::Bins(x)), map(symbol("bins"), |x| BinsKeyword::Bins(x)),
@ -855,16 +885,19 @@ pub fn bins_keyword(s: Span) -> IResult<Span, BinsKeyword> {
))(s) ))(s)
} }
#[trace]
pub fn trans_list(s: Span) -> IResult<Span, TransList> { pub fn trans_list(s: Span) -> IResult<Span, TransList> {
let (s, a) = list(symbol(","), paren(trans_set))(s)?; let (s, a) = list(symbol(","), paren(trans_set))(s)?;
Ok((s, TransList { nodes: (a,) })) Ok((s, TransList { nodes: (a,) }))
} }
#[trace]
pub fn trans_set(s: Span) -> IResult<Span, TransSet> { pub fn trans_set(s: Span) -> IResult<Span, TransSet> {
let (s, a) = list(symbol("=>"), trans_range_list)(s)?; let (s, a) = list(symbol("=>"), trans_range_list)(s)?;
Ok((s, TransSet { nodes: (a,) })) Ok((s, TransSet { nodes: (a,) }))
} }
#[trace]
pub fn trans_range_list(s: Span) -> IResult<Span, TransRangeList> { pub fn trans_range_list(s: Span) -> IResult<Span, TransRangeList> {
alt(( alt((
map(trans_item, |x| TransRangeList::TransItem(x)), map(trans_item, |x| TransRangeList::TransItem(x)),
@ -874,6 +907,7 @@ pub fn trans_range_list(s: Span) -> IResult<Span, TransRangeList> {
))(s) ))(s)
} }
#[trace]
pub fn trans_range_list_asterisk(s: Span) -> IResult<Span, TransRangeList> { pub fn trans_range_list_asterisk(s: Span) -> IResult<Span, TransRangeList> {
let (s, a) = trans_item(s)?; let (s, a) = trans_item(s)?;
let (s, b) = bracket(pair(symbol("*"), repeat_range))(s)?; let (s, b) = bracket(pair(symbol("*"), repeat_range))(s)?;
@ -883,6 +917,7 @@ pub fn trans_range_list_asterisk(s: Span) -> IResult<Span, TransRangeList> {
)) ))
} }
#[trace]
pub fn trans_range_list_arrow(s: Span) -> IResult<Span, TransRangeList> { pub fn trans_range_list_arrow(s: Span) -> IResult<Span, TransRangeList> {
let (s, a) = trans_item(s)?; let (s, a) = trans_item(s)?;
let (s, b) = bracket(pair(symbol("->"), repeat_range))(s)?; let (s, b) = bracket(pair(symbol("->"), repeat_range))(s)?;
@ -892,6 +927,7 @@ pub fn trans_range_list_arrow(s: Span) -> IResult<Span, TransRangeList> {
)) ))
} }
#[trace]
pub fn trans_range_list_equal(s: Span) -> IResult<Span, TransRangeList> { pub fn trans_range_list_equal(s: Span) -> IResult<Span, TransRangeList> {
let (s, a) = trans_item(s)?; let (s, a) = trans_item(s)?;
let (s, b) = bracket(pair(symbol("="), repeat_range))(s)?; let (s, b) = bracket(pair(symbol("="), repeat_range))(s)?;
@ -901,11 +937,13 @@ pub fn trans_range_list_equal(s: Span) -> IResult<Span, TransRangeList> {
)) ))
} }
#[trace]
pub fn trans_item(s: Span) -> IResult<Span, TransItem> { pub fn trans_item(s: Span) -> IResult<Span, TransItem> {
let (s, a) = covergroup_range_list(s)?; let (s, a) = covergroup_range_list(s)?;
Ok((s, TransItem { nodes: (a,) })) Ok((s, TransItem { nodes: (a,) }))
} }
#[trace]
pub fn repeat_range(s: Span) -> IResult<Span, RepeatRange> { pub fn repeat_range(s: Span) -> IResult<Span, RepeatRange> {
alt(( alt((
map(covergroup_expression, |x| { map(covergroup_expression, |x| {
@ -915,6 +953,7 @@ pub fn repeat_range(s: Span) -> IResult<Span, RepeatRange> {
))(s) ))(s)
} }
#[trace]
pub fn repeat_range_binary(s: Span) -> IResult<Span, RepeatRange> { pub fn repeat_range_binary(s: Span) -> IResult<Span, RepeatRange> {
let (s, a) = covergroup_expression(s)?; let (s, a) = covergroup_expression(s)?;
let (s, b) = symbol(":")(s)?; let (s, b) = symbol(":")(s)?;
@ -925,6 +964,7 @@ pub fn repeat_range_binary(s: Span) -> IResult<Span, RepeatRange> {
)) ))
} }
#[trace]
pub fn cover_cross(s: Span) -> IResult<Span, CoverCross> { pub fn cover_cross(s: Span) -> IResult<Span, CoverCross> {
let (s, a) = opt(pair(cross_identifier, symbol(":")))(s)?; let (s, a) = opt(pair(cross_identifier, symbol(":")))(s)?;
let (s, b) = symbol("cross")(s)?; let (s, b) = symbol("cross")(s)?;
@ -939,12 +979,14 @@ pub fn cover_cross(s: Span) -> IResult<Span, CoverCross> {
)) ))
} }
#[trace]
pub fn list_of_cross_items(s: Span) -> IResult<Span, ListOfCrossItems> { pub fn list_of_cross_items(s: Span) -> IResult<Span, ListOfCrossItems> {
let (s, a) = cross_item(s)?; let (s, a) = cross_item(s)?;
let (s, b) = list(symbol(","), cross_item)(s)?; let (s, b) = list(symbol(","), cross_item)(s)?;
Ok((s, ListOfCrossItems { nodes: (a, b) })) Ok((s, ListOfCrossItems { nodes: (a, b) }))
} }
#[trace]
pub fn cross_item(s: Span) -> IResult<Span, CrossItem> { pub fn cross_item(s: Span) -> IResult<Span, CrossItem> {
alt(( alt((
map(cover_point_identifier, |x| { map(cover_point_identifier, |x| {
@ -954,6 +996,7 @@ pub fn cross_item(s: Span) -> IResult<Span, CrossItem> {
))(s) ))(s)
} }
#[trace]
pub fn cross_body(s: Span) -> IResult<Span, CrossBody> { pub fn cross_body(s: Span) -> IResult<Span, CrossBody> {
alt(( alt((
cross_body_non_empty, cross_body_non_empty,
@ -961,11 +1004,13 @@ pub fn cross_body(s: Span) -> IResult<Span, CrossBody> {
))(s) ))(s)
} }
#[trace]
pub fn cross_body_non_empty(s: Span) -> IResult<Span, CrossBody> { pub fn cross_body_non_empty(s: Span) -> IResult<Span, CrossBody> {
let (s, a) = brace(many0(pair(cross_body_item, symbol(";"))))(s)?; let (s, a) = brace(many0(pair(cross_body_item, symbol(";"))))(s)?;
Ok((s, CrossBody::NonEmpty(CrossBodyNonEmpty { nodes: (a,) }))) Ok((s, CrossBody::NonEmpty(CrossBodyNonEmpty { nodes: (a,) })))
} }
#[trace]
pub fn cross_body_item(s: Span) -> IResult<Span, CrossBodyItem> { pub fn cross_body_item(s: Span) -> IResult<Span, CrossBodyItem> {
alt(( alt((
map(function_declaration, |x| { map(function_declaration, |x| {
@ -977,6 +1022,7 @@ pub fn cross_body_item(s: Span) -> IResult<Span, CrossBodyItem> {
))(s) ))(s)
} }
#[trace]
pub fn bins_selection_or_option(s: Span) -> IResult<Span, BinsSelectionOrOption> { pub fn bins_selection_or_option(s: Span) -> IResult<Span, BinsSelectionOrOption> {
alt(( alt((
bins_selection_or_option_coverage, bins_selection_or_option_coverage,
@ -984,6 +1030,7 @@ pub fn bins_selection_or_option(s: Span) -> IResult<Span, BinsSelectionOrOption>
))(s) ))(s)
} }
#[trace]
pub fn bins_selection_or_option_coverage(s: Span) -> IResult<Span, BinsSelectionOrOption> { pub fn bins_selection_or_option_coverage(s: Span) -> IResult<Span, BinsSelectionOrOption> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = coverage_option(s)?; let (s, b) = coverage_option(s)?;
@ -993,6 +1040,7 @@ pub fn bins_selection_or_option_coverage(s: Span) -> IResult<Span, BinsSelection
)) ))
} }
#[trace]
pub fn bins_selection_or_option_bins(s: Span) -> IResult<Span, BinsSelectionOrOption> { pub fn bins_selection_or_option_bins(s: Span) -> IResult<Span, BinsSelectionOrOption> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = bins_selection(s)?; let (s, b) = bins_selection(s)?;
@ -1002,6 +1050,7 @@ pub fn bins_selection_or_option_bins(s: Span) -> IResult<Span, BinsSelectionOrOp
)) ))
} }
#[trace]
pub fn bins_selection(s: Span) -> IResult<Span, BinsSelection> { pub fn bins_selection(s: Span) -> IResult<Span, BinsSelection> {
let (s, a) = bins_keyword(s)?; let (s, a) = bins_keyword(s)?;
let (s, b) = bin_identifier(s)?; let (s, b) = bin_identifier(s)?;
@ -1016,6 +1065,7 @@ pub fn bins_selection(s: Span) -> IResult<Span, BinsSelection> {
)) ))
} }
#[trace]
pub fn select_expression(s: Span) -> IResult<Span, SelectExpression> { pub fn select_expression(s: Span) -> IResult<Span, SelectExpression> {
alt(( alt((
map(select_condition, |x| SelectExpression::SelectCondition(x)), map(select_condition, |x| SelectExpression::SelectCondition(x)),
@ -1029,6 +1079,7 @@ pub fn select_expression(s: Span) -> IResult<Span, SelectExpression> {
))(s) ))(s)
} }
#[trace]
pub fn select_expression_not(s: Span) -> IResult<Span, SelectExpression> { pub fn select_expression_not(s: Span) -> IResult<Span, SelectExpression> {
let (s, a) = symbol("!")(s)?; let (s, a) = symbol("!")(s)?;
let (s, b) = select_condition(s)?; let (s, b) = select_condition(s)?;
@ -1038,6 +1089,7 @@ pub fn select_expression_not(s: Span) -> IResult<Span, SelectExpression> {
)) ))
} }
#[trace]
pub fn select_expression_and(s: Span) -> IResult<Span, SelectExpression> { pub fn select_expression_and(s: Span) -> IResult<Span, SelectExpression> {
let (s, a) = select_expression(s)?; let (s, a) = select_expression(s)?;
let (s, b) = symbol("&&")(s)?; let (s, b) = symbol("&&")(s)?;
@ -1048,6 +1100,7 @@ pub fn select_expression_and(s: Span) -> IResult<Span, SelectExpression> {
)) ))
} }
#[trace]
pub fn select_expression_or(s: Span) -> IResult<Span, SelectExpression> { pub fn select_expression_or(s: Span) -> IResult<Span, SelectExpression> {
let (s, a) = select_expression(s)?; let (s, a) = select_expression(s)?;
let (s, b) = symbol("||")(s)?; let (s, b) = symbol("||")(s)?;
@ -1058,6 +1111,7 @@ pub fn select_expression_or(s: Span) -> IResult<Span, SelectExpression> {
)) ))
} }
#[trace]
pub fn select_expression_paren(s: Span) -> IResult<Span, SelectExpression> { pub fn select_expression_paren(s: Span) -> IResult<Span, SelectExpression> {
let (s, a) = paren(select_expression)(s)?; let (s, a) = paren(select_expression)(s)?;
Ok(( Ok((
@ -1066,6 +1120,7 @@ pub fn select_expression_paren(s: Span) -> IResult<Span, SelectExpression> {
)) ))
} }
#[trace]
pub fn select_expression_with(s: Span) -> IResult<Span, SelectExpression> { pub fn select_expression_with(s: Span) -> IResult<Span, SelectExpression> {
let (s, a) = select_expression(s)?; let (s, a) = select_expression(s)?;
let (s, b) = symbol("with")(s)?; let (s, b) = symbol("with")(s)?;
@ -1079,6 +1134,7 @@ pub fn select_expression_with(s: Span) -> IResult<Span, SelectExpression> {
)) ))
} }
#[trace]
pub fn select_expression_cross_set(s: Span) -> IResult<Span, SelectExpression> { pub fn select_expression_cross_set(s: Span) -> IResult<Span, SelectExpression> {
let (s, a) = cross_set_expression(s)?; let (s, a) = cross_set_expression(s)?;
let (s, b) = opt(pair(symbol("matches"), integer_covergroup_expression))(s)?; let (s, b) = opt(pair(symbol("matches"), integer_covergroup_expression))(s)?;
@ -1088,6 +1144,7 @@ pub fn select_expression_cross_set(s: Span) -> IResult<Span, SelectExpression> {
)) ))
} }
#[trace]
pub fn select_condition(s: Span) -> IResult<Span, SelectCondition> { pub fn select_condition(s: Span) -> IResult<Span, SelectCondition> {
let (s, a) = symbol("binsof")(s)?; let (s, a) = symbol("binsof")(s)?;
let (s, b) = paren(bins_expression)(s)?; let (s, b) = paren(bins_expression)(s)?;
@ -1095,6 +1152,7 @@ pub fn select_condition(s: Span) -> IResult<Span, SelectCondition> {
Ok((s, SelectCondition { nodes: (a, b, c) })) Ok((s, SelectCondition { nodes: (a, b, c) }))
} }
#[trace]
pub fn bins_expression(s: Span) -> IResult<Span, BinsExpression> { pub fn bins_expression(s: Span) -> IResult<Span, BinsExpression> {
alt(( alt((
map(variable_identifier, |x| { map(variable_identifier, |x| {
@ -1104,6 +1162,7 @@ pub fn bins_expression(s: Span) -> IResult<Span, BinsExpression> {
))(s) ))(s)
} }
#[trace]
pub fn bins_expression_cover_point(s: Span) -> IResult<Span, BinsExpression> { pub fn bins_expression_cover_point(s: Span) -> IResult<Span, BinsExpression> {
let (s, a) = cover_point_identifier(s)?; let (s, a) = cover_point_identifier(s)?;
let (s, b) = opt(pair(symbol("."), bin_identifier))(s)?; let (s, b) = opt(pair(symbol("."), bin_identifier))(s)?;
@ -1113,11 +1172,13 @@ pub fn bins_expression_cover_point(s: Span) -> IResult<Span, BinsExpression> {
)) ))
} }
#[trace]
pub fn covergroup_range_list(s: Span) -> IResult<Span, CovergroupRangeList> { pub fn covergroup_range_list(s: Span) -> IResult<Span, CovergroupRangeList> {
let (s, a) = list(symbol(","), covergroup_value_range)(s)?; let (s, a) = list(symbol(","), covergroup_value_range)(s)?;
Ok((s, CovergroupRangeList { nodes: (a,) })) Ok((s, CovergroupRangeList { nodes: (a,) }))
} }
#[trace]
pub fn covergroup_value_range(s: Span) -> IResult<Span, CovergroupValueRange> { pub fn covergroup_value_range(s: Span) -> IResult<Span, CovergroupValueRange> {
alt(( alt((
map(covergroup_expression, |x| { map(covergroup_expression, |x| {
@ -1127,6 +1188,7 @@ pub fn covergroup_value_range(s: Span) -> IResult<Span, CovergroupValueRange> {
))(s) ))(s)
} }
#[trace]
pub fn covergroup_value_range_binary(s: Span) -> IResult<Span, CovergroupValueRange> { pub fn covergroup_value_range_binary(s: Span) -> IResult<Span, CovergroupValueRange> {
let (s, a) = bracket(triple( let (s, a) = bracket(triple(
covergroup_expression, covergroup_expression,
@ -1139,26 +1201,31 @@ pub fn covergroup_value_range_binary(s: Span) -> IResult<Span, CovergroupValueRa
)) ))
} }
#[trace]
pub fn with_covergroup_expression(s: Span) -> IResult<Span, WithCovergroupExpression> { pub fn with_covergroup_expression(s: Span) -> IResult<Span, WithCovergroupExpression> {
let (s, a) = covergroup_expression(s)?; let (s, a) = covergroup_expression(s)?;
Ok((s, WithCovergroupExpression { nodes: (a,) })) Ok((s, WithCovergroupExpression { nodes: (a,) }))
} }
#[trace]
pub fn set_covergroup_expression(s: Span) -> IResult<Span, SetCovergroupExpression> { pub fn set_covergroup_expression(s: Span) -> IResult<Span, SetCovergroupExpression> {
let (s, a) = covergroup_expression(s)?; let (s, a) = covergroup_expression(s)?;
Ok((s, SetCovergroupExpression { nodes: (a,) })) Ok((s, SetCovergroupExpression { nodes: (a,) }))
} }
#[trace]
pub fn integer_covergroup_expression(s: Span) -> IResult<Span, IntegerCovergroupExpression> { pub fn integer_covergroup_expression(s: Span) -> IResult<Span, IntegerCovergroupExpression> {
let (s, a) = covergroup_expression(s)?; let (s, a) = covergroup_expression(s)?;
Ok((s, IntegerCovergroupExpression { nodes: (a,) })) Ok((s, IntegerCovergroupExpression { nodes: (a,) }))
} }
#[trace]
pub fn cross_set_expression(s: Span) -> IResult<Span, CrossSetExpression> { pub fn cross_set_expression(s: Span) -> IResult<Span, CrossSetExpression> {
let (s, a) = covergroup_expression(s)?; let (s, a) = covergroup_expression(s)?;
Ok((s, CrossSetExpression { nodes: (a,) })) Ok((s, CrossSetExpression { nodes: (a,) }))
} }
#[trace]
pub fn covergroup_expression(s: Span) -> IResult<Span, CovergroupExpression> { pub fn covergroup_expression(s: Span) -> IResult<Span, CovergroupExpression> {
let (s, a) = expression(s)?; let (s, a) = expression(s)?;
Ok((s, CovergroupExpression { nodes: (a,) })) Ok((s, CovergroupExpression { nodes: (a,) }))

View File

@ -174,6 +174,7 @@ pub struct DynamicArrayNew<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn defparam_assignment(s: Span) -> IResult<Span, DefparamAssignment> { pub fn defparam_assignment(s: Span) -> IResult<Span, DefparamAssignment> {
let (s, a) = hierarchical_parameter_identifier(s)?; let (s, a) = hierarchical_parameter_identifier(s)?;
let (s, b) = symbol("=")(s)?; let (s, b) = symbol("=")(s)?;
@ -181,6 +182,7 @@ pub fn defparam_assignment(s: Span) -> IResult<Span, DefparamAssignment> {
Ok((s, DefparamAssignment { nodes: (a, b, c) })) Ok((s, DefparamAssignment { nodes: (a, b, c) }))
} }
#[trace]
pub fn net_decl_assignment(s: Span) -> IResult<Span, NetDeclAssignment> { pub fn net_decl_assignment(s: Span) -> IResult<Span, NetDeclAssignment> {
let (s, a) = net_identifier(s)?; let (s, a) = net_identifier(s)?;
let (s, b) = many0(unpacked_dimension)(s)?; let (s, b) = many0(unpacked_dimension)(s)?;
@ -188,6 +190,7 @@ pub fn net_decl_assignment(s: Span) -> IResult<Span, NetDeclAssignment> {
Ok((s, NetDeclAssignment { nodes: (a, b, c) })) Ok((s, NetDeclAssignment { nodes: (a, b, c) }))
} }
#[trace]
pub fn param_assignment(s: Span) -> IResult<Span, ParamAssignment> { pub fn param_assignment(s: Span) -> IResult<Span, ParamAssignment> {
let (s, a) = parameter_identifier(s)?; let (s, a) = parameter_identifier(s)?;
let (s, b) = many0(unpacked_dimension)(s)?; let (s, b) = many0(unpacked_dimension)(s)?;
@ -195,6 +198,7 @@ pub fn param_assignment(s: Span) -> IResult<Span, ParamAssignment> {
Ok((s, ParamAssignment { nodes: (a, b, c) })) Ok((s, ParamAssignment { nodes: (a, b, c) }))
} }
#[trace]
pub fn specparam_assignment(s: Span) -> IResult<Span, SpecparamAssignment> { pub fn specparam_assignment(s: Span) -> IResult<Span, SpecparamAssignment> {
alt(( alt((
specparam_assignment_mintypmax, specparam_assignment_mintypmax,
@ -204,6 +208,7 @@ pub fn specparam_assignment(s: Span) -> IResult<Span, SpecparamAssignment> {
))(s) ))(s)
} }
#[trace]
pub fn specparam_assignment_mintypmax(s: Span) -> IResult<Span, SpecparamAssignment> { pub fn specparam_assignment_mintypmax(s: Span) -> IResult<Span, SpecparamAssignment> {
let (s, a) = specparam_identifier(s)?; let (s, a) = specparam_identifier(s)?;
let (s, b) = symbol("=")(s)?; let (s, b) = symbol("=")(s)?;
@ -214,12 +219,14 @@ pub fn specparam_assignment_mintypmax(s: Span) -> IResult<Span, SpecparamAssignm
)) ))
} }
#[trace]
pub fn type_assignment(s: Span) -> IResult<Span, TypeAssignment> { pub fn type_assignment(s: Span) -> IResult<Span, TypeAssignment> {
let (s, a) = type_identifier(s)?; let (s, a) = type_identifier(s)?;
let (s, b) = opt(pair(symbol("="), data_type))(s)?; let (s, b) = opt(pair(symbol("="), data_type))(s)?;
Ok((s, TypeAssignment { nodes: (a, b) })) Ok((s, TypeAssignment { nodes: (a, b) }))
} }
#[trace]
pub fn pulse_control_specparam(s: Span) -> IResult<Span, PulseControlSpecparam> { pub fn pulse_control_specparam(s: Span) -> IResult<Span, PulseControlSpecparam> {
alt(( alt((
pulse_control_specparam_without_descriptor, pulse_control_specparam_without_descriptor,
@ -227,6 +234,7 @@ pub fn pulse_control_specparam(s: Span) -> IResult<Span, PulseControlSpecparam>
))(s) ))(s)
} }
#[trace]
pub fn pulse_control_specparam_without_descriptor(s: Span) -> IResult<Span, PulseControlSpecparam> { pub fn pulse_control_specparam_without_descriptor(s: Span) -> IResult<Span, PulseControlSpecparam> {
let (s, a) = symbol("PATHPULSE$")(s)?; let (s, a) = symbol("PATHPULSE$")(s)?;
let (s, b) = symbol("=")(s)?; let (s, b) = symbol("=")(s)?;
@ -242,6 +250,7 @@ pub fn pulse_control_specparam_without_descriptor(s: Span) -> IResult<Span, Puls
)) ))
} }
#[trace]
pub fn pulse_control_specparam_with_descriptor(s: Span) -> IResult<Span, PulseControlSpecparam> { pub fn pulse_control_specparam_with_descriptor(s: Span) -> IResult<Span, PulseControlSpecparam> {
let (s, a) = symbol("PATHPULSE$")(s)?; let (s, a) = symbol("PATHPULSE$")(s)?;
let (s, b) = specify_input_terminal_descriptor(s)?; let (s, b) = specify_input_terminal_descriptor(s)?;
@ -260,21 +269,25 @@ pub fn pulse_control_specparam_with_descriptor(s: Span) -> IResult<Span, PulseCo
)) ))
} }
#[trace]
pub fn error_limit_value(s: Span) -> IResult<Span, ErrorLimitValue> { pub fn error_limit_value(s: Span) -> IResult<Span, ErrorLimitValue> {
let (s, a) = limit_value(s)?; let (s, a) = limit_value(s)?;
Ok((s, ErrorLimitValue { nodes: (a,) })) Ok((s, ErrorLimitValue { nodes: (a,) }))
} }
#[trace]
pub fn reject_limit_value(s: Span) -> IResult<Span, RejectLimitValue> { pub fn reject_limit_value(s: Span) -> IResult<Span, RejectLimitValue> {
let (s, a) = limit_value(s)?; let (s, a) = limit_value(s)?;
Ok((s, RejectLimitValue { nodes: (a,) })) Ok((s, RejectLimitValue { nodes: (a,) }))
} }
#[trace]
pub fn limit_value(s: Span) -> IResult<Span, LimitValue> { pub fn limit_value(s: Span) -> IResult<Span, LimitValue> {
let (s, a) = constant_mintypmax_expression(s)?; let (s, a) = constant_mintypmax_expression(s)?;
Ok((s, LimitValue { nodes: (a,) })) Ok((s, LimitValue { nodes: (a,) }))
} }
#[trace]
pub fn variable_decl_assignment(s: Span) -> IResult<Span, VariableDeclAssignment> { pub fn variable_decl_assignment(s: Span) -> IResult<Span, VariableDeclAssignment> {
alt(( alt((
variable_decl_assignment_variable, variable_decl_assignment_variable,
@ -283,6 +296,7 @@ pub fn variable_decl_assignment(s: Span) -> IResult<Span, VariableDeclAssignment
))(s) ))(s)
} }
#[trace]
pub fn variable_decl_assignment_variable(s: Span) -> IResult<Span, VariableDeclAssignment> { pub fn variable_decl_assignment_variable(s: Span) -> IResult<Span, VariableDeclAssignment> {
let (s, a) = variable_identifier(s)?; let (s, a) = variable_identifier(s)?;
let (s, b) = many0(variable_dimension)(s)?; let (s, b) = many0(variable_dimension)(s)?;
@ -293,6 +307,7 @@ pub fn variable_decl_assignment_variable(s: Span) -> IResult<Span, VariableDeclA
)) ))
} }
#[trace]
pub fn variable_decl_assignment_dynamic_array(s: Span) -> IResult<Span, VariableDeclAssignment> { pub fn variable_decl_assignment_dynamic_array(s: Span) -> IResult<Span, VariableDeclAssignment> {
let (s, a) = dynamic_array_variable_identifier(s)?; let (s, a) = dynamic_array_variable_identifier(s)?;
let (s, b) = unsized_dimension(s)?; let (s, b) = unsized_dimension(s)?;
@ -306,6 +321,7 @@ pub fn variable_decl_assignment_dynamic_array(s: Span) -> IResult<Span, Variable
)) ))
} }
#[trace]
pub fn variable_decl_assignment_class(s: Span) -> IResult<Span, VariableDeclAssignment> { pub fn variable_decl_assignment_class(s: Span) -> IResult<Span, VariableDeclAssignment> {
let (s, a) = class_variable_identifier(s)?; let (s, a) = class_variable_identifier(s)?;
let (s, b) = opt(pair(symbol("="), class_new))(s)?; let (s, b) = opt(pair(symbol("="), class_new))(s)?;
@ -315,10 +331,12 @@ pub fn variable_decl_assignment_class(s: Span) -> IResult<Span, VariableDeclAssi
)) ))
} }
#[trace]
pub fn class_new(s: Span) -> IResult<Span, ClassNew> { pub fn class_new(s: Span) -> IResult<Span, ClassNew> {
alt((class_new_argument, class_new_expression))(s) alt((class_new_argument, class_new_expression))(s)
} }
#[trace]
pub fn class_new_argument(s: Span) -> IResult<Span, ClassNew> { pub fn class_new_argument(s: Span) -> IResult<Span, ClassNew> {
let (s, a) = opt(class_scope)(s)?; let (s, a) = opt(class_scope)(s)?;
let (s, b) = symbol("new")(s)?; let (s, b) = symbol("new")(s)?;
@ -326,6 +344,7 @@ pub fn class_new_argument(s: Span) -> IResult<Span, ClassNew> {
Ok((s, ClassNew::Argument(ClassNewArgument { nodes: (a, b, c) }))) Ok((s, ClassNew::Argument(ClassNewArgument { nodes: (a, b, c) })))
} }
#[trace]
pub fn class_new_expression(s: Span) -> IResult<Span, ClassNew> { pub fn class_new_expression(s: Span) -> IResult<Span, ClassNew> {
let (s, a) = symbol("new")(s)?; let (s, a) = symbol("new")(s)?;
let (s, b) = expression(s)?; let (s, b) = expression(s)?;
@ -335,6 +354,7 @@ pub fn class_new_expression(s: Span) -> IResult<Span, ClassNew> {
)) ))
} }
#[trace]
pub fn dynamic_array_new(s: Span) -> IResult<Span, DynamicArrayNew> { pub fn dynamic_array_new(s: Span) -> IResult<Span, DynamicArrayNew> {
let (s, a) = symbol("new")(s)?; let (s, a) = symbol("new")(s)?;
let (s, b) = bracket(expression)(s)?; let (s, b) = bracket(expression)(s)?;

View File

@ -92,16 +92,19 @@ pub struct ListOfVariablePortIdentifiers<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn list_of_defparam_assignments(s: Span) -> IResult<Span, ListOfDefparamAssignments> { pub fn list_of_defparam_assignments(s: Span) -> IResult<Span, ListOfDefparamAssignments> {
let (s, a) = list(symbol(","), defparam_assignment)(s)?; let (s, a) = list(symbol(","), defparam_assignment)(s)?;
Ok((s, ListOfDefparamAssignments { nodes: (a,) })) Ok((s, ListOfDefparamAssignments { nodes: (a,) }))
} }
#[trace]
pub fn list_of_genvar_identifiers(s: Span) -> IResult<Span, ListOfGenvarIdentifiers> { pub fn list_of_genvar_identifiers(s: Span) -> IResult<Span, ListOfGenvarIdentifiers> {
let (s, a) = list(symbol(","), genvar_identifier)(s)?; let (s, a) = list(symbol(","), genvar_identifier)(s)?;
Ok((s, ListOfGenvarIdentifiers { nodes: (a,) })) Ok((s, ListOfGenvarIdentifiers { nodes: (a,) }))
} }
#[trace]
pub fn list_of_interface_identifiers(s: Span) -> IResult<Span, ListOfInterfaceIdentifiers> { pub fn list_of_interface_identifiers(s: Span) -> IResult<Span, ListOfInterfaceIdentifiers> {
let (s, a) = list( let (s, a) = list(
symbol(","), symbol(","),
@ -110,16 +113,19 @@ pub fn list_of_interface_identifiers(s: Span) -> IResult<Span, ListOfInterfaceId
Ok((s, ListOfInterfaceIdentifiers { nodes: (a,) })) Ok((s, ListOfInterfaceIdentifiers { nodes: (a,) }))
} }
#[trace]
pub fn list_of_net_decl_assignments(s: Span) -> IResult<Span, ListOfNetDeclAssignments> { pub fn list_of_net_decl_assignments(s: Span) -> IResult<Span, ListOfNetDeclAssignments> {
let (s, a) = list(symbol(","), net_decl_assignment)(s)?; let (s, a) = list(symbol(","), net_decl_assignment)(s)?;
Ok((s, ListOfNetDeclAssignments { nodes: (a,) })) Ok((s, ListOfNetDeclAssignments { nodes: (a,) }))
} }
#[trace]
pub fn list_of_param_assignments(s: Span) -> IResult<Span, ListOfParamAssignments> { pub fn list_of_param_assignments(s: Span) -> IResult<Span, ListOfParamAssignments> {
let (s, a) = list(symbol(","), param_assignment)(s)?; let (s, a) = list(symbol(","), param_assignment)(s)?;
Ok((s, ListOfParamAssignments { nodes: (a,) })) Ok((s, ListOfParamAssignments { nodes: (a,) }))
} }
#[trace]
pub fn list_of_port_identifiers(s: Span) -> IResult<Span, ListOfPortIdentifiers> { pub fn list_of_port_identifiers(s: Span) -> IResult<Span, ListOfPortIdentifiers> {
let (s, a) = list( let (s, a) = list(
symbol(","), symbol(","),
@ -128,16 +134,19 @@ pub fn list_of_port_identifiers(s: Span) -> IResult<Span, ListOfPortIdentifiers>
Ok((s, ListOfPortIdentifiers { nodes: (a,) })) Ok((s, ListOfPortIdentifiers { nodes: (a,) }))
} }
#[trace]
pub fn list_of_udp_port_identifiers(s: Span) -> IResult<Span, ListOfUdpPortIdentifiers> { pub fn list_of_udp_port_identifiers(s: Span) -> IResult<Span, ListOfUdpPortIdentifiers> {
let (s, a) = list(symbol(","), port_identifier)(s)?; let (s, a) = list(symbol(","), port_identifier)(s)?;
Ok((s, ListOfUdpPortIdentifiers { nodes: (a,) })) Ok((s, ListOfUdpPortIdentifiers { nodes: (a,) }))
} }
#[trace]
pub fn list_of_specparam_assignments(s: Span) -> IResult<Span, ListOfSpecparamAssignments> { pub fn list_of_specparam_assignments(s: Span) -> IResult<Span, ListOfSpecparamAssignments> {
let (s, a) = list(symbol(","), specparam_assignment)(s)?; let (s, a) = list(symbol(","), specparam_assignment)(s)?;
Ok((s, ListOfSpecparamAssignments { nodes: (a,) })) Ok((s, ListOfSpecparamAssignments { nodes: (a,) }))
} }
#[trace]
pub fn list_of_tf_variable_identifiers(s: Span) -> IResult<Span, ListOfTfVariableIdentifiers> { pub fn list_of_tf_variable_identifiers(s: Span) -> IResult<Span, ListOfTfVariableIdentifiers> {
let (s, a) = list( let (s, a) = list(
symbol(","), symbol(","),
@ -150,16 +159,19 @@ pub fn list_of_tf_variable_identifiers(s: Span) -> IResult<Span, ListOfTfVariabl
Ok((s, ListOfTfVariableIdentifiers { nodes: (a,) })) Ok((s, ListOfTfVariableIdentifiers { nodes: (a,) }))
} }
#[trace]
pub fn list_of_type_assignments(s: Span) -> IResult<Span, ListOfTypeAssignments> { pub fn list_of_type_assignments(s: Span) -> IResult<Span, ListOfTypeAssignments> {
let (s, a) = list(symbol(","), type_assignment)(s)?; let (s, a) = list(symbol(","), type_assignment)(s)?;
Ok((s, ListOfTypeAssignments { nodes: (a,) })) Ok((s, ListOfTypeAssignments { nodes: (a,) }))
} }
#[trace]
pub fn list_of_variable_decl_assignments(s: Span) -> IResult<Span, ListOfVariableDeclAssignments> { pub fn list_of_variable_decl_assignments(s: Span) -> IResult<Span, ListOfVariableDeclAssignments> {
let (s, a) = list(symbol(","), variable_decl_assignment)(s)?; let (s, a) = list(symbol(","), variable_decl_assignment)(s)?;
Ok((s, ListOfVariableDeclAssignments { nodes: (a,) })) Ok((s, ListOfVariableDeclAssignments { nodes: (a,) }))
} }
#[trace]
pub fn list_of_variable_identifiers(s: Span) -> IResult<Span, ListOfVariableIdentifiers> { pub fn list_of_variable_identifiers(s: Span) -> IResult<Span, ListOfVariableIdentifiers> {
let (s, a) = list( let (s, a) = list(
symbol(","), symbol(","),
@ -168,6 +180,7 @@ pub fn list_of_variable_identifiers(s: Span) -> IResult<Span, ListOfVariableIden
Ok((s, ListOfVariableIdentifiers { nodes: (a,) })) Ok((s, ListOfVariableIdentifiers { nodes: (a,) }))
} }
#[trace]
pub fn list_of_variable_port_identifiers(s: Span) -> IResult<Span, ListOfVariablePortIdentifiers> { pub fn list_of_variable_port_identifiers(s: Span) -> IResult<Span, ListOfVariablePortIdentifiers> {
let (s, a) = list( let (s, a) = list(
symbol(","), symbol(","),

View File

@ -70,10 +70,12 @@ pub struct UnsizedDimension<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn unpacked_dimension(s: Span) -> IResult<Span, UnpackedDimension> { pub fn unpacked_dimension(s: Span) -> IResult<Span, UnpackedDimension> {
alt((unpacked_dimension_range, unpacked_dimension_expression))(s) alt((unpacked_dimension_range, unpacked_dimension_expression))(s)
} }
#[trace]
pub fn unpacked_dimension_range(s: Span) -> IResult<Span, UnpackedDimension> { pub fn unpacked_dimension_range(s: Span) -> IResult<Span, UnpackedDimension> {
let (s, a) = bracket(constant_range)(s)?; let (s, a) = bracket(constant_range)(s)?;
Ok(( Ok((
@ -82,6 +84,7 @@ pub fn unpacked_dimension_range(s: Span) -> IResult<Span, UnpackedDimension> {
)) ))
} }
#[trace]
pub fn unpacked_dimension_expression(s: Span) -> IResult<Span, UnpackedDimension> { pub fn unpacked_dimension_expression(s: Span) -> IResult<Span, UnpackedDimension> {
let (s, a) = bracket(constant_expression)(s)?; let (s, a) = bracket(constant_expression)(s)?;
Ok(( Ok((
@ -90,6 +93,7 @@ pub fn unpacked_dimension_expression(s: Span) -> IResult<Span, UnpackedDimension
)) ))
} }
#[trace]
pub fn packed_dimension(s: Span) -> IResult<Span, PackedDimension> { pub fn packed_dimension(s: Span) -> IResult<Span, PackedDimension> {
alt(( alt((
packed_dimension_range, packed_dimension_range,
@ -97,6 +101,7 @@ pub fn packed_dimension(s: Span) -> IResult<Span, PackedDimension> {
))(s) ))(s)
} }
#[trace]
pub fn packed_dimension_range(s: Span) -> IResult<Span, PackedDimension> { pub fn packed_dimension_range(s: Span) -> IResult<Span, PackedDimension> {
let (s, a) = bracket(constant_range)(s)?; let (s, a) = bracket(constant_range)(s)?;
Ok(( Ok((
@ -105,6 +110,7 @@ pub fn packed_dimension_range(s: Span) -> IResult<Span, PackedDimension> {
)) ))
} }
#[trace]
pub fn associative_dimension(s: Span) -> IResult<Span, AssociativeDimension> { pub fn associative_dimension(s: Span) -> IResult<Span, AssociativeDimension> {
alt(( alt((
associative_dimension_data_type, associative_dimension_data_type,
@ -112,6 +118,7 @@ pub fn associative_dimension(s: Span) -> IResult<Span, AssociativeDimension> {
))(s) ))(s)
} }
#[trace]
pub fn associative_dimension_data_type(s: Span) -> IResult<Span, AssociativeDimension> { pub fn associative_dimension_data_type(s: Span) -> IResult<Span, AssociativeDimension> {
let (s, a) = bracket(data_type)(s)?; let (s, a) = bracket(data_type)(s)?;
Ok(( Ok((
@ -120,6 +127,7 @@ pub fn associative_dimension_data_type(s: Span) -> IResult<Span, AssociativeDime
)) ))
} }
#[trace]
pub fn associative_dimension_asterisk(s: Span) -> IResult<Span, AssociativeDimension> { pub fn associative_dimension_asterisk(s: Span) -> IResult<Span, AssociativeDimension> {
let (s, a) = bracket(symbol("*"))(s)?; let (s, a) = bracket(symbol("*"))(s)?;
Ok(( Ok((
@ -128,6 +136,7 @@ pub fn associative_dimension_asterisk(s: Span) -> IResult<Span, AssociativeDimen
)) ))
} }
#[trace]
pub fn variable_dimension(s: Span) -> IResult<Span, VariableDimension> { pub fn variable_dimension(s: Span) -> IResult<Span, VariableDimension> {
alt(( alt((
map(unsized_dimension, |x| { map(unsized_dimension, |x| {
@ -143,6 +152,7 @@ pub fn variable_dimension(s: Span) -> IResult<Span, VariableDimension> {
))(s) ))(s)
} }
#[trace]
pub fn queue_dimension(s: Span) -> IResult<Span, QueueDimension> { pub fn queue_dimension(s: Span) -> IResult<Span, QueueDimension> {
let (s, a) = bracket(pair( let (s, a) = bracket(pair(
symbol("$"), symbol("$"),
@ -151,6 +161,7 @@ pub fn queue_dimension(s: Span) -> IResult<Span, QueueDimension> {
Ok((s, QueueDimension { nodes: (a,) })) Ok((s, QueueDimension { nodes: (a,) }))
} }
#[trace]
pub fn unsized_dimension(s: Span) -> IResult<Span, UnsizedDimension> { pub fn unsized_dimension(s: Span) -> IResult<Span, UnsizedDimension> {
let (s, a) = symbol("[")(s)?; let (s, a) = symbol("[")(s)?;
let (s, b) = symbol("]")(s)?; let (s, b) = symbol("]")(s)?;

View File

@ -72,16 +72,19 @@ pub enum DelayValue<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn delay3(s: Span) -> IResult<Span, Delay3> { pub fn delay3(s: Span) -> IResult<Span, Delay3> {
alt((delay3_single, delay3_mintypmax))(s) alt((delay3_single, delay3_mintypmax))(s)
} }
#[trace]
pub fn delay3_single(s: Span) -> IResult<Span, Delay3> { pub fn delay3_single(s: Span) -> IResult<Span, Delay3> {
let (s, a) = symbol("#")(s)?; let (s, a) = symbol("#")(s)?;
let (s, b) = delay_value(s)?; let (s, b) = delay_value(s)?;
Ok((s, Delay3::Single(Delay3Single { nodes: (a, b) }))) Ok((s, Delay3::Single(Delay3Single { nodes: (a, b) })))
} }
#[trace]
pub fn delay3_mintypmax(s: Span) -> IResult<Span, Delay3> { pub fn delay3_mintypmax(s: Span) -> IResult<Span, Delay3> {
let (s, a) = symbol("#")(s)?; let (s, a) = symbol("#")(s)?;
let (s, b) = paren(pair( let (s, b) = paren(pair(
@ -95,16 +98,19 @@ pub fn delay3_mintypmax(s: Span) -> IResult<Span, Delay3> {
Ok((s, Delay3::Mintypmax(Delay3Mintypmax { nodes: (a, b) }))) Ok((s, Delay3::Mintypmax(Delay3Mintypmax { nodes: (a, b) })))
} }
#[trace]
pub fn delay2(s: Span) -> IResult<Span, Delay2> { pub fn delay2(s: Span) -> IResult<Span, Delay2> {
alt((delay2_single, delay2_mintypmax))(s) alt((delay2_single, delay2_mintypmax))(s)
} }
#[trace]
pub fn delay2_single(s: Span) -> IResult<Span, Delay2> { pub fn delay2_single(s: Span) -> IResult<Span, Delay2> {
let (s, a) = symbol("#")(s)?; let (s, a) = symbol("#")(s)?;
let (s, b) = delay_value(s)?; let (s, b) = delay_value(s)?;
Ok((s, Delay2::Single(Delay2Single { nodes: (a, b) }))) Ok((s, Delay2::Single(Delay2Single { nodes: (a, b) })))
} }
#[trace]
pub fn delay2_mintypmax(s: Span) -> IResult<Span, Delay2> { pub fn delay2_mintypmax(s: Span) -> IResult<Span, Delay2> {
let (s, a) = symbol("#")(s)?; let (s, a) = symbol("#")(s)?;
let (s, b) = paren(pair( let (s, b) = paren(pair(
@ -114,6 +120,7 @@ pub fn delay2_mintypmax(s: Span) -> IResult<Span, Delay2> {
Ok((s, Delay2::Mintypmax(Delay2Mintypmax { nodes: (a, b) }))) Ok((s, Delay2::Mintypmax(Delay2Mintypmax { nodes: (a, b) })))
} }
#[trace]
pub fn delay_value(s: Span) -> IResult<Span, DelayValue> { pub fn delay_value(s: Span) -> IResult<Span, DelayValue> {
alt(( alt((
map(unsigned_number, |x| DelayValue::UnsignedNumber(x)), map(unsigned_number, |x| DelayValue::UnsignedNumber(x)),

View File

@ -159,6 +159,7 @@ pub struct DpiTaskProto<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn function_data_type_or_implicit(s: Span) -> IResult<Span, FunctionDataTypeOrImplicit> { pub fn function_data_type_or_implicit(s: Span) -> IResult<Span, FunctionDataTypeOrImplicit> {
alt(( alt((
map(data_type_or_void, |x| { map(data_type_or_void, |x| {
@ -170,6 +171,7 @@ pub fn function_data_type_or_implicit(s: Span) -> IResult<Span, FunctionDataType
))(s) ))(s)
} }
#[trace]
pub fn function_declaration(s: Span) -> IResult<Span, FunctionDeclaration> { pub fn function_declaration(s: Span) -> IResult<Span, FunctionDeclaration> {
let (s, a) = symbol("function")(s)?; let (s, a) = symbol("function")(s)?;
let (s, b) = opt(lifetime)(s)?; let (s, b) = opt(lifetime)(s)?;
@ -177,6 +179,7 @@ pub fn function_declaration(s: Span) -> IResult<Span, FunctionDeclaration> {
Ok((s, FunctionDeclaration { nodes: (a, b, c) })) Ok((s, FunctionDeclaration { nodes: (a, b, c) }))
} }
#[trace]
pub fn function_body_declaration(s: Span) -> IResult<Span, FunctionBodyDeclaration> { pub fn function_body_declaration(s: Span) -> IResult<Span, FunctionBodyDeclaration> {
alt(( alt((
function_body_declaration_without_port, function_body_declaration_without_port,
@ -184,6 +187,7 @@ pub fn function_body_declaration(s: Span) -> IResult<Span, FunctionBodyDeclarati
))(s) ))(s)
} }
#[trace]
pub fn function_body_declaration_without_port(s: Span) -> IResult<Span, FunctionBodyDeclaration> { pub fn function_body_declaration_without_port(s: Span) -> IResult<Span, FunctionBodyDeclaration> {
let (s, a) = function_data_type_or_implicit(s)?; let (s, a) = function_data_type_or_implicit(s)?;
let (s, b) = opt(interface_identifier_or_class_scope)(s)?; let (s, b) = opt(interface_identifier_or_class_scope)(s)?;
@ -201,6 +205,7 @@ pub fn function_body_declaration_without_port(s: Span) -> IResult<Span, Function
)) ))
} }
#[trace]
pub fn function_body_declaration_with_port(s: Span) -> IResult<Span, FunctionBodyDeclaration> { pub fn function_body_declaration_with_port(s: Span) -> IResult<Span, FunctionBodyDeclaration> {
let (s, a) = function_data_type_or_implicit(s)?; let (s, a) = function_data_type_or_implicit(s)?;
let (s, b) = opt(interface_identifier_or_class_scope)(s)?; let (s, b) = opt(interface_identifier_or_class_scope)(s)?;
@ -219,6 +224,7 @@ pub fn function_body_declaration_with_port(s: Span) -> IResult<Span, FunctionBod
)) ))
} }
#[trace]
pub fn interface_identifier_or_class_scope( pub fn interface_identifier_or_class_scope(
s: Span, s: Span,
) -> IResult<Span, InterfaceIdentifierOrClassScope> { ) -> IResult<Span, InterfaceIdentifierOrClassScope> {
@ -232,6 +238,7 @@ pub fn interface_identifier_or_class_scope(
))(s) ))(s)
} }
#[trace]
pub fn function_prototype(s: Span) -> IResult<Span, FunctionPrototype> { pub fn function_prototype(s: Span) -> IResult<Span, FunctionPrototype> {
let (s, a) = symbol("function")(s)?; let (s, a) = symbol("function")(s)?;
let (s, b) = data_type_or_void(s)?; let (s, b) = data_type_or_void(s)?;
@ -245,6 +252,7 @@ pub fn function_prototype(s: Span) -> IResult<Span, FunctionPrototype> {
)) ))
} }
#[trace]
pub fn dpi_import_export(s: Span) -> IResult<Span, DpiImportExport> { pub fn dpi_import_export(s: Span) -> IResult<Span, DpiImportExport> {
alt(( alt((
dpi_import_export_import_function, dpi_import_export_import_function,
@ -254,6 +262,7 @@ pub fn dpi_import_export(s: Span) -> IResult<Span, DpiImportExport> {
))(s) ))(s)
} }
#[trace]
pub fn dpi_import_export_import_function(s: Span) -> IResult<Span, DpiImportExport> { pub fn dpi_import_export_import_function(s: Span) -> IResult<Span, DpiImportExport> {
let (s, a) = symbol("import")(s)?; let (s, a) = symbol("import")(s)?;
let (s, b) = dpi_spec_string(s)?; let (s, b) = dpi_spec_string(s)?;
@ -269,6 +278,7 @@ pub fn dpi_import_export_import_function(s: Span) -> IResult<Span, DpiImportExpo
)) ))
} }
#[trace]
pub fn dpi_import_export_import_task(s: Span) -> IResult<Span, DpiImportExport> { pub fn dpi_import_export_import_task(s: Span) -> IResult<Span, DpiImportExport> {
let (s, a) = symbol("import")(s)?; let (s, a) = symbol("import")(s)?;
let (s, b) = dpi_spec_string(s)?; let (s, b) = dpi_spec_string(s)?;
@ -284,6 +294,7 @@ pub fn dpi_import_export_import_task(s: Span) -> IResult<Span, DpiImportExport>
)) ))
} }
#[trace]
pub fn dpi_import_export_export_function(s: Span) -> IResult<Span, DpiImportExport> { pub fn dpi_import_export_export_function(s: Span) -> IResult<Span, DpiImportExport> {
let (s, a) = symbol("export")(s)?; let (s, a) = symbol("export")(s)?;
let (s, b) = dpi_spec_string(s)?; let (s, b) = dpi_spec_string(s)?;
@ -299,6 +310,7 @@ pub fn dpi_import_export_export_function(s: Span) -> IResult<Span, DpiImportExpo
)) ))
} }
#[trace]
pub fn dpi_import_export_export_task(s: Span) -> IResult<Span, DpiImportExport> { pub fn dpi_import_export_export_task(s: Span) -> IResult<Span, DpiImportExport> {
let (s, a) = symbol("export")(s)?; let (s, a) = symbol("export")(s)?;
let (s, b) = dpi_spec_string(s)?; let (s, b) = dpi_spec_string(s)?;
@ -314,6 +326,7 @@ pub fn dpi_import_export_export_task(s: Span) -> IResult<Span, DpiImportExport>
)) ))
} }
#[trace]
pub fn dpi_spec_string(s: Span) -> IResult<Span, DpiSpecString> { pub fn dpi_spec_string(s: Span) -> IResult<Span, DpiSpecString> {
alt(( alt((
map(symbol("DPI-C"), |x| DpiSpecString::DpiC(x)), map(symbol("DPI-C"), |x| DpiSpecString::DpiC(x)),
@ -321,6 +334,7 @@ pub fn dpi_spec_string(s: Span) -> IResult<Span, DpiSpecString> {
))(s) ))(s)
} }
#[trace]
pub fn dpi_function_import_property(s: Span) -> IResult<Span, DpiFunctionImportProperty> { pub fn dpi_function_import_property(s: Span) -> IResult<Span, DpiFunctionImportProperty> {
alt(( alt((
map(symbol("context"), |x| DpiFunctionImportProperty::Context(x)), map(symbol("context"), |x| DpiFunctionImportProperty::Context(x)),
@ -328,16 +342,19 @@ pub fn dpi_function_import_property(s: Span) -> IResult<Span, DpiFunctionImportP
))(s) ))(s)
} }
#[trace]
pub fn dpi_task_import_property(s: Span) -> IResult<Span, DpiTaskImportProperty> { pub fn dpi_task_import_property(s: Span) -> IResult<Span, DpiTaskImportProperty> {
let (s, a) = symbol("context")(s)?; let (s, a) = symbol("context")(s)?;
Ok((s, DpiTaskImportProperty::Context(a))) Ok((s, DpiTaskImportProperty::Context(a)))
} }
#[trace]
pub fn dpi_function_proto(s: Span) -> IResult<Span, DpiFunctionProto> { pub fn dpi_function_proto(s: Span) -> IResult<Span, DpiFunctionProto> {
let (s, a) = function_prototype(s)?; let (s, a) = function_prototype(s)?;
Ok((s, DpiFunctionProto { nodes: (a,) })) Ok((s, DpiFunctionProto { nodes: (a,) }))
} }
#[trace]
pub fn dpi_task_proto(s: Span) -> IResult<Span, DpiTaskProto> { pub fn dpi_task_proto(s: Span) -> IResult<Span, DpiTaskProto> {
let (s, a) = task_prototype(s)?; let (s, a) = task_prototype(s)?;
Ok((s, DpiTaskProto { nodes: (a,) })) Ok((s, DpiTaskProto { nodes: (a,) }))

View File

@ -94,6 +94,7 @@ pub enum ImportExport<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn modport_declaration(s: Span) -> IResult<Span, ModportDeclaration> { pub fn modport_declaration(s: Span) -> IResult<Span, ModportDeclaration> {
let (s, a) = symbol("modport")(s)?; let (s, a) = symbol("modport")(s)?;
let (s, b) = list(symbol(","), modport_item)(s)?; let (s, b) = list(symbol(","), modport_item)(s)?;
@ -101,12 +102,14 @@ pub fn modport_declaration(s: Span) -> IResult<Span, ModportDeclaration> {
Ok((s, ModportDeclaration { nodes: (a, b, c) })) Ok((s, ModportDeclaration { nodes: (a, b, c) }))
} }
#[trace]
pub fn modport_item(s: Span) -> IResult<Span, ModportItem> { pub fn modport_item(s: Span) -> IResult<Span, ModportItem> {
let (s, a) = modport_identifier(s)?; let (s, a) = modport_identifier(s)?;
let (s, b) = paren(list(symbol(","), modport_ports_declaration))(s)?; let (s, b) = paren(list(symbol(","), modport_ports_declaration))(s)?;
Ok((s, ModportItem { nodes: (a, b) })) Ok((s, ModportItem { nodes: (a, b) }))
} }
#[trace]
pub fn modport_ports_declaration(s: Span) -> IResult<Span, ModportPortsDeclaraton> { pub fn modport_ports_declaration(s: Span) -> IResult<Span, ModportPortsDeclaraton> {
alt(( alt((
modport_ports_declaration_simple, modport_ports_declaration_simple,
@ -115,6 +118,7 @@ pub fn modport_ports_declaration(s: Span) -> IResult<Span, ModportPortsDeclarato
))(s) ))(s)
} }
#[trace]
pub fn modport_ports_declaration_simple(s: Span) -> IResult<Span, ModportPortsDeclaraton> { pub fn modport_ports_declaration_simple(s: Span) -> IResult<Span, ModportPortsDeclaraton> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = modport_simple_ports_declaration(s)?; let (s, b) = modport_simple_ports_declaration(s)?;
@ -124,6 +128,7 @@ pub fn modport_ports_declaration_simple(s: Span) -> IResult<Span, ModportPortsDe
)) ))
} }
#[trace]
pub fn modport_ports_declaration_tf(s: Span) -> IResult<Span, ModportPortsDeclaraton> { pub fn modport_ports_declaration_tf(s: Span) -> IResult<Span, ModportPortsDeclaraton> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = modport_tf_ports_declaration(s)?; let (s, b) = modport_tf_ports_declaration(s)?;
@ -133,6 +138,7 @@ pub fn modport_ports_declaration_tf(s: Span) -> IResult<Span, ModportPortsDeclar
)) ))
} }
#[trace]
pub fn modport_ports_declaration_clocking(s: Span) -> IResult<Span, ModportPortsDeclaraton> { pub fn modport_ports_declaration_clocking(s: Span) -> IResult<Span, ModportPortsDeclaraton> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = modport_clocking_declaration(s)?; let (s, b) = modport_clocking_declaration(s)?;
@ -142,22 +148,26 @@ pub fn modport_ports_declaration_clocking(s: Span) -> IResult<Span, ModportPorts
)) ))
} }
#[trace]
pub fn modport_clocking_declaration(s: Span) -> IResult<Span, ModportClockingDeclaration> { pub fn modport_clocking_declaration(s: Span) -> IResult<Span, ModportClockingDeclaration> {
let (s, a) = symbol("clocking")(s)?; let (s, a) = symbol("clocking")(s)?;
let (s, b) = clocking_identifier(s)?; let (s, b) = clocking_identifier(s)?;
Ok((s, ModportClockingDeclaration { nodes: (a, b) })) Ok((s, ModportClockingDeclaration { nodes: (a, b) }))
} }
#[trace]
pub fn modport_simple_ports_declaration(s: Span) -> IResult<Span, ModportSimplePortsDeclaration> { pub fn modport_simple_ports_declaration(s: Span) -> IResult<Span, ModportSimplePortsDeclaration> {
let (s, a) = port_direction(s)?; let (s, a) = port_direction(s)?;
let (s, b) = list(symbol(","), modport_simple_port)(s)?; let (s, b) = list(symbol(","), modport_simple_port)(s)?;
Ok((s, ModportSimplePortsDeclaration { nodes: (a, b) })) Ok((s, ModportSimplePortsDeclaration { nodes: (a, b) }))
} }
#[trace]
pub fn modport_simple_port(s: Span) -> IResult<Span, ModportSimplePort> { pub fn modport_simple_port(s: Span) -> IResult<Span, ModportSimplePort> {
alt((modport_simple_port_ordered, modport_simple_port_named))(s) alt((modport_simple_port_ordered, modport_simple_port_named))(s)
} }
#[trace]
pub fn modport_simple_port_ordered(s: Span) -> IResult<Span, ModportSimplePort> { pub fn modport_simple_port_ordered(s: Span) -> IResult<Span, ModportSimplePort> {
let (s, a) = port_identifier(s)?; let (s, a) = port_identifier(s)?;
Ok(( Ok((
@ -166,6 +176,7 @@ pub fn modport_simple_port_ordered(s: Span) -> IResult<Span, ModportSimplePort>
)) ))
} }
#[trace]
pub fn modport_simple_port_named(s: Span) -> IResult<Span, ModportSimplePort> { pub fn modport_simple_port_named(s: Span) -> IResult<Span, ModportSimplePort> {
let (s, a) = symbol(".")(s)?; let (s, a) = symbol(".")(s)?;
let (s, b) = port_identifier(s)?; let (s, b) = port_identifier(s)?;
@ -176,12 +187,14 @@ pub fn modport_simple_port_named(s: Span) -> IResult<Span, ModportSimplePort> {
)) ))
} }
#[trace]
pub fn modport_tf_ports_declaration(s: Span) -> IResult<Span, ModportTfPortsDeclaration> { pub fn modport_tf_ports_declaration(s: Span) -> IResult<Span, ModportTfPortsDeclaration> {
let (s, a) = import_export(s)?; let (s, a) = import_export(s)?;
let (s, b) = list(symbol(","), modport_tf_port)(s)?; let (s, b) = list(symbol(","), modport_tf_port)(s)?;
Ok((s, ModportTfPortsDeclaration { nodes: (a, b) })) Ok((s, ModportTfPortsDeclaration { nodes: (a, b) }))
} }
#[trace]
pub fn modport_tf_port(s: Span) -> IResult<Span, ModportTfPort> { pub fn modport_tf_port(s: Span) -> IResult<Span, ModportTfPort> {
alt(( alt((
map(method_prototype, |x| ModportTfPort::MethodPrototype(x)), map(method_prototype, |x| ModportTfPort::MethodPrototype(x)),
@ -189,6 +202,7 @@ pub fn modport_tf_port(s: Span) -> IResult<Span, ModportTfPort> {
))(s) ))(s)
} }
#[trace]
pub fn import_export(s: Span) -> IResult<Span, ImportExport> { pub fn import_export(s: Span) -> IResult<Span, ImportExport> {
alt(( alt((
map(symbol("import"), |x| ImportExport::Import(x)), map(symbol("import"), |x| ImportExport::Import(x)),

View File

@ -96,6 +96,7 @@ pub struct LetActualArg<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn let_declaration(s: Span) -> IResult<Span, LetDeclaration> { pub fn let_declaration(s: Span) -> IResult<Span, LetDeclaration> {
let (s, a) = symbol("let")(s)?; let (s, a) = symbol("let")(s)?;
let (s, b) = let_identifier(s)?; let (s, b) = let_identifier(s)?;
@ -111,16 +112,19 @@ pub fn let_declaration(s: Span) -> IResult<Span, LetDeclaration> {
)) ))
} }
#[trace]
pub fn let_identifier(s: Span) -> IResult<Span, LetIdentifier> { pub fn let_identifier(s: Span) -> IResult<Span, LetIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, LetIdentifier { nodes: (a,) })) Ok((s, LetIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn let_port_list(s: Span) -> IResult<Span, LetPortList> { pub fn let_port_list(s: Span) -> IResult<Span, LetPortList> {
let (s, a) = list(symbol(","), let_port_item)(s)?; let (s, a) = list(symbol(","), let_port_item)(s)?;
Ok((s, LetPortList { nodes: (a,) })) Ok((s, LetPortList { nodes: (a,) }))
} }
#[trace]
pub fn let_port_item(s: Span) -> IResult<Span, LetPortItem> { pub fn let_port_item(s: Span) -> IResult<Span, LetPortItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = let_formal_type(s)?; let (s, b) = let_formal_type(s)?;
@ -135,6 +139,7 @@ pub fn let_port_item(s: Span) -> IResult<Span, LetPortItem> {
)) ))
} }
#[trace]
pub fn let_formal_type(s: Span) -> IResult<Span, LetFormalType> { pub fn let_formal_type(s: Span) -> IResult<Span, LetFormalType> {
alt(( alt((
map(data_type_or_implicit, |x| { map(data_type_or_implicit, |x| {
@ -144,6 +149,7 @@ pub fn let_formal_type(s: Span) -> IResult<Span, LetFormalType> {
))(s) ))(s)
} }
#[trace]
pub fn let_expression(s: Span) -> IResult<Span, LetExpression> { pub fn let_expression(s: Span) -> IResult<Span, LetExpression> {
let (s, a) = opt(package_scope)(s)?; let (s, a) = opt(package_scope)(s)?;
let (s, b) = let_identifier(s)?; let (s, b) = let_identifier(s)?;
@ -151,10 +157,12 @@ pub fn let_expression(s: Span) -> IResult<Span, LetExpression> {
Ok((s, LetExpression { nodes: (a, b, c) })) Ok((s, LetExpression { nodes: (a, b, c) }))
} }
#[trace]
pub fn let_list_of_arguments(s: Span) -> IResult<Span, LetListOfArguments> { pub fn let_list_of_arguments(s: Span) -> IResult<Span, LetListOfArguments> {
alt((let_list_of_arguments_ordered, let_list_of_arguments_named))(s) alt((let_list_of_arguments_ordered, let_list_of_arguments_named))(s)
} }
#[trace]
pub fn let_list_of_arguments_ordered(s: Span) -> IResult<Span, LetListOfArguments> { pub fn let_list_of_arguments_ordered(s: Span) -> IResult<Span, LetListOfArguments> {
let (s, a) = list(symbol(","), opt(let_actual_arg))(s)?; let (s, a) = list(symbol(","), opt(let_actual_arg))(s)?;
let (s, b) = many0(tuple(( let (s, b) = many0(tuple((
@ -169,6 +177,7 @@ pub fn let_list_of_arguments_ordered(s: Span) -> IResult<Span, LetListOfArgument
)) ))
} }
#[trace]
pub fn let_list_of_arguments_named(s: Span) -> IResult<Span, LetListOfArguments> { pub fn let_list_of_arguments_named(s: Span) -> IResult<Span, LetListOfArguments> {
let (s, a) = list( let (s, a) = list(
symbol(","), symbol(","),
@ -180,6 +189,7 @@ pub fn let_list_of_arguments_named(s: Span) -> IResult<Span, LetListOfArguments>
)) ))
} }
#[trace]
pub fn let_actual_arg(s: Span) -> IResult<Span, LetActualArg> { pub fn let_actual_arg(s: Span) -> IResult<Span, LetActualArg> {
let (s, a) = expression(s)?; let (s, a) = expression(s)?;
Ok((s, LetActualArg { nodes: (a,) })) Ok((s, LetActualArg { nodes: (a,) }))

View File

@ -58,6 +58,7 @@ pub struct SpecparamDeclaration<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn local_parameter_declaration(s: Span) -> IResult<Span, LocalParameterDeclaration> { pub fn local_parameter_declaration(s: Span) -> IResult<Span, LocalParameterDeclaration> {
alt(( alt((
local_parameter_declaration_param, local_parameter_declaration_param,
@ -65,6 +66,7 @@ pub fn local_parameter_declaration(s: Span) -> IResult<Span, LocalParameterDecla
))(s) ))(s)
} }
#[trace]
pub fn local_parameter_declaration_param(s: Span) -> IResult<Span, LocalParameterDeclaration> { pub fn local_parameter_declaration_param(s: Span) -> IResult<Span, LocalParameterDeclaration> {
let (s, a) = symbol("localparam")(s)?; let (s, a) = symbol("localparam")(s)?;
let (s, b) = data_type_or_implicit(s)?; let (s, b) = data_type_or_implicit(s)?;
@ -75,6 +77,7 @@ pub fn local_parameter_declaration_param(s: Span) -> IResult<Span, LocalParamete
)) ))
} }
#[trace]
pub fn local_parameter_declaration_type(s: Span) -> IResult<Span, LocalParameterDeclaration> { pub fn local_parameter_declaration_type(s: Span) -> IResult<Span, LocalParameterDeclaration> {
let (s, a) = symbol("localparam")(s)?; let (s, a) = symbol("localparam")(s)?;
let (s, b) = symbol("type")(s)?; let (s, b) = symbol("type")(s)?;
@ -85,10 +88,12 @@ pub fn local_parameter_declaration_type(s: Span) -> IResult<Span, LocalParameter
)) ))
} }
#[trace]
pub fn parameter_declaration(s: Span) -> IResult<Span, ParameterDeclaration> { pub fn parameter_declaration(s: Span) -> IResult<Span, ParameterDeclaration> {
alt((parameter_declaration_param, parameter_declaration_type))(s) alt((parameter_declaration_param, parameter_declaration_type))(s)
} }
#[trace]
pub fn parameter_declaration_param(s: Span) -> IResult<Span, ParameterDeclaration> { pub fn parameter_declaration_param(s: Span) -> IResult<Span, ParameterDeclaration> {
let (s, a) = symbol("parameter")(s)?; let (s, a) = symbol("parameter")(s)?;
let (s, b) = data_type_or_implicit(s)?; let (s, b) = data_type_or_implicit(s)?;
@ -99,6 +104,7 @@ pub fn parameter_declaration_param(s: Span) -> IResult<Span, ParameterDeclaratio
)) ))
} }
#[trace]
pub fn parameter_declaration_type(s: Span) -> IResult<Span, ParameterDeclaration> { pub fn parameter_declaration_type(s: Span) -> IResult<Span, ParameterDeclaration> {
let (s, a) = symbol("parameter")(s)?; let (s, a) = symbol("parameter")(s)?;
let (s, b) = symbol("type")(s)?; let (s, b) = symbol("type")(s)?;
@ -109,6 +115,7 @@ pub fn parameter_declaration_type(s: Span) -> IResult<Span, ParameterDeclaration
)) ))
} }
#[trace]
pub fn specparam_declaration(s: Span) -> IResult<Span, SpecparamDeclaration> { pub fn specparam_declaration(s: Span) -> IResult<Span, SpecparamDeclaration> {
let (s, a) = symbol("specparam")(s)?; let (s, a) = symbol("specparam")(s)?;
let (s, b) = opt(packed_dimension)(s)?; let (s, b) = opt(packed_dimension)(s)?;

View File

@ -297,6 +297,7 @@ pub struct TypeReferenceDataType<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn casting_type(s: Span) -> IResult<Span, CastingType> { pub fn casting_type(s: Span) -> IResult<Span, CastingType> {
alt(( alt((
map(simple_type, |x| CastingType::SimpleType(Box::new(x))), map(simple_type, |x| CastingType::SimpleType(Box::new(x))),
@ -309,6 +310,7 @@ pub fn casting_type(s: Span) -> IResult<Span, CastingType> {
))(s) ))(s)
} }
#[trace]
pub fn data_type(s: Span) -> IResult<Span, DataType> { pub fn data_type(s: Span) -> IResult<Span, DataType> {
alt(( alt((
data_type_vector, data_type_vector,
@ -329,6 +331,7 @@ pub fn data_type(s: Span) -> IResult<Span, DataType> {
))(s) ))(s)
} }
#[trace]
pub fn data_type_vector(s: Span) -> IResult<Span, DataType> { pub fn data_type_vector(s: Span) -> IResult<Span, DataType> {
let (s, a) = integer_vector_type(s)?; let (s, a) = integer_vector_type(s)?;
let (s, b) = opt(signing)(s)?; let (s, b) = opt(signing)(s)?;
@ -336,12 +339,14 @@ pub fn data_type_vector(s: Span) -> IResult<Span, DataType> {
Ok((s, DataType::Vector(DataTypeVector { nodes: (a, b, c) }))) Ok((s, DataType::Vector(DataTypeVector { nodes: (a, b, c) })))
} }
#[trace]
pub fn data_type_atom(s: Span) -> IResult<Span, DataType> { pub fn data_type_atom(s: Span) -> IResult<Span, DataType> {
let (s, a) = integer_atom_type(s)?; let (s, a) = integer_atom_type(s)?;
let (s, b) = opt(signing)(s)?; let (s, b) = opt(signing)(s)?;
Ok((s, DataType::Atom(DataTypeAtom { nodes: (a, b) }))) Ok((s, DataType::Atom(DataTypeAtom { nodes: (a, b) })))
} }
#[trace]
pub fn data_type_union(s: Span) -> IResult<Span, DataType> { pub fn data_type_union(s: Span) -> IResult<Span, DataType> {
let (s, a) = struct_union(s)?; let (s, a) = struct_union(s)?;
let (s, b) = opt(pair(packed, opt(signing)))(s)?; let (s, b) = opt(pair(packed, opt(signing)))(s)?;
@ -355,11 +360,13 @@ pub fn data_type_union(s: Span) -> IResult<Span, DataType> {
)) ))
} }
#[trace]
pub fn packed(s: Span) -> IResult<Span, Packed> { pub fn packed(s: Span) -> IResult<Span, Packed> {
let (s, a) = symbol("packed")(s)?; let (s, a) = symbol("packed")(s)?;
Ok((s, Packed { nodes: (a,) })) Ok((s, Packed { nodes: (a,) }))
} }
#[trace]
pub fn data_type_enum(s: Span) -> IResult<Span, DataType> { pub fn data_type_enum(s: Span) -> IResult<Span, DataType> {
let (s, a) = symbol("enum")(s)?; let (s, a) = symbol("enum")(s)?;
let (s, b) = opt(enum_base_type)(s)?; let (s, b) = opt(enum_base_type)(s)?;
@ -373,6 +380,7 @@ pub fn data_type_enum(s: Span) -> IResult<Span, DataType> {
)) ))
} }
#[trace]
pub fn data_type_virtual(s: Span) -> IResult<Span, DataType> { pub fn data_type_virtual(s: Span) -> IResult<Span, DataType> {
let (s, a) = symbol("virtual")(s)?; let (s, a) = symbol("virtual")(s)?;
let (s, b) = opt(interface)(s)?; let (s, b) = opt(interface)(s)?;
@ -387,11 +395,13 @@ pub fn data_type_virtual(s: Span) -> IResult<Span, DataType> {
)) ))
} }
#[trace]
pub fn interface(s: Span) -> IResult<Span, Interface> { pub fn interface(s: Span) -> IResult<Span, Interface> {
let (s, a) = symbol("interface")(s)?; let (s, a) = symbol("interface")(s)?;
Ok((s, Interface { nodes: (a,) })) Ok((s, Interface { nodes: (a,) }))
} }
#[trace]
pub fn data_type_type(s: Span) -> IResult<Span, DataType> { pub fn data_type_type(s: Span) -> IResult<Span, DataType> {
let (s, a) = opt(package_scope_or_class_scope)(s)?; let (s, a) = opt(package_scope_or_class_scope)(s)?;
let (s, b) = type_identifier(s)?; let (s, b) = type_identifier(s)?;
@ -399,6 +409,7 @@ pub fn data_type_type(s: Span) -> IResult<Span, DataType> {
Ok((s, DataType::Type(DataTypeType { nodes: (a, b, c) }))) Ok((s, DataType::Type(DataTypeType { nodes: (a, b, c) })))
} }
#[trace]
pub fn data_type_or_implicit(s: Span) -> IResult<Span, DataTypeOrImplicit> { pub fn data_type_or_implicit(s: Span) -> IResult<Span, DataTypeOrImplicit> {
alt(( alt((
map(data_type, |x| DataTypeOrImplicit::DataType(x)), map(data_type, |x| DataTypeOrImplicit::DataType(x)),
@ -408,12 +419,14 @@ pub fn data_type_or_implicit(s: Span) -> IResult<Span, DataTypeOrImplicit> {
))(s) ))(s)
} }
#[trace]
pub fn implicit_data_type(s: Span) -> IResult<Span, ImplicitDataType> { pub fn implicit_data_type(s: Span) -> IResult<Span, ImplicitDataType> {
let (s, a) = opt(signing)(s)?; let (s, a) = opt(signing)(s)?;
let (s, b) = many0(packed_dimension)(s)?; let (s, b) = many0(packed_dimension)(s)?;
Ok((s, ImplicitDataType { nodes: (a, b) })) Ok((s, ImplicitDataType { nodes: (a, b) }))
} }
#[trace]
pub fn enum_base_type(s: Span) -> IResult<Span, EnumBaseType> { pub fn enum_base_type(s: Span) -> IResult<Span, EnumBaseType> {
alt(( alt((
enum_base_type_atom, enum_base_type_atom,
@ -422,12 +435,14 @@ pub fn enum_base_type(s: Span) -> IResult<Span, EnumBaseType> {
))(s) ))(s)
} }
#[trace]
pub fn enum_base_type_atom(s: Span) -> IResult<Span, EnumBaseType> { pub fn enum_base_type_atom(s: Span) -> IResult<Span, EnumBaseType> {
let (s, a) = integer_atom_type(s)?; let (s, a) = integer_atom_type(s)?;
let (s, b) = opt(signing)(s)?; let (s, b) = opt(signing)(s)?;
Ok((s, EnumBaseType::Atom(EnumBaseTypeAtom { nodes: (a, b) }))) Ok((s, EnumBaseType::Atom(EnumBaseTypeAtom { nodes: (a, b) })))
} }
#[trace]
pub fn enum_base_type_vector(s: Span) -> IResult<Span, EnumBaseType> { pub fn enum_base_type_vector(s: Span) -> IResult<Span, EnumBaseType> {
let (s, a) = integer_vector_type(s)?; let (s, a) = integer_vector_type(s)?;
let (s, b) = opt(signing)(s)?; let (s, b) = opt(signing)(s)?;
@ -438,12 +453,14 @@ pub fn enum_base_type_vector(s: Span) -> IResult<Span, EnumBaseType> {
)) ))
} }
#[trace]
pub fn enum_base_type_type(s: Span) -> IResult<Span, EnumBaseType> { pub fn enum_base_type_type(s: Span) -> IResult<Span, EnumBaseType> {
let (s, a) = type_identifier(s)?; let (s, a) = type_identifier(s)?;
let (s, b) = opt(packed_dimension)(s)?; let (s, b) = opt(packed_dimension)(s)?;
Ok((s, EnumBaseType::Type(EnumBaseTypeType { nodes: (a, b) }))) Ok((s, EnumBaseType::Type(EnumBaseTypeType { nodes: (a, b) })))
} }
#[trace]
pub fn enum_name_declaration(s: Span) -> IResult<Span, EnumNameDeclaration> { pub fn enum_name_declaration(s: Span) -> IResult<Span, EnumNameDeclaration> {
let (s, a) = enum_identifier(s)?; let (s, a) = enum_identifier(s)?;
let (s, b) = opt(bracket(pair( let (s, b) = opt(bracket(pair(
@ -454,12 +471,14 @@ pub fn enum_name_declaration(s: Span) -> IResult<Span, EnumNameDeclaration> {
Ok((s, EnumNameDeclaration { nodes: (a, b, c) })) Ok((s, EnumNameDeclaration { nodes: (a, b, c) }))
} }
#[trace]
pub fn class_scope(s: Span) -> IResult<Span, ClassScope> { pub fn class_scope(s: Span) -> IResult<Span, ClassScope> {
let (s, a) = class_type(s)?; let (s, a) = class_type(s)?;
let (s, b) = symbol("::")(s)?; let (s, b) = symbol("::")(s)?;
Ok((s, ClassScope { nodes: (a, b) })) Ok((s, ClassScope { nodes: (a, b) }))
} }
#[trace]
pub fn class_type(s: Span) -> IResult<Span, ClassType> { pub fn class_type(s: Span) -> IResult<Span, ClassType> {
let (s, a) = ps_class_identifier(s)?; let (s, a) = ps_class_identifier(s)?;
let (s, b) = opt(parameter_value_assignment)(s)?; let (s, b) = opt(parameter_value_assignment)(s)?;
@ -471,6 +490,7 @@ pub fn class_type(s: Span) -> IResult<Span, ClassType> {
Ok((s, ClassType { nodes: (a, b, c) })) Ok((s, ClassType { nodes: (a, b, c) }))
} }
#[trace]
pub fn integer_type(s: Span) -> IResult<Span, IntegerType> { pub fn integer_type(s: Span) -> IResult<Span, IntegerType> {
alt(( alt((
map(integer_vector_type, |x| IntegerType::IntegerVectorType(x)), map(integer_vector_type, |x| IntegerType::IntegerVectorType(x)),
@ -478,6 +498,7 @@ pub fn integer_type(s: Span) -> IResult<Span, IntegerType> {
))(s) ))(s)
} }
#[trace]
pub fn integer_atom_type(s: Span) -> IResult<Span, IntegerAtomType> { pub fn integer_atom_type(s: Span) -> IResult<Span, IntegerAtomType> {
alt(( alt((
map(symbol("byte"), |x| IntegerAtomType::Byte(x)), map(symbol("byte"), |x| IntegerAtomType::Byte(x)),
@ -489,6 +510,7 @@ pub fn integer_atom_type(s: Span) -> IResult<Span, IntegerAtomType> {
))(s) ))(s)
} }
#[trace]
pub fn integer_vector_type(s: Span) -> IResult<Span, IntegerVectorType> { pub fn integer_vector_type(s: Span) -> IResult<Span, IntegerVectorType> {
alt(( alt((
map(symbol("bit"), |x| IntegerVectorType::Bit(x)), map(symbol("bit"), |x| IntegerVectorType::Bit(x)),
@ -497,6 +519,7 @@ pub fn integer_vector_type(s: Span) -> IResult<Span, IntegerVectorType> {
))(s) ))(s)
} }
#[trace]
pub fn non_integer_type(s: Span) -> IResult<Span, NonIntegerType> { pub fn non_integer_type(s: Span) -> IResult<Span, NonIntegerType> {
alt(( alt((
map(symbol("shortreal"), |x| NonIntegerType::Shortreal(x)), map(symbol("shortreal"), |x| NonIntegerType::Shortreal(x)),
@ -505,6 +528,7 @@ pub fn non_integer_type(s: Span) -> IResult<Span, NonIntegerType> {
))(s) ))(s)
} }
#[trace]
pub fn net_type(s: Span) -> IResult<Span, NetType> { pub fn net_type(s: Span) -> IResult<Span, NetType> {
alt(( alt((
map(symbol("supply0"), |x| NetType::Supply0(x)), map(symbol("supply0"), |x| NetType::Supply0(x)),
@ -522,6 +546,7 @@ pub fn net_type(s: Span) -> IResult<Span, NetType> {
))(s) ))(s)
} }
#[trace]
pub fn net_port_type(s: Span) -> IResult<Span, NetPortType> { pub fn net_port_type(s: Span) -> IResult<Span, NetPortType> {
alt(( alt((
net_port_type_data_type, net_port_type_data_type,
@ -530,6 +555,7 @@ pub fn net_port_type(s: Span) -> IResult<Span, NetPortType> {
))(s) ))(s)
} }
#[trace]
pub fn net_port_type_data_type(s: Span) -> IResult<Span, NetPortType> { pub fn net_port_type_data_type(s: Span) -> IResult<Span, NetPortType> {
let (s, a) = opt(net_type)(s)?; let (s, a) = opt(net_type)(s)?;
let (s, b) = data_type_or_implicit(s)?; let (s, b) = data_type_or_implicit(s)?;
@ -539,6 +565,7 @@ pub fn net_port_type_data_type(s: Span) -> IResult<Span, NetPortType> {
)) ))
} }
#[trace]
pub fn net_port_type_interconnect(s: Span) -> IResult<Span, NetPortType> { pub fn net_port_type_interconnect(s: Span) -> IResult<Span, NetPortType> {
let (s, a) = symbol("interconnect")(s)?; let (s, a) = symbol("interconnect")(s)?;
let (s, b) = implicit_data_type(s)?; let (s, b) = implicit_data_type(s)?;
@ -548,11 +575,13 @@ pub fn net_port_type_interconnect(s: Span) -> IResult<Span, NetPortType> {
)) ))
} }
#[trace]
pub fn variable_port_type(s: Span) -> IResult<Span, VariablePortType> { pub fn variable_port_type(s: Span) -> IResult<Span, VariablePortType> {
let (s, a) = var_data_type(s)?; let (s, a) = var_data_type(s)?;
Ok((s, VariablePortType { nodes: (a,) })) Ok((s, VariablePortType { nodes: (a,) }))
} }
#[trace]
pub fn var_data_type(s: Span) -> IResult<Span, VarDataType> { pub fn var_data_type(s: Span) -> IResult<Span, VarDataType> {
alt(( alt((
map(data_type, |x| VarDataType::DataType(x)), map(data_type, |x| VarDataType::DataType(x)),
@ -560,12 +589,14 @@ pub fn var_data_type(s: Span) -> IResult<Span, VarDataType> {
))(s) ))(s)
} }
#[trace]
pub fn var_data_type_var(s: Span) -> IResult<Span, VarDataType> { pub fn var_data_type_var(s: Span) -> IResult<Span, VarDataType> {
let (s, a) = symbol("var")(s)?; let (s, a) = symbol("var")(s)?;
let (s, b) = data_type_or_implicit(s)?; let (s, b) = data_type_or_implicit(s)?;
Ok((s, VarDataType::Var(VarDataTypeVar { nodes: (a, b) }))) Ok((s, VarDataType::Var(VarDataTypeVar { nodes: (a, b) })))
} }
#[trace]
pub fn signing(s: Span) -> IResult<Span, Signing> { pub fn signing(s: Span) -> IResult<Span, Signing> {
alt(( alt((
map(symbol("signed"), |x| Signing::Signed(x)), map(symbol("signed"), |x| Signing::Signed(x)),
@ -573,6 +604,7 @@ pub fn signing(s: Span) -> IResult<Span, Signing> {
))(s) ))(s)
} }
#[trace]
pub fn simple_type(s: Span) -> IResult<Span, SimpleType> { pub fn simple_type(s: Span) -> IResult<Span, SimpleType> {
alt(( alt((
map(integer_type, |x| SimpleType::IntegerType(x)), map(integer_type, |x| SimpleType::IntegerType(x)),
@ -584,6 +616,7 @@ pub fn simple_type(s: Span) -> IResult<Span, SimpleType> {
))(s) ))(s)
} }
#[trace]
pub fn struct_union_member(s: Span) -> IResult<Span, StructUnionMember> { pub fn struct_union_member(s: Span) -> IResult<Span, StructUnionMember> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = opt(random_qualifier)(s)?; let (s, b) = opt(random_qualifier)(s)?;
@ -598,6 +631,7 @@ pub fn struct_union_member(s: Span) -> IResult<Span, StructUnionMember> {
)) ))
} }
#[trace]
pub fn data_type_or_void(s: Span) -> IResult<Span, DataTypeOrVoid> { pub fn data_type_or_void(s: Span) -> IResult<Span, DataTypeOrVoid> {
alt(( alt((
map(data_type, |x| DataTypeOrVoid::DataType(x)), map(data_type, |x| DataTypeOrVoid::DataType(x)),
@ -605,6 +639,7 @@ pub fn data_type_or_void(s: Span) -> IResult<Span, DataTypeOrVoid> {
))(s) ))(s)
} }
#[trace]
pub fn struct_union(s: Span) -> IResult<Span, StructUnion> { pub fn struct_union(s: Span) -> IResult<Span, StructUnion> {
alt(( alt((
map(symbol("struct"), |x| StructUnion::Struct(x)), map(symbol("struct"), |x| StructUnion::Struct(x)),
@ -615,10 +650,12 @@ pub fn struct_union(s: Span) -> IResult<Span, StructUnion> {
))(s) ))(s)
} }
#[trace]
pub fn type_reference(s: Span) -> IResult<Span, TypeReference> { pub fn type_reference(s: Span) -> IResult<Span, TypeReference> {
alt((type_reference_expression, type_reference_data_type))(s) alt((type_reference_expression, type_reference_data_type))(s)
} }
#[trace]
pub fn type_reference_expression(s: Span) -> IResult<Span, TypeReference> { pub fn type_reference_expression(s: Span) -> IResult<Span, TypeReference> {
let (s, a) = symbol("type")(s)?; let (s, a) = symbol("type")(s)?;
let (s, b) = paren(expression)(s)?; let (s, b) = paren(expression)(s)?;
@ -628,6 +665,7 @@ pub fn type_reference_expression(s: Span) -> IResult<Span, TypeReference> {
)) ))
} }
#[trace]
pub fn type_reference_data_type(s: Span) -> IResult<Span, TypeReference> { pub fn type_reference_data_type(s: Span) -> IResult<Span, TypeReference> {
let (s, a) = symbol("type")(s)?; let (s, a) = symbol("type")(s)?;
let (s, b) = paren(data_type)(s)?; let (s, b) = paren(data_type)(s)?;

View File

@ -72,6 +72,7 @@ pub struct RefDeclaration<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn inout_declaration(s: Span) -> IResult<Span, InoutDeclaration> { pub fn inout_declaration(s: Span) -> IResult<Span, InoutDeclaration> {
let (s, a) = symbol("inout")(s)?; let (s, a) = symbol("inout")(s)?;
let (s, b) = net_port_type(s)?; let (s, b) = net_port_type(s)?;
@ -79,10 +80,12 @@ pub fn inout_declaration(s: Span) -> IResult<Span, InoutDeclaration> {
Ok((s, InoutDeclaration { nodes: (a, b, c) })) Ok((s, InoutDeclaration { nodes: (a, b, c) }))
} }
#[trace]
pub fn input_declaration(s: Span) -> IResult<Span, InputDeclaration> { pub fn input_declaration(s: Span) -> IResult<Span, InputDeclaration> {
alt((input_declaration_net, input_declaration_variable))(s) alt((input_declaration_net, input_declaration_variable))(s)
} }
#[trace]
pub fn input_declaration_net(s: Span) -> IResult<Span, InputDeclaration> { pub fn input_declaration_net(s: Span) -> IResult<Span, InputDeclaration> {
let (s, a) = symbol("input")(s)?; let (s, a) = symbol("input")(s)?;
let (s, b) = net_port_type(s)?; let (s, b) = net_port_type(s)?;
@ -93,6 +96,7 @@ pub fn input_declaration_net(s: Span) -> IResult<Span, InputDeclaration> {
)) ))
} }
#[trace]
pub fn input_declaration_variable(s: Span) -> IResult<Span, InputDeclaration> { pub fn input_declaration_variable(s: Span) -> IResult<Span, InputDeclaration> {
let (s, a) = symbol("input")(s)?; let (s, a) = symbol("input")(s)?;
let (s, b) = variable_port_type(s)?; let (s, b) = variable_port_type(s)?;
@ -103,10 +107,12 @@ pub fn input_declaration_variable(s: Span) -> IResult<Span, InputDeclaration> {
)) ))
} }
#[trace]
pub fn output_declaration(s: Span) -> IResult<Span, OutputDeclaration> { pub fn output_declaration(s: Span) -> IResult<Span, OutputDeclaration> {
alt((output_declaration_net, output_declaration_variable))(s) alt((output_declaration_net, output_declaration_variable))(s)
} }
#[trace]
pub fn output_declaration_net(s: Span) -> IResult<Span, OutputDeclaration> { pub fn output_declaration_net(s: Span) -> IResult<Span, OutputDeclaration> {
let (s, a) = symbol("output")(s)?; let (s, a) = symbol("output")(s)?;
let (s, b) = net_port_type(s)?; let (s, b) = net_port_type(s)?;
@ -117,6 +123,7 @@ pub fn output_declaration_net(s: Span) -> IResult<Span, OutputDeclaration> {
)) ))
} }
#[trace]
pub fn output_declaration_variable(s: Span) -> IResult<Span, OutputDeclaration> { pub fn output_declaration_variable(s: Span) -> IResult<Span, OutputDeclaration> {
let (s, a) = symbol("output")(s)?; let (s, a) = symbol("output")(s)?;
let (s, b) = variable_port_type(s)?; let (s, b) = variable_port_type(s)?;
@ -127,6 +134,7 @@ pub fn output_declaration_variable(s: Span) -> IResult<Span, OutputDeclaration>
)) ))
} }
#[trace]
pub fn interface_port_declaration(s: Span) -> IResult<Span, InterfacePortDeclaration> { pub fn interface_port_declaration(s: Span) -> IResult<Span, InterfacePortDeclaration> {
let (s, a) = interface_identifier(s)?; let (s, a) = interface_identifier(s)?;
let (s, b) = opt(pair(symbol("."), modport_identifier))(s)?; let (s, b) = opt(pair(symbol("."), modport_identifier))(s)?;
@ -134,6 +142,7 @@ pub fn interface_port_declaration(s: Span) -> IResult<Span, InterfacePortDeclara
Ok((s, InterfacePortDeclaration { nodes: (a, b, c) })) Ok((s, InterfacePortDeclaration { nodes: (a, b, c) }))
} }
#[trace]
pub fn ref_declaration(s: Span) -> IResult<Span, RefDeclaration> { pub fn ref_declaration(s: Span) -> IResult<Span, RefDeclaration> {
let (s, a) = symbol("ref")(s)?; let (s, a) = symbol("ref")(s)?;
let (s, b) = variable_port_type(s)?; let (s, b) = variable_port_type(s)?;

View File

@ -86,6 +86,7 @@ pub struct ChargeStrengthLarge<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn drive_strength(s: Span) -> IResult<Span, DriveStrength> { pub fn drive_strength(s: Span) -> IResult<Span, DriveStrength> {
alt(( alt((
drive_strength01, drive_strength01,
@ -97,6 +98,7 @@ pub fn drive_strength(s: Span) -> IResult<Span, DriveStrength> {
))(s) ))(s)
} }
#[trace]
pub fn drive_strength01(s: Span) -> IResult<Span, DriveStrength> { pub fn drive_strength01(s: Span) -> IResult<Span, DriveStrength> {
let (s, a) = paren(triple(strength0, symbol(","), strength1))(s)?; let (s, a) = paren(triple(strength0, symbol(","), strength1))(s)?;
Ok(( Ok((
@ -105,6 +107,7 @@ pub fn drive_strength01(s: Span) -> IResult<Span, DriveStrength> {
)) ))
} }
#[trace]
pub fn drive_strength10(s: Span) -> IResult<Span, DriveStrength> { pub fn drive_strength10(s: Span) -> IResult<Span, DriveStrength> {
let (s, a) = paren(triple(strength1, symbol(","), strength0))(s)?; let (s, a) = paren(triple(strength1, symbol(","), strength0))(s)?;
Ok(( Ok((
@ -113,6 +116,7 @@ pub fn drive_strength10(s: Span) -> IResult<Span, DriveStrength> {
)) ))
} }
#[trace]
pub fn drive_strength0z(s: Span) -> IResult<Span, DriveStrength> { pub fn drive_strength0z(s: Span) -> IResult<Span, DriveStrength> {
let (s, a) = paren(triple(strength0, symbol(","), symbol("highz1")))(s)?; let (s, a) = paren(triple(strength0, symbol(","), symbol("highz1")))(s)?;
Ok(( Ok((
@ -121,6 +125,7 @@ pub fn drive_strength0z(s: Span) -> IResult<Span, DriveStrength> {
)) ))
} }
#[trace]
pub fn drive_strength1z(s: Span) -> IResult<Span, DriveStrength> { pub fn drive_strength1z(s: Span) -> IResult<Span, DriveStrength> {
let (s, a) = paren(triple(strength1, symbol(","), symbol("highz0")))(s)?; let (s, a) = paren(triple(strength1, symbol(","), symbol("highz0")))(s)?;
Ok(( Ok((
@ -129,6 +134,7 @@ pub fn drive_strength1z(s: Span) -> IResult<Span, DriveStrength> {
)) ))
} }
#[trace]
pub fn drive_strengthz1(s: Span) -> IResult<Span, DriveStrength> { pub fn drive_strengthz1(s: Span) -> IResult<Span, DriveStrength> {
let (s, a) = paren(triple(symbol("highz0"), symbol(","), strength1))(s)?; let (s, a) = paren(triple(symbol("highz0"), symbol(","), strength1))(s)?;
Ok(( Ok((
@ -137,6 +143,7 @@ pub fn drive_strengthz1(s: Span) -> IResult<Span, DriveStrength> {
)) ))
} }
#[trace]
pub fn drive_strengthz0(s: Span) -> IResult<Span, DriveStrength> { pub fn drive_strengthz0(s: Span) -> IResult<Span, DriveStrength> {
let (s, a) = paren(triple(symbol("highz1"), symbol(","), strength0))(s)?; let (s, a) = paren(triple(symbol("highz1"), symbol(","), strength0))(s)?;
Ok(( Ok((
@ -145,6 +152,7 @@ pub fn drive_strengthz0(s: Span) -> IResult<Span, DriveStrength> {
)) ))
} }
#[trace]
pub fn strength0(s: Span) -> IResult<Span, Strength0> { pub fn strength0(s: Span) -> IResult<Span, Strength0> {
alt(( alt((
map(symbol("supply0"), |x| Strength0::Supply0(x)), map(symbol("supply0"), |x| Strength0::Supply0(x)),
@ -154,6 +162,7 @@ pub fn strength0(s: Span) -> IResult<Span, Strength0> {
))(s) ))(s)
} }
#[trace]
pub fn strength1(s: Span) -> IResult<Span, Strength1> { pub fn strength1(s: Span) -> IResult<Span, Strength1> {
alt(( alt((
map(symbol("supply1"), |x| Strength1::Supply1(x)), map(symbol("supply1"), |x| Strength1::Supply1(x)),
@ -163,6 +172,7 @@ pub fn strength1(s: Span) -> IResult<Span, Strength1> {
))(s) ))(s)
} }
#[trace]
pub fn charge_strength(s: Span) -> IResult<Span, ChargeStrength> { pub fn charge_strength(s: Span) -> IResult<Span, ChargeStrength> {
alt(( alt((
charge_strength_small, charge_strength_small,
@ -171,6 +181,7 @@ pub fn charge_strength(s: Span) -> IResult<Span, ChargeStrength> {
))(s) ))(s)
} }
#[trace]
pub fn charge_strength_small(s: Span) -> IResult<Span, ChargeStrength> { pub fn charge_strength_small(s: Span) -> IResult<Span, ChargeStrength> {
let (s, a) = paren(symbol("small"))(s)?; let (s, a) = paren(symbol("small"))(s)?;
Ok(( Ok((
@ -179,6 +190,7 @@ pub fn charge_strength_small(s: Span) -> IResult<Span, ChargeStrength> {
)) ))
} }
#[trace]
pub fn charge_strength_medium(s: Span) -> IResult<Span, ChargeStrength> { pub fn charge_strength_medium(s: Span) -> IResult<Span, ChargeStrength> {
let (s, a) = paren(symbol("medium"))(s)?; let (s, a) = paren(symbol("medium"))(s)?;
Ok(( Ok((
@ -187,6 +199,7 @@ pub fn charge_strength_medium(s: Span) -> IResult<Span, ChargeStrength> {
)) ))
} }
#[trace]
pub fn charge_strength_large(s: Span) -> IResult<Span, ChargeStrength> { pub fn charge_strength_large(s: Span) -> IResult<Span, ChargeStrength> {
let (s, a) = paren(symbol("large"))(s)?; let (s, a) = paren(symbol("large"))(s)?;
Ok(( Ok((

View File

@ -101,6 +101,7 @@ pub struct TaskPrototype<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn task_declaration(s: Span) -> IResult<Span, TaskDeclaration> { pub fn task_declaration(s: Span) -> IResult<Span, TaskDeclaration> {
let (s, a) = symbol("task")(s)?; let (s, a) = symbol("task")(s)?;
let (s, b) = opt(lifetime)(s)?; let (s, b) = opt(lifetime)(s)?;
@ -108,6 +109,7 @@ pub fn task_declaration(s: Span) -> IResult<Span, TaskDeclaration> {
Ok((s, TaskDeclaration { nodes: (a, b, c) })) Ok((s, TaskDeclaration { nodes: (a, b, c) }))
} }
#[trace]
pub fn task_body_declaration(s: Span) -> IResult<Span, TaskBodyDeclaration> { pub fn task_body_declaration(s: Span) -> IResult<Span, TaskBodyDeclaration> {
alt(( alt((
task_body_declaration_without_port, task_body_declaration_without_port,
@ -115,6 +117,7 @@ pub fn task_body_declaration(s: Span) -> IResult<Span, TaskBodyDeclaration> {
))(s) ))(s)
} }
#[trace]
pub fn task_body_declaration_without_port(s: Span) -> IResult<Span, TaskBodyDeclaration> { pub fn task_body_declaration_without_port(s: Span) -> IResult<Span, TaskBodyDeclaration> {
let (s, a) = opt(interface_identifier_or_class_scope)(s)?; let (s, a) = opt(interface_identifier_or_class_scope)(s)?;
let (s, b) = task_identifier(s)?; let (s, b) = task_identifier(s)?;
@ -131,6 +134,7 @@ pub fn task_body_declaration_without_port(s: Span) -> IResult<Span, TaskBodyDecl
)) ))
} }
#[trace]
pub fn task_body_declaration_with_port(s: Span) -> IResult<Span, TaskBodyDeclaration> { pub fn task_body_declaration_with_port(s: Span) -> IResult<Span, TaskBodyDeclaration> {
let (s, a) = opt(interface_identifier_or_class_scope)(s)?; let (s, a) = opt(interface_identifier_or_class_scope)(s)?;
let (s, b) = task_identifier(s)?; let (s, b) = task_identifier(s)?;
@ -148,6 +152,7 @@ pub fn task_body_declaration_with_port(s: Span) -> IResult<Span, TaskBodyDeclara
)) ))
} }
#[trace]
pub fn tf_item_declaration(s: Span) -> IResult<Span, TfItemDeclaration> { pub fn tf_item_declaration(s: Span) -> IResult<Span, TfItemDeclaration> {
alt(( alt((
map(block_item_declaration, |x| { map(block_item_declaration, |x| {
@ -159,11 +164,13 @@ pub fn tf_item_declaration(s: Span) -> IResult<Span, TfItemDeclaration> {
))(s) ))(s)
} }
#[trace]
pub fn tf_port_list(s: Span) -> IResult<Span, TfPortList> { pub fn tf_port_list(s: Span) -> IResult<Span, TfPortList> {
let (s, a) = list(symbol(","), tf_port_item)(s)?; let (s, a) = list(symbol(","), tf_port_item)(s)?;
Ok((s, TfPortList { nodes: (a,) })) Ok((s, TfPortList { nodes: (a,) }))
} }
#[trace]
pub fn tf_port_item(s: Span) -> IResult<Span, TfPortItem> { pub fn tf_port_item(s: Span) -> IResult<Span, TfPortItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = opt(tf_port_direction)(s)?; let (s, b) = opt(tf_port_direction)(s)?;
@ -182,6 +189,7 @@ pub fn tf_port_item(s: Span) -> IResult<Span, TfPortItem> {
)) ))
} }
#[trace]
pub fn tf_port_direction(s: Span) -> IResult<Span, TfPortDirection> { pub fn tf_port_direction(s: Span) -> IResult<Span, TfPortDirection> {
alt(( alt((
map(port_direction, |x| TfPortDirection::PortDirection(x)), map(port_direction, |x| TfPortDirection::PortDirection(x)),
@ -191,6 +199,7 @@ pub fn tf_port_direction(s: Span) -> IResult<Span, TfPortDirection> {
))(s) ))(s)
} }
#[trace]
pub fn tf_port_declaration(s: Span) -> IResult<Span, TfPortDeclaration> { pub fn tf_port_declaration(s: Span) -> IResult<Span, TfPortDeclaration> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = tf_port_direction(s)?; let (s, b) = tf_port_direction(s)?;
@ -206,6 +215,7 @@ pub fn tf_port_declaration(s: Span) -> IResult<Span, TfPortDeclaration> {
)) ))
} }
#[trace]
pub fn task_prototype(s: Span) -> IResult<Span, TaskPrototype> { pub fn task_prototype(s: Span) -> IResult<Span, TaskPrototype> {
let (s, a) = symbol("task")(s)?; let (s, a) = symbol("task")(s)?;
let (s, b) = task_identifier(s)?; let (s, b) = task_identifier(s)?;

View File

@ -228,6 +228,7 @@ pub enum Lifetime<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn data_declaration(s: Span) -> IResult<Span, DataDeclaration> { pub fn data_declaration(s: Span) -> IResult<Span, DataDeclaration> {
alt(( alt((
data_declaration_variable, data_declaration_variable,
@ -241,6 +242,7 @@ pub fn data_declaration(s: Span) -> IResult<Span, DataDeclaration> {
))(s) ))(s)
} }
#[trace]
pub fn data_declaration_variable(s: Span) -> IResult<Span, DataDeclaration> { pub fn data_declaration_variable(s: Span) -> IResult<Span, DataDeclaration> {
let (s, a) = opt(r#const)(s)?; let (s, a) = opt(r#const)(s)?;
let (s, b) = opt(var)(s)?; let (s, b) = opt(var)(s)?;
@ -256,11 +258,13 @@ pub fn data_declaration_variable(s: Span) -> IResult<Span, DataDeclaration> {
)) ))
} }
#[trace]
pub fn r#const(s: Span) -> IResult<Span, Const> { pub fn r#const(s: Span) -> IResult<Span, Const> {
let (s, a) = symbol("const")(s)?; let (s, a) = symbol("const")(s)?;
Ok((s, Const { nodes: (a,) })) Ok((s, Const { nodes: (a,) }))
} }
#[trace]
pub fn package_import_declaration(s: Span) -> IResult<Span, PackageImportDeclaration> { pub fn package_import_declaration(s: Span) -> IResult<Span, PackageImportDeclaration> {
let (s, a) = symbol("import")(s)?; let (s, a) = symbol("import")(s)?;
let (s, b) = list(symbol(","), package_import_item)(s)?; let (s, b) = list(symbol(","), package_import_item)(s)?;
@ -268,10 +272,12 @@ pub fn package_import_declaration(s: Span) -> IResult<Span, PackageImportDeclara
Ok((s, PackageImportDeclaration { nodes: (a, b, c) })) Ok((s, PackageImportDeclaration { nodes: (a, b, c) }))
} }
#[trace]
pub fn package_import_item(s: Span) -> IResult<Span, PackageImportItem> { pub fn package_import_item(s: Span) -> IResult<Span, PackageImportItem> {
alt((package_import_item_identifier, package_import_item_asterisk))(s) alt((package_import_item_identifier, package_import_item_asterisk))(s)
} }
#[trace]
pub fn package_import_item_identifier(s: Span) -> IResult<Span, PackageImportItem> { pub fn package_import_item_identifier(s: Span) -> IResult<Span, PackageImportItem> {
let (s, a) = package_identifier(s)?; let (s, a) = package_identifier(s)?;
let (s, b) = symbol("::")(s)?; let (s, b) = symbol("::")(s)?;
@ -282,6 +288,7 @@ pub fn package_import_item_identifier(s: Span) -> IResult<Span, PackageImportIte
)) ))
} }
#[trace]
pub fn package_import_item_asterisk(s: Span) -> IResult<Span, PackageImportItem> { pub fn package_import_item_asterisk(s: Span) -> IResult<Span, PackageImportItem> {
let (s, a) = package_identifier(s)?; let (s, a) = package_identifier(s)?;
let (s, b) = symbol("::")(s)?; let (s, b) = symbol("::")(s)?;
@ -292,6 +299,7 @@ pub fn package_import_item_asterisk(s: Span) -> IResult<Span, PackageImportItem>
)) ))
} }
#[trace]
pub fn package_export_declaration(s: Span) -> IResult<Span, PackageExportDeclaration> { pub fn package_export_declaration(s: Span) -> IResult<Span, PackageExportDeclaration> {
alt(( alt((
package_export_declaration_asterisk, package_export_declaration_asterisk,
@ -299,6 +307,7 @@ pub fn package_export_declaration(s: Span) -> IResult<Span, PackageExportDeclara
))(s) ))(s)
} }
#[trace]
pub fn package_export_declaration_asterisk(s: Span) -> IResult<Span, PackageExportDeclaration> { pub fn package_export_declaration_asterisk(s: Span) -> IResult<Span, PackageExportDeclaration> {
let (s, a) = symbol("export")(s)?; let (s, a) = symbol("export")(s)?;
let (s, b) = symbol("*::*")(s)?; let (s, b) = symbol("*::*")(s)?;
@ -309,6 +318,7 @@ pub fn package_export_declaration_asterisk(s: Span) -> IResult<Span, PackageExpo
)) ))
} }
#[trace]
pub fn package_export_declaration_item(s: Span) -> IResult<Span, PackageExportDeclaration> { pub fn package_export_declaration_item(s: Span) -> IResult<Span, PackageExportDeclaration> {
let (s, a) = symbol("export")(s)?; let (s, a) = symbol("export")(s)?;
let (s, b) = list(symbol(","), package_import_item)(s)?; let (s, b) = list(symbol(","), package_import_item)(s)?;
@ -319,6 +329,7 @@ pub fn package_export_declaration_item(s: Span) -> IResult<Span, PackageExportDe
)) ))
} }
#[trace]
pub fn genvar_declaration(s: Span) -> IResult<Span, GenvarDeclaration> { pub fn genvar_declaration(s: Span) -> IResult<Span, GenvarDeclaration> {
let (s, a) = symbol("genvar")(s)?; let (s, a) = symbol("genvar")(s)?;
let (s, b) = list_of_genvar_identifiers(s)?; let (s, b) = list_of_genvar_identifiers(s)?;
@ -326,6 +337,7 @@ pub fn genvar_declaration(s: Span) -> IResult<Span, GenvarDeclaration> {
Ok((s, GenvarDeclaration { nodes: (a, b, c) })) Ok((s, GenvarDeclaration { nodes: (a, b, c) }))
} }
#[trace]
pub fn net_declaration(s: Span) -> IResult<Span, NetDeclaration> { pub fn net_declaration(s: Span) -> IResult<Span, NetDeclaration> {
alt(( alt((
net_declaration_net_type, net_declaration_net_type,
@ -334,6 +346,7 @@ pub fn net_declaration(s: Span) -> IResult<Span, NetDeclaration> {
))(s) ))(s)
} }
#[trace]
pub fn net_declaration_net_type(s: Span) -> IResult<Span, NetDeclaration> { pub fn net_declaration_net_type(s: Span) -> IResult<Span, NetDeclaration> {
let (s, a) = net_type(s)?; let (s, a) = net_type(s)?;
let (s, b) = opt(strength)(s)?; let (s, b) = opt(strength)(s)?;
@ -350,6 +363,7 @@ pub fn net_declaration_net_type(s: Span) -> IResult<Span, NetDeclaration> {
)) ))
} }
#[trace]
pub fn strength(s: Span) -> IResult<Span, Strength> { pub fn strength(s: Span) -> IResult<Span, Strength> {
alt(( alt((
map(drive_strength, |x| Strength::Drive(x)), map(drive_strength, |x| Strength::Drive(x)),
@ -357,6 +371,7 @@ pub fn strength(s: Span) -> IResult<Span, Strength> {
))(s) ))(s)
} }
#[trace]
pub fn vector_scalar(s: Span) -> IResult<Span, VectorScalar> { pub fn vector_scalar(s: Span) -> IResult<Span, VectorScalar> {
alt(( alt((
map(symbol("vectored"), |x| VectorScalar::Vectored(x)), map(symbol("vectored"), |x| VectorScalar::Vectored(x)),
@ -364,6 +379,7 @@ pub fn vector_scalar(s: Span) -> IResult<Span, VectorScalar> {
))(s) ))(s)
} }
#[trace]
pub fn net_declaration_net_type_identifier(s: Span) -> IResult<Span, NetDeclaration> { pub fn net_declaration_net_type_identifier(s: Span) -> IResult<Span, NetDeclaration> {
let (s, a) = net_type_identifier(s)?; let (s, a) = net_type_identifier(s)?;
let (s, b) = opt(delay_control)(s)?; let (s, b) = opt(delay_control)(s)?;
@ -377,6 +393,7 @@ pub fn net_declaration_net_type_identifier(s: Span) -> IResult<Span, NetDeclarat
)) ))
} }
#[trace]
pub fn net_declaration_interconnect(s: Span) -> IResult<Span, NetDeclaration> { pub fn net_declaration_interconnect(s: Span) -> IResult<Span, NetDeclaration> {
let (s, a) = symbol("interconnect")(s)?; let (s, a) = symbol("interconnect")(s)?;
let (s, b) = implicit_data_type(s)?; let (s, b) = implicit_data_type(s)?;
@ -397,6 +414,7 @@ pub fn net_declaration_interconnect(s: Span) -> IResult<Span, NetDeclaration> {
)) ))
} }
#[trace]
pub fn type_declaration(s: Span) -> IResult<Span, TypeDeclaration> { pub fn type_declaration(s: Span) -> IResult<Span, TypeDeclaration> {
alt(( alt((
type_declaration_data_type, type_declaration_data_type,
@ -405,6 +423,7 @@ pub fn type_declaration(s: Span) -> IResult<Span, TypeDeclaration> {
))(s) ))(s)
} }
#[trace]
pub fn type_declaration_data_type(s: Span) -> IResult<Span, TypeDeclaration> { pub fn type_declaration_data_type(s: Span) -> IResult<Span, TypeDeclaration> {
let (s, a) = symbol("typedef")(s)?; let (s, a) = symbol("typedef")(s)?;
let (s, b) = data_type(s)?; let (s, b) = data_type(s)?;
@ -419,6 +438,7 @@ pub fn type_declaration_data_type(s: Span) -> IResult<Span, TypeDeclaration> {
)) ))
} }
#[trace]
pub fn type_declaration_interface(s: Span) -> IResult<Span, TypeDeclaration> { pub fn type_declaration_interface(s: Span) -> IResult<Span, TypeDeclaration> {
let (s, a) = symbol("typedef")(s)?; let (s, a) = symbol("typedef")(s)?;
let (s, b) = interface_instance_identifier(s)?; let (s, b) = interface_instance_identifier(s)?;
@ -435,6 +455,7 @@ pub fn type_declaration_interface(s: Span) -> IResult<Span, TypeDeclaration> {
)) ))
} }
#[trace]
pub fn type_declaration_reserved(s: Span) -> IResult<Span, TypeDeclaration> { pub fn type_declaration_reserved(s: Span) -> IResult<Span, TypeDeclaration> {
let (s, a) = symbol("typedef")(s)?; let (s, a) = symbol("typedef")(s)?;
let (s, b) = type_declaration_keyword(s)?; let (s, b) = type_declaration_keyword(s)?;
@ -448,6 +469,7 @@ pub fn type_declaration_reserved(s: Span) -> IResult<Span, TypeDeclaration> {
)) ))
} }
#[trace]
pub fn type_declaration_keyword(s: Span) -> IResult<Span, TypeDeclarationKeyword> { pub fn type_declaration_keyword(s: Span) -> IResult<Span, TypeDeclarationKeyword> {
alt(( alt((
map(symbol("enum"), |x| TypeDeclarationKeyword::Enum(x)), map(symbol("enum"), |x| TypeDeclarationKeyword::Enum(x)),
@ -460,6 +482,7 @@ pub fn type_declaration_keyword(s: Span) -> IResult<Span, TypeDeclarationKeyword
))(s) ))(s)
} }
#[trace]
pub fn net_type_declaration(s: Span) -> IResult<Span, NetTypeDeclaration> { pub fn net_type_declaration(s: Span) -> IResult<Span, NetTypeDeclaration> {
alt(( alt((
net_type_declaration_data_type, net_type_declaration_data_type,
@ -467,6 +490,7 @@ pub fn net_type_declaration(s: Span) -> IResult<Span, NetTypeDeclaration> {
))(s) ))(s)
} }
#[trace]
pub fn net_type_declaration_data_type(s: Span) -> IResult<Span, NetTypeDeclaration> { pub fn net_type_declaration_data_type(s: Span) -> IResult<Span, NetTypeDeclaration> {
let (s, a) = symbol("nettype")(s)?; let (s, a) = symbol("nettype")(s)?;
let (s, b) = data_type(s)?; let (s, b) = data_type(s)?;
@ -485,6 +509,7 @@ pub fn net_type_declaration_data_type(s: Span) -> IResult<Span, NetTypeDeclarati
)) ))
} }
#[trace]
pub fn net_type_declaration_net_type(s: Span) -> IResult<Span, NetTypeDeclaration> { pub fn net_type_declaration_net_type(s: Span) -> IResult<Span, NetTypeDeclaration> {
let (s, a) = symbol("nettype")(s)?; let (s, a) = symbol("nettype")(s)?;
let (s, b) = opt(package_scope_or_class_scope)(s)?; let (s, b) = opt(package_scope_or_class_scope)(s)?;
@ -499,6 +524,7 @@ pub fn net_type_declaration_net_type(s: Span) -> IResult<Span, NetTypeDeclaratio
)) ))
} }
#[trace]
pub fn lifetime(s: Span) -> IResult<Span, Lifetime> { pub fn lifetime(s: Span) -> IResult<Span, Lifetime> {
alt(( alt((
map(symbol("static"), |x| Lifetime::Static(x)), map(symbol("static"), |x| Lifetime::Static(x)),

View File

@ -105,26 +105,31 @@ pub struct EmptyUnpackedArrayConcatenation<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn concatenation(s: Span) -> IResult<Span, Concatenation> { pub fn concatenation(s: Span) -> IResult<Span, Concatenation> {
let (s, a) = brace(list(symbol(","), expression))(s)?; let (s, a) = brace(list(symbol(","), expression))(s)?;
Ok((s, Concatenation { nodes: (a,) })) Ok((s, Concatenation { nodes: (a,) }))
} }
#[trace]
pub fn constant_concatenation(s: Span) -> IResult<Span, ConstantConcatenation> { pub fn constant_concatenation(s: Span) -> IResult<Span, ConstantConcatenation> {
let (s, a) = brace(list(symbol(","), constant_expression))(s)?; let (s, a) = brace(list(symbol(","), constant_expression))(s)?;
Ok((s, ConstantConcatenation { nodes: (a,) })) Ok((s, ConstantConcatenation { nodes: (a,) }))
} }
#[trace]
pub fn constant_multiple_concatenation(s: Span) -> IResult<Span, ConstantMultipleConcatenation> { pub fn constant_multiple_concatenation(s: Span) -> IResult<Span, ConstantMultipleConcatenation> {
let (s, a) = brace(pair(constant_expression, constant_concatenation))(s)?; let (s, a) = brace(pair(constant_expression, constant_concatenation))(s)?;
Ok((s, ConstantMultipleConcatenation { nodes: (a,) })) Ok((s, ConstantMultipleConcatenation { nodes: (a,) }))
} }
#[trace]
pub fn module_path_concatenation(s: Span) -> IResult<Span, ModulePathConcatenation> { pub fn module_path_concatenation(s: Span) -> IResult<Span, ModulePathConcatenation> {
let (s, a) = brace(list(symbol(","), module_path_expression))(s)?; let (s, a) = brace(list(symbol(","), module_path_expression))(s)?;
Ok((s, ModulePathConcatenation { nodes: (a,) })) Ok((s, ModulePathConcatenation { nodes: (a,) }))
} }
#[trace]
pub fn module_path_multiple_concatenation( pub fn module_path_multiple_concatenation(
s: Span, s: Span,
) -> IResult<Span, ModulePathMultipleConcatenation> { ) -> IResult<Span, ModulePathMultipleConcatenation> {
@ -132,11 +137,13 @@ pub fn module_path_multiple_concatenation(
Ok((s, ModulePathMultipleConcatenation { nodes: (a,) })) Ok((s, ModulePathMultipleConcatenation { nodes: (a,) }))
} }
#[trace]
pub fn multiple_concatenation(s: Span) -> IResult<Span, MultipleConcatenation> { pub fn multiple_concatenation(s: Span) -> IResult<Span, MultipleConcatenation> {
let (s, a) = brace(pair(expression, concatenation))(s)?; let (s, a) = brace(pair(expression, concatenation))(s)?;
Ok((s, MultipleConcatenation { nodes: (a,) })) Ok((s, MultipleConcatenation { nodes: (a,) }))
} }
#[trace]
pub fn streaming_concatenation(s: Span) -> IResult<Span, StreamingConcatenation> { pub fn streaming_concatenation(s: Span) -> IResult<Span, StreamingConcatenation> {
let (s, a) = brace(triple( let (s, a) = brace(triple(
stream_operator, stream_operator,
@ -146,6 +153,7 @@ pub fn streaming_concatenation(s: Span) -> IResult<Span, StreamingConcatenation>
Ok((s, StreamingConcatenation { nodes: (a,) })) Ok((s, StreamingConcatenation { nodes: (a,) }))
} }
#[trace]
pub fn stream_operator(s: Span) -> IResult<Span, StreamOperator> { pub fn stream_operator(s: Span) -> IResult<Span, StreamOperator> {
alt(( alt((
map(symbol(">>"), |x| StreamOperator { nodes: (x,) }), map(symbol(">>"), |x| StreamOperator { nodes: (x,) }),
@ -153,6 +161,7 @@ pub fn stream_operator(s: Span) -> IResult<Span, StreamOperator> {
))(s) ))(s)
} }
#[trace]
pub fn slice_size(s: Span) -> IResult<Span, SliceSize> { pub fn slice_size(s: Span) -> IResult<Span, SliceSize> {
alt(( alt((
map(simple_type, |x| SliceSize::SimpleType(x)), map(simple_type, |x| SliceSize::SimpleType(x)),
@ -160,17 +169,20 @@ pub fn slice_size(s: Span) -> IResult<Span, SliceSize> {
))(s) ))(s)
} }
#[trace]
pub fn stream_concatenation(s: Span) -> IResult<Span, StreamConcatenation> { pub fn stream_concatenation(s: Span) -> IResult<Span, StreamConcatenation> {
let (s, a) = brace(list(symbol(","), stream_expression))(s)?; let (s, a) = brace(list(symbol(","), stream_expression))(s)?;
Ok((s, StreamConcatenation { nodes: (a,) })) Ok((s, StreamConcatenation { nodes: (a,) }))
} }
#[trace]
pub fn stream_expression(s: Span) -> IResult<Span, StreamExpression> { pub fn stream_expression(s: Span) -> IResult<Span, StreamExpression> {
let (s, a) = expression(s)?; let (s, a) = expression(s)?;
let (s, b) = opt(pair(symbol("with"), bracket(array_range_expression)))(s)?; let (s, b) = opt(pair(symbol("with"), bracket(array_range_expression)))(s)?;
Ok((s, StreamExpression { nodes: (a, b) })) Ok((s, StreamExpression { nodes: (a, b) }))
} }
#[trace]
pub fn array_range_expression(s: Span) -> IResult<Span, ArrayRangeExpression> { pub fn array_range_expression(s: Span) -> IResult<Span, ArrayRangeExpression> {
alt(( alt((
map(expression, |x| ArrayRangeExpression::Expression(x)), map(expression, |x| ArrayRangeExpression::Expression(x)),
@ -180,6 +192,7 @@ pub fn array_range_expression(s: Span) -> IResult<Span, ArrayRangeExpression> {
))(s) ))(s)
} }
#[trace]
pub fn array_range_expression_colon(s: Span) -> IResult<Span, ArrayRangeExpression> { pub fn array_range_expression_colon(s: Span) -> IResult<Span, ArrayRangeExpression> {
let (s, a) = expression(s)?; let (s, a) = expression(s)?;
let (s, b) = symbol(":")(s)?; let (s, b) = symbol(":")(s)?;
@ -190,6 +203,7 @@ pub fn array_range_expression_colon(s: Span) -> IResult<Span, ArrayRangeExpressi
)) ))
} }
#[trace]
pub fn array_range_expression_plus_colon(s: Span) -> IResult<Span, ArrayRangeExpression> { pub fn array_range_expression_plus_colon(s: Span) -> IResult<Span, ArrayRangeExpression> {
let (s, a) = expression(s)?; let (s, a) = expression(s)?;
let (s, b) = symbol("+:")(s)?; let (s, b) = symbol("+:")(s)?;
@ -200,6 +214,7 @@ pub fn array_range_expression_plus_colon(s: Span) -> IResult<Span, ArrayRangeExp
)) ))
} }
#[trace]
pub fn array_range_expression_minus_colon(s: Span) -> IResult<Span, ArrayRangeExpression> { pub fn array_range_expression_minus_colon(s: Span) -> IResult<Span, ArrayRangeExpression> {
let (s, a) = expression(s)?; let (s, a) = expression(s)?;
let (s, b) = symbol("-:")(s)?; let (s, b) = symbol("-:")(s)?;
@ -210,6 +225,7 @@ pub fn array_range_expression_minus_colon(s: Span) -> IResult<Span, ArrayRangeEx
)) ))
} }
#[trace]
pub fn empty_unpacked_array_concatenation( pub fn empty_unpacked_array_concatenation(
s: Span, s: Span,
) -> IResult<Span, EmptyUnpackedArrayConcatenation> { ) -> IResult<Span, EmptyUnpackedArrayConcatenation> {

View File

@ -72,10 +72,12 @@ pub struct NonrangeVariableLvalue<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn net_lvalue(s: Span) -> IResult<Span, NetLvalue> { pub fn net_lvalue(s: Span) -> IResult<Span, NetLvalue> {
alt((net_lvalue_identifier, net_lvalue_lvalue, net_lvalue_pattern))(s) alt((net_lvalue_identifier, net_lvalue_lvalue, net_lvalue_pattern))(s)
} }
#[trace]
pub fn net_lvalue_identifier(s: Span) -> IResult<Span, NetLvalue> { pub fn net_lvalue_identifier(s: Span) -> IResult<Span, NetLvalue> {
let (s, a) = ps_or_hierarchical_net_identifier(s)?; let (s, a) = ps_or_hierarchical_net_identifier(s)?;
let (s, b) = constant_select(s)?; let (s, b) = constant_select(s)?;
@ -85,6 +87,7 @@ pub fn net_lvalue_identifier(s: Span) -> IResult<Span, NetLvalue> {
)) ))
} }
#[trace]
pub fn net_lvalue_pattern(s: Span) -> IResult<Span, NetLvalue> { pub fn net_lvalue_pattern(s: Span) -> IResult<Span, NetLvalue> {
let (s, a) = opt(assignment_pattern_expression_type)(s)?; let (s, a) = opt(assignment_pattern_expression_type)(s)?;
let (s, b) = assignment_pattern_net_lvalue(s)?; let (s, b) = assignment_pattern_net_lvalue(s)?;
@ -94,6 +97,7 @@ pub fn net_lvalue_pattern(s: Span) -> IResult<Span, NetLvalue> {
)) ))
} }
#[trace]
pub fn net_lvalue_lvalue(s: Span) -> IResult<Span, NetLvalue> { pub fn net_lvalue_lvalue(s: Span) -> IResult<Span, NetLvalue> {
let (s, a) = brace(list(symbol(","), net_lvalue))(s)?; let (s, a) = brace(list(symbol(","), net_lvalue))(s)?;
Ok(( Ok((
@ -102,6 +106,7 @@ pub fn net_lvalue_lvalue(s: Span) -> IResult<Span, NetLvalue> {
)) ))
} }
#[trace]
pub fn variable_lvalue(s: Span) -> IResult<Span, VariableLvalue> { pub fn variable_lvalue(s: Span) -> IResult<Span, VariableLvalue> {
alt(( alt((
variable_lvalue_identifier, variable_lvalue_identifier,
@ -113,6 +118,7 @@ pub fn variable_lvalue(s: Span) -> IResult<Span, VariableLvalue> {
))(s) ))(s)
} }
#[trace]
pub fn variable_lvalue_identifier(s: Span) -> IResult<Span, VariableLvalue> { pub fn variable_lvalue_identifier(s: Span) -> IResult<Span, VariableLvalue> {
let (s, a) = opt(implicit_class_handle_or_package_scope)(s)?; let (s, a) = opt(implicit_class_handle_or_package_scope)(s)?;
let (s, b) = hierarchical_variable_identifier(s)?; let (s, b) = hierarchical_variable_identifier(s)?;
@ -123,6 +129,7 @@ pub fn variable_lvalue_identifier(s: Span) -> IResult<Span, VariableLvalue> {
)) ))
} }
#[trace]
pub fn variable_lvalue_pattern(s: Span) -> IResult<Span, VariableLvalue> { pub fn variable_lvalue_pattern(s: Span) -> IResult<Span, VariableLvalue> {
let (s, a) = opt(assignment_pattern_expression_type)(s)?; let (s, a) = opt(assignment_pattern_expression_type)(s)?;
let (s, b) = assignment_pattern_variable_lvalue(s)?; let (s, b) = assignment_pattern_variable_lvalue(s)?;
@ -132,6 +139,7 @@ pub fn variable_lvalue_pattern(s: Span) -> IResult<Span, VariableLvalue> {
)) ))
} }
#[trace]
pub fn variable_lvalue_lvalue(s: Span) -> IResult<Span, VariableLvalue> { pub fn variable_lvalue_lvalue(s: Span) -> IResult<Span, VariableLvalue> {
let (s, a) = brace(list(symbol(","), variable_lvalue))(s)?; let (s, a) = brace(list(symbol(","), variable_lvalue))(s)?;
Ok(( Ok((
@ -140,6 +148,7 @@ pub fn variable_lvalue_lvalue(s: Span) -> IResult<Span, VariableLvalue> {
)) ))
} }
#[trace]
pub fn nonrange_variable_lvalue(s: Span) -> IResult<Span, NonrangeVariableLvalue> { pub fn nonrange_variable_lvalue(s: Span) -> IResult<Span, NonrangeVariableLvalue> {
let (s, a) = opt(implicit_class_handle_or_package_scope)(s)?; let (s, a) = opt(implicit_class_handle_or_package_scope)(s)?;
let (s, b) = hierarchical_variable_identifier(s)?; let (s, b) = hierarchical_variable_identifier(s)?;

View File

@ -279,10 +279,12 @@ pub struct GenvarExpression<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn inc_or_dec_expression(s: Span) -> IResult<Span, IncOrDecExpression> { pub fn inc_or_dec_expression(s: Span) -> IResult<Span, IncOrDecExpression> {
alt((inc_or_dec_expression_prefix, inc_or_dec_expression_suffix))(s) alt((inc_or_dec_expression_prefix, inc_or_dec_expression_suffix))(s)
} }
#[trace]
pub fn inc_or_dec_expression_prefix(s: Span) -> IResult<Span, IncOrDecExpression> { pub fn inc_or_dec_expression_prefix(s: Span) -> IResult<Span, IncOrDecExpression> {
let (s, a) = inc_or_dec_operator(s)?; let (s, a) = inc_or_dec_operator(s)?;
let (s, b) = many0(attribute_instance)(s)?; let (s, b) = many0(attribute_instance)(s)?;
@ -293,6 +295,7 @@ pub fn inc_or_dec_expression_prefix(s: Span) -> IResult<Span, IncOrDecExpression
)) ))
} }
#[trace]
pub fn inc_or_dec_expression_suffix(s: Span) -> IResult<Span, IncOrDecExpression> { pub fn inc_or_dec_expression_suffix(s: Span) -> IResult<Span, IncOrDecExpression> {
let (s, a) = variable_lvalue(s)?; let (s, a) = variable_lvalue(s)?;
let (s, b) = many0(attribute_instance)(s)?; let (s, b) = many0(attribute_instance)(s)?;
@ -303,6 +306,7 @@ pub fn inc_or_dec_expression_suffix(s: Span) -> IResult<Span, IncOrDecExpression
)) ))
} }
#[trace]
pub fn conditional_expression(s: Span) -> IResult<Span, ConditionalExpression> { pub fn conditional_expression(s: Span) -> IResult<Span, ConditionalExpression> {
let (s, a) = cond_predicate(s)?; let (s, a) = cond_predicate(s)?;
let (s, b) = symbol("?")(s)?; let (s, b) = symbol("?")(s)?;
@ -318,6 +322,7 @@ pub fn conditional_expression(s: Span) -> IResult<Span, ConditionalExpression> {
)) ))
} }
#[trace]
pub fn constant_expression(s: Span) -> IResult<Span, ConstantExpression> { pub fn constant_expression(s: Span) -> IResult<Span, ConstantExpression> {
alt(( alt((
map(constant_primary, |x| { map(constant_primary, |x| {
@ -329,6 +334,7 @@ pub fn constant_expression(s: Span) -> IResult<Span, ConstantExpression> {
))(s) ))(s)
} }
#[trace]
pub fn constant_expression_unary(s: Span) -> IResult<Span, ConstantExpression> { pub fn constant_expression_unary(s: Span) -> IResult<Span, ConstantExpression> {
let (s, a) = unary_operator(s)?; let (s, a) = unary_operator(s)?;
let (s, b) = many0(attribute_instance)(s)?; let (s, b) = many0(attribute_instance)(s)?;
@ -339,6 +345,7 @@ pub fn constant_expression_unary(s: Span) -> IResult<Span, ConstantExpression> {
)) ))
} }
#[trace]
pub fn constant_expression_binary(s: Span) -> IResult<Span, ConstantExpression> { pub fn constant_expression_binary(s: Span) -> IResult<Span, ConstantExpression> {
let (s, a) = constant_expression(s)?; let (s, a) = constant_expression(s)?;
let (s, b) = binary_operator(s)?; let (s, b) = binary_operator(s)?;
@ -352,6 +359,7 @@ pub fn constant_expression_binary(s: Span) -> IResult<Span, ConstantExpression>
)) ))
} }
#[trace]
pub fn constant_expression_ternary(s: Span) -> IResult<Span, ConstantExpression> { pub fn constant_expression_ternary(s: Span) -> IResult<Span, ConstantExpression> {
let (s, a) = constant_expression(s)?; let (s, a) = constant_expression(s)?;
let (s, b) = symbol("?")(s)?; let (s, b) = symbol("?")(s)?;
@ -367,6 +375,7 @@ pub fn constant_expression_ternary(s: Span) -> IResult<Span, ConstantExpression>
)) ))
} }
#[trace]
pub fn constant_mintypmax_expression(s: Span) -> IResult<Span, ConstantMintypmaxExpression> { pub fn constant_mintypmax_expression(s: Span) -> IResult<Span, ConstantMintypmaxExpression> {
alt(( alt((
constant_mintypmax_expression_ternary, constant_mintypmax_expression_ternary,
@ -376,6 +385,7 @@ pub fn constant_mintypmax_expression(s: Span) -> IResult<Span, ConstantMintypmax
))(s) ))(s)
} }
#[trace]
pub fn constant_mintypmax_expression_ternary( pub fn constant_mintypmax_expression_ternary(
s: Span, s: Span,
) -> IResult<Span, ConstantMintypmaxExpression> { ) -> IResult<Span, ConstantMintypmaxExpression> {
@ -392,6 +402,7 @@ pub fn constant_mintypmax_expression_ternary(
)) ))
} }
#[trace]
pub fn constant_param_expression(s: Span) -> IResult<Span, ConstantParamExpression> { pub fn constant_param_expression(s: Span) -> IResult<Span, ConstantParamExpression> {
alt(( alt((
map(symbol("$"), |x| ConstantParamExpression::Dollar(x)), map(symbol("$"), |x| ConstantParamExpression::Dollar(x)),
@ -402,6 +413,7 @@ pub fn constant_param_expression(s: Span) -> IResult<Span, ConstantParamExpressi
))(s) ))(s)
} }
#[trace]
pub fn param_expression(s: Span) -> IResult<Span, ParamExpression> { pub fn param_expression(s: Span) -> IResult<Span, ParamExpression> {
alt(( alt((
map(symbol("$"), |x| ParamExpression::Dollar(x)), map(symbol("$"), |x| ParamExpression::Dollar(x)),
@ -412,6 +424,7 @@ pub fn param_expression(s: Span) -> IResult<Span, ParamExpression> {
))(s) ))(s)
} }
#[trace]
pub fn constant_range_expression(s: Span) -> IResult<Span, ConstantRangeExpression> { pub fn constant_range_expression(s: Span) -> IResult<Span, ConstantRangeExpression> {
alt(( alt((
map(constant_part_select_range, |x| { map(constant_part_select_range, |x| {
@ -423,6 +436,7 @@ pub fn constant_range_expression(s: Span) -> IResult<Span, ConstantRangeExpressi
))(s) ))(s)
} }
#[trace]
pub fn constant_part_select_range(s: Span) -> IResult<Span, ConstantPartSelectRange> { pub fn constant_part_select_range(s: Span) -> IResult<Span, ConstantPartSelectRange> {
alt(( alt((
map(constant_range, |x| { map(constant_range, |x| {
@ -434,6 +448,7 @@ pub fn constant_part_select_range(s: Span) -> IResult<Span, ConstantPartSelectRa
))(s) ))(s)
} }
#[trace]
pub fn constant_range(s: Span) -> IResult<Span, ConstantRange> { pub fn constant_range(s: Span) -> IResult<Span, ConstantRange> {
let (s, a) = constant_expression(s)?; let (s, a) = constant_expression(s)?;
let (s, b) = symbol(":")(s)?; let (s, b) = symbol(":")(s)?;
@ -441,6 +456,7 @@ pub fn constant_range(s: Span) -> IResult<Span, ConstantRange> {
Ok((s, ConstantRange { nodes: (a, b, c) })) Ok((s, ConstantRange { nodes: (a, b, c) }))
} }
#[trace]
pub fn constant_indexed_range(s: Span) -> IResult<Span, ConstantIndexedRange> { pub fn constant_indexed_range(s: Span) -> IResult<Span, ConstantIndexedRange> {
let (s, a) = constant_expression(s)?; let (s, a) = constant_expression(s)?;
let (s, b) = alt((symbol("+:"), symbol("-:")))(s)?; let (s, b) = alt((symbol("+:"), symbol("-:")))(s)?;
@ -448,6 +464,7 @@ pub fn constant_indexed_range(s: Span) -> IResult<Span, ConstantIndexedRange> {
Ok((s, ConstantIndexedRange { nodes: (a, b, c) })) Ok((s, ConstantIndexedRange { nodes: (a, b, c) }))
} }
#[trace]
pub fn expression(s: Span) -> IResult<Span, Expression> { pub fn expression(s: Span) -> IResult<Span, Expression> {
alt(( alt((
map(primary, |x| Expression::Primary(Box::new(x))), map(primary, |x| Expression::Primary(Box::new(x))),
@ -469,6 +486,7 @@ pub fn expression(s: Span) -> IResult<Span, Expression> {
))(s) ))(s)
} }
#[trace]
pub fn expression_unary(s: Span) -> IResult<Span, Expression> { pub fn expression_unary(s: Span) -> IResult<Span, Expression> {
let (s, x) = unary_operator(s)?; let (s, x) = unary_operator(s)?;
let (s, y) = many0(attribute_instance)(s)?; let (s, y) = many0(attribute_instance)(s)?;
@ -479,6 +497,7 @@ pub fn expression_unary(s: Span) -> IResult<Span, Expression> {
)) ))
} }
#[trace]
pub fn expression_operator_assignment(s: Span) -> IResult<Span, Expression> { pub fn expression_operator_assignment(s: Span) -> IResult<Span, Expression> {
let (s, a) = paren(operator_assignment)(s)?; let (s, a) = paren(operator_assignment)(s)?;
Ok(( Ok((
@ -487,6 +506,7 @@ pub fn expression_operator_assignment(s: Span) -> IResult<Span, Expression> {
)) ))
} }
#[trace]
pub fn expression_binary(s: Span) -> IResult<Span, Expression> { pub fn expression_binary(s: Span) -> IResult<Span, Expression> {
let (s, a) = expression(s)?; let (s, a) = expression(s)?;
let (s, b) = binary_operator(s)?; let (s, b) = binary_operator(s)?;
@ -500,6 +520,7 @@ pub fn expression_binary(s: Span) -> IResult<Span, Expression> {
)) ))
} }
#[trace]
pub fn tagged_union_expression(s: Span) -> IResult<Span, TaggedUnionExpression> { pub fn tagged_union_expression(s: Span) -> IResult<Span, TaggedUnionExpression> {
let (s, a) = symbol("tagged")(s)?; let (s, a) = symbol("tagged")(s)?;
let (s, b) = member_identifier(s)?; let (s, b) = member_identifier(s)?;
@ -507,6 +528,7 @@ pub fn tagged_union_expression(s: Span) -> IResult<Span, TaggedUnionExpression>
Ok((s, TaggedUnionExpression { nodes: (a, b, c) })) Ok((s, TaggedUnionExpression { nodes: (a, b, c) }))
} }
#[trace]
pub fn inside_expression(s: Span) -> IResult<Span, InsideExpression> { pub fn inside_expression(s: Span) -> IResult<Span, InsideExpression> {
let (s, a) = expression(s)?; let (s, a) = expression(s)?;
let (s, b) = symbol("inside")(s)?; let (s, b) = symbol("inside")(s)?;
@ -514,6 +536,7 @@ pub fn inside_expression(s: Span) -> IResult<Span, InsideExpression> {
Ok((s, InsideExpression { nodes: (a, b, c) })) Ok((s, InsideExpression { nodes: (a, b, c) }))
} }
#[trace]
pub fn value_range(s: Span) -> IResult<Span, ValueRange> { pub fn value_range(s: Span) -> IResult<Span, ValueRange> {
alt(( alt((
value_range_binary, value_range_binary,
@ -521,11 +544,13 @@ pub fn value_range(s: Span) -> IResult<Span, ValueRange> {
))(s) ))(s)
} }
#[trace]
pub fn value_range_binary(s: Span) -> IResult<Span, ValueRange> { pub fn value_range_binary(s: Span) -> IResult<Span, ValueRange> {
let (s, a) = bracket(triple(expression, symbol(":"), expression))(s)?; let (s, a) = bracket(triple(expression, symbol(":"), expression))(s)?;
Ok((s, ValueRange::Binary(ValueRangeBinary { nodes: (a,) }))) Ok((s, ValueRange::Binary(ValueRangeBinary { nodes: (a,) })))
} }
#[trace]
pub fn mintypmax_expression(s: Span) -> IResult<Span, MintypmaxExpression> { pub fn mintypmax_expression(s: Span) -> IResult<Span, MintypmaxExpression> {
alt(( alt((
mintypmax_expression_ternary, mintypmax_expression_ternary,
@ -533,6 +558,7 @@ pub fn mintypmax_expression(s: Span) -> IResult<Span, MintypmaxExpression> {
))(s) ))(s)
} }
#[trace]
pub fn mintypmax_expression_ternary(s: Span) -> IResult<Span, MintypmaxExpression> { pub fn mintypmax_expression_ternary(s: Span) -> IResult<Span, MintypmaxExpression> {
let (s, a) = expression(s)?; let (s, a) = expression(s)?;
let (s, b) = symbol(":")(s)?; let (s, b) = symbol(":")(s)?;
@ -547,6 +573,7 @@ pub fn mintypmax_expression_ternary(s: Span) -> IResult<Span, MintypmaxExpressio
)) ))
} }
#[trace]
pub fn module_path_conditional_expression( pub fn module_path_conditional_expression(
s: Span, s: Span,
) -> IResult<Span, ModulePathConditionalExpression> { ) -> IResult<Span, ModulePathConditionalExpression> {
@ -564,6 +591,7 @@ pub fn module_path_conditional_expression(
)) ))
} }
#[trace]
pub fn module_path_expression(s: Span) -> IResult<Span, ModulePathExpression> { pub fn module_path_expression(s: Span) -> IResult<Span, ModulePathExpression> {
alt(( alt((
map(module_path_primary, |x| { map(module_path_primary, |x| {
@ -577,6 +605,7 @@ pub fn module_path_expression(s: Span) -> IResult<Span, ModulePathExpression> {
))(s) ))(s)
} }
#[trace]
pub fn module_path_expression_unary(s: Span) -> IResult<Span, ModulePathExpression> { pub fn module_path_expression_unary(s: Span) -> IResult<Span, ModulePathExpression> {
let (s, a) = unary_module_path_operator(s)?; let (s, a) = unary_module_path_operator(s)?;
let (s, b) = many0(attribute_instance)(s)?; let (s, b) = many0(attribute_instance)(s)?;
@ -587,6 +616,7 @@ pub fn module_path_expression_unary(s: Span) -> IResult<Span, ModulePathExpressi
)) ))
} }
#[trace]
pub fn module_path_expression_binary(s: Span) -> IResult<Span, ModulePathExpression> { pub fn module_path_expression_binary(s: Span) -> IResult<Span, ModulePathExpression> {
let (s, a) = module_path_expression(s)?; let (s, a) = module_path_expression(s)?;
let (s, b) = binary_module_path_operator(s)?; let (s, b) = binary_module_path_operator(s)?;
@ -600,6 +630,7 @@ pub fn module_path_expression_binary(s: Span) -> IResult<Span, ModulePathExpress
)) ))
} }
#[trace]
pub fn module_path_mintypmax_expression(s: Span) -> IResult<Span, ModulePathMintypmaxExpression> { pub fn module_path_mintypmax_expression(s: Span) -> IResult<Span, ModulePathMintypmaxExpression> {
alt(( alt((
module_path_mintypmax_expression_ternary, module_path_mintypmax_expression_ternary,
@ -609,6 +640,7 @@ pub fn module_path_mintypmax_expression(s: Span) -> IResult<Span, ModulePathMint
))(s) ))(s)
} }
#[trace]
pub fn module_path_mintypmax_expression_ternary( pub fn module_path_mintypmax_expression_ternary(
s: Span, s: Span,
) -> IResult<Span, ModulePathMintypmaxExpression> { ) -> IResult<Span, ModulePathMintypmaxExpression> {
@ -625,6 +657,7 @@ pub fn module_path_mintypmax_expression_ternary(
)) ))
} }
#[trace]
pub fn part_select_range(s: Span) -> IResult<Span, PartSelectRange> { pub fn part_select_range(s: Span) -> IResult<Span, PartSelectRange> {
alt(( alt((
map(constant_range, |x| PartSelectRange::ConstantRange(x)), map(constant_range, |x| PartSelectRange::ConstantRange(x)),
@ -632,6 +665,7 @@ pub fn part_select_range(s: Span) -> IResult<Span, PartSelectRange> {
))(s) ))(s)
} }
#[trace]
pub fn indexed_range(s: Span) -> IResult<Span, IndexedRange> { pub fn indexed_range(s: Span) -> IResult<Span, IndexedRange> {
let (s, a) = expression(s)?; let (s, a) = expression(s)?;
let (s, b) = alt((symbol("+:"), symbol("-:")))(s)?; let (s, b) = alt((symbol("+:"), symbol("-:")))(s)?;
@ -639,6 +673,7 @@ pub fn indexed_range(s: Span) -> IResult<Span, IndexedRange> {
Ok((s, IndexedRange { nodes: (a, b, c) })) Ok((s, IndexedRange { nodes: (a, b, c) }))
} }
#[trace]
pub fn genvar_expression(s: Span) -> IResult<Span, GenvarExpression> { pub fn genvar_expression(s: Span) -> IResult<Span, GenvarExpression> {
let (s, a) = constant_expression(s)?; let (s, a) = constant_expression(s)?;
Ok((s, GenvarExpression { nodes: (a,) })) Ok((s, GenvarExpression { nodes: (a,) }))

View File

@ -162,6 +162,7 @@ pub struct UnbasedUnsizedLiteral<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn number(s: Span) -> IResult<Span, Number> { pub fn number(s: Span) -> IResult<Span, Number> {
alt(( alt((
map(real_number, |x| Number::RealNumber(x)), map(real_number, |x| Number::RealNumber(x)),
@ -169,6 +170,7 @@ pub fn number(s: Span) -> IResult<Span, Number> {
))(s) ))(s)
} }
#[trace]
pub fn integral_number(s: Span) -> IResult<Span, IntegralNumber> { pub fn integral_number(s: Span) -> IResult<Span, IntegralNumber> {
alt(( alt((
map(octal_number, |x| IntegralNumber::OctalNumber(x)), map(octal_number, |x| IntegralNumber::OctalNumber(x)),
@ -178,6 +180,7 @@ pub fn integral_number(s: Span) -> IResult<Span, IntegralNumber> {
))(s) ))(s)
} }
#[trace]
pub fn decimal_number(s: Span) -> IResult<Span, DecimalNumber> { pub fn decimal_number(s: Span) -> IResult<Span, DecimalNumber> {
alt(( alt((
decimal_number_base_unsigned, decimal_number_base_unsigned,
@ -187,6 +190,7 @@ pub fn decimal_number(s: Span) -> IResult<Span, DecimalNumber> {
))(s) ))(s)
} }
#[trace]
pub fn decimal_number_base_unsigned(s: Span) -> IResult<Span, DecimalNumber> { pub fn decimal_number_base_unsigned(s: Span) -> IResult<Span, DecimalNumber> {
let (s, a) = opt(size)(s)?; let (s, a) = opt(size)(s)?;
let (s, b) = decimal_base(s)?; let (s, b) = decimal_base(s)?;
@ -197,6 +201,7 @@ pub fn decimal_number_base_unsigned(s: Span) -> IResult<Span, DecimalNumber> {
)) ))
} }
#[trace]
pub fn decimal_number_base_x_number(s: Span) -> IResult<Span, DecimalNumber> { pub fn decimal_number_base_x_number(s: Span) -> IResult<Span, DecimalNumber> {
let (s, a) = opt(size)(s)?; let (s, a) = opt(size)(s)?;
let (s, b) = decimal_base(s)?; let (s, b) = decimal_base(s)?;
@ -207,6 +212,7 @@ pub fn decimal_number_base_x_number(s: Span) -> IResult<Span, DecimalNumber> {
)) ))
} }
#[trace]
pub fn decimal_number_base_z_number(s: Span) -> IResult<Span, DecimalNumber> { pub fn decimal_number_base_z_number(s: Span) -> IResult<Span, DecimalNumber> {
let (s, a) = opt(size)(s)?; let (s, a) = opt(size)(s)?;
let (s, b) = decimal_base(s)?; let (s, b) = decimal_base(s)?;
@ -217,6 +223,7 @@ pub fn decimal_number_base_z_number(s: Span) -> IResult<Span, DecimalNumber> {
)) ))
} }
#[trace]
pub fn binary_number(s: Span) -> IResult<Span, BinaryNumber> { pub fn binary_number(s: Span) -> IResult<Span, BinaryNumber> {
let (s, a) = opt(size)(s)?; let (s, a) = opt(size)(s)?;
let (s, b) = binary_base(s)?; let (s, b) = binary_base(s)?;
@ -224,6 +231,7 @@ pub fn binary_number(s: Span) -> IResult<Span, BinaryNumber> {
Ok((s, BinaryNumber { nodes: (a, b, c) })) Ok((s, BinaryNumber { nodes: (a, b, c) }))
} }
#[trace]
pub fn octal_number(s: Span) -> IResult<Span, OctalNumber> { pub fn octal_number(s: Span) -> IResult<Span, OctalNumber> {
let (s, a) = opt(size)(s)?; let (s, a) = opt(size)(s)?;
let (s, b) = octal_base(s)?; let (s, b) = octal_base(s)?;
@ -231,6 +239,7 @@ pub fn octal_number(s: Span) -> IResult<Span, OctalNumber> {
Ok((s, OctalNumber { nodes: (a, b, c) })) Ok((s, OctalNumber { nodes: (a, b, c) }))
} }
#[trace]
pub fn hex_number(s: Span) -> IResult<Span, HexNumber> { pub fn hex_number(s: Span) -> IResult<Span, HexNumber> {
let (s, a) = opt(size)(s)?; let (s, a) = opt(size)(s)?;
let (s, b) = hex_base(s)?; let (s, b) = hex_base(s)?;
@ -238,6 +247,7 @@ pub fn hex_number(s: Span) -> IResult<Span, HexNumber> {
Ok((s, HexNumber { nodes: (a, b, c) })) Ok((s, HexNumber { nodes: (a, b, c) }))
} }
#[trace]
pub fn sign(s: Span) -> IResult<Span, Sign> { pub fn sign(s: Span) -> IResult<Span, Sign> {
alt(( alt((
map(symbol("+"), |x| Sign::Plus(x)), map(symbol("+"), |x| Sign::Plus(x)),
@ -245,16 +255,19 @@ pub fn sign(s: Span) -> IResult<Span, Sign> {
))(s) ))(s)
} }
#[trace]
pub fn size(s: Span) -> IResult<Span, Size> { pub fn size(s: Span) -> IResult<Span, Size> {
let (s, a) = non_zero_unsigned_number(s)?; let (s, a) = non_zero_unsigned_number(s)?;
Ok((s, Size { nodes: (a,) })) Ok((s, Size { nodes: (a,) }))
} }
#[trace]
pub fn non_zero_unsigned_number(s: Span) -> IResult<Span, NonZeroUnsignedNumber> { pub fn non_zero_unsigned_number(s: Span) -> IResult<Span, NonZeroUnsignedNumber> {
let (s, a) = ws(non_zero_unsigned_number_impl)(s)?; let (s, a) = ws(non_zero_unsigned_number_impl)(s)?;
Ok((s, NonZeroUnsignedNumber { nodes: a })) Ok((s, NonZeroUnsignedNumber { nodes: a }))
} }
#[trace]
pub fn non_zero_unsigned_number_impl(s: Span) -> IResult<Span, Span> { pub fn non_zero_unsigned_number_impl(s: Span) -> IResult<Span, Span> {
let (s, a) = is_a("123456789")(s)?; let (s, a) = is_a("123456789")(s)?;
fold_many0(alt((tag("_"), digit1)), a, |acc, item| { fold_many0(alt((tag("_"), digit1)), a, |acc, item| {
@ -262,6 +275,7 @@ pub fn non_zero_unsigned_number_impl(s: Span) -> IResult<Span, Span> {
})(s) })(s)
} }
#[trace]
pub fn real_number(s: Span) -> IResult<Span, RealNumber> { pub fn real_number(s: Span) -> IResult<Span, RealNumber> {
alt(( alt((
real_number_floating, real_number_floating,
@ -269,6 +283,7 @@ pub fn real_number(s: Span) -> IResult<Span, RealNumber> {
))(s) ))(s)
} }
#[trace]
pub fn real_number_floating(s: Span) -> IResult<Span, RealNumber> { pub fn real_number_floating(s: Span) -> IResult<Span, RealNumber> {
let (s, a) = unsigned_number(s)?; let (s, a) = unsigned_number(s)?;
let (s, b) = opt(pair(symbol("."), unsigned_number))(s)?; let (s, b) = opt(pair(symbol("."), unsigned_number))(s)?;
@ -283,6 +298,7 @@ pub fn real_number_floating(s: Span) -> IResult<Span, RealNumber> {
)) ))
} }
#[trace]
pub fn fixed_point_number(s: Span) -> IResult<Span, FixedPointNumber> { pub fn fixed_point_number(s: Span) -> IResult<Span, FixedPointNumber> {
let (s, a) = unsigned_number(s)?; let (s, a) = unsigned_number(s)?;
let (s, b) = map(tag("."), |x| Symbol { nodes: (x, vec![]) })(s)?;; let (s, b) = map(tag("."), |x| Symbol { nodes: (x, vec![]) })(s)?;;
@ -290,16 +306,19 @@ pub fn fixed_point_number(s: Span) -> IResult<Span, FixedPointNumber> {
Ok((s, FixedPointNumber { nodes: (a, b, c) })) Ok((s, FixedPointNumber { nodes: (a, b, c) }))
} }
#[trace]
pub fn exp(s: Span) -> IResult<Span, Exp> { pub fn exp(s: Span) -> IResult<Span, Exp> {
let (s, a) = alt((symbol("e"), symbol("E")))(s)?; let (s, a) = alt((symbol("e"), symbol("E")))(s)?;
Ok((s, Exp { nodes: (a,) })) Ok((s, Exp { nodes: (a,) }))
} }
#[trace]
pub fn unsigned_number(s: Span) -> IResult<Span, UnsignedNumber> { pub fn unsigned_number(s: Span) -> IResult<Span, UnsignedNumber> {
let (s, a) = ws(unsigned_number_impl)(s)?; let (s, a) = ws(unsigned_number_impl)(s)?;
Ok((s, UnsignedNumber { nodes: a })) Ok((s, UnsignedNumber { nodes: a }))
} }
#[trace]
pub fn unsigned_number_impl(s: Span) -> IResult<Span, Span> { pub fn unsigned_number_impl(s: Span) -> IResult<Span, Span> {
let (s, a) = digit1(s)?; let (s, a) = digit1(s)?;
fold_many0(alt((tag("_"), digit1)), a, |acc, item| { fold_many0(alt((tag("_"), digit1)), a, |acc, item| {
@ -307,11 +326,13 @@ pub fn unsigned_number_impl(s: Span) -> IResult<Span, Span> {
})(s) })(s)
} }
#[trace]
pub fn binary_value(s: Span) -> IResult<Span, BinaryValue> { pub fn binary_value(s: Span) -> IResult<Span, BinaryValue> {
let (s, a) = ws(binary_value_impl)(s)?; let (s, a) = ws(binary_value_impl)(s)?;
Ok((s, BinaryValue { nodes: a })) Ok((s, BinaryValue { nodes: a }))
} }
#[trace]
pub fn binary_value_impl(s: Span) -> IResult<Span, Span> { pub fn binary_value_impl(s: Span) -> IResult<Span, Span> {
let (s, a) = is_a("01xXzZ?")(s)?; let (s, a) = is_a("01xXzZ?")(s)?;
fold_many0(alt((tag("_"), is_a("01xXzZ?"))), a, |acc, item| { fold_many0(alt((tag("_"), is_a("01xXzZ?"))), a, |acc, item| {
@ -319,11 +340,13 @@ pub fn binary_value_impl(s: Span) -> IResult<Span, Span> {
})(s) })(s)
} }
#[trace]
pub fn octal_value(s: Span) -> IResult<Span, OctalValue> { pub fn octal_value(s: Span) -> IResult<Span, OctalValue> {
let (s, a) = ws(octal_value_impl)(s)?; let (s, a) = ws(octal_value_impl)(s)?;
Ok((s, OctalValue { nodes: a })) Ok((s, OctalValue { nodes: a }))
} }
#[trace]
pub fn octal_value_impl(s: Span) -> IResult<Span, Span> { pub fn octal_value_impl(s: Span) -> IResult<Span, Span> {
let (s, a) = is_a("01234567xXzZ?")(s)?; let (s, a) = is_a("01234567xXzZ?")(s)?;
fold_many0(alt((tag("_"), is_a("01234567xXzZ?"))), a, |acc, item| { fold_many0(alt((tag("_"), is_a("01234567xXzZ?"))), a, |acc, item| {
@ -331,11 +354,13 @@ pub fn octal_value_impl(s: Span) -> IResult<Span, Span> {
})(s) })(s)
} }
#[trace]
pub fn hex_value(s: Span) -> IResult<Span, HexValue> { pub fn hex_value(s: Span) -> IResult<Span, HexValue> {
let (s, a) = ws(hex_value_impl)(s)?; let (s, a) = ws(hex_value_impl)(s)?;
Ok((s, HexValue { nodes: a })) Ok((s, HexValue { nodes: a }))
} }
#[trace]
pub fn hex_value_impl(s: Span) -> IResult<Span, Span> { pub fn hex_value_impl(s: Span) -> IResult<Span, Span> {
let (s, a) = is_a("0123456789abcdefABCDEFxXzZ?")(s)?; let (s, a) = is_a("0123456789abcdefABCDEFxXzZ?")(s)?;
fold_many0( fold_many0(
@ -345,47 +370,57 @@ pub fn hex_value_impl(s: Span) -> IResult<Span, Span> {
)(s) )(s)
} }
#[trace]
pub fn decimal_base(s: Span) -> IResult<Span, DecimalBase> { pub fn decimal_base(s: Span) -> IResult<Span, DecimalBase> {
let (s, a) = ws(decimal_base_impl)(s)?; let (s, a) = ws(decimal_base_impl)(s)?;
Ok((s, DecimalBase { nodes: a })) Ok((s, DecimalBase { nodes: a }))
} }
#[trace]
pub fn decimal_base_impl(s: Span) -> IResult<Span, Span> { pub fn decimal_base_impl(s: Span) -> IResult<Span, Span> {
alt((tag_no_case("'d"), tag_no_case("'sd")))(s) alt((tag_no_case("'d"), tag_no_case("'sd")))(s)
} }
#[trace]
pub fn binary_base(s: Span) -> IResult<Span, BinaryBase> { pub fn binary_base(s: Span) -> IResult<Span, BinaryBase> {
let (s, a) = ws(binary_base_impl)(s)?; let (s, a) = ws(binary_base_impl)(s)?;
Ok((s, BinaryBase { nodes: a })) Ok((s, BinaryBase { nodes: a }))
} }
#[trace]
pub fn binary_base_impl(s: Span) -> IResult<Span, Span> { pub fn binary_base_impl(s: Span) -> IResult<Span, Span> {
alt((tag_no_case("'b"), tag_no_case("'sb")))(s) alt((tag_no_case("'b"), tag_no_case("'sb")))(s)
} }
#[trace]
pub fn octal_base(s: Span) -> IResult<Span, OctalBase> { pub fn octal_base(s: Span) -> IResult<Span, OctalBase> {
let (s, a) = ws(octal_base_impl)(s)?; let (s, a) = ws(octal_base_impl)(s)?;
Ok((s, OctalBase { nodes: a })) Ok((s, OctalBase { nodes: a }))
} }
#[trace]
pub fn octal_base_impl(s: Span) -> IResult<Span, Span> { pub fn octal_base_impl(s: Span) -> IResult<Span, Span> {
alt((tag_no_case("'o"), tag_no_case("'so")))(s) alt((tag_no_case("'o"), tag_no_case("'so")))(s)
} }
#[trace]
pub fn hex_base(s: Span) -> IResult<Span, HexBase> { pub fn hex_base(s: Span) -> IResult<Span, HexBase> {
let (s, a) = ws(hex_base_impl)(s)?; let (s, a) = ws(hex_base_impl)(s)?;
Ok((s, HexBase { nodes: a })) Ok((s, HexBase { nodes: a }))
} }
#[trace]
pub fn hex_base_impl(s: Span) -> IResult<Span, Span> { pub fn hex_base_impl(s: Span) -> IResult<Span, Span> {
alt((tag_no_case("'h"), tag_no_case("'sh")))(s) alt((tag_no_case("'h"), tag_no_case("'sh")))(s)
} }
#[trace]
pub fn x_number(s: Span) -> IResult<Span, XNumber> { pub fn x_number(s: Span) -> IResult<Span, XNumber> {
let (s, a) = ws(x_number_impl)(s)?; let (s, a) = ws(x_number_impl)(s)?;
Ok((s, XNumber { nodes: a })) Ok((s, XNumber { nodes: a }))
} }
#[trace]
pub fn x_number_impl(s: Span) -> IResult<Span, Span> { pub fn x_number_impl(s: Span) -> IResult<Span, Span> {
let (s, a) = tag_no_case("x")(s)?; let (s, a) = tag_no_case("x")(s)?;
fold_many0(alt((tag("_"), is_a("_"))), a, |acc, item| { fold_many0(alt((tag("_"), is_a("_"))), a, |acc, item| {
@ -393,11 +428,13 @@ pub fn x_number_impl(s: Span) -> IResult<Span, Span> {
})(s) })(s)
} }
#[trace]
pub fn z_number(s: Span) -> IResult<Span, ZNumber> { pub fn z_number(s: Span) -> IResult<Span, ZNumber> {
let (s, a) = ws(z_number_impl)(s)?; let (s, a) = ws(z_number_impl)(s)?;
Ok((s, ZNumber { nodes: a })) Ok((s, ZNumber { nodes: a }))
} }
#[trace]
pub fn z_number_impl(s: Span) -> IResult<Span, Span> { pub fn z_number_impl(s: Span) -> IResult<Span, Span> {
let (s, a) = alt((tag_no_case("z"), tag("?")))(s)?; let (s, a) = alt((tag_no_case("z"), tag("?")))(s)?;
fold_many0(alt((tag("_"), is_a("_"))), a, |acc, item| { fold_many0(alt((tag("_"), is_a("_"))), a, |acc, item| {
@ -405,6 +442,7 @@ pub fn z_number_impl(s: Span) -> IResult<Span, Span> {
})(s) })(s)
} }
#[trace]
pub fn unbased_unsized_literal(s: Span) -> IResult<Span, UnbasedUnsizedLiteral> { pub fn unbased_unsized_literal(s: Span) -> IResult<Span, UnbasedUnsizedLiteral> {
let (s, a) = alt((symbol("'0"), symbol("'1"), symbol("'z"), symbol("'x")))(s)?; let (s, a) = alt((symbol("'0"), symbol("'1"), symbol("'z"), symbol("'x")))(s)?;
Ok((s, UnbasedUnsizedLiteral { nodes: (a,) })) Ok((s, UnbasedUnsizedLiteral { nodes: (a,) }))

View File

@ -32,6 +32,7 @@ pub struct BinaryModulePathOperator<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn unary_operator(s: Span) -> IResult<Span, UnaryOperator> { pub fn unary_operator(s: Span) -> IResult<Span, UnaryOperator> {
let (s, a) = alt(( let (s, a) = alt((
symbol("+"), symbol("+"),
@ -49,6 +50,7 @@ pub fn unary_operator(s: Span) -> IResult<Span, UnaryOperator> {
Ok((s, UnaryOperator { nodes: (a,) })) Ok((s, UnaryOperator { nodes: (a,) }))
} }
#[trace]
pub fn binary_operator(s: Span) -> IResult<Span, BinaryOperator> { pub fn binary_operator(s: Span) -> IResult<Span, BinaryOperator> {
let (s, a) = alt(( let (s, a) = alt((
alt(( alt((
@ -88,11 +90,13 @@ pub fn binary_operator(s: Span) -> IResult<Span, BinaryOperator> {
Ok((s, BinaryOperator { nodes: (a,) })) Ok((s, BinaryOperator { nodes: (a,) }))
} }
#[trace]
pub fn inc_or_dec_operator(s: Span) -> IResult<Span, IncOrDecOperator> { pub fn inc_or_dec_operator(s: Span) -> IResult<Span, IncOrDecOperator> {
let (s, a) = alt((symbol("++"), symbol("--")))(s)?; let (s, a) = alt((symbol("++"), symbol("--")))(s)?;
Ok((s, IncOrDecOperator { nodes: (a,) })) Ok((s, IncOrDecOperator { nodes: (a,) }))
} }
#[trace]
pub fn unary_module_path_operator(s: Span) -> IResult<Span, UnaryModulePathOperator> { pub fn unary_module_path_operator(s: Span) -> IResult<Span, UnaryModulePathOperator> {
let (s, a) = alt(( let (s, a) = alt((
symbol("!"), symbol("!"),
@ -108,6 +112,7 @@ pub fn unary_module_path_operator(s: Span) -> IResult<Span, UnaryModulePathOpera
Ok((s, UnaryModulePathOperator { nodes: (a,) })) Ok((s, UnaryModulePathOperator { nodes: (a,) }))
} }
#[trace]
pub fn binary_module_path_operator(s: Span) -> IResult<Span, BinaryModulePathOperator> { pub fn binary_module_path_operator(s: Span) -> IResult<Span, BinaryModulePathOperator> {
let (s, a) = alt(( let (s, a) = alt((
symbol("=="), symbol("=="),

View File

@ -261,6 +261,7 @@ pub struct Cast<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn constant_primary(s: Span) -> IResult<Span, ConstantPrimary> { pub fn constant_primary(s: Span) -> IResult<Span, ConstantPrimary> {
alt(( alt((
map(symbol("null"), |x| ConstantPrimary::Null(x)), map(symbol("null"), |x| ConstantPrimary::Null(x)),
@ -287,6 +288,7 @@ pub fn constant_primary(s: Span) -> IResult<Span, ConstantPrimary> {
))(s) ))(s)
} }
#[trace]
pub fn constant_primary_ps_parameter(s: Span) -> IResult<Span, ConstantPrimary> { pub fn constant_primary_ps_parameter(s: Span) -> IResult<Span, ConstantPrimary> {
let (s, a) = ps_parameter_identifier(s)?; let (s, a) = ps_parameter_identifier(s)?;
let (s, b) = constant_select(s)?; let (s, b) = constant_select(s)?;
@ -296,6 +298,7 @@ pub fn constant_primary_ps_parameter(s: Span) -> IResult<Span, ConstantPrimary>
)) ))
} }
#[trace]
pub fn constant_primary_specparam(s: Span) -> IResult<Span, ConstantPrimary> { pub fn constant_primary_specparam(s: Span) -> IResult<Span, ConstantPrimary> {
let (s, a) = specparam_identifier(s)?; let (s, a) = specparam_identifier(s)?;
let (s, b) = opt(bracket(constant_range_expression))(s)?; let (s, b) = opt(bracket(constant_range_expression))(s)?;
@ -305,6 +308,7 @@ pub fn constant_primary_specparam(s: Span) -> IResult<Span, ConstantPrimary> {
)) ))
} }
#[trace]
pub fn constant_primary_formal_port(s: Span) -> IResult<Span, ConstantPrimary> { pub fn constant_primary_formal_port(s: Span) -> IResult<Span, ConstantPrimary> {
let (s, a) = formal_port_identifier(s)?; let (s, a) = formal_port_identifier(s)?;
let (s, b) = constant_select(s)?; let (s, b) = constant_select(s)?;
@ -314,6 +318,7 @@ pub fn constant_primary_formal_port(s: Span) -> IResult<Span, ConstantPrimary> {
)) ))
} }
#[trace]
pub fn constant_primary_enum(s: Span) -> IResult<Span, ConstantPrimary> { pub fn constant_primary_enum(s: Span) -> IResult<Span, ConstantPrimary> {
let (s, a) = package_scope_or_class_scope(s)?; let (s, a) = package_scope_or_class_scope(s)?;
let (s, b) = enum_identifier(s)?; let (s, b) = enum_identifier(s)?;
@ -323,6 +328,7 @@ pub fn constant_primary_enum(s: Span) -> IResult<Span, ConstantPrimary> {
)) ))
} }
#[trace]
pub fn constant_primary_concatenation(s: Span) -> IResult<Span, ConstantPrimary> { pub fn constant_primary_concatenation(s: Span) -> IResult<Span, ConstantPrimary> {
let (s, a) = constant_concatenation(s)?; let (s, a) = constant_concatenation(s)?;
let (s, b) = opt(bracket(constant_range_expression))(s)?; let (s, b) = opt(bracket(constant_range_expression))(s)?;
@ -332,6 +338,7 @@ pub fn constant_primary_concatenation(s: Span) -> IResult<Span, ConstantPrimary>
)) ))
} }
#[trace]
pub fn constant_primary_multiple_concatenation(s: Span) -> IResult<Span, ConstantPrimary> { pub fn constant_primary_multiple_concatenation(s: Span) -> IResult<Span, ConstantPrimary> {
let (s, a) = constant_multiple_concatenation(s)?; let (s, a) = constant_multiple_concatenation(s)?;
let (s, b) = opt(bracket(constant_range_expression))(s)?; let (s, b) = opt(bracket(constant_range_expression))(s)?;
@ -343,6 +350,7 @@ pub fn constant_primary_multiple_concatenation(s: Span) -> IResult<Span, Constan
)) ))
} }
#[trace]
pub fn constant_primary_mintypmax_expression(s: Span) -> IResult<Span, ConstantPrimary> { pub fn constant_primary_mintypmax_expression(s: Span) -> IResult<Span, ConstantPrimary> {
let (s, a) = paren(constant_mintypmax_expression)(s)?; let (s, a) = paren(constant_mintypmax_expression)(s)?;
Ok(( Ok((
@ -351,6 +359,7 @@ pub fn constant_primary_mintypmax_expression(s: Span) -> IResult<Span, ConstantP
)) ))
} }
#[trace]
pub fn module_path_primary(s: Span) -> IResult<Span, ModulePathPrimary> { pub fn module_path_primary(s: Span) -> IResult<Span, ModulePathPrimary> {
alt(( alt((
map(number, |x| ModulePathPrimary::Number(x)), map(number, |x| ModulePathPrimary::Number(x)),
@ -368,6 +377,7 @@ pub fn module_path_primary(s: Span) -> IResult<Span, ModulePathPrimary> {
))(s) ))(s)
} }
#[trace]
pub fn module_path_primary_mintypmax_expression(s: Span) -> IResult<Span, ModulePathPrimary> { pub fn module_path_primary_mintypmax_expression(s: Span) -> IResult<Span, ModulePathPrimary> {
let (s, a) = paren(module_path_mintypmax_expression)(s)?; let (s, a) = paren(module_path_mintypmax_expression)(s)?;
Ok(( Ok((
@ -376,6 +386,7 @@ pub fn module_path_primary_mintypmax_expression(s: Span) -> IResult<Span, Module
)) ))
} }
#[trace]
pub fn primary(s: Span) -> IResult<Span, Primary> { pub fn primary(s: Span) -> IResult<Span, Primary> {
alt(( alt((
map(symbol("this"), |x| Primary::This(x)), map(symbol("this"), |x| Primary::This(x)),
@ -387,7 +398,7 @@ pub fn primary(s: Span) -> IResult<Span, Primary> {
Primary::EmptyUnpackedArrayConcatenation(x) Primary::EmptyUnpackedArrayConcatenation(x)
}), }),
primary_concatenation, primary_concatenation,
map(rec(function_subroutine_call, REC_PRIMARY), |x| { map(function_subroutine_call, |x| {
Primary::FunctionSubroutineCall(x) Primary::FunctionSubroutineCall(x)
}), }),
map(let_expression, |x| Primary::LetExpression(x)), map(let_expression, |x| Primary::LetExpression(x)),
@ -403,6 +414,7 @@ pub fn primary(s: Span) -> IResult<Span, Primary> {
))(s) ))(s)
} }
#[trace]
pub fn primary_hierarchical(s: Span) -> IResult<Span, Primary> { pub fn primary_hierarchical(s: Span) -> IResult<Span, Primary> {
let (s, a) = opt(class_qualifier_or_package_scope)(s)?; let (s, a) = opt(class_qualifier_or_package_scope)(s)?;
let (s, b) = hierarchical_identifier(s)?; let (s, b) = hierarchical_identifier(s)?;
@ -413,6 +425,7 @@ pub fn primary_hierarchical(s: Span) -> IResult<Span, Primary> {
)) ))
} }
#[trace]
pub fn primary_concatenation(s: Span) -> IResult<Span, Primary> { pub fn primary_concatenation(s: Span) -> IResult<Span, Primary> {
let (s, a) = concatenation(s)?; let (s, a) = concatenation(s)?;
let (s, b) = opt(bracket(range_expression))(s)?; let (s, b) = opt(bracket(range_expression))(s)?;
@ -422,6 +435,7 @@ pub fn primary_concatenation(s: Span) -> IResult<Span, Primary> {
)) ))
} }
#[trace]
pub fn primary_multiple_concatenation(s: Span) -> IResult<Span, Primary> { pub fn primary_multiple_concatenation(s: Span) -> IResult<Span, Primary> {
let (s, a) = multiple_concatenation(s)?; let (s, a) = multiple_concatenation(s)?;
let (s, b) = opt(bracket(range_expression))(s)?; let (s, b) = opt(bracket(range_expression))(s)?;
@ -431,6 +445,7 @@ pub fn primary_multiple_concatenation(s: Span) -> IResult<Span, Primary> {
)) ))
} }
#[trace]
pub fn primary_mintypmax_expression(s: Span) -> IResult<Span, Primary> { pub fn primary_mintypmax_expression(s: Span) -> IResult<Span, Primary> {
let (s, a) = paren(mintypmax_expression)(s)?; let (s, a) = paren(mintypmax_expression)(s)?;
Ok(( Ok((
@ -439,6 +454,7 @@ pub fn primary_mintypmax_expression(s: Span) -> IResult<Span, Primary> {
)) ))
} }
#[trace]
pub fn class_qualifier_or_package_scope(s: Span) -> IResult<Span, ClassQualifierOrPackageScope> { pub fn class_qualifier_or_package_scope(s: Span) -> IResult<Span, ClassQualifierOrPackageScope> {
alt(( alt((
map(class_qualifier, |x| { map(class_qualifier, |x| {
@ -450,12 +466,14 @@ pub fn class_qualifier_or_package_scope(s: Span) -> IResult<Span, ClassQualifier
))(s) ))(s)
} }
#[trace]
pub fn class_qualifier(s: Span) -> IResult<Span, ClassQualifier> { pub fn class_qualifier(s: Span) -> IResult<Span, ClassQualifier> {
let (s, a) = opt(local)(s)?; let (s, a) = opt(local)(s)?;
let (s, b) = opt(implicit_class_handle_or_class_scope)(s)?; let (s, b) = opt(implicit_class_handle_or_class_scope)(s)?;
Ok((s, ClassQualifier { nodes: (a, b) })) Ok((s, ClassQualifier { nodes: (a, b) }))
} }
#[trace]
pub fn range_expression(s: Span) -> IResult<Span, RangeExpression> { pub fn range_expression(s: Span) -> IResult<Span, RangeExpression> {
alt(( alt((
map(expression, |x| RangeExpression::Expression(x)), map(expression, |x| RangeExpression::Expression(x)),
@ -463,6 +481,7 @@ pub fn range_expression(s: Span) -> IResult<Span, RangeExpression> {
))(s) ))(s)
} }
#[trace]
pub fn primary_literal(s: Span) -> IResult<Span, PrimaryLiteral> { pub fn primary_literal(s: Span) -> IResult<Span, PrimaryLiteral> {
alt(( alt((
map(time_literal, |x| PrimaryLiteral::TimeLiteral(x)), map(time_literal, |x| PrimaryLiteral::TimeLiteral(x)),
@ -474,10 +493,12 @@ pub fn primary_literal(s: Span) -> IResult<Span, PrimaryLiteral> {
))(s) ))(s)
} }
#[trace]
pub fn time_literal(s: Span) -> IResult<Span, TimeLiteral> { pub fn time_literal(s: Span) -> IResult<Span, TimeLiteral> {
alt((time_literal_unsigned, time_literal_fixed_point))(s) alt((time_literal_unsigned, time_literal_fixed_point))(s)
} }
#[trace]
pub fn time_literal_unsigned(s: Span) -> IResult<Span, TimeLiteral> { pub fn time_literal_unsigned(s: Span) -> IResult<Span, TimeLiteral> {
let (s, a) = unsigned_number(s)?; let (s, a) = unsigned_number(s)?;
let (s, b) = time_unit(s)?; let (s, b) = time_unit(s)?;
@ -487,6 +508,7 @@ pub fn time_literal_unsigned(s: Span) -> IResult<Span, TimeLiteral> {
)) ))
} }
#[trace]
pub fn time_literal_fixed_point(s: Span) -> IResult<Span, TimeLiteral> { pub fn time_literal_fixed_point(s: Span) -> IResult<Span, TimeLiteral> {
let (s, a) = fixed_point_number(s)?; let (s, a) = fixed_point_number(s)?;
let (s, b) = time_unit(s)?; let (s, b) = time_unit(s)?;
@ -496,6 +518,7 @@ pub fn time_literal_fixed_point(s: Span) -> IResult<Span, TimeLiteral> {
)) ))
} }
#[trace]
pub fn time_unit(s: Span) -> IResult<Span, TimeUnit> { pub fn time_unit(s: Span) -> IResult<Span, TimeUnit> {
alt(( alt((
map(symbol("s"), |x| TimeUnit::S(x)), map(symbol("s"), |x| TimeUnit::S(x)),
@ -507,6 +530,7 @@ pub fn time_unit(s: Span) -> IResult<Span, TimeUnit> {
))(s) ))(s)
} }
#[trace]
pub fn implicit_class_handle(s: Span) -> IResult<Span, ImplicitClassHandle> { pub fn implicit_class_handle(s: Span) -> IResult<Span, ImplicitClassHandle> {
alt(( alt((
map( map(
@ -518,11 +542,13 @@ pub fn implicit_class_handle(s: Span) -> IResult<Span, ImplicitClassHandle> {
))(s) ))(s)
} }
#[trace]
pub fn bit_select(s: Span) -> IResult<Span, BitSelect> { pub fn bit_select(s: Span) -> IResult<Span, BitSelect> {
let (s, a) = many0(bracket(expression))(s)?; let (s, a) = many0(bracket(expression))(s)?;
Ok((s, BitSelect { nodes: (a,) })) Ok((s, BitSelect { nodes: (a,) }))
} }
#[trace]
pub fn select(s: Span) -> IResult<Span, Select> { pub fn select(s: Span) -> IResult<Span, Select> {
let (s, a) = opt(triple( let (s, a) = opt(triple(
many0(triple(symbol("."), member_identifier, bit_select)), many0(triple(symbol("."), member_identifier, bit_select)),
@ -534,6 +560,7 @@ pub fn select(s: Span) -> IResult<Span, Select> {
Ok((s, Select { nodes: (a, b, c) })) Ok((s, Select { nodes: (a, b, c) }))
} }
#[trace]
pub fn nonrange_select(s: Span) -> IResult<Span, NonrangeSelect> { pub fn nonrange_select(s: Span) -> IResult<Span, NonrangeSelect> {
let (s, a) = opt(triple( let (s, a) = opt(triple(
many0(triple(symbol("."), member_identifier, bit_select)), many0(triple(symbol("."), member_identifier, bit_select)),
@ -544,11 +571,13 @@ pub fn nonrange_select(s: Span) -> IResult<Span, NonrangeSelect> {
Ok((s, NonrangeSelect { nodes: (a, b) })) Ok((s, NonrangeSelect { nodes: (a, b) }))
} }
#[trace]
pub fn constant_bit_select(s: Span) -> IResult<Span, ConstantBitSelect> { pub fn constant_bit_select(s: Span) -> IResult<Span, ConstantBitSelect> {
let (s, a) = many0(bracket(constant_expression))(s)?; let (s, a) = many0(bracket(constant_expression))(s)?;
Ok((s, ConstantBitSelect { nodes: (a,) })) Ok((s, ConstantBitSelect { nodes: (a,) }))
} }
#[trace]
pub fn constant_select(s: Span) -> IResult<Span, ConstantSelect> { pub fn constant_select(s: Span) -> IResult<Span, ConstantSelect> {
let (s, a) = opt(triple( let (s, a) = opt(triple(
many0(triple(symbol("."), member_identifier, constant_bit_select)), many0(triple(symbol("."), member_identifier, constant_bit_select)),
@ -560,6 +589,7 @@ pub fn constant_select(s: Span) -> IResult<Span, ConstantSelect> {
Ok((s, ConstantSelect { nodes: (a, b, c) })) Ok((s, ConstantSelect { nodes: (a, b, c) }))
} }
#[trace]
pub fn constant_cast(s: Span) -> IResult<Span, ConstantCast> { pub fn constant_cast(s: Span) -> IResult<Span, ConstantCast> {
let (s, a) = casting_type(s)?; let (s, a) = casting_type(s)?;
let (s, b) = symbol("'")(s)?; let (s, b) = symbol("'")(s)?;
@ -567,11 +597,13 @@ pub fn constant_cast(s: Span) -> IResult<Span, ConstantCast> {
Ok((s, ConstantCast { nodes: (a, b, c) })) Ok((s, ConstantCast { nodes: (a, b, c) }))
} }
#[trace]
pub fn constant_let_expression(s: Span) -> IResult<Span, ConstantLetExpression> { pub fn constant_let_expression(s: Span) -> IResult<Span, ConstantLetExpression> {
let (s, a) = let_expression(s)?; let (s, a) = let_expression(s)?;
Ok((s, ConstantLetExpression { nodes: (a,) })) Ok((s, ConstantLetExpression { nodes: (a,) }))
} }
#[trace]
pub fn cast(s: Span) -> IResult<Span, Cast> { pub fn cast(s: Span) -> IResult<Span, Cast> {
let (s, a) = casting_type(s)?; let (s, a) = casting_type(s)?;
let (s, b) = symbol("'")(s)?; let (s, b) = symbol("'")(s)?;

View File

@ -15,11 +15,13 @@ pub struct StringLiteral<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn string_literal(s: Span) -> IResult<Span, StringLiteral> { pub fn string_literal(s: Span) -> IResult<Span, StringLiteral> {
let (s, a) = ws(string_literal_impl)(s)?; let (s, a) = ws(string_literal_impl)(s)?;
Ok((s, StringLiteral { nodes: a })) Ok((s, StringLiteral { nodes: a }))
} }
#[trace]
pub fn string_literal_impl(s: Span) -> IResult<Span, Span> { pub fn string_literal_impl(s: Span) -> IResult<Span, Span> {
let (s, a) = tag("\"")(s)?; let (s, a) = tag("\"")(s)?;
let (s, b) = many1(pair(is_not("\\\""), opt(pair(tag("\\"), take(1usize)))))(s)?; let (s, b) = many1(pair(is_not("\\\""), opt(pair(tag("\\"), take(1usize)))))(s)?;

View File

@ -184,11 +184,13 @@ pub enum ArrayMethodName<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn constant_function_call(s: Span) -> IResult<Span, ConstantFunctionCall> { pub fn constant_function_call(s: Span) -> IResult<Span, ConstantFunctionCall> {
let (s, a) = function_subroutine_call(s)?; let (s, a) = function_subroutine_call(s)?;
Ok((s, ConstantFunctionCall { nodes: (a,) })) Ok((s, ConstantFunctionCall { nodes: (a,) }))
} }
#[trace]
pub fn tf_call(s: Span) -> IResult<Span, TfCall> { pub fn tf_call(s: Span) -> IResult<Span, TfCall> {
let (s, a) = ps_or_hierarchical_tf_identifier(s)?; let (s, a) = ps_or_hierarchical_tf_identifier(s)?;
let (s, b) = many0(attribute_instance)(s)?; let (s, b) = many0(attribute_instance)(s)?;
@ -196,6 +198,7 @@ pub fn tf_call(s: Span) -> IResult<Span, TfCall> {
Ok((s, TfCall { nodes: (a, b, c) })) Ok((s, TfCall { nodes: (a, b, c) }))
} }
#[trace]
pub fn system_tf_call(s: Span) -> IResult<Span, SystemTfCall> { pub fn system_tf_call(s: Span) -> IResult<Span, SystemTfCall> {
alt(( alt((
system_tf_call_arg_optional, system_tf_call_arg_optional,
@ -204,6 +207,7 @@ pub fn system_tf_call(s: Span) -> IResult<Span, SystemTfCall> {
))(s) ))(s)
} }
#[trace]
pub fn system_tf_call_arg_optional(s: Span) -> IResult<Span, SystemTfCall> { pub fn system_tf_call_arg_optional(s: Span) -> IResult<Span, SystemTfCall> {
let (s, a) = system_tf_identifier(s)?; let (s, a) = system_tf_identifier(s)?;
let (s, b) = opt(paren(list_of_arguments))(s)?; let (s, b) = opt(paren(list_of_arguments))(s)?;
@ -213,6 +217,7 @@ pub fn system_tf_call_arg_optional(s: Span) -> IResult<Span, SystemTfCall> {
)) ))
} }
#[trace]
pub fn system_tf_call_arg_data_type(s: Span) -> IResult<Span, SystemTfCall> { pub fn system_tf_call_arg_data_type(s: Span) -> IResult<Span, SystemTfCall> {
let (s, a) = system_tf_identifier(s)?; let (s, a) = system_tf_identifier(s)?;
let (s, b) = paren(pair(data_type, opt(pair(symbol(","), expression))))(s)?; let (s, b) = paren(pair(data_type, opt(pair(symbol(","), expression))))(s)?;
@ -222,6 +227,7 @@ pub fn system_tf_call_arg_data_type(s: Span) -> IResult<Span, SystemTfCall> {
)) ))
} }
#[trace]
pub fn system_tf_call_arg_expression(s: Span) -> IResult<Span, SystemTfCall> { pub fn system_tf_call_arg_expression(s: Span) -> IResult<Span, SystemTfCall> {
let (s, a) = system_tf_identifier(s)?; let (s, a) = system_tf_identifier(s)?;
let (s, b) = paren(pair( let (s, b) = paren(pair(
@ -234,6 +240,7 @@ pub fn system_tf_call_arg_expression(s: Span) -> IResult<Span, SystemTfCall> {
)) ))
} }
#[trace]
pub fn subroutine_call(s: Span) -> IResult<Span, SubroutineCall> { pub fn subroutine_call(s: Span) -> IResult<Span, SubroutineCall> {
alt(( alt((
map(tf_call, |x| SubroutineCall::TfCall(Box::new(x))), map(tf_call, |x| SubroutineCall::TfCall(Box::new(x))),
@ -245,6 +252,7 @@ pub fn subroutine_call(s: Span) -> IResult<Span, SubroutineCall> {
))(s) ))(s)
} }
#[trace]
pub fn subroutine_call_randomize(s: Span) -> IResult<Span, SubroutineCall> { pub fn subroutine_call_randomize(s: Span) -> IResult<Span, SubroutineCall> {
let (s, a) = opt(pair(symbol("std"), symbol("::")))(s)?; let (s, a) = opt(pair(symbol("std"), symbol("::")))(s)?;
let (s, b) = randomize_call(s)?; let (s, b) = randomize_call(s)?;
@ -254,14 +262,17 @@ pub fn subroutine_call_randomize(s: Span) -> IResult<Span, SubroutineCall> {
)) ))
} }
#[trace]
pub fn function_subroutine_call(s: Span) -> IResult<Span, FunctionSubroutineCall> { pub fn function_subroutine_call(s: Span) -> IResult<Span, FunctionSubroutineCall> {
map(subroutine_call, |x| FunctionSubroutineCall { nodes: (x,) })(s) map(subroutine_call, |x| FunctionSubroutineCall { nodes: (x,) })(s)
} }
#[trace]
pub fn list_of_arguments(s: Span) -> IResult<Span, ListOfArguments> { pub fn list_of_arguments(s: Span) -> IResult<Span, ListOfArguments> {
alt((list_of_arguments_ordered, list_of_arguments_named))(s) alt((list_of_arguments_ordered, list_of_arguments_named))(s)
} }
#[trace]
pub fn list_of_arguments_ordered(s: Span) -> IResult<Span, ListOfArguments> { pub fn list_of_arguments_ordered(s: Span) -> IResult<Span, ListOfArguments> {
let (s, a) = list(symbol(","), opt(expression))(s)?; let (s, a) = list(symbol(","), opt(expression))(s)?;
let (s, b) = many0(tuple(( let (s, b) = many0(tuple((
@ -276,6 +287,7 @@ pub fn list_of_arguments_ordered(s: Span) -> IResult<Span, ListOfArguments> {
)) ))
} }
#[trace]
pub fn list_of_arguments_named(s: Span) -> IResult<Span, ListOfArguments> { pub fn list_of_arguments_named(s: Span) -> IResult<Span, ListOfArguments> {
let (s, a) = symbol(".")(s)?; let (s, a) = symbol(".")(s)?;
let (s, b) = identifier(s)?; let (s, b) = identifier(s)?;
@ -294,6 +306,7 @@ pub fn list_of_arguments_named(s: Span) -> IResult<Span, ListOfArguments> {
)) ))
} }
#[trace]
pub fn method_call(s: Span) -> IResult<Span, MethodCall> { pub fn method_call(s: Span) -> IResult<Span, MethodCall> {
let (s, a) = method_call_root(s)?; let (s, a) = method_call_root(s)?;
let (s, b) = symbol(".")(s)?; let (s, b) = symbol(".")(s)?;
@ -302,6 +315,7 @@ pub fn method_call(s: Span) -> IResult<Span, MethodCall> {
Ok((s, MethodCall { nodes: (a, b, c) })) Ok((s, MethodCall { nodes: (a, b, c) }))
} }
#[trace]
pub fn method_call_body(s: Span) -> IResult<Span, MethodCallBody> { pub fn method_call_body(s: Span) -> IResult<Span, MethodCallBody> {
alt(( alt((
method_call_body_user, method_call_body_user,
@ -311,6 +325,7 @@ pub fn method_call_body(s: Span) -> IResult<Span, MethodCallBody> {
))(s) ))(s)
} }
#[trace]
pub fn method_call_body_user(s: Span) -> IResult<Span, MethodCallBody> { pub fn method_call_body_user(s: Span) -> IResult<Span, MethodCallBody> {
let (s, a) = method_identifier(s)?; let (s, a) = method_identifier(s)?;
let (s, b) = many0(attribute_instance)(s)?; let (s, b) = many0(attribute_instance)(s)?;
@ -321,6 +336,7 @@ pub fn method_call_body_user(s: Span) -> IResult<Span, MethodCallBody> {
)) ))
} }
#[trace]
pub fn built_in_method_call(s: Span) -> IResult<Span, BuiltInMethodCall> { pub fn built_in_method_call(s: Span) -> IResult<Span, BuiltInMethodCall> {
alt(( alt((
map(array_manipulation_call, |x| { map(array_manipulation_call, |x| {
@ -330,6 +346,7 @@ pub fn built_in_method_call(s: Span) -> IResult<Span, BuiltInMethodCall> {
))(s) ))(s)
} }
#[trace]
pub fn array_manipulation_call(s: Span) -> IResult<Span, ArrayManipulationCall> { pub fn array_manipulation_call(s: Span) -> IResult<Span, ArrayManipulationCall> {
let (s, a) = array_method_name(s)?; let (s, a) = array_method_name(s)?;
let (s, b) = many0(attribute_instance)(s)?; let (s, b) = many0(attribute_instance)(s)?;
@ -343,6 +360,7 @@ pub fn array_manipulation_call(s: Span) -> IResult<Span, ArrayManipulationCall>
)) ))
} }
#[trace]
pub fn randomize_call(s: Span) -> IResult<Span, RandomizeCall> { pub fn randomize_call(s: Span) -> IResult<Span, RandomizeCall> {
let (s, a) = symbol("randomize")(s)?; let (s, a) = symbol("randomize")(s)?;
let (s, b) = many0(attribute_instance)(s)?; let (s, b) = many0(attribute_instance)(s)?;
@ -360,6 +378,7 @@ pub fn randomize_call(s: Span) -> IResult<Span, RandomizeCall> {
)) ))
} }
#[trace]
pub fn variable_identifier_list_or_null(s: Span) -> IResult<Span, VariableIdentifierListOrNull> { pub fn variable_identifier_list_or_null(s: Span) -> IResult<Span, VariableIdentifierListOrNull> {
alt(( alt((
map(variable_identifier_list, |x| { map(variable_identifier_list, |x| {
@ -369,6 +388,7 @@ pub fn variable_identifier_list_or_null(s: Span) -> IResult<Span, VariableIdenti
))(s) ))(s)
} }
#[trace]
pub fn method_call_root(s: Span) -> IResult<Span, MethodCallRoot> { pub fn method_call_root(s: Span) -> IResult<Span, MethodCallRoot> {
alt(( alt((
map(primary, |x| MethodCallRoot::Primary(x)), map(primary, |x| MethodCallRoot::Primary(x)),
@ -378,6 +398,7 @@ pub fn method_call_root(s: Span) -> IResult<Span, MethodCallRoot> {
))(s) ))(s)
} }
#[trace]
pub fn array_method_name(s: Span) -> IResult<Span, ArrayMethodName> { pub fn array_method_name(s: Span) -> IResult<Span, ArrayMethodName> {
alt(( alt((
map(symbol("unique"), |x| ArrayMethodName::Unique(x)), map(symbol("unique"), |x| ArrayMethodName::Unique(x)),

View File

@ -18,6 +18,7 @@ pub struct AttrSpec<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn attribute_instance(s: Span) -> IResult<Span, AttributeInstance> { pub fn attribute_instance(s: Span) -> IResult<Span, AttributeInstance> {
let (s, a) = symbol("(*")(s)?; let (s, a) = symbol("(*")(s)?;
let (s, b) = list(symbol(","), attr_spec)(s)?; let (s, b) = list(symbol(","), attr_spec)(s)?;
@ -25,6 +26,7 @@ pub fn attribute_instance(s: Span) -> IResult<Span, AttributeInstance> {
Ok((s, AttributeInstance { nodes: (a, b, c) })) Ok((s, AttributeInstance { nodes: (a, b, c) }))
} }
#[trace]
pub fn attr_spec(s: Span) -> IResult<Span, AttrSpec> { pub fn attr_spec(s: Span) -> IResult<Span, AttrSpec> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
let (s, b) = opt(pair(symbol("="), constant_expression))(s)?; let (s, b) = opt(pair(symbol("="), constant_expression))(s)?;

View File

@ -13,10 +13,12 @@ pub struct Comment<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn comment(s: Span) -> IResult<Span, Comment> { pub fn comment(s: Span) -> IResult<Span, Comment> {
alt((one_line_comment, block_comment))(s) alt((one_line_comment, block_comment))(s)
} }
#[trace]
pub fn one_line_comment(s: Span) -> IResult<Span, Comment> { pub fn one_line_comment(s: Span) -> IResult<Span, Comment> {
let (s, a) = tag("//")(s)?; let (s, a) = tag("//")(s)?;
let (s, b) = is_not("\n")(s)?; let (s, b) = is_not("\n")(s)?;
@ -24,6 +26,7 @@ pub fn one_line_comment(s: Span) -> IResult<Span, Comment> {
Ok((s, Comment { nodes: (a,) })) Ok((s, Comment { nodes: (a,) }))
} }
#[trace]
pub fn block_comment(s: Span) -> IResult<Span, Comment> { pub fn block_comment(s: Span) -> IResult<Span, Comment> {
let (s, a) = tag("/*")(s)?; let (s, a) = tag("/*")(s)?;
let (s, b) = is_not("*/")(s)?; let (s, b) = is_not("*/")(s)?;

View File

@ -544,26 +544,31 @@ pub enum PackageScopeOrClassScope<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn array_identifier(s: Span) -> IResult<Span, ArrayIdentifier> { pub fn array_identifier(s: Span) -> IResult<Span, ArrayIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, ArrayIdentifier { nodes: (a,) })) Ok((s, ArrayIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn block_identifier(s: Span) -> IResult<Span, BlockIdentifier> { pub fn block_identifier(s: Span) -> IResult<Span, BlockIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, BlockIdentifier { nodes: (a,) })) Ok((s, BlockIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn bin_identifier(s: Span) -> IResult<Span, BinIdentifier> { pub fn bin_identifier(s: Span) -> IResult<Span, BinIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, BinIdentifier { nodes: (a,) })) Ok((s, BinIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn c_identifier(s: Span) -> IResult<Span, CIdentifier> { pub fn c_identifier(s: Span) -> IResult<Span, CIdentifier> {
let (s, a) = ws(c_identifier_impl)(s)?; let (s, a) = ws(c_identifier_impl)(s)?;
Ok((s, CIdentifier { nodes: a })) Ok((s, CIdentifier { nodes: a }))
} }
#[trace]
pub fn c_identifier_impl(s: Span) -> IResult<Span, Span> { pub fn c_identifier_impl(s: Span) -> IResult<Span, Span> {
let (s, a) = is_a(AZ_)(s)?; let (s, a) = is_a(AZ_)(s)?;
let (s, b) = opt(is_a(AZ09_))(s)?; let (s, b) = opt(is_a(AZ09_))(s)?;
@ -575,81 +580,97 @@ pub fn c_identifier_impl(s: Span) -> IResult<Span, Span> {
Ok((s, a)) Ok((s, a))
} }
#[trace]
pub fn cell_identifier(s: Span) -> IResult<Span, CellIdentifier> { pub fn cell_identifier(s: Span) -> IResult<Span, CellIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, CellIdentifier { nodes: (a,) })) Ok((s, CellIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn checker_identifier(s: Span) -> IResult<Span, CheckerIdentifier> { pub fn checker_identifier(s: Span) -> IResult<Span, CheckerIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, CheckerIdentifier { nodes: (a,) })) Ok((s, CheckerIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn class_identifier(s: Span) -> IResult<Span, ClassIdentifier> { pub fn class_identifier(s: Span) -> IResult<Span, ClassIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, ClassIdentifier { nodes: (a,) })) Ok((s, ClassIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn class_variable_identifier(s: Span) -> IResult<Span, ClassVariableIdentifier> { pub fn class_variable_identifier(s: Span) -> IResult<Span, ClassVariableIdentifier> {
let (s, a) = variable_identifier(s)?; let (s, a) = variable_identifier(s)?;
Ok((s, ClassVariableIdentifier { nodes: (a,) })) Ok((s, ClassVariableIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn clocking_identifier(s: Span) -> IResult<Span, ClockingIdentifier> { pub fn clocking_identifier(s: Span) -> IResult<Span, ClockingIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, ClockingIdentifier { nodes: (a,) })) Ok((s, ClockingIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn config_identifier(s: Span) -> IResult<Span, ConfigIdentifier> { pub fn config_identifier(s: Span) -> IResult<Span, ConfigIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, ConfigIdentifier { nodes: (a,) })) Ok((s, ConfigIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn const_identifier(s: Span) -> IResult<Span, ConstIdentifier> { pub fn const_identifier(s: Span) -> IResult<Span, ConstIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, ConstIdentifier { nodes: (a,) })) Ok((s, ConstIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn constraint_identifier(s: Span) -> IResult<Span, ConstraintIdentifier> { pub fn constraint_identifier(s: Span) -> IResult<Span, ConstraintIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, ConstraintIdentifier { nodes: (a,) })) Ok((s, ConstraintIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn covergroup_identifier(s: Span) -> IResult<Span, CovergroupIdentifier> { pub fn covergroup_identifier(s: Span) -> IResult<Span, CovergroupIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, CovergroupIdentifier { nodes: (a,) })) Ok((s, CovergroupIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn covergroup_variable_identifier(s: Span) -> IResult<Span, CovergroupVariableIdentifier> { pub fn covergroup_variable_identifier(s: Span) -> IResult<Span, CovergroupVariableIdentifier> {
let (s, a) = variable_identifier(s)?; let (s, a) = variable_identifier(s)?;
Ok((s, CovergroupVariableIdentifier { nodes: (a,) })) Ok((s, CovergroupVariableIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn cover_point_identifier(s: Span) -> IResult<Span, CoverPointIdentifier> { pub fn cover_point_identifier(s: Span) -> IResult<Span, CoverPointIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, CoverPointIdentifier { nodes: (a,) })) Ok((s, CoverPointIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn cross_identifier(s: Span) -> IResult<Span, CrossIdentifier> { pub fn cross_identifier(s: Span) -> IResult<Span, CrossIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, CrossIdentifier { nodes: (a,) })) Ok((s, CrossIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn dynamic_array_variable_identifier(s: Span) -> IResult<Span, DynamicArrayVariableIdentifier> { pub fn dynamic_array_variable_identifier(s: Span) -> IResult<Span, DynamicArrayVariableIdentifier> {
let (s, a) = variable_identifier(s)?; let (s, a) = variable_identifier(s)?;
Ok((s, DynamicArrayVariableIdentifier { nodes: (a,) })) Ok((s, DynamicArrayVariableIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn enum_identifier(s: Span) -> IResult<Span, EnumIdentifier> { pub fn enum_identifier(s: Span) -> IResult<Span, EnumIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, EnumIdentifier { nodes: (a,) })) Ok((s, EnumIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn escaped_identifier(s: Span) -> IResult<Span, EscapedIdentifier> { pub fn escaped_identifier(s: Span) -> IResult<Span, EscapedIdentifier> {
let (s, a) = ws(escaped_identifier_impl)(s)?; let (s, a) = ws(escaped_identifier_impl)(s)?;
Ok((s, EscapedIdentifier { nodes: a })) Ok((s, EscapedIdentifier { nodes: a }))
} }
#[trace]
pub fn escaped_identifier_impl(s: Span) -> IResult<Span, Span> { pub fn escaped_identifier_impl(s: Span) -> IResult<Span, Span> {
let (s, a) = tag("\\")(s)?; let (s, a) = tag("\\")(s)?;
let (s, b) = is_not(" \t\r\n")(s)?; let (s, b) = is_not(" \t\r\n")(s)?;
@ -657,46 +678,55 @@ pub fn escaped_identifier_impl(s: Span) -> IResult<Span, Span> {
Ok((s, a)) Ok((s, a))
} }
#[trace]
pub fn formal_identifier(s: Span) -> IResult<Span, FormalIdentifier> { pub fn formal_identifier(s: Span) -> IResult<Span, FormalIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, FormalIdentifier { nodes: (a,) })) Ok((s, FormalIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn formal_port_identifier(s: Span) -> IResult<Span, FormalPortIdentifier> { pub fn formal_port_identifier(s: Span) -> IResult<Span, FormalPortIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, FormalPortIdentifier { nodes: (a,) })) Ok((s, FormalPortIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn function_identifier(s: Span) -> IResult<Span, FunctionIdentifier> { pub fn function_identifier(s: Span) -> IResult<Span, FunctionIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, FunctionIdentifier { nodes: (a,) })) Ok((s, FunctionIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn generate_block_identifier(s: Span) -> IResult<Span, GenerateBlockIdentifier> { pub fn generate_block_identifier(s: Span) -> IResult<Span, GenerateBlockIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, GenerateBlockIdentifier { nodes: (a,) })) Ok((s, GenerateBlockIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn genvar_identifier(s: Span) -> IResult<Span, GenvarIdentifier> { pub fn genvar_identifier(s: Span) -> IResult<Span, GenvarIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, GenvarIdentifier { nodes: (a,) })) Ok((s, GenvarIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn hierarchical_array_identifier(s: Span) -> IResult<Span, HierarchicalArrayIdentifier> { pub fn hierarchical_array_identifier(s: Span) -> IResult<Span, HierarchicalArrayIdentifier> {
let (s, a) = hierarchical_identifier(s)?; let (s, a) = hierarchical_identifier(s)?;
Ok((s, HierarchicalArrayIdentifier { nodes: (a,) })) Ok((s, HierarchicalArrayIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn hierarchical_block_identifier(s: Span) -> IResult<Span, HierarchicalBlockIdentifier> { pub fn hierarchical_block_identifier(s: Span) -> IResult<Span, HierarchicalBlockIdentifier> {
let (s, a) = hierarchical_identifier(s)?; let (s, a) = hierarchical_identifier(s)?;
Ok((s, HierarchicalBlockIdentifier { nodes: (a,) })) Ok((s, HierarchicalBlockIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn hierarchical_event_identifier(s: Span) -> IResult<Span, HierarchicalEventIdentifier> { pub fn hierarchical_event_identifier(s: Span) -> IResult<Span, HierarchicalEventIdentifier> {
let (s, a) = hierarchical_identifier(s)?; let (s, a) = hierarchical_identifier(s)?;
Ok((s, HierarchicalEventIdentifier { nodes: (a,) })) Ok((s, HierarchicalEventIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn hierarchical_identifier(s: Span) -> IResult<Span, HierarchicalIdentifier> { pub fn hierarchical_identifier(s: Span) -> IResult<Span, HierarchicalIdentifier> {
let (s, a) = opt(root)(s)?; let (s, a) = opt(root)(s)?;
let (s, b) = many0(triple(identifier, constant_bit_select, symbol(".")))(s)?; let (s, b) = many0(triple(identifier, constant_bit_select, symbol(".")))(s)?;
@ -704,17 +734,20 @@ pub fn hierarchical_identifier(s: Span) -> IResult<Span, HierarchicalIdentifier>
Ok((s, HierarchicalIdentifier { nodes: (a, b, c) })) Ok((s, HierarchicalIdentifier { nodes: (a, b, c) }))
} }
#[trace]
pub fn root(s: Span) -> IResult<Span, Root> { pub fn root(s: Span) -> IResult<Span, Root> {
let (s, a) = symbol("$root")(s)?; let (s, a) = symbol("$root")(s)?;
let (s, b) = symbol(".")(s)?; let (s, b) = symbol(".")(s)?;
Ok((s, Root { nodes: (a, b) })) Ok((s, Root { nodes: (a, b) }))
} }
#[trace]
pub fn hierarchical_net_identifier(s: Span) -> IResult<Span, HierarchicalNetIdentifier> { pub fn hierarchical_net_identifier(s: Span) -> IResult<Span, HierarchicalNetIdentifier> {
let (s, a) = hierarchical_identifier(s)?; let (s, a) = hierarchical_identifier(s)?;
Ok((s, HierarchicalNetIdentifier { nodes: (a,) })) Ok((s, HierarchicalNetIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn hierarchical_parameter_identifier( pub fn hierarchical_parameter_identifier(
s: Span, s: Span,
) -> IResult<Span, HierarchicalParameterIdentifier> { ) -> IResult<Span, HierarchicalParameterIdentifier> {
@ -722,31 +755,37 @@ pub fn hierarchical_parameter_identifier(
Ok((s, HierarchicalParameterIdentifier { nodes: (a,) })) Ok((s, HierarchicalParameterIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn hierarchical_property_identifier(s: Span) -> IResult<Span, HierarchicalPropertyIdentifier> { pub fn hierarchical_property_identifier(s: Span) -> IResult<Span, HierarchicalPropertyIdentifier> {
let (s, a) = hierarchical_identifier(s)?; let (s, a) = hierarchical_identifier(s)?;
Ok((s, HierarchicalPropertyIdentifier { nodes: (a,) })) Ok((s, HierarchicalPropertyIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn hierarchical_sequence_identifier(s: Span) -> IResult<Span, HierarchicalSequenceIdentifier> { pub fn hierarchical_sequence_identifier(s: Span) -> IResult<Span, HierarchicalSequenceIdentifier> {
let (s, a) = hierarchical_identifier(s)?; let (s, a) = hierarchical_identifier(s)?;
Ok((s, HierarchicalSequenceIdentifier { nodes: (a,) })) Ok((s, HierarchicalSequenceIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn hierarchical_task_identifier(s: Span) -> IResult<Span, HierarchicalTaskIdentifier> { pub fn hierarchical_task_identifier(s: Span) -> IResult<Span, HierarchicalTaskIdentifier> {
let (s, a) = hierarchical_identifier(s)?; let (s, a) = hierarchical_identifier(s)?;
Ok((s, HierarchicalTaskIdentifier { nodes: (a,) })) Ok((s, HierarchicalTaskIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn hierarchical_tf_identifier(s: Span) -> IResult<Span, HierarchicalTfIdentifier> { pub fn hierarchical_tf_identifier(s: Span) -> IResult<Span, HierarchicalTfIdentifier> {
let (s, a) = hierarchical_identifier(s)?; let (s, a) = hierarchical_identifier(s)?;
Ok((s, HierarchicalTfIdentifier { nodes: (a,) })) Ok((s, HierarchicalTfIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn hierarchical_variable_identifier(s: Span) -> IResult<Span, HierarchicalVariableIdentifier> { pub fn hierarchical_variable_identifier(s: Span) -> IResult<Span, HierarchicalVariableIdentifier> {
let (s, a) = hierarchical_identifier(s)?; let (s, a) = hierarchical_identifier(s)?;
Ok((s, HierarchicalVariableIdentifier { nodes: (a,) })) Ok((s, HierarchicalVariableIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn identifier(s: Span) -> IResult<Span, Identifier> { pub fn identifier(s: Span) -> IResult<Span, Identifier> {
alt(( alt((
map(escaped_identifier, |x| Identifier::EscapedIdentifier(x)), map(escaped_identifier, |x| Identifier::EscapedIdentifier(x)),
@ -754,85 +793,102 @@ pub fn identifier(s: Span) -> IResult<Span, Identifier> {
))(s) ))(s)
} }
#[trace]
pub fn index_variable_identifier(s: Span) -> IResult<Span, IndexVariableIdentifier> { pub fn index_variable_identifier(s: Span) -> IResult<Span, IndexVariableIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, IndexVariableIdentifier { nodes: (a,) })) Ok((s, IndexVariableIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn interface_identifier(s: Span) -> IResult<Span, InterfaceIdentifier> { pub fn interface_identifier(s: Span) -> IResult<Span, InterfaceIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, InterfaceIdentifier { nodes: (a,) })) Ok((s, InterfaceIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn interface_instance_identifier(s: Span) -> IResult<Span, InterfaceInstanceIdentifier> { pub fn interface_instance_identifier(s: Span) -> IResult<Span, InterfaceInstanceIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, InterfaceInstanceIdentifier { nodes: (a,) })) Ok((s, InterfaceInstanceIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn inout_port_identifier(s: Span) -> IResult<Span, InoutPortIdentifier> { pub fn inout_port_identifier(s: Span) -> IResult<Span, InoutPortIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, InoutPortIdentifier { nodes: (a,) })) Ok((s, InoutPortIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn input_port_identifier(s: Span) -> IResult<Span, InputPortIdentifier> { pub fn input_port_identifier(s: Span) -> IResult<Span, InputPortIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, InputPortIdentifier { nodes: (a,) })) Ok((s, InputPortIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn instance_identifier(s: Span) -> IResult<Span, InstanceIdentifier> { pub fn instance_identifier(s: Span) -> IResult<Span, InstanceIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, InstanceIdentifier { nodes: (a,) })) Ok((s, InstanceIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn library_identifier(s: Span) -> IResult<Span, LibraryIdentifier> { pub fn library_identifier(s: Span) -> IResult<Span, LibraryIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, LibraryIdentifier { nodes: (a,) })) Ok((s, LibraryIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn member_identifier(s: Span) -> IResult<Span, MemberIdentifier> { pub fn member_identifier(s: Span) -> IResult<Span, MemberIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, MemberIdentifier { nodes: (a,) })) Ok((s, MemberIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn method_identifier(s: Span) -> IResult<Span, MethodIdentifier> { pub fn method_identifier(s: Span) -> IResult<Span, MethodIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, MethodIdentifier { nodes: (a,) })) Ok((s, MethodIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn modport_identifier(s: Span) -> IResult<Span, ModportIdentifier> { pub fn modport_identifier(s: Span) -> IResult<Span, ModportIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, ModportIdentifier { nodes: (a,) })) Ok((s, ModportIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn module_identifier(s: Span) -> IResult<Span, ModuleIdentifier> { pub fn module_identifier(s: Span) -> IResult<Span, ModuleIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, ModuleIdentifier { nodes: (a,) })) Ok((s, ModuleIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn net_identifier(s: Span) -> IResult<Span, NetIdentifier> { pub fn net_identifier(s: Span) -> IResult<Span, NetIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, NetIdentifier { nodes: (a,) })) Ok((s, NetIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn net_type_identifier(s: Span) -> IResult<Span, NetTypeIdentifier> { pub fn net_type_identifier(s: Span) -> IResult<Span, NetTypeIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, NetTypeIdentifier { nodes: (a,) })) Ok((s, NetTypeIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn output_port_identifier(s: Span) -> IResult<Span, OutputPortIdentifier> { pub fn output_port_identifier(s: Span) -> IResult<Span, OutputPortIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, OutputPortIdentifier { nodes: (a,) })) Ok((s, OutputPortIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn package_identifier(s: Span) -> IResult<Span, PackageIdentifier> { pub fn package_identifier(s: Span) -> IResult<Span, PackageIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, PackageIdentifier { nodes: (a,) })) Ok((s, PackageIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn package_scope(s: Span) -> IResult<Span, PackageScope> { pub fn package_scope(s: Span) -> IResult<Span, PackageScope> {
alt((package_scope_package, map(unit, |x| PackageScope::Unit(x))))(s) alt((package_scope_package, map(unit, |x| PackageScope::Unit(x))))(s)
} }
#[trace]
pub fn package_scope_package(s: Span) -> IResult<Span, PackageScope> { pub fn package_scope_package(s: Span) -> IResult<Span, PackageScope> {
let (s, a) = package_identifier(s)?; let (s, a) = package_identifier(s)?;
let (s, b) = symbol("::")(s)?; let (s, b) = symbol("::")(s)?;
@ -842,61 +898,72 @@ pub fn package_scope_package(s: Span) -> IResult<Span, PackageScope> {
)) ))
} }
#[trace]
pub fn unit(s: Span) -> IResult<Span, Unit> { pub fn unit(s: Span) -> IResult<Span, Unit> {
let (s, a) = symbol("$unit")(s)?; let (s, a) = symbol("$unit")(s)?;
let (s, b) = symbol("::")(s)?; let (s, b) = symbol("::")(s)?;
Ok((s, Unit { nodes: (a, b) })) Ok((s, Unit { nodes: (a, b) }))
} }
#[trace]
pub fn parameter_identifier(s: Span) -> IResult<Span, ParameterIdentifier> { pub fn parameter_identifier(s: Span) -> IResult<Span, ParameterIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, ParameterIdentifier { nodes: (a,) })) Ok((s, ParameterIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn port_identifier(s: Span) -> IResult<Span, PortIdentifier> { pub fn port_identifier(s: Span) -> IResult<Span, PortIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, PortIdentifier { nodes: (a,) })) Ok((s, PortIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn production_identifier(s: Span) -> IResult<Span, ProductionIdentifier> { pub fn production_identifier(s: Span) -> IResult<Span, ProductionIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, ProductionIdentifier { nodes: (a,) })) Ok((s, ProductionIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn program_identifier(s: Span) -> IResult<Span, ProgramIdentifier> { pub fn program_identifier(s: Span) -> IResult<Span, ProgramIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, ProgramIdentifier { nodes: (a,) })) Ok((s, ProgramIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn property_identifier(s: Span) -> IResult<Span, PropertyIdentifier> { pub fn property_identifier(s: Span) -> IResult<Span, PropertyIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, PropertyIdentifier { nodes: (a,) })) Ok((s, PropertyIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn ps_class_identifier(s: Span) -> IResult<Span, PsClassIdentifier> { pub fn ps_class_identifier(s: Span) -> IResult<Span, PsClassIdentifier> {
let (s, a) = opt(package_scope)(s)?; let (s, a) = opt(package_scope)(s)?;
let (s, b) = class_identifier(s)?; let (s, b) = class_identifier(s)?;
Ok((s, PsClassIdentifier { nodes: (a, b) })) Ok((s, PsClassIdentifier { nodes: (a, b) }))
} }
#[trace]
pub fn ps_covergroup_identifier(s: Span) -> IResult<Span, PsCovergroupIdentifier> { pub fn ps_covergroup_identifier(s: Span) -> IResult<Span, PsCovergroupIdentifier> {
let (s, a) = opt(package_scope)(s)?; let (s, a) = opt(package_scope)(s)?;
let (s, b) = covergroup_identifier(s)?; let (s, b) = covergroup_identifier(s)?;
Ok((s, PsCovergroupIdentifier { nodes: (a, b) })) Ok((s, PsCovergroupIdentifier { nodes: (a, b) }))
} }
#[trace]
pub fn ps_checker_identifier(s: Span) -> IResult<Span, PsCheckerIdentifier> { pub fn ps_checker_identifier(s: Span) -> IResult<Span, PsCheckerIdentifier> {
let (s, a) = opt(package_scope)(s)?; let (s, a) = opt(package_scope)(s)?;
let (s, b) = checker_identifier(s)?; let (s, b) = checker_identifier(s)?;
Ok((s, PsCheckerIdentifier { nodes: (a, b) })) Ok((s, PsCheckerIdentifier { nodes: (a, b) }))
} }
#[trace]
pub fn ps_identifier(s: Span) -> IResult<Span, PsIdentifier> { pub fn ps_identifier(s: Span) -> IResult<Span, PsIdentifier> {
let (s, a) = opt(package_scope)(s)?; let (s, a) = opt(package_scope)(s)?;
let (s, b) = identifier(s)?; let (s, b) = identifier(s)?;
Ok((s, PsIdentifier { nodes: (a, b) })) Ok((s, PsIdentifier { nodes: (a, b) }))
} }
#[trace]
pub fn ps_or_hierarchical_array_identifier( pub fn ps_or_hierarchical_array_identifier(
s: Span, s: Span,
) -> IResult<Span, PsOrHierarchicalArrayIdentifier> { ) -> IResult<Span, PsOrHierarchicalArrayIdentifier> {
@ -905,6 +972,7 @@ pub fn ps_or_hierarchical_array_identifier(
Ok((s, PsOrHierarchicalArrayIdentifier { nodes: (a, b) })) Ok((s, PsOrHierarchicalArrayIdentifier { nodes: (a, b) }))
} }
#[trace]
pub fn ps_or_hierarchical_net_identifier(s: Span) -> IResult<Span, PsOrHierarchicalNetIdentifier> { pub fn ps_or_hierarchical_net_identifier(s: Span) -> IResult<Span, PsOrHierarchicalNetIdentifier> {
alt(( alt((
ps_or_hierarchical_net_identifier_package_scope, ps_or_hierarchical_net_identifier_package_scope,
@ -914,6 +982,7 @@ pub fn ps_or_hierarchical_net_identifier(s: Span) -> IResult<Span, PsOrHierarchi
))(s) ))(s)
} }
#[trace]
pub fn ps_or_hierarchical_net_identifier_package_scope( pub fn ps_or_hierarchical_net_identifier_package_scope(
s: Span, s: Span,
) -> IResult<Span, PsOrHierarchicalNetIdentifier> { ) -> IResult<Span, PsOrHierarchicalNetIdentifier> {
@ -927,6 +996,7 @@ pub fn ps_or_hierarchical_net_identifier_package_scope(
)) ))
} }
#[trace]
pub fn ps_or_hierarchical_property_identifier( pub fn ps_or_hierarchical_property_identifier(
s: Span, s: Span,
) -> IResult<Span, PsOrHierarchicalPropertyIdentifier> { ) -> IResult<Span, PsOrHierarchicalPropertyIdentifier> {
@ -938,6 +1008,7 @@ pub fn ps_or_hierarchical_property_identifier(
))(s) ))(s)
} }
#[trace]
pub fn ps_or_hierarchical_property_identifier_package_scope( pub fn ps_or_hierarchical_property_identifier_package_scope(
s: Span, s: Span,
) -> IResult<Span, PsOrHierarchicalPropertyIdentifier> { ) -> IResult<Span, PsOrHierarchicalPropertyIdentifier> {
@ -951,6 +1022,7 @@ pub fn ps_or_hierarchical_property_identifier_package_scope(
)) ))
} }
#[trace]
pub fn ps_or_hierarchical_sequence_identifier( pub fn ps_or_hierarchical_sequence_identifier(
s: Span, s: Span,
) -> IResult<Span, PsOrHierarchicalSequenceIdentifier> { ) -> IResult<Span, PsOrHierarchicalSequenceIdentifier> {
@ -962,6 +1034,7 @@ pub fn ps_or_hierarchical_sequence_identifier(
))(s) ))(s)
} }
#[trace]
pub fn ps_or_hierarchical_sequence_identifier_package_scope( pub fn ps_or_hierarchical_sequence_identifier_package_scope(
s: Span, s: Span,
) -> IResult<Span, PsOrHierarchicalSequenceIdentifier> { ) -> IResult<Span, PsOrHierarchicalSequenceIdentifier> {
@ -975,6 +1048,7 @@ pub fn ps_or_hierarchical_sequence_identifier_package_scope(
)) ))
} }
#[trace]
pub fn ps_or_hierarchical_tf_identifier(s: Span) -> IResult<Span, PsOrHierarchicalTfIdentifier> { pub fn ps_or_hierarchical_tf_identifier(s: Span) -> IResult<Span, PsOrHierarchicalTfIdentifier> {
alt(( alt((
ps_or_hierarchical_tf_identifier_package_scope, ps_or_hierarchical_tf_identifier_package_scope,
@ -984,6 +1058,7 @@ pub fn ps_or_hierarchical_tf_identifier(s: Span) -> IResult<Span, PsOrHierarchic
))(s) ))(s)
} }
#[trace]
pub fn ps_or_hierarchical_tf_identifier_package_scope( pub fn ps_or_hierarchical_tf_identifier_package_scope(
s: Span, s: Span,
) -> IResult<Span, PsOrHierarchicalTfIdentifier> { ) -> IResult<Span, PsOrHierarchicalTfIdentifier> {
@ -997,6 +1072,7 @@ pub fn ps_or_hierarchical_tf_identifier_package_scope(
)) ))
} }
#[trace]
pub fn ps_parameter_identifier(s: Span) -> IResult<Span, PsParameterIdentifier> { pub fn ps_parameter_identifier(s: Span) -> IResult<Span, PsParameterIdentifier> {
alt(( alt((
ps_parameter_identifier_scope, ps_parameter_identifier_scope,
@ -1004,6 +1080,7 @@ pub fn ps_parameter_identifier(s: Span) -> IResult<Span, PsParameterIdentifier>
))(s) ))(s)
} }
#[trace]
pub fn ps_parameter_identifier_scope(s: Span) -> IResult<Span, PsParameterIdentifier> { pub fn ps_parameter_identifier_scope(s: Span) -> IResult<Span, PsParameterIdentifier> {
let (s, a) = opt(package_scope_or_class_scope)(s)?; let (s, a) = opt(package_scope_or_class_scope)(s)?;
let (s, b) = parameter_identifier(s)?; let (s, b) = parameter_identifier(s)?;
@ -1013,6 +1090,7 @@ pub fn ps_parameter_identifier_scope(s: Span) -> IResult<Span, PsParameterIdenti
)) ))
} }
#[trace]
pub fn ps_parameter_identifier_generate(s: Span) -> IResult<Span, PsParameterIdentifier> { pub fn ps_parameter_identifier_generate(s: Span) -> IResult<Span, PsParameterIdentifier> {
let (s, a) = many0(triple( let (s, a) = many0(triple(
generate_block_identifier, generate_block_identifier,
@ -1026,27 +1104,32 @@ pub fn ps_parameter_identifier_generate(s: Span) -> IResult<Span, PsParameterIde
)) ))
} }
#[trace]
pub fn ps_type_identifier(s: Span) -> IResult<Span, PsTypeIdentifier> { pub fn ps_type_identifier(s: Span) -> IResult<Span, PsTypeIdentifier> {
let (s, a) = opt(local_or_package_scope_or_class_scope)(s)?; let (s, a) = opt(local_or_package_scope_or_class_scope)(s)?;
let (s, b) = type_identifier(s)?; let (s, b) = type_identifier(s)?;
Ok((s, PsTypeIdentifier { nodes: (a, b) })) Ok((s, PsTypeIdentifier { nodes: (a, b) }))
} }
#[trace]
pub fn sequence_identifier(s: Span) -> IResult<Span, SequenceIdentifier> { pub fn sequence_identifier(s: Span) -> IResult<Span, SequenceIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, SequenceIdentifier { nodes: (a,) })) Ok((s, SequenceIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn signal_identifier(s: Span) -> IResult<Span, SignalIdentifier> { pub fn signal_identifier(s: Span) -> IResult<Span, SignalIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, SignalIdentifier { nodes: (a,) })) Ok((s, SignalIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn simple_identifier(s: Span) -> IResult<Span, SimpleIdentifier> { pub fn simple_identifier(s: Span) -> IResult<Span, SimpleIdentifier> {
let (s, a) = ws(simple_identifier_impl)(s)?; let (s, a) = ws(simple_identifier_impl)(s)?;
Ok((s, SimpleIdentifier { nodes: a })) Ok((s, SimpleIdentifier { nodes: a }))
} }
#[trace]
pub fn simple_identifier_impl(s: Span) -> IResult<Span, Span> { pub fn simple_identifier_impl(s: Span) -> IResult<Span, Span> {
let (s, a) = is_a(AZ_)(s)?; let (s, a) = is_a(AZ_)(s)?;
let (s, b) = opt(is_a(AZ09_DOLLAR))(s)?; let (s, b) = opt(is_a(AZ09_DOLLAR))(s)?;
@ -1058,16 +1141,19 @@ pub fn simple_identifier_impl(s: Span) -> IResult<Span, Span> {
Ok((s, a)) Ok((s, a))
} }
#[trace]
pub fn specparam_identifier(s: Span) -> IResult<Span, SpecparamIdentifier> { pub fn specparam_identifier(s: Span) -> IResult<Span, SpecparamIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, SpecparamIdentifier { nodes: (a,) })) Ok((s, SpecparamIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn system_tf_identifier(s: Span) -> IResult<Span, SystemTfIdentifier> { pub fn system_tf_identifier(s: Span) -> IResult<Span, SystemTfIdentifier> {
let (s, a) = ws(system_tf_identifier_impl)(s)?; let (s, a) = ws(system_tf_identifier_impl)(s)?;
Ok((s, SystemTfIdentifier { nodes: a })) Ok((s, SystemTfIdentifier { nodes: a }))
} }
#[trace]
pub fn system_tf_identifier_impl(s: Span) -> IResult<Span, Span> { pub fn system_tf_identifier_impl(s: Span) -> IResult<Span, Span> {
let (s, a) = tag("$")(s)?; let (s, a) = tag("$")(s)?;
let (s, b) = is_a(AZ09_DOLLAR)(s)?; let (s, b) = is_a(AZ09_DOLLAR)(s)?;
@ -1075,41 +1161,49 @@ pub fn system_tf_identifier_impl(s: Span) -> IResult<Span, Span> {
Ok((s, a)) Ok((s, a))
} }
#[trace]
pub fn task_identifier(s: Span) -> IResult<Span, TaskIdentifier> { pub fn task_identifier(s: Span) -> IResult<Span, TaskIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, TaskIdentifier { nodes: (a,) })) Ok((s, TaskIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn tf_identifier(s: Span) -> IResult<Span, TfIdentifier> { pub fn tf_identifier(s: Span) -> IResult<Span, TfIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, TfIdentifier { nodes: (a,) })) Ok((s, TfIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn terminal_identifier(s: Span) -> IResult<Span, TerminalIdentifier> { pub fn terminal_identifier(s: Span) -> IResult<Span, TerminalIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, TerminalIdentifier { nodes: (a,) })) Ok((s, TerminalIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn topmodule_identifier(s: Span) -> IResult<Span, TopmoduleIdentifier> { pub fn topmodule_identifier(s: Span) -> IResult<Span, TopmoduleIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, TopmoduleIdentifier { nodes: (a,) })) Ok((s, TopmoduleIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn type_identifier(s: Span) -> IResult<Span, TypeIdentifier> { pub fn type_identifier(s: Span) -> IResult<Span, TypeIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, TypeIdentifier { nodes: (a,) })) Ok((s, TypeIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn udp_identifier(s: Span) -> IResult<Span, UdpIdentifier> { pub fn udp_identifier(s: Span) -> IResult<Span, UdpIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, UdpIdentifier { nodes: (a,) })) Ok((s, UdpIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn variable_identifier(s: Span) -> IResult<Span, VariableIdentifier> { pub fn variable_identifier(s: Span) -> IResult<Span, VariableIdentifier> {
let (s, a) = identifier(s)?; let (s, a) = identifier(s)?;
Ok((s, VariableIdentifier { nodes: (a,) })) Ok((s, VariableIdentifier { nodes: (a,) }))
} }
#[trace]
pub fn implicit_class_handle_or_class_scope_or_package_scope( pub fn implicit_class_handle_or_class_scope_or_package_scope(
s: Span, s: Span,
) -> IResult<Span, ImplicitClassHandleOrClassScopeOrPackageScope> { ) -> IResult<Span, ImplicitClassHandleOrClassScopeOrPackageScope> {
@ -1126,6 +1220,7 @@ pub fn implicit_class_handle_or_class_scope_or_package_scope(
))(s) ))(s)
} }
#[trace]
pub fn implicit_class_handle_or_package_scope( pub fn implicit_class_handle_or_package_scope(
s: Span, s: Span,
) -> IResult<Span, ImplicitClassHandleOrPackageScope> { ) -> IResult<Span, ImplicitClassHandleOrPackageScope> {
@ -1139,6 +1234,7 @@ pub fn implicit_class_handle_or_package_scope(
))(s) ))(s)
} }
#[trace]
pub fn implicit_class_handle_or_class_scope( pub fn implicit_class_handle_or_class_scope(
s: Span, s: Span,
) -> IResult<Span, ImplicitClassHandleOrClassScope> { ) -> IResult<Span, ImplicitClassHandleOrClassScope> {
@ -1152,6 +1248,7 @@ pub fn implicit_class_handle_or_class_scope(
))(s) ))(s)
} }
#[trace]
pub fn package_scope_or_class_scope(s: Span) -> IResult<Span, PackageScopeOrClassScope> { pub fn package_scope_or_class_scope(s: Span) -> IResult<Span, PackageScopeOrClassScope> {
alt(( alt((
map(package_scope, |x| PackageScopeOrClassScope::PackageScope(x)), map(package_scope, |x| PackageScopeOrClassScope::PackageScope(x)),
@ -1159,6 +1256,7 @@ pub fn package_scope_or_class_scope(s: Span) -> IResult<Span, PackageScopeOrClas
))(s) ))(s)
} }
#[trace]
pub fn local_or_package_scope_or_class_scope( pub fn local_or_package_scope_or_class_scope(
s: Span, s: Span,
) -> IResult<Span, LocalOrPackageScopeOrClassScope> { ) -> IResult<Span, LocalOrPackageScopeOrClassScope> {
@ -1173,6 +1271,7 @@ pub fn local_or_package_scope_or_class_scope(
))(s) ))(s)
} }
#[trace]
pub fn local(s: Span) -> IResult<Span, Local> { pub fn local(s: Span) -> IResult<Span, Local> {
let (s, a) = symbol("local")(s)?; let (s, a) = symbol("local")(s)?;
let (s, b) = symbol("::")(s)?; let (s, b) = symbol("::")(s)?;

View File

@ -61,6 +61,7 @@ pub struct NamedCheckerPortConnectionAsterisk<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn checker_instantiation(s: Span) -> IResult<Span, CheckerInstantiation> { pub fn checker_instantiation(s: Span) -> IResult<Span, CheckerInstantiation> {
let (s, a) = ps_checker_identifier(s)?; let (s, a) = ps_checker_identifier(s)?;
let (s, b) = name_of_instance(s)?; let (s, b) = name_of_instance(s)?;
@ -74,6 +75,7 @@ pub fn checker_instantiation(s: Span) -> IResult<Span, CheckerInstantiation> {
)) ))
} }
#[trace]
pub fn list_of_checker_port_connections(s: Span) -> IResult<Span, ListOfCheckerPortConnections> { pub fn list_of_checker_port_connections(s: Span) -> IResult<Span, ListOfCheckerPortConnections> {
alt(( alt((
list_of_checker_port_connections_ordered, list_of_checker_port_connections_ordered,
@ -81,6 +83,7 @@ pub fn list_of_checker_port_connections(s: Span) -> IResult<Span, ListOfCheckerP
))(s) ))(s)
} }
#[trace]
pub fn list_of_checker_port_connections_ordered( pub fn list_of_checker_port_connections_ordered(
s: Span, s: Span,
) -> IResult<Span, ListOfCheckerPortConnections> { ) -> IResult<Span, ListOfCheckerPortConnections> {
@ -91,6 +94,7 @@ pub fn list_of_checker_port_connections_ordered(
)) ))
} }
#[trace]
pub fn list_of_checker_port_connections_named( pub fn list_of_checker_port_connections_named(
s: Span, s: Span,
) -> IResult<Span, ListOfCheckerPortConnections> { ) -> IResult<Span, ListOfCheckerPortConnections> {
@ -101,12 +105,14 @@ pub fn list_of_checker_port_connections_named(
)) ))
} }
#[trace]
pub fn ordered_checker_port_connection(s: Span) -> IResult<Span, OrderedCheckerPortConnection> { pub fn ordered_checker_port_connection(s: Span) -> IResult<Span, OrderedCheckerPortConnection> {
let (s, x) = many0(attribute_instance)(s)?; let (s, x) = many0(attribute_instance)(s)?;
let (s, y) = opt(property_actual_arg)(s)?; let (s, y) = opt(property_actual_arg)(s)?;
Ok((s, OrderedCheckerPortConnection { nodes: (x, y) })) Ok((s, OrderedCheckerPortConnection { nodes: (x, y) }))
} }
#[trace]
pub fn named_checker_port_connection(s: Span) -> IResult<Span, NamedCheckerPortConnection> { pub fn named_checker_port_connection(s: Span) -> IResult<Span, NamedCheckerPortConnection> {
alt(( alt((
named_checker_port_connection_identifier, named_checker_port_connection_identifier,
@ -114,6 +120,7 @@ pub fn named_checker_port_connection(s: Span) -> IResult<Span, NamedCheckerPortC
))(s) ))(s)
} }
#[trace]
pub fn named_checker_port_connection_identifier( pub fn named_checker_port_connection_identifier(
s: Span, s: Span,
) -> IResult<Span, NamedCheckerPortConnection> { ) -> IResult<Span, NamedCheckerPortConnection> {
@ -129,6 +136,7 @@ pub fn named_checker_port_connection_identifier(
)) ))
} }
#[trace]
pub fn named_checker_port_connection_asterisk( pub fn named_checker_port_connection_asterisk(
s: Span, s: Span,
) -> IResult<Span, NamedCheckerPortConnection> { ) -> IResult<Span, NamedCheckerPortConnection> {

View File

@ -145,6 +145,7 @@ pub enum GenerateItem<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn generate_region(s: Span) -> IResult<Span, GenerateRegion> { pub fn generate_region(s: Span) -> IResult<Span, GenerateRegion> {
let (s, a) = symbol("generate")(s)?; let (s, a) = symbol("generate")(s)?;
let (s, b) = many0(generate_item)(s)?; let (s, b) = many0(generate_item)(s)?;
@ -152,6 +153,7 @@ pub fn generate_region(s: Span) -> IResult<Span, GenerateRegion> {
Ok((s, GenerateRegion { nodes: (a, b, c) })) Ok((s, GenerateRegion { nodes: (a, b, c) }))
} }
#[trace]
pub fn loop_generate_construct(s: Span) -> IResult<Span, LoopGenerateConstruct> { pub fn loop_generate_construct(s: Span) -> IResult<Span, LoopGenerateConstruct> {
let (s, a) = symbol("for")(s)?; let (s, a) = symbol("for")(s)?;
let (s, b) = paren(tuple(( let (s, b) = paren(tuple((
@ -165,6 +167,7 @@ pub fn loop_generate_construct(s: Span) -> IResult<Span, LoopGenerateConstruct>
Ok((s, LoopGenerateConstruct { nodes: (a, b, c) })) Ok((s, LoopGenerateConstruct { nodes: (a, b, c) }))
} }
#[trace]
pub fn generate_initialization(s: Span) -> IResult<Span, GenvarInitialization> { pub fn generate_initialization(s: Span) -> IResult<Span, GenvarInitialization> {
let (s, a) = opt(map(symbol("genvar"), |x| Genvar { nodes: (x,) }))(s)?; let (s, a) = opt(map(symbol("genvar"), |x| Genvar { nodes: (x,) }))(s)?;
let (s, b) = genvar_identifier(s)?; let (s, b) = genvar_identifier(s)?;
@ -178,6 +181,7 @@ pub fn generate_initialization(s: Span) -> IResult<Span, GenvarInitialization> {
)) ))
} }
#[trace]
pub fn genvar_iteration(s: Span) -> IResult<Span, GenvarIteration> { pub fn genvar_iteration(s: Span) -> IResult<Span, GenvarIteration> {
alt(( alt((
genvar_iteration_assignment, genvar_iteration_assignment,
@ -186,6 +190,7 @@ pub fn genvar_iteration(s: Span) -> IResult<Span, GenvarIteration> {
))(s) ))(s)
} }
#[trace]
pub fn genvar_iteration_assignment(s: Span) -> IResult<Span, GenvarIteration> { pub fn genvar_iteration_assignment(s: Span) -> IResult<Span, GenvarIteration> {
let (s, a) = genvar_identifier(s)?; let (s, a) = genvar_identifier(s)?;
let (s, b) = assignment_operator(s)?; let (s, b) = assignment_operator(s)?;
@ -196,6 +201,7 @@ pub fn genvar_iteration_assignment(s: Span) -> IResult<Span, GenvarIteration> {
)) ))
} }
#[trace]
pub fn genvar_iteration_prefix(s: Span) -> IResult<Span, GenvarIteration> { pub fn genvar_iteration_prefix(s: Span) -> IResult<Span, GenvarIteration> {
let (s, a) = inc_or_dec_operator(s)?; let (s, a) = inc_or_dec_operator(s)?;
let (s, b) = genvar_identifier(s)?; let (s, b) = genvar_identifier(s)?;
@ -205,6 +211,7 @@ pub fn genvar_iteration_prefix(s: Span) -> IResult<Span, GenvarIteration> {
)) ))
} }
#[trace]
pub fn genvar_iteration_suffix(s: Span) -> IResult<Span, GenvarIteration> { pub fn genvar_iteration_suffix(s: Span) -> IResult<Span, GenvarIteration> {
let (s, a) = genvar_identifier(s)?; let (s, a) = genvar_identifier(s)?;
let (s, b) = inc_or_dec_operator(s)?; let (s, b) = inc_or_dec_operator(s)?;
@ -214,6 +221,7 @@ pub fn genvar_iteration_suffix(s: Span) -> IResult<Span, GenvarIteration> {
)) ))
} }
#[trace]
pub fn conditional_generate_construct(s: Span) -> IResult<Span, ConditionalGenerateConstruct> { pub fn conditional_generate_construct(s: Span) -> IResult<Span, ConditionalGenerateConstruct> {
alt(( alt((
map(if_generate_construct, |x| { map(if_generate_construct, |x| {
@ -225,6 +233,7 @@ pub fn conditional_generate_construct(s: Span) -> IResult<Span, ConditionalGener
))(s) ))(s)
} }
#[trace]
pub fn if_generate_construct(s: Span) -> IResult<Span, IfGenerateConstruct> { pub fn if_generate_construct(s: Span) -> IResult<Span, IfGenerateConstruct> {
let (s, a) = symbol("if")(s)?; let (s, a) = symbol("if")(s)?;
let (s, b) = paren(constant_expression)(s)?; let (s, b) = paren(constant_expression)(s)?;
@ -238,6 +247,7 @@ pub fn if_generate_construct(s: Span) -> IResult<Span, IfGenerateConstruct> {
)) ))
} }
#[trace]
pub fn case_generate_construct(s: Span) -> IResult<Span, CaseGenerateConstruct> { pub fn case_generate_construct(s: Span) -> IResult<Span, CaseGenerateConstruct> {
let (s, a) = symbol("case")(s)?; let (s, a) = symbol("case")(s)?;
let (s, b) = paren(constant_expression)(s)?; let (s, b) = paren(constant_expression)(s)?;
@ -251,10 +261,12 @@ pub fn case_generate_construct(s: Span) -> IResult<Span, CaseGenerateConstruct>
)) ))
} }
#[trace]
pub fn case_generate_item(s: Span) -> IResult<Span, CaseGenerateItem> { pub fn case_generate_item(s: Span) -> IResult<Span, CaseGenerateItem> {
alt((case_generate_item_nondefault, case_generate_item_default))(s) alt((case_generate_item_nondefault, case_generate_item_default))(s)
} }
#[trace]
pub fn case_generate_item_nondefault(s: Span) -> IResult<Span, CaseGenerateItem> { pub fn case_generate_item_nondefault(s: Span) -> IResult<Span, CaseGenerateItem> {
let (s, a) = list(symbol(","), constant_expression)(s)?; let (s, a) = list(symbol(","), constant_expression)(s)?;
let (s, b) = symbol(":")(s)?; let (s, b) = symbol(":")(s)?;
@ -265,6 +277,7 @@ pub fn case_generate_item_nondefault(s: Span) -> IResult<Span, CaseGenerateItem>
)) ))
} }
#[trace]
pub fn case_generate_item_default(s: Span) -> IResult<Span, CaseGenerateItem> { pub fn case_generate_item_default(s: Span) -> IResult<Span, CaseGenerateItem> {
let (s, a) = symbol("default")(s)?; let (s, a) = symbol("default")(s)?;
let (s, b) = opt(symbol(":"))(s)?; let (s, b) = opt(symbol(":"))(s)?;
@ -275,6 +288,7 @@ pub fn case_generate_item_default(s: Span) -> IResult<Span, CaseGenerateItem> {
)) ))
} }
#[trace]
pub fn generate_block(s: Span) -> IResult<Span, GenerateBlock> { pub fn generate_block(s: Span) -> IResult<Span, GenerateBlock> {
alt(( alt((
map(generate_item, |x| GenerateBlock::GenerateItem(x)), map(generate_item, |x| GenerateBlock::GenerateItem(x)),
@ -282,6 +296,7 @@ pub fn generate_block(s: Span) -> IResult<Span, GenerateBlock> {
))(s) ))(s)
} }
#[trace]
pub fn generate_block_multiple(s: Span) -> IResult<Span, GenerateBlock> { pub fn generate_block_multiple(s: Span) -> IResult<Span, GenerateBlock> {
let (s, a) = opt(pair(generate_block_identifier, symbol(":")))(s)?; let (s, a) = opt(pair(generate_block_identifier, symbol(":")))(s)?;
let (s, b) = symbol("begin")(s)?; let (s, b) = symbol("begin")(s)?;
@ -297,6 +312,7 @@ pub fn generate_block_multiple(s: Span) -> IResult<Span, GenerateBlock> {
)) ))
} }
#[trace]
pub fn generate_item(s: Span) -> IResult<Span, GenerateItem> { pub fn generate_item(s: Span) -> IResult<Span, GenerateItem> {
alt(( alt((
map(module_or_generate_item, |x| { map(module_or_generate_item, |x| {

View File

@ -17,6 +17,7 @@ pub struct InterfaceInstantiation<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn interface_instantiation(s: Span) -> IResult<Span, InterfaceInstantiation> { pub fn interface_instantiation(s: Span) -> IResult<Span, InterfaceInstantiation> {
let (s, a) = interface_identifier(s)?; let (s, a) = interface_identifier(s)?;
let (s, b) = opt(parameter_value_assignment)(s)?; let (s, b) = opt(parameter_value_assignment)(s)?;

View File

@ -112,6 +112,7 @@ pub struct NamedPortConnectionAsterisk<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn module_instantiation(s: Span) -> IResult<Span, ModuleInstantiation> { pub fn module_instantiation(s: Span) -> IResult<Span, ModuleInstantiation> {
let (s, a) = module_identifier(s)?; let (s, a) = module_identifier(s)?;
let (s, b) = opt(parameter_value_assignment)(s)?; let (s, b) = opt(parameter_value_assignment)(s)?;
@ -125,12 +126,14 @@ pub fn module_instantiation(s: Span) -> IResult<Span, ModuleInstantiation> {
)) ))
} }
#[trace]
pub fn parameter_value_assignment(s: Span) -> IResult<Span, ParameterValueAssignment> { pub fn parameter_value_assignment(s: Span) -> IResult<Span, ParameterValueAssignment> {
let (s, a) = symbol("#")(s)?; let (s, a) = symbol("#")(s)?;
let (s, b) = paren(opt(list_of_parameter_assignments))(s)?; let (s, b) = paren(opt(list_of_parameter_assignments))(s)?;
Ok((s, ParameterValueAssignment { nodes: (a, b) })) Ok((s, ParameterValueAssignment { nodes: (a, b) }))
} }
#[trace]
pub fn list_of_parameter_assignments(s: Span) -> IResult<Span, ListOfParameterAssignments> { pub fn list_of_parameter_assignments(s: Span) -> IResult<Span, ListOfParameterAssignments> {
alt(( alt((
list_of_parameter_assignments_ordered, list_of_parameter_assignments_ordered,
@ -138,6 +141,7 @@ pub fn list_of_parameter_assignments(s: Span) -> IResult<Span, ListOfParameterAs
))(s) ))(s)
} }
#[trace]
pub fn list_of_parameter_assignments_ordered(s: Span) -> IResult<Span, ListOfParameterAssignments> { pub fn list_of_parameter_assignments_ordered(s: Span) -> IResult<Span, ListOfParameterAssignments> {
let (s, a) = list(symbol(","), ordered_parameter_assignment)(s)?; let (s, a) = list(symbol(","), ordered_parameter_assignment)(s)?;
Ok(( Ok((
@ -146,6 +150,7 @@ pub fn list_of_parameter_assignments_ordered(s: Span) -> IResult<Span, ListOfPar
)) ))
} }
#[trace]
pub fn list_of_parameter_assignments_named(s: Span) -> IResult<Span, ListOfParameterAssignments> { pub fn list_of_parameter_assignments_named(s: Span) -> IResult<Span, ListOfParameterAssignments> {
let (s, a) = list(symbol(","), named_parameter_assignment)(s)?; let (s, a) = list(symbol(","), named_parameter_assignment)(s)?;
Ok(( Ok((
@ -154,11 +159,13 @@ pub fn list_of_parameter_assignments_named(s: Span) -> IResult<Span, ListOfParam
)) ))
} }
#[trace]
pub fn ordered_parameter_assignment(s: Span) -> IResult<Span, OrderedParameterAssignment> { pub fn ordered_parameter_assignment(s: Span) -> IResult<Span, OrderedParameterAssignment> {
let (s, x) = param_expression(s)?; let (s, x) = param_expression(s)?;
Ok((s, OrderedParameterAssignment { nodes: (x,) })) Ok((s, OrderedParameterAssignment { nodes: (x,) }))
} }
#[trace]
pub fn named_parameter_assignment(s: Span) -> IResult<Span, NamedParameterAssignment> { pub fn named_parameter_assignment(s: Span) -> IResult<Span, NamedParameterAssignment> {
let (s, a) = symbol(".")(s)?; let (s, a) = symbol(".")(s)?;
let (s, b) = parameter_identifier(s)?; let (s, b) = parameter_identifier(s)?;
@ -166,18 +173,21 @@ pub fn named_parameter_assignment(s: Span) -> IResult<Span, NamedParameterAssign
Ok((s, NamedParameterAssignment { nodes: (a, b, c) })) Ok((s, NamedParameterAssignment { nodes: (a, b, c) }))
} }
#[trace]
pub fn hierarchical_instance(s: Span) -> IResult<Span, HierarchicalInstance> { pub fn hierarchical_instance(s: Span) -> IResult<Span, HierarchicalInstance> {
let (s, a) = name_of_instance(s)?; let (s, a) = name_of_instance(s)?;
let (s, b) = paren(opt(list_of_port_connections))(s)?; let (s, b) = paren(opt(list_of_port_connections))(s)?;
Ok((s, HierarchicalInstance { nodes: (a, b) })) Ok((s, HierarchicalInstance { nodes: (a, b) }))
} }
#[trace]
pub fn name_of_instance(s: Span) -> IResult<Span, NameOfInstance> { pub fn name_of_instance(s: Span) -> IResult<Span, NameOfInstance> {
let (s, x) = instance_identifier(s)?; let (s, x) = instance_identifier(s)?;
let (s, y) = many0(unpacked_dimension)(s)?; let (s, y) = many0(unpacked_dimension)(s)?;
Ok((s, NameOfInstance { nodes: (x, y) })) Ok((s, NameOfInstance { nodes: (x, y) }))
} }
#[trace]
pub fn list_of_port_connections(s: Span) -> IResult<Span, ListOfPortConnections> { pub fn list_of_port_connections(s: Span) -> IResult<Span, ListOfPortConnections> {
alt(( alt((
list_of_port_connections_ordered, list_of_port_connections_ordered,
@ -185,6 +195,7 @@ pub fn list_of_port_connections(s: Span) -> IResult<Span, ListOfPortConnections>
))(s) ))(s)
} }
#[trace]
pub fn list_of_port_connections_ordered(s: Span) -> IResult<Span, ListOfPortConnections> { pub fn list_of_port_connections_ordered(s: Span) -> IResult<Span, ListOfPortConnections> {
let (s, a) = list(symbol(","), ordered_port_connection)(s)?; let (s, a) = list(symbol(","), ordered_port_connection)(s)?;
Ok(( Ok((
@ -193,6 +204,7 @@ pub fn list_of_port_connections_ordered(s: Span) -> IResult<Span, ListOfPortConn
)) ))
} }
#[trace]
pub fn list_of_port_connections_named(s: Span) -> IResult<Span, ListOfPortConnections> { pub fn list_of_port_connections_named(s: Span) -> IResult<Span, ListOfPortConnections> {
let (s, a) = list(symbol(","), named_port_connection)(s)?; let (s, a) = list(symbol(","), named_port_connection)(s)?;
Ok(( Ok((
@ -201,12 +213,14 @@ pub fn list_of_port_connections_named(s: Span) -> IResult<Span, ListOfPortConnec
)) ))
} }
#[trace]
pub fn ordered_port_connection(s: Span) -> IResult<Span, OrderedPortConnection> { pub fn ordered_port_connection(s: Span) -> IResult<Span, OrderedPortConnection> {
let (s, x) = many0(attribute_instance)(s)?; let (s, x) = many0(attribute_instance)(s)?;
let (s, y) = opt(expression)(s)?; let (s, y) = opt(expression)(s)?;
Ok((s, OrderedPortConnection { nodes: (x, y) })) Ok((s, OrderedPortConnection { nodes: (x, y) }))
} }
#[trace]
pub fn named_port_connection(s: Span) -> IResult<Span, NamedPortConnection> { pub fn named_port_connection(s: Span) -> IResult<Span, NamedPortConnection> {
alt(( alt((
named_port_connection_identifier, named_port_connection_identifier,
@ -214,6 +228,7 @@ pub fn named_port_connection(s: Span) -> IResult<Span, NamedPortConnection> {
))(s) ))(s)
} }
#[trace]
pub fn named_port_connection_identifier(s: Span) -> IResult<Span, NamedPortConnection> { pub fn named_port_connection_identifier(s: Span) -> IResult<Span, NamedPortConnection> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = symbol(".")(s)?; let (s, b) = symbol(".")(s)?;
@ -227,6 +242,7 @@ pub fn named_port_connection_identifier(s: Span) -> IResult<Span, NamedPortConne
)) ))
} }
#[trace]
pub fn named_port_connection_asterisk(s: Span) -> IResult<Span, NamedPortConnection> { pub fn named_port_connection_asterisk(s: Span) -> IResult<Span, NamedPortConnection> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = symbol(".*")(s)?; let (s, b) = symbol(".*")(s)?;

View File

@ -17,6 +17,7 @@ pub struct ProgramInstantiation<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn program_instantiation(s: Span) -> IResult<Span, ProgramInstantiation> { pub fn program_instantiation(s: Span) -> IResult<Span, ProgramInstantiation> {
let (s, a) = program_identifier(s)?; let (s, a) = program_identifier(s)?;
let (s, b) = opt(parameter_value_assignment)(s)?; let (s, b) = opt(parameter_value_assignment)(s)?;

View File

@ -42,11 +42,13 @@ pub struct PassSwitchtype<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn cmos_switchtype(s: Span) -> IResult<Span, CmosSwitchtype> { pub fn cmos_switchtype(s: Span) -> IResult<Span, CmosSwitchtype> {
let (s, a) = alt((symbol("cmos"), symbol("rcmos")))(s)?; let (s, a) = alt((symbol("cmos"), symbol("rcmos")))(s)?;
Ok((s, CmosSwitchtype { nodes: (a,) })) Ok((s, CmosSwitchtype { nodes: (a,) }))
} }
#[trace]
pub fn enable_gatetype(s: Span) -> IResult<Span, EnableGatetype> { pub fn enable_gatetype(s: Span) -> IResult<Span, EnableGatetype> {
let (s, a) = alt(( let (s, a) = alt((
symbol("bufif0"), symbol("bufif0"),
@ -57,6 +59,7 @@ pub fn enable_gatetype(s: Span) -> IResult<Span, EnableGatetype> {
Ok((s, EnableGatetype { nodes: (a,) })) Ok((s, EnableGatetype { nodes: (a,) }))
} }
#[trace]
pub fn mos_switchtype(s: Span) -> IResult<Span, MosSwitchtype> { pub fn mos_switchtype(s: Span) -> IResult<Span, MosSwitchtype> {
let (s, a) = alt(( let (s, a) = alt((
symbol("nmos"), symbol("nmos"),
@ -67,6 +70,7 @@ pub fn mos_switchtype(s: Span) -> IResult<Span, MosSwitchtype> {
Ok((s, MosSwitchtype { nodes: (a,) })) Ok((s, MosSwitchtype { nodes: (a,) }))
} }
#[trace]
pub fn n_input_gatetype(s: Span) -> IResult<Span, NInputGatetype> { pub fn n_input_gatetype(s: Span) -> IResult<Span, NInputGatetype> {
let (s, a) = alt(( let (s, a) = alt((
symbol("and"), symbol("and"),
@ -79,11 +83,13 @@ pub fn n_input_gatetype(s: Span) -> IResult<Span, NInputGatetype> {
Ok((s, NInputGatetype { nodes: (a,) })) Ok((s, NInputGatetype { nodes: (a,) }))
} }
#[trace]
pub fn n_output_gatetype(s: Span) -> IResult<Span, NOutputGatetype> { pub fn n_output_gatetype(s: Span) -> IResult<Span, NOutputGatetype> {
let (s, a) = alt((symbol("buf"), symbol("not")))(s)?; let (s, a) = alt((symbol("buf"), symbol("not")))(s)?;
Ok((s, NOutputGatetype { nodes: (a,) })) Ok((s, NOutputGatetype { nodes: (a,) }))
} }
#[trace]
pub fn pass_en_switchtype(s: Span) -> IResult<Span, PassEnSwitchtype> { pub fn pass_en_switchtype(s: Span) -> IResult<Span, PassEnSwitchtype> {
let (s, a) = alt(( let (s, a) = alt((
symbol("tranif0"), symbol("tranif0"),
@ -94,6 +100,7 @@ pub fn pass_en_switchtype(s: Span) -> IResult<Span, PassEnSwitchtype> {
Ok((s, PassEnSwitchtype { nodes: (a,) })) Ok((s, PassEnSwitchtype { nodes: (a,) }))
} }
#[trace]
pub fn pass_switchtype(s: Span) -> IResult<Span, PassSwitchtype> { pub fn pass_switchtype(s: Span) -> IResult<Span, PassSwitchtype> {
let (s, a) = alt((symbol("tran"), symbol("rtran")))(s)?; let (s, a) = alt((symbol("tran"), symbol("rtran")))(s)?;
Ok((s, PassSwitchtype { nodes: (a,) })) Ok((s, PassSwitchtype { nodes: (a,) }))

View File

@ -227,6 +227,7 @@ pub struct PullGateInstance<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn gate_instantiation(s: Span) -> IResult<Span, GateInstantiation> { pub fn gate_instantiation(s: Span) -> IResult<Span, GateInstantiation> {
alt(( alt((
gate_instantiation_cmos, gate_instantiation_cmos,
@ -241,6 +242,7 @@ pub fn gate_instantiation(s: Span) -> IResult<Span, GateInstantiation> {
))(s) ))(s)
} }
#[trace]
pub fn gate_instantiation_cmos(s: Span) -> IResult<Span, GateInstantiation> { pub fn gate_instantiation_cmos(s: Span) -> IResult<Span, GateInstantiation> {
let (s, a) = cmos_switchtype(s)?; let (s, a) = cmos_switchtype(s)?;
let (s, b) = opt(delay3)(s)?; let (s, b) = opt(delay3)(s)?;
@ -254,6 +256,7 @@ pub fn gate_instantiation_cmos(s: Span) -> IResult<Span, GateInstantiation> {
)) ))
} }
#[trace]
pub fn gate_instantiation_enable(s: Span) -> IResult<Span, GateInstantiation> { pub fn gate_instantiation_enable(s: Span) -> IResult<Span, GateInstantiation> {
let (s, a) = enable_gatetype(s)?; let (s, a) = enable_gatetype(s)?;
let (s, b) = opt(drive_strength)(s)?; let (s, b) = opt(drive_strength)(s)?;
@ -268,6 +271,7 @@ pub fn gate_instantiation_enable(s: Span) -> IResult<Span, GateInstantiation> {
)) ))
} }
#[trace]
pub fn gate_instantiation_mos(s: Span) -> IResult<Span, GateInstantiation> { pub fn gate_instantiation_mos(s: Span) -> IResult<Span, GateInstantiation> {
let (s, a) = mos_switchtype(s)?; let (s, a) = mos_switchtype(s)?;
let (s, b) = opt(delay3)(s)?; let (s, b) = opt(delay3)(s)?;
@ -281,6 +285,7 @@ pub fn gate_instantiation_mos(s: Span) -> IResult<Span, GateInstantiation> {
)) ))
} }
#[trace]
pub fn gate_instantiation_n_input(s: Span) -> IResult<Span, GateInstantiation> { pub fn gate_instantiation_n_input(s: Span) -> IResult<Span, GateInstantiation> {
let (s, a) = n_input_gatetype(s)?; let (s, a) = n_input_gatetype(s)?;
let (s, b) = opt(drive_strength)(s)?; let (s, b) = opt(drive_strength)(s)?;
@ -295,6 +300,7 @@ pub fn gate_instantiation_n_input(s: Span) -> IResult<Span, GateInstantiation> {
)) ))
} }
#[trace]
pub fn gate_instantiation_n_output(s: Span) -> IResult<Span, GateInstantiation> { pub fn gate_instantiation_n_output(s: Span) -> IResult<Span, GateInstantiation> {
let (s, a) = n_output_gatetype(s)?; let (s, a) = n_output_gatetype(s)?;
let (s, b) = opt(drive_strength)(s)?; let (s, b) = opt(drive_strength)(s)?;
@ -309,6 +315,7 @@ pub fn gate_instantiation_n_output(s: Span) -> IResult<Span, GateInstantiation>
)) ))
} }
#[trace]
pub fn gate_instantiation_pass_en(s: Span) -> IResult<Span, GateInstantiation> { pub fn gate_instantiation_pass_en(s: Span) -> IResult<Span, GateInstantiation> {
let (s, a) = pass_en_switchtype(s)?; let (s, a) = pass_en_switchtype(s)?;
let (s, b) = opt(delay2)(s)?; let (s, b) = opt(delay2)(s)?;
@ -322,6 +329,7 @@ pub fn gate_instantiation_pass_en(s: Span) -> IResult<Span, GateInstantiation> {
)) ))
} }
#[trace]
pub fn gate_instantiation_pass(s: Span) -> IResult<Span, GateInstantiation> { pub fn gate_instantiation_pass(s: Span) -> IResult<Span, GateInstantiation> {
let (s, a) = pass_switchtype(s)?; let (s, a) = pass_switchtype(s)?;
let (s, b) = list(symbol(","), pass_switch_instance)(s)?; let (s, b) = list(symbol(","), pass_switch_instance)(s)?;
@ -332,6 +340,7 @@ pub fn gate_instantiation_pass(s: Span) -> IResult<Span, GateInstantiation> {
)) ))
} }
#[trace]
pub fn gate_instantiation_pulldown(s: Span) -> IResult<Span, GateInstantiation> { pub fn gate_instantiation_pulldown(s: Span) -> IResult<Span, GateInstantiation> {
let (s, a) = symbol("pulldown")(s)?; let (s, a) = symbol("pulldown")(s)?;
let (s, b) = opt(pulldown_strength)(s)?; let (s, b) = opt(pulldown_strength)(s)?;
@ -345,6 +354,7 @@ pub fn gate_instantiation_pulldown(s: Span) -> IResult<Span, GateInstantiation>
)) ))
} }
#[trace]
pub fn gate_instantiation_pullup(s: Span) -> IResult<Span, GateInstantiation> { pub fn gate_instantiation_pullup(s: Span) -> IResult<Span, GateInstantiation> {
let (s, a) = symbol("pullup")(s)?; let (s, a) = symbol("pullup")(s)?;
let (s, b) = opt(pullup_strength)(s)?; let (s, b) = opt(pullup_strength)(s)?;
@ -358,6 +368,7 @@ pub fn gate_instantiation_pullup(s: Span) -> IResult<Span, GateInstantiation> {
)) ))
} }
#[trace]
pub fn cmos_switch_instance(s: Span) -> IResult<Span, CmosSwitchInstance> { pub fn cmos_switch_instance(s: Span) -> IResult<Span, CmosSwitchInstance> {
let (s, a) = opt(name_of_instance)(s)?; let (s, a) = opt(name_of_instance)(s)?;
let (s, b) = paren(tuple(( let (s, b) = paren(tuple((
@ -372,6 +383,7 @@ pub fn cmos_switch_instance(s: Span) -> IResult<Span, CmosSwitchInstance> {
Ok((s, CmosSwitchInstance { nodes: (a, b) })) Ok((s, CmosSwitchInstance { nodes: (a, b) }))
} }
#[trace]
pub fn enable_gate_instance(s: Span) -> IResult<Span, EnableGateInstance> { pub fn enable_gate_instance(s: Span) -> IResult<Span, EnableGateInstance> {
let (s, a) = opt(name_of_instance)(s)?; let (s, a) = opt(name_of_instance)(s)?;
let (s, b) = paren(tuple(( let (s, b) = paren(tuple((
@ -384,6 +396,7 @@ pub fn enable_gate_instance(s: Span) -> IResult<Span, EnableGateInstance> {
Ok((s, EnableGateInstance { nodes: (a, b) })) Ok((s, EnableGateInstance { nodes: (a, b) }))
} }
#[trace]
pub fn mos_switch_instance(s: Span) -> IResult<Span, MosSwitchInstance> { pub fn mos_switch_instance(s: Span) -> IResult<Span, MosSwitchInstance> {
let (s, a) = opt(name_of_instance)(s)?; let (s, a) = opt(name_of_instance)(s)?;
let (s, b) = paren(tuple(( let (s, b) = paren(tuple((
@ -396,6 +409,7 @@ pub fn mos_switch_instance(s: Span) -> IResult<Span, MosSwitchInstance> {
Ok((s, MosSwitchInstance { nodes: (a, b) })) Ok((s, MosSwitchInstance { nodes: (a, b) }))
} }
#[trace]
pub fn n_input_gate_instance(s: Span) -> IResult<Span, NInputGateInstance> { pub fn n_input_gate_instance(s: Span) -> IResult<Span, NInputGateInstance> {
let (s, a) = opt(name_of_instance)(s)?; let (s, a) = opt(name_of_instance)(s)?;
let (s, b) = paren(tuple(( let (s, b) = paren(tuple((
@ -406,6 +420,7 @@ pub fn n_input_gate_instance(s: Span) -> IResult<Span, NInputGateInstance> {
Ok((s, NInputGateInstance { nodes: (a, b) })) Ok((s, NInputGateInstance { nodes: (a, b) }))
} }
#[trace]
pub fn n_output_gate_instance(s: Span) -> IResult<Span, NOutputGateInstance> { pub fn n_output_gate_instance(s: Span) -> IResult<Span, NOutputGateInstance> {
let (s, a) = opt(name_of_instance)(s)?; let (s, a) = opt(name_of_instance)(s)?;
let (s, b) = paren(tuple(( let (s, b) = paren(tuple((
@ -416,12 +431,14 @@ pub fn n_output_gate_instance(s: Span) -> IResult<Span, NOutputGateInstance> {
Ok((s, NOutputGateInstance { nodes: (a, b) })) Ok((s, NOutputGateInstance { nodes: (a, b) }))
} }
#[trace]
pub fn pass_switch_instance(s: Span) -> IResult<Span, PassSwitchInstance> { pub fn pass_switch_instance(s: Span) -> IResult<Span, PassSwitchInstance> {
let (s, a) = opt(name_of_instance)(s)?; let (s, a) = opt(name_of_instance)(s)?;
let (s, b) = paren(tuple((inout_terminal, symbol(","), inout_terminal)))(s)?; let (s, b) = paren(tuple((inout_terminal, symbol(","), inout_terminal)))(s)?;
Ok((s, PassSwitchInstance { nodes: (a, b) })) Ok((s, PassSwitchInstance { nodes: (a, b) }))
} }
#[trace]
pub fn pass_enable_switch_instance(s: Span) -> IResult<Span, PassEnableSwitchInstance> { pub fn pass_enable_switch_instance(s: Span) -> IResult<Span, PassEnableSwitchInstance> {
let (s, a) = opt(name_of_instance)(s)?; let (s, a) = opt(name_of_instance)(s)?;
let (s, b) = paren(tuple(( let (s, b) = paren(tuple((
@ -434,6 +451,7 @@ pub fn pass_enable_switch_instance(s: Span) -> IResult<Span, PassEnableSwitchIns
Ok((s, PassEnableSwitchInstance { nodes: (a, b) })) Ok((s, PassEnableSwitchInstance { nodes: (a, b) }))
} }
#[trace]
pub fn pull_gate_instance(s: Span) -> IResult<Span, PullGateInstance> { pub fn pull_gate_instance(s: Span) -> IResult<Span, PullGateInstance> {
let (s, a) = opt(name_of_instance)(s)?; let (s, a) = opt(name_of_instance)(s)?;
let (s, b) = paren(output_terminal)(s)?; let (s, b) = paren(output_terminal)(s)?;

View File

@ -51,10 +51,12 @@ pub struct PullupStrength1<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn pulldown_strength(s: Span) -> IResult<Span, PulldownStrength> { pub fn pulldown_strength(s: Span) -> IResult<Span, PulldownStrength> {
alt((pulldown_strength01, pulldown_strength10, pulldown_strength0))(s) alt((pulldown_strength01, pulldown_strength10, pulldown_strength0))(s)
} }
#[trace]
pub fn pulldown_strength01(s: Span) -> IResult<Span, PulldownStrength> { pub fn pulldown_strength01(s: Span) -> IResult<Span, PulldownStrength> {
let (s, a) = paren(triple(strength0, symbol(","), strength1))(s)?; let (s, a) = paren(triple(strength0, symbol(","), strength1))(s)?;
Ok(( Ok((
@ -63,6 +65,7 @@ pub fn pulldown_strength01(s: Span) -> IResult<Span, PulldownStrength> {
)) ))
} }
#[trace]
pub fn pulldown_strength10(s: Span) -> IResult<Span, PulldownStrength> { pub fn pulldown_strength10(s: Span) -> IResult<Span, PulldownStrength> {
let (s, a) = paren(triple(strength1, symbol(","), strength0))(s)?; let (s, a) = paren(triple(strength1, symbol(","), strength0))(s)?;
Ok(( Ok((
@ -71,6 +74,7 @@ pub fn pulldown_strength10(s: Span) -> IResult<Span, PulldownStrength> {
)) ))
} }
#[trace]
pub fn pulldown_strength0(s: Span) -> IResult<Span, PulldownStrength> { pub fn pulldown_strength0(s: Span) -> IResult<Span, PulldownStrength> {
let (s, a) = paren(strength0)(s)?; let (s, a) = paren(strength0)(s)?;
Ok(( Ok((
@ -79,10 +83,12 @@ pub fn pulldown_strength0(s: Span) -> IResult<Span, PulldownStrength> {
)) ))
} }
#[trace]
pub fn pullup_strength(s: Span) -> IResult<Span, PullupStrength> { pub fn pullup_strength(s: Span) -> IResult<Span, PullupStrength> {
alt((pullup_strength01, pullup_strength10, pullup_strength1))(s) alt((pullup_strength01, pullup_strength10, pullup_strength1))(s)
} }
#[trace]
pub fn pullup_strength01(s: Span) -> IResult<Span, PullupStrength> { pub fn pullup_strength01(s: Span) -> IResult<Span, PullupStrength> {
let (s, a) = paren(triple(strength0, symbol(","), strength1))(s)?; let (s, a) = paren(triple(strength0, symbol(","), strength1))(s)?;
Ok(( Ok((
@ -91,6 +97,7 @@ pub fn pullup_strength01(s: Span) -> IResult<Span, PullupStrength> {
)) ))
} }
#[trace]
pub fn pullup_strength10(s: Span) -> IResult<Span, PullupStrength> { pub fn pullup_strength10(s: Span) -> IResult<Span, PullupStrength> {
let (s, a) = paren(triple(strength1, symbol(","), strength0))(s)?; let (s, a) = paren(triple(strength1, symbol(","), strength0))(s)?;
Ok(( Ok((
@ -99,6 +106,7 @@ pub fn pullup_strength10(s: Span) -> IResult<Span, PullupStrength> {
)) ))
} }
#[trace]
pub fn pullup_strength1(s: Span) -> IResult<Span, PullupStrength> { pub fn pullup_strength1(s: Span) -> IResult<Span, PullupStrength> {
let (s, a) = paren(strength1)(s)?; let (s, a) = paren(strength1)(s)?;
Ok(( Ok((

View File

@ -36,31 +36,37 @@ pub struct PcontrolTerminal<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn enable_terminal(s: Span) -> IResult<Span, EnableTerminal> { pub fn enable_terminal(s: Span) -> IResult<Span, EnableTerminal> {
let (s, a) = expression(s)?; let (s, a) = expression(s)?;
Ok((s, EnableTerminal { nodes: (a,) })) Ok((s, EnableTerminal { nodes: (a,) }))
} }
#[trace]
pub fn inout_terminal(s: Span) -> IResult<Span, InoutTerminal> { pub fn inout_terminal(s: Span) -> IResult<Span, InoutTerminal> {
let (s, a) = net_lvalue(s)?; let (s, a) = net_lvalue(s)?;
Ok((s, InoutTerminal { nodes: (a,) })) Ok((s, InoutTerminal { nodes: (a,) }))
} }
#[trace]
pub fn input_terminal(s: Span) -> IResult<Span, InputTerminal> { pub fn input_terminal(s: Span) -> IResult<Span, InputTerminal> {
let (s, a) = expression(s)?; let (s, a) = expression(s)?;
Ok((s, InputTerminal { nodes: (a,) })) Ok((s, InputTerminal { nodes: (a,) }))
} }
#[trace]
pub fn ncontrol_terminal(s: Span) -> IResult<Span, NcontrolTerminal> { pub fn ncontrol_terminal(s: Span) -> IResult<Span, NcontrolTerminal> {
let (s, a) = expression(s)?; let (s, a) = expression(s)?;
Ok((s, NcontrolTerminal { nodes: (a,) })) Ok((s, NcontrolTerminal { nodes: (a,) }))
} }
#[trace]
pub fn output_terminal(s: Span) -> IResult<Span, OutputTerminal> { pub fn output_terminal(s: Span) -> IResult<Span, OutputTerminal> {
let (s, a) = net_lvalue(s)?; let (s, a) = net_lvalue(s)?;
Ok((s, OutputTerminal { nodes: (a,) })) Ok((s, OutputTerminal { nodes: (a,) }))
} }
#[trace]
pub fn pcontrol_terminal(s: Span) -> IResult<Span, PcontrolTerminal> { pub fn pcontrol_terminal(s: Span) -> IResult<Span, PcontrolTerminal> {
let (s, a) = expression(s)?; let (s, a) = expression(s)?;
Ok((s, PcontrolTerminal { nodes: (a,) })) Ok((s, PcontrolTerminal { nodes: (a,) }))

View File

@ -92,11 +92,13 @@ pub enum CheckerGenerateItem<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn checker_port_list(s: Span) -> IResult<Span, CheckerPortList> { pub fn checker_port_list(s: Span) -> IResult<Span, CheckerPortList> {
let (s, a) = list(symbol(","), checker_port_item)(s)?; let (s, a) = list(symbol(","), checker_port_item)(s)?;
Ok((s, CheckerPortList { nodes: (a,) })) Ok((s, CheckerPortList { nodes: (a,) }))
} }
#[trace]
pub fn checker_port_item(s: Span) -> IResult<Span, CheckerPortItem> { pub fn checker_port_item(s: Span) -> IResult<Span, CheckerPortItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = opt(checker_port_direction)(s)?; let (s, b) = opt(checker_port_direction)(s)?;
@ -112,6 +114,7 @@ pub fn checker_port_item(s: Span) -> IResult<Span, CheckerPortItem> {
)) ))
} }
#[trace]
pub fn checker_port_direction(s: Span) -> IResult<Span, CheckerPortDirection> { pub fn checker_port_direction(s: Span) -> IResult<Span, CheckerPortDirection> {
alt(( alt((
map(symbol("input"), |x| CheckerPortDirection::Input(x)), map(symbol("input"), |x| CheckerPortDirection::Input(x)),
@ -119,6 +122,7 @@ pub fn checker_port_direction(s: Span) -> IResult<Span, CheckerPortDirection> {
))(s) ))(s)
} }
#[trace]
pub fn checker_or_generate_item(s: Span) -> IResult<Span, CheckerOrGenerateItem> { pub fn checker_or_generate_item(s: Span) -> IResult<Span, CheckerOrGenerateItem> {
alt(( alt((
map(checker_or_generate_item_declaration, |x| { map(checker_or_generate_item_declaration, |x| {
@ -143,6 +147,7 @@ pub fn checker_or_generate_item(s: Span) -> IResult<Span, CheckerOrGenerateItem>
))(s) ))(s)
} }
#[trace]
pub fn checker_or_generate_item_declaration( pub fn checker_or_generate_item_declaration(
s: Span, s: Span,
) -> IResult<Span, CheckerOrGenerateItemDeclaration> { ) -> IResult<Span, CheckerOrGenerateItemDeclaration> {
@ -172,6 +177,7 @@ pub fn checker_or_generate_item_declaration(
))(s) ))(s)
} }
#[trace]
pub fn checker_or_generate_item_declaration_data( pub fn checker_or_generate_item_declaration_data(
s: Span, s: Span,
) -> IResult<Span, CheckerOrGenerateItemDeclaration> { ) -> IResult<Span, CheckerOrGenerateItemDeclaration> {
@ -185,11 +191,13 @@ pub fn checker_or_generate_item_declaration_data(
)) ))
} }
#[trace]
pub fn rand(s: Span) -> IResult<Span, Rand> { pub fn rand(s: Span) -> IResult<Span, Rand> {
let (s, a) = symbol("rand")(s)?; let (s, a) = symbol("rand")(s)?;
Ok((s, Rand { nodes: (a,) })) Ok((s, Rand { nodes: (a,) }))
} }
#[trace]
pub fn checker_or_generate_item_declaration_clocking( pub fn checker_or_generate_item_declaration_clocking(
s: Span, s: Span,
) -> IResult<Span, CheckerOrGenerateItemDeclaration> { ) -> IResult<Span, CheckerOrGenerateItemDeclaration> {
@ -205,6 +213,7 @@ pub fn checker_or_generate_item_declaration_clocking(
)) ))
} }
#[trace]
pub fn checker_or_generate_item_declaration_disable( pub fn checker_or_generate_item_declaration_disable(
s: Span, s: Span,
) -> IResult<Span, CheckerOrGenerateItemDeclaration> { ) -> IResult<Span, CheckerOrGenerateItemDeclaration> {
@ -221,6 +230,7 @@ pub fn checker_or_generate_item_declaration_disable(
)) ))
} }
#[trace]
pub fn checker_generate_item(s: Span) -> IResult<Span, CheckerGenerateItem> { pub fn checker_generate_item(s: Span) -> IResult<Span, CheckerGenerateItem> {
alt(( alt((
map(loop_generate_construct, |x| { map(loop_generate_construct, |x| {

View File

@ -200,6 +200,7 @@ pub struct New<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn class_item(s: Span) -> IResult<Span, ClassItem> { pub fn class_item(s: Span) -> IResult<Span, ClassItem> {
alt(( alt((
class_item_property, class_item_property,
@ -217,18 +218,21 @@ pub fn class_item(s: Span) -> IResult<Span, ClassItem> {
))(s) ))(s)
} }
#[trace]
pub fn class_item_property(s: Span) -> IResult<Span, ClassItem> { pub fn class_item_property(s: Span) -> IResult<Span, ClassItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = class_property(s)?; let (s, b) = class_property(s)?;
Ok((s, ClassItem::Property(ClassItemProperty { nodes: (a, b) }))) Ok((s, ClassItem::Property(ClassItemProperty { nodes: (a, b) })))
} }
#[trace]
pub fn class_item_method(s: Span) -> IResult<Span, ClassItem> { pub fn class_item_method(s: Span) -> IResult<Span, ClassItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = class_method(s)?; let (s, b) = class_method(s)?;
Ok((s, ClassItem::Method(ClassItemMethod { nodes: (a, b) }))) Ok((s, ClassItem::Method(ClassItemMethod { nodes: (a, b) })))
} }
#[trace]
pub fn class_item_constraint(s: Span) -> IResult<Span, ClassItem> { pub fn class_item_constraint(s: Span) -> IResult<Span, ClassItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = class_constraint(s)?; let (s, b) = class_constraint(s)?;
@ -238,6 +242,7 @@ pub fn class_item_constraint(s: Span) -> IResult<Span, ClassItem> {
)) ))
} }
#[trace]
pub fn class_item_declaration(s: Span) -> IResult<Span, ClassItem> { pub fn class_item_declaration(s: Span) -> IResult<Span, ClassItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = class_declaration(s)?; let (s, b) = class_declaration(s)?;
@ -247,6 +252,7 @@ pub fn class_item_declaration(s: Span) -> IResult<Span, ClassItem> {
)) ))
} }
#[trace]
pub fn class_item_covergroup(s: Span) -> IResult<Span, ClassItem> { pub fn class_item_covergroup(s: Span) -> IResult<Span, ClassItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = covergroup_declaration(s)?; let (s, b) = covergroup_declaration(s)?;
@ -256,10 +262,12 @@ pub fn class_item_covergroup(s: Span) -> IResult<Span, ClassItem> {
)) ))
} }
#[trace]
pub fn class_property(s: Span) -> IResult<Span, ClassProperty> { pub fn class_property(s: Span) -> IResult<Span, ClassProperty> {
alt((class_property_non_const, class_property_const))(s) alt((class_property_non_const, class_property_const))(s)
} }
#[trace]
pub fn class_property_non_const(s: Span) -> IResult<Span, ClassProperty> { pub fn class_property_non_const(s: Span) -> IResult<Span, ClassProperty> {
let (s, a) = many0(property_qualifier)(s)?; let (s, a) = many0(property_qualifier)(s)?;
let (s, b) = data_declaration(s)?; let (s, b) = data_declaration(s)?;
@ -269,6 +277,7 @@ pub fn class_property_non_const(s: Span) -> IResult<Span, ClassProperty> {
)) ))
} }
#[trace]
pub fn class_property_const(s: Span) -> IResult<Span, ClassProperty> { pub fn class_property_const(s: Span) -> IResult<Span, ClassProperty> {
let (s, a) = symbol("const")(s)?; let (s, a) = symbol("const")(s)?;
let (s, b) = many0(class_item_qualifier)(s)?; let (s, b) = many0(class_item_qualifier)(s)?;
@ -284,6 +293,7 @@ pub fn class_property_const(s: Span) -> IResult<Span, ClassProperty> {
)) ))
} }
#[trace]
pub fn class_method(s: Span) -> IResult<Span, ClassMethod> { pub fn class_method(s: Span) -> IResult<Span, ClassMethod> {
alt(( alt((
class_method_task, class_method_task,
@ -295,12 +305,14 @@ pub fn class_method(s: Span) -> IResult<Span, ClassMethod> {
))(s) ))(s)
} }
#[trace]
pub fn class_method_task(s: Span) -> IResult<Span, ClassMethod> { pub fn class_method_task(s: Span) -> IResult<Span, ClassMethod> {
let (s, a) = many0(method_qualifier)(s)?; let (s, a) = many0(method_qualifier)(s)?;
let (s, b) = task_declaration(s)?; let (s, b) = task_declaration(s)?;
Ok((s, ClassMethod::Task(ClassMethodTask { nodes: (a, b) }))) Ok((s, ClassMethod::Task(ClassMethodTask { nodes: (a, b) })))
} }
#[trace]
pub fn class_method_function(s: Span) -> IResult<Span, ClassMethod> { pub fn class_method_function(s: Span) -> IResult<Span, ClassMethod> {
let (s, a) = many0(method_qualifier)(s)?; let (s, a) = many0(method_qualifier)(s)?;
let (s, b) = function_declaration(s)?; let (s, b) = function_declaration(s)?;
@ -310,6 +322,7 @@ pub fn class_method_function(s: Span) -> IResult<Span, ClassMethod> {
)) ))
} }
#[trace]
pub fn class_method_pure_virtual(s: Span) -> IResult<Span, ClassMethod> { pub fn class_method_pure_virtual(s: Span) -> IResult<Span, ClassMethod> {
let (s, a) = symbol("pure")(s)?; let (s, a) = symbol("pure")(s)?;
let (s, b) = symbol("virtual")(s)?; let (s, b) = symbol("virtual")(s)?;
@ -324,6 +337,7 @@ pub fn class_method_pure_virtual(s: Span) -> IResult<Span, ClassMethod> {
)) ))
} }
#[trace]
pub fn class_method_extern_method(s: Span) -> IResult<Span, ClassMethod> { pub fn class_method_extern_method(s: Span) -> IResult<Span, ClassMethod> {
let (s, a) = symbol("extern")(s)?; let (s, a) = symbol("extern")(s)?;
let (s, b) = many0(method_qualifier)(s)?; let (s, b) = many0(method_qualifier)(s)?;
@ -337,6 +351,7 @@ pub fn class_method_extern_method(s: Span) -> IResult<Span, ClassMethod> {
)) ))
} }
#[trace]
pub fn class_method_constructor(s: Span) -> IResult<Span, ClassMethod> { pub fn class_method_constructor(s: Span) -> IResult<Span, ClassMethod> {
let (s, a) = many0(method_qualifier)(s)?; let (s, a) = many0(method_qualifier)(s)?;
let (s, b) = class_constructor_declaration(s)?; let (s, b) = class_constructor_declaration(s)?;
@ -346,6 +361,7 @@ pub fn class_method_constructor(s: Span) -> IResult<Span, ClassMethod> {
)) ))
} }
#[trace]
pub fn class_method_extern_constructor(s: Span) -> IResult<Span, ClassMethod> { pub fn class_method_extern_constructor(s: Span) -> IResult<Span, ClassMethod> {
let (s, a) = symbol("extern")(s)?; let (s, a) = symbol("extern")(s)?;
let (s, b) = many0(method_qualifier)(s)?; let (s, b) = many0(method_qualifier)(s)?;
@ -356,6 +372,7 @@ pub fn class_method_extern_constructor(s: Span) -> IResult<Span, ClassMethod> {
)) ))
} }
#[trace]
pub fn class_constructor_prototype(s: Span) -> IResult<Span, ClassConstructorPrototype> { pub fn class_constructor_prototype(s: Span) -> IResult<Span, ClassConstructorPrototype> {
let (s, a) = symbol("function")(s)?; let (s, a) = symbol("function")(s)?;
let (s, b) = symbol("new")(s)?; let (s, b) = symbol("new")(s)?;
@ -369,6 +386,7 @@ pub fn class_constructor_prototype(s: Span) -> IResult<Span, ClassConstructorPro
)) ))
} }
#[trace]
pub fn class_constraint(s: Span) -> IResult<Span, ClassConstraint> { pub fn class_constraint(s: Span) -> IResult<Span, ClassConstraint> {
alt(( alt((
map(constraint_prototype, |x| { map(constraint_prototype, |x| {
@ -380,6 +398,7 @@ pub fn class_constraint(s: Span) -> IResult<Span, ClassConstraint> {
))(s) ))(s)
} }
#[trace]
pub fn class_item_qualifier(s: Span) -> IResult<Span, ClassItemQualifier> { pub fn class_item_qualifier(s: Span) -> IResult<Span, ClassItemQualifier> {
alt(( alt((
map(symbol("static"), |x| ClassItemQualifier::Static(x)), map(symbol("static"), |x| ClassItemQualifier::Static(x)),
@ -388,6 +407,7 @@ pub fn class_item_qualifier(s: Span) -> IResult<Span, ClassItemQualifier> {
))(s) ))(s)
} }
#[trace]
pub fn property_qualifier(s: Span) -> IResult<Span, PropertyQualifier> { pub fn property_qualifier(s: Span) -> IResult<Span, PropertyQualifier> {
alt(( alt((
map(random_qualifier, |x| PropertyQualifier::RandomQualifier(x)), map(random_qualifier, |x| PropertyQualifier::RandomQualifier(x)),
@ -397,6 +417,7 @@ pub fn property_qualifier(s: Span) -> IResult<Span, PropertyQualifier> {
))(s) ))(s)
} }
#[trace]
pub fn random_qualifier(s: Span) -> IResult<Span, RandomQualifier> { pub fn random_qualifier(s: Span) -> IResult<Span, RandomQualifier> {
alt(( alt((
map(symbol("randc"), |x| RandomQualifier::Randc(x)), map(symbol("randc"), |x| RandomQualifier::Randc(x)),
@ -404,6 +425,7 @@ pub fn random_qualifier(s: Span) -> IResult<Span, RandomQualifier> {
))(s) ))(s)
} }
#[trace]
pub fn method_qualifier(s: Span) -> IResult<Span, MethodQualifier> { pub fn method_qualifier(s: Span) -> IResult<Span, MethodQualifier> {
alt(( alt((
map(pair(symbol("pure"), symbol("virtual")), |x| { map(pair(symbol("pure"), symbol("virtual")), |x| {
@ -416,6 +438,7 @@ pub fn method_qualifier(s: Span) -> IResult<Span, MethodQualifier> {
))(s) ))(s)
} }
#[trace]
pub fn method_prototype(s: Span) -> IResult<Span, MethodPrototype> { pub fn method_prototype(s: Span) -> IResult<Span, MethodPrototype> {
alt(( alt((
map(task_prototype, |x| MethodPrototype::TaskPrototype(x)), map(task_prototype, |x| MethodPrototype::TaskPrototype(x)),
@ -425,6 +448,7 @@ pub fn method_prototype(s: Span) -> IResult<Span, MethodPrototype> {
))(s) ))(s)
} }
#[trace]
pub fn class_constructor_declaration(s: Span) -> IResult<Span, ClassConstructorDeclaration> { pub fn class_constructor_declaration(s: Span) -> IResult<Span, ClassConstructorDeclaration> {
let (s, a) = symbol("function")(s)?; let (s, a) = symbol("function")(s)?;
let (s, b) = opt(class_scope)(s)?; let (s, b) = opt(class_scope)(s)?;
@ -450,6 +474,7 @@ pub fn class_constructor_declaration(s: Span) -> IResult<Span, ClassConstructorD
)) ))
} }
#[trace]
pub fn new(s: Span) -> IResult<Span, New> { pub fn new(s: Span) -> IResult<Span, New> {
let (s, a) = symbol("new")(s)?; let (s, a) = symbol("new")(s)?;
Ok((s, New { nodes: (a,) })) Ok((s, New { nodes: (a,) }))

View File

@ -144,6 +144,7 @@ pub struct Config<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn config_declaration(s: Span) -> IResult<Span, ConfigDeclaration> { pub fn config_declaration(s: Span) -> IResult<Span, ConfigDeclaration> {
let (s, a) = symbol("config")(s)?; let (s, a) = symbol("config")(s)?;
let (s, b) = config_identifier(s)?; let (s, b) = config_identifier(s)?;
@ -161,6 +162,7 @@ pub fn config_declaration(s: Span) -> IResult<Span, ConfigDeclaration> {
)) ))
} }
#[trace]
pub fn design_statement(s: Span) -> IResult<Span, DesignStatement> { pub fn design_statement(s: Span) -> IResult<Span, DesignStatement> {
let (s, a) = symbol("design")(s)?; let (s, a) = symbol("design")(s)?;
let (s, b) = many0(pair( let (s, b) = many0(pair(
@ -171,6 +173,7 @@ pub fn design_statement(s: Span) -> IResult<Span, DesignStatement> {
Ok((s, DesignStatement { nodes: (a, b, c) })) Ok((s, DesignStatement { nodes: (a, b, c) }))
} }
#[trace]
pub fn config_rule_statement(s: Span) -> IResult<Span, ConfigRuleStatement> { pub fn config_rule_statement(s: Span) -> IResult<Span, ConfigRuleStatement> {
alt(( alt((
config_rule_statement_default, config_rule_statement_default,
@ -181,6 +184,7 @@ pub fn config_rule_statement(s: Span) -> IResult<Span, ConfigRuleStatement> {
))(s) ))(s)
} }
#[trace]
pub fn config_rule_statement_default(s: Span) -> IResult<Span, ConfigRuleStatement> { pub fn config_rule_statement_default(s: Span) -> IResult<Span, ConfigRuleStatement> {
let (s, a) = default_clause(s)?; let (s, a) = default_clause(s)?;
let (s, b) = liblist_clause(s)?; let (s, b) = liblist_clause(s)?;
@ -191,6 +195,7 @@ pub fn config_rule_statement_default(s: Span) -> IResult<Span, ConfigRuleStateme
)) ))
} }
#[trace]
pub fn config_rule_statement_inst_lib(s: Span) -> IResult<Span, ConfigRuleStatement> { pub fn config_rule_statement_inst_lib(s: Span) -> IResult<Span, ConfigRuleStatement> {
let (s, a) = inst_clause(s)?; let (s, a) = inst_clause(s)?;
let (s, b) = liblist_clause(s)?; let (s, b) = liblist_clause(s)?;
@ -201,6 +206,7 @@ pub fn config_rule_statement_inst_lib(s: Span) -> IResult<Span, ConfigRuleStatem
)) ))
} }
#[trace]
pub fn config_rule_statement_inst_use(s: Span) -> IResult<Span, ConfigRuleStatement> { pub fn config_rule_statement_inst_use(s: Span) -> IResult<Span, ConfigRuleStatement> {
let (s, a) = inst_clause(s)?; let (s, a) = inst_clause(s)?;
let (s, b) = use_clause(s)?; let (s, b) = use_clause(s)?;
@ -211,6 +217,7 @@ pub fn config_rule_statement_inst_use(s: Span) -> IResult<Span, ConfigRuleStatem
)) ))
} }
#[trace]
pub fn config_rule_statement_cell_lib(s: Span) -> IResult<Span, ConfigRuleStatement> { pub fn config_rule_statement_cell_lib(s: Span) -> IResult<Span, ConfigRuleStatement> {
let (s, a) = cell_clause(s)?; let (s, a) = cell_clause(s)?;
let (s, b) = liblist_clause(s)?; let (s, b) = liblist_clause(s)?;
@ -221,6 +228,7 @@ pub fn config_rule_statement_cell_lib(s: Span) -> IResult<Span, ConfigRuleStatem
)) ))
} }
#[trace]
pub fn config_rule_statement_cell_use(s: Span) -> IResult<Span, ConfigRuleStatement> { pub fn config_rule_statement_cell_use(s: Span) -> IResult<Span, ConfigRuleStatement> {
let (s, a) = cell_clause(s)?; let (s, a) = cell_clause(s)?;
let (s, b) = use_clause(s)?; let (s, b) = use_clause(s)?;
@ -231,23 +239,27 @@ pub fn config_rule_statement_cell_use(s: Span) -> IResult<Span, ConfigRuleStatem
)) ))
} }
#[trace]
pub fn default_clause(s: Span) -> IResult<Span, DefaultClause> { pub fn default_clause(s: Span) -> IResult<Span, DefaultClause> {
let (s, a) = symbol("default")(s)?; let (s, a) = symbol("default")(s)?;
Ok((s, DefaultClause { nodes: (a,) })) Ok((s, DefaultClause { nodes: (a,) }))
} }
#[trace]
pub fn inst_clause(s: Span) -> IResult<Span, InstClause> { pub fn inst_clause(s: Span) -> IResult<Span, InstClause> {
let (s, a) = symbol("instance")(s)?; let (s, a) = symbol("instance")(s)?;
let (s, b) = inst_name(s)?; let (s, b) = inst_name(s)?;
Ok((s, InstClause { nodes: (a, b) })) Ok((s, InstClause { nodes: (a, b) }))
} }
#[trace]
pub fn inst_name(s: Span) -> IResult<Span, InstName> { pub fn inst_name(s: Span) -> IResult<Span, InstName> {
let (s, a) = topmodule_identifier(s)?; let (s, a) = topmodule_identifier(s)?;
let (s, b) = many0(pair(symbol("."), instance_identifier))(s)?; let (s, b) = many0(pair(symbol("."), instance_identifier))(s)?;
Ok((s, InstName { nodes: (a, b) })) Ok((s, InstName { nodes: (a, b) }))
} }
#[trace]
pub fn cell_clause(s: Span) -> IResult<Span, CellClause> { pub fn cell_clause(s: Span) -> IResult<Span, CellClause> {
let (s, a) = symbol("cell")(s)?; let (s, a) = symbol("cell")(s)?;
let (s, b) = opt(pair(library_identifier, symbol(".")))(s)?; let (s, b) = opt(pair(library_identifier, symbol(".")))(s)?;
@ -255,16 +267,19 @@ pub fn cell_clause(s: Span) -> IResult<Span, CellClause> {
Ok((s, CellClause { nodes: (a, b, c) })) Ok((s, CellClause { nodes: (a, b, c) }))
} }
#[trace]
pub fn liblist_clause(s: Span) -> IResult<Span, LiblistClause> { pub fn liblist_clause(s: Span) -> IResult<Span, LiblistClause> {
let (s, a) = symbol("liblist")(s)?; let (s, a) = symbol("liblist")(s)?;
let (s, b) = many0(library_identifier)(s)?; let (s, b) = many0(library_identifier)(s)?;
Ok((s, LiblistClause { nodes: (a, b) })) Ok((s, LiblistClause { nodes: (a, b) }))
} }
#[trace]
pub fn use_clause(s: Span) -> IResult<Span, UseClause> { pub fn use_clause(s: Span) -> IResult<Span, UseClause> {
alt((use_clause_cell, use_clause_named, use_clause_cell_named))(s) alt((use_clause_cell, use_clause_named, use_clause_cell_named))(s)
} }
#[trace]
pub fn use_clause_cell(s: Span) -> IResult<Span, UseClause> { pub fn use_clause_cell(s: Span) -> IResult<Span, UseClause> {
let (s, a) = symbol("use")(s)?; let (s, a) = symbol("use")(s)?;
let (s, b) = opt(pair(library_identifier, symbol(".")))(s)?; let (s, b) = opt(pair(library_identifier, symbol(".")))(s)?;
@ -278,6 +293,7 @@ pub fn use_clause_cell(s: Span) -> IResult<Span, UseClause> {
)) ))
} }
#[trace]
pub fn use_clause_named(s: Span) -> IResult<Span, UseClause> { pub fn use_clause_named(s: Span) -> IResult<Span, UseClause> {
let (s, a) = symbol("use")(s)?; let (s, a) = symbol("use")(s)?;
let (s, b) = list(symbol(","), named_parameter_assignment)(s)?; let (s, b) = list(symbol(","), named_parameter_assignment)(s)?;
@ -285,6 +301,7 @@ pub fn use_clause_named(s: Span) -> IResult<Span, UseClause> {
Ok((s, UseClause::Named(UseClauseNamed { nodes: (a, b, c) }))) Ok((s, UseClause::Named(UseClauseNamed { nodes: (a, b, c) })))
} }
#[trace]
pub fn use_clause_cell_named(s: Span) -> IResult<Span, UseClause> { pub fn use_clause_cell_named(s: Span) -> IResult<Span, UseClause> {
let (s, a) = symbol("use")(s)?; let (s, a) = symbol("use")(s)?;
let (s, b) = opt(pair(library_identifier, symbol(".")))(s)?; let (s, b) = opt(pair(library_identifier, symbol(".")))(s)?;
@ -299,6 +316,7 @@ pub fn use_clause_cell_named(s: Span) -> IResult<Span, UseClause> {
)) ))
} }
#[trace]
pub fn config(s: Span) -> IResult<Span, Config> { pub fn config(s: Span) -> IResult<Span, Config> {
let (s, a) = symbol("config")(s)?; let (s, a) = symbol("config")(s)?;
Ok((s, Config { nodes: (a,) })) Ok((s, Config { nodes: (a,) }))

View File

@ -191,6 +191,7 @@ pub struct IdentifierList<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn constraint_declaration(s: Span) -> IResult<Span, ConstraintDeclaration> { pub fn constraint_declaration(s: Span) -> IResult<Span, ConstraintDeclaration> {
let (s, a) = opt(r#static)(s)?; let (s, a) = opt(r#static)(s)?;
let (s, b) = symbol("constraint")(s)?; let (s, b) = symbol("constraint")(s)?;
@ -204,16 +205,19 @@ pub fn constraint_declaration(s: Span) -> IResult<Span, ConstraintDeclaration> {
)) ))
} }
#[trace]
pub fn r#static(s: Span) -> IResult<Span, Static> { pub fn r#static(s: Span) -> IResult<Span, Static> {
let (s, a) = symbol("static")(s)?; let (s, a) = symbol("static")(s)?;
Ok((s, Static { nodes: (a,) })) Ok((s, Static { nodes: (a,) }))
} }
#[trace]
pub fn constraint_block(s: Span) -> IResult<Span, ConstraintBlock> { pub fn constraint_block(s: Span) -> IResult<Span, ConstraintBlock> {
let (s, a) = brace(many0(constraint_block_item))(s)?; let (s, a) = brace(many0(constraint_block_item))(s)?;
Ok((s, ConstraintBlock { nodes: (a,) })) Ok((s, ConstraintBlock { nodes: (a,) }))
} }
#[trace]
pub fn constraint_block_item(s: Span) -> IResult<Span, ConstraintBlockItem> { pub fn constraint_block_item(s: Span) -> IResult<Span, ConstraintBlockItem> {
alt(( alt((
constraint_block_item_solve, constraint_block_item_solve,
@ -223,6 +227,7 @@ pub fn constraint_block_item(s: Span) -> IResult<Span, ConstraintBlockItem> {
))(s) ))(s)
} }
#[trace]
pub fn constraint_block_item_solve(s: Span) -> IResult<Span, ConstraintBlockItem> { pub fn constraint_block_item_solve(s: Span) -> IResult<Span, ConstraintBlockItem> {
let (s, a) = symbol("solve")(s)?; let (s, a) = symbol("solve")(s)?;
let (s, b) = solve_before_list(s)?; let (s, b) = solve_before_list(s)?;
@ -237,11 +242,13 @@ pub fn constraint_block_item_solve(s: Span) -> IResult<Span, ConstraintBlockItem
)) ))
} }
#[trace]
pub fn solve_before_list(s: Span) -> IResult<Span, SolveBeforeList> { pub fn solve_before_list(s: Span) -> IResult<Span, SolveBeforeList> {
let (s, a) = list(symbol(","), constraint_primary)(s)?; let (s, a) = list(symbol(","), constraint_primary)(s)?;
Ok((s, SolveBeforeList { nodes: (a,) })) Ok((s, SolveBeforeList { nodes: (a,) }))
} }
#[trace]
pub fn constraint_primary(s: Span) -> IResult<Span, ConstraintPrimary> { pub fn constraint_primary(s: Span) -> IResult<Span, ConstraintPrimary> {
let (s, a) = opt(implicit_class_handle_or_class_scope)(s)?; let (s, a) = opt(implicit_class_handle_or_class_scope)(s)?;
let (s, b) = hierarchical_identifier(s)?; let (s, b) = hierarchical_identifier(s)?;
@ -249,6 +256,7 @@ pub fn constraint_primary(s: Span) -> IResult<Span, ConstraintPrimary> {
Ok((s, ConstraintPrimary { nodes: (a, b, c) })) Ok((s, ConstraintPrimary { nodes: (a, b, c) }))
} }
#[trace]
pub fn constraint_expression(s: Span) -> IResult<Span, ConstraintExpression> { pub fn constraint_expression(s: Span) -> IResult<Span, ConstraintExpression> {
alt(( alt((
constraint_expression_expression, constraint_expression_expression,
@ -262,6 +270,7 @@ pub fn constraint_expression(s: Span) -> IResult<Span, ConstraintExpression> {
))(s) ))(s)
} }
#[trace]
pub fn constraint_expression_expression(s: Span) -> IResult<Span, ConstraintExpression> { pub fn constraint_expression_expression(s: Span) -> IResult<Span, ConstraintExpression> {
let (s, a) = opt(soft)(s)?; let (s, a) = opt(soft)(s)?;
let (s, b) = expression_or_dist(s)?; let (s, b) = expression_or_dist(s)?;
@ -272,11 +281,13 @@ pub fn constraint_expression_expression(s: Span) -> IResult<Span, ConstraintExpr
)) ))
} }
#[trace]
pub fn soft(s: Span) -> IResult<Span, Soft> { pub fn soft(s: Span) -> IResult<Span, Soft> {
let (s, a) = symbol("soft")(s)?; let (s, a) = symbol("soft")(s)?;
Ok((s, Soft { nodes: (a,) })) Ok((s, Soft { nodes: (a,) }))
} }
#[trace]
pub fn constraint_expression_arrow(s: Span) -> IResult<Span, ConstraintExpression> { pub fn constraint_expression_arrow(s: Span) -> IResult<Span, ConstraintExpression> {
let (s, a) = expression(s)?; let (s, a) = expression(s)?;
let (s, b) = symbol("->")(s)?; let (s, b) = symbol("->")(s)?;
@ -287,6 +298,7 @@ pub fn constraint_expression_arrow(s: Span) -> IResult<Span, ConstraintExpressio
)) ))
} }
#[trace]
pub fn constraint_expression_if(s: Span) -> IResult<Span, ConstraintExpression> { pub fn constraint_expression_if(s: Span) -> IResult<Span, ConstraintExpression> {
let (s, a) = symbol("if")(s)?; let (s, a) = symbol("if")(s)?;
let (s, b) = paren(expression)(s)?; let (s, b) = paren(expression)(s)?;
@ -300,6 +312,7 @@ pub fn constraint_expression_if(s: Span) -> IResult<Span, ConstraintExpression>
)) ))
} }
#[trace]
pub fn constraint_expression_foreach(s: Span) -> IResult<Span, ConstraintExpression> { pub fn constraint_expression_foreach(s: Span) -> IResult<Span, ConstraintExpression> {
let (s, a) = symbol("foreach")(s)?; let (s, a) = symbol("foreach")(s)?;
let (s, b) = paren(pair( let (s, b) = paren(pair(
@ -313,6 +326,7 @@ pub fn constraint_expression_foreach(s: Span) -> IResult<Span, ConstraintExpress
)) ))
} }
#[trace]
pub fn constraint_expression_disable(s: Span) -> IResult<Span, ConstraintExpression> { pub fn constraint_expression_disable(s: Span) -> IResult<Span, ConstraintExpression> {
let (s, a) = symbol("disable")(s)?; let (s, a) = symbol("disable")(s)?;
let (s, b) = symbol("soft")(s)?; let (s, b) = symbol("soft")(s)?;
@ -326,12 +340,14 @@ pub fn constraint_expression_disable(s: Span) -> IResult<Span, ConstraintExpress
)) ))
} }
#[trace]
pub fn uniqueness_constraint(s: Span) -> IResult<Span, UniquenessConstraint> { pub fn uniqueness_constraint(s: Span) -> IResult<Span, UniquenessConstraint> {
let (s, a) = symbol("unique")(s)?; let (s, a) = symbol("unique")(s)?;
let (s, b) = brace(open_range_list)(s)?; let (s, b) = brace(open_range_list)(s)?;
Ok((s, UniquenessConstraint { nodes: (a, b) })) Ok((s, UniquenessConstraint { nodes: (a, b) }))
} }
#[trace]
pub fn constraint_set(s: Span) -> IResult<Span, ConstraintSet> { pub fn constraint_set(s: Span) -> IResult<Span, ConstraintSet> {
alt(( alt((
map(constraint_expression, |x| { map(constraint_expression, |x| {
@ -341,38 +357,45 @@ pub fn constraint_set(s: Span) -> IResult<Span, ConstraintSet> {
))(s) ))(s)
} }
#[trace]
pub fn constraint_set_brace(s: Span) -> IResult<Span, ConstraintSet> { pub fn constraint_set_brace(s: Span) -> IResult<Span, ConstraintSet> {
let (s, a) = brace(many0(constraint_expression))(s)?; let (s, a) = brace(many0(constraint_expression))(s)?;
Ok((s, ConstraintSet::Brace(ConstraintSetBrace { nodes: (a,) }))) Ok((s, ConstraintSet::Brace(ConstraintSetBrace { nodes: (a,) })))
} }
#[trace]
pub fn dist_list(s: Span) -> IResult<Span, DistList> { pub fn dist_list(s: Span) -> IResult<Span, DistList> {
let (s, a) = list(symbol(","), dist_item)(s)?; let (s, a) = list(symbol(","), dist_item)(s)?;
Ok((s, DistList { nodes: (a,) })) Ok((s, DistList { nodes: (a,) }))
} }
#[trace]
pub fn dist_item(s: Span) -> IResult<Span, DistItem> { pub fn dist_item(s: Span) -> IResult<Span, DistItem> {
let (s, a) = value_range(s)?; let (s, a) = value_range(s)?;
let (s, b) = opt(dist_weight)(s)?; let (s, b) = opt(dist_weight)(s)?;
Ok((s, DistItem { nodes: (a, b) })) Ok((s, DistItem { nodes: (a, b) }))
} }
#[trace]
pub fn dist_weight(s: Span) -> IResult<Span, DistWeight> { pub fn dist_weight(s: Span) -> IResult<Span, DistWeight> {
alt((dist_weight_equal, dist_weight_divide))(s) alt((dist_weight_equal, dist_weight_divide))(s)
} }
#[trace]
pub fn dist_weight_equal(s: Span) -> IResult<Span, DistWeight> { pub fn dist_weight_equal(s: Span) -> IResult<Span, DistWeight> {
let (s, a) = symbol(":=")(s)?; let (s, a) = symbol(":=")(s)?;
let (s, b) = expression(s)?; let (s, b) = expression(s)?;
Ok((s, DistWeight::Equal(DistWeightEqual { nodes: (a, b) }))) Ok((s, DistWeight::Equal(DistWeightEqual { nodes: (a, b) })))
} }
#[trace]
pub fn dist_weight_divide(s: Span) -> IResult<Span, DistWeight> { pub fn dist_weight_divide(s: Span) -> IResult<Span, DistWeight> {
let (s, a) = symbol(":/")(s)?; let (s, a) = symbol(":/")(s)?;
let (s, b) = expression(s)?; let (s, b) = expression(s)?;
Ok((s, DistWeight::Divide(DistWeightDivide { nodes: (a, b) }))) Ok((s, DistWeight::Divide(DistWeightDivide { nodes: (a, b) })))
} }
#[trace]
pub fn constraint_prototype(s: Span) -> IResult<Span, ConstraintPrototype> { pub fn constraint_prototype(s: Span) -> IResult<Span, ConstraintPrototype> {
let (s, a) = opt(constraint_prototype_qualifier)(s)?; let (s, a) = opt(constraint_prototype_qualifier)(s)?;
let (s, b) = opt(r#static)(s)?; let (s, b) = opt(r#static)(s)?;
@ -387,6 +410,7 @@ pub fn constraint_prototype(s: Span) -> IResult<Span, ConstraintPrototype> {
)) ))
} }
#[trace]
pub fn constraint_prototype_qualifier(s: Span) -> IResult<Span, ConstraintPrototypeQualifier> { pub fn constraint_prototype_qualifier(s: Span) -> IResult<Span, ConstraintPrototypeQualifier> {
alt(( alt((
map(symbol("extern"), |x| { map(symbol("extern"), |x| {
@ -396,6 +420,7 @@ pub fn constraint_prototype_qualifier(s: Span) -> IResult<Span, ConstraintProtot
))(s) ))(s)
} }
#[trace]
pub fn extern_constraint_declaration(s: Span) -> IResult<Span, ExternConstraintDeclaration> { pub fn extern_constraint_declaration(s: Span) -> IResult<Span, ExternConstraintDeclaration> {
let (s, a) = opt(r#static)(s)?; let (s, a) = opt(r#static)(s)?;
let (s, b) = symbol("constraint")(s)?; let (s, b) = symbol("constraint")(s)?;
@ -410,6 +435,7 @@ pub fn extern_constraint_declaration(s: Span) -> IResult<Span, ExternConstraintD
)) ))
} }
#[trace]
pub fn identifier_list(s: Span) -> IResult<Span, IdentifierList> { pub fn identifier_list(s: Span) -> IResult<Span, IdentifierList> {
let (s, a) = list(symbol(","), identifier)(s)?; let (s, a) = list(symbol(","), identifier)(s)?;
Ok((s, IdentifierList { nodes: (a,) })) Ok((s, IdentifierList { nodes: (a,) }))

View File

@ -58,6 +58,7 @@ pub enum NonPortInterfaceItem<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn interface_or_generate_item(s: Span) -> IResult<Span, InterfaceOrGenerateItem> { pub fn interface_or_generate_item(s: Span) -> IResult<Span, InterfaceOrGenerateItem> {
alt(( alt((
interface_or_generate_item_module, interface_or_generate_item_module,
@ -65,6 +66,7 @@ pub fn interface_or_generate_item(s: Span) -> IResult<Span, InterfaceOrGenerateI
))(s) ))(s)
} }
#[trace]
pub fn interface_or_generate_item_module(s: Span) -> IResult<Span, InterfaceOrGenerateItem> { pub fn interface_or_generate_item_module(s: Span) -> IResult<Span, InterfaceOrGenerateItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = module_common_item(s)?; let (s, b) = module_common_item(s)?;
@ -74,6 +76,7 @@ pub fn interface_or_generate_item_module(s: Span) -> IResult<Span, InterfaceOrGe
)) ))
} }
#[trace]
pub fn interface_or_generate_item_extern(s: Span) -> IResult<Span, InterfaceOrGenerateItem> { pub fn interface_or_generate_item_extern(s: Span) -> IResult<Span, InterfaceOrGenerateItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = extern_tf_declaration(s)?; let (s, b) = extern_tf_declaration(s)?;
@ -83,10 +86,12 @@ pub fn interface_or_generate_item_extern(s: Span) -> IResult<Span, InterfaceOrGe
)) ))
} }
#[trace]
pub fn extern_tf_declaration(s: Span) -> IResult<Span, ExternTfDeclaration> { pub fn extern_tf_declaration(s: Span) -> IResult<Span, ExternTfDeclaration> {
alt((extern_tf_declaration_method, extern_tf_declaration_task))(s) alt((extern_tf_declaration_method, extern_tf_declaration_task))(s)
} }
#[trace]
pub fn extern_tf_declaration_method(s: Span) -> IResult<Span, ExternTfDeclaration> { pub fn extern_tf_declaration_method(s: Span) -> IResult<Span, ExternTfDeclaration> {
let (s, a) = symbol("extern")(s)?; let (s, a) = symbol("extern")(s)?;
let (s, b) = method_prototype(s)?; let (s, b) = method_prototype(s)?;
@ -97,6 +102,7 @@ pub fn extern_tf_declaration_method(s: Span) -> IResult<Span, ExternTfDeclaratio
)) ))
} }
#[trace]
pub fn extern_tf_declaration_task(s: Span) -> IResult<Span, ExternTfDeclaration> { pub fn extern_tf_declaration_task(s: Span) -> IResult<Span, ExternTfDeclaration> {
let (s, a) = symbol("extern")(s)?; let (s, a) = symbol("extern")(s)?;
let (s, b) = symbol("forkjoin")(s)?; let (s, b) = symbol("forkjoin")(s)?;
@ -110,6 +116,7 @@ pub fn extern_tf_declaration_task(s: Span) -> IResult<Span, ExternTfDeclaration>
)) ))
} }
#[trace]
pub fn interface_item(s: Span) -> IResult<Span, InterfaceItem> { pub fn interface_item(s: Span) -> IResult<Span, InterfaceItem> {
alt(( alt((
map(pair(port_declaration, symbol(";")), |x| { map(pair(port_declaration, symbol(";")), |x| {
@ -121,6 +128,7 @@ pub fn interface_item(s: Span) -> IResult<Span, InterfaceItem> {
))(s) ))(s)
} }
#[trace]
pub fn non_port_interface_item(s: Span) -> IResult<Span, NonPortInterfaceItem> { pub fn non_port_interface_item(s: Span) -> IResult<Span, NonPortInterfaceItem> {
alt(( alt((
map(generate_region, |x| NonPortInterfaceItem::GenerateRegion(x)), map(generate_region, |x| NonPortInterfaceItem::GenerateRegion(x)),

View File

@ -44,11 +44,13 @@ pub struct FilePathSpec<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn library_text(s: Span) -> IResult<Span, LibraryText> { pub fn library_text(s: Span) -> IResult<Span, LibraryText> {
let (s, a) = many0(library_description)(s)?; let (s, a) = many0(library_description)(s)?;
Ok((s, LibraryText { nodes: (a,) })) Ok((s, LibraryText { nodes: (a,) }))
} }
#[trace]
pub fn library_description(s: Span) -> IResult<Span, LibraryDescription> { pub fn library_description(s: Span) -> IResult<Span, LibraryDescription> {
alt(( alt((
map(library_declaration, |x| { map(library_declaration, |x| {
@ -64,6 +66,7 @@ pub fn library_description(s: Span) -> IResult<Span, LibraryDescription> {
))(s) ))(s)
} }
#[trace]
pub fn library_declaration(s: Span) -> IResult<Span, LibraryDeclaration> { pub fn library_declaration(s: Span) -> IResult<Span, LibraryDeclaration> {
let (s, a) = symbol("library")(s)?; let (s, a) = symbol("library")(s)?;
let (s, b) = library_identifier(s)?; let (s, b) = library_identifier(s)?;
@ -78,6 +81,7 @@ pub fn library_declaration(s: Span) -> IResult<Span, LibraryDeclaration> {
)) ))
} }
#[trace]
pub fn include_statement(s: Span) -> IResult<Span, IncludeStatement> { pub fn include_statement(s: Span) -> IResult<Span, IncludeStatement> {
let (s, a) = symbol("include")(s)?; let (s, a) = symbol("include")(s)?;
let (s, b) = file_path_spec(s)?; let (s, b) = file_path_spec(s)?;
@ -86,6 +90,7 @@ pub fn include_statement(s: Span) -> IResult<Span, IncludeStatement> {
} }
//TODO support non literal path //TODO support non literal path
#[trace]
pub fn file_path_spec(s: Span) -> IResult<Span, FilePathSpec> { pub fn file_path_spec(s: Span) -> IResult<Span, FilePathSpec> {
let (s, a) = string_literal(s)?; let (s, a) = string_literal(s)?;
Ok((s, FilePathSpec { nodes: (a,) })) Ok((s, FilePathSpec { nodes: (a,) }))

View File

@ -216,6 +216,7 @@ pub enum BindInstantiation<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn elaboration_system_task(s: Span) -> IResult<Span, ElaborationSystemTask> { pub fn elaboration_system_task(s: Span) -> IResult<Span, ElaborationSystemTask> {
alt(( alt((
elaboration_system_task_fatal, elaboration_system_task_fatal,
@ -225,6 +226,7 @@ pub fn elaboration_system_task(s: Span) -> IResult<Span, ElaborationSystemTask>
))(s) ))(s)
} }
#[trace]
pub fn elaboration_system_task_fatal(s: Span) -> IResult<Span, ElaborationSystemTask> { pub fn elaboration_system_task_fatal(s: Span) -> IResult<Span, ElaborationSystemTask> {
let (s, a) = symbol("$fatal")(s)?; let (s, a) = symbol("$fatal")(s)?;
let (s, b) = opt(paren(pair( let (s, b) = opt(paren(pair(
@ -238,6 +240,7 @@ pub fn elaboration_system_task_fatal(s: Span) -> IResult<Span, ElaborationSystem
)) ))
} }
#[trace]
pub fn elaboration_system_task_error(s: Span) -> IResult<Span, ElaborationSystemTask> { pub fn elaboration_system_task_error(s: Span) -> IResult<Span, ElaborationSystemTask> {
let (s, a) = symbol("$error")(s)?; let (s, a) = symbol("$error")(s)?;
let (s, b) = opt(paren(opt(list_of_arguments)))(s)?; let (s, b) = opt(paren(opt(list_of_arguments)))(s)?;
@ -248,6 +251,7 @@ pub fn elaboration_system_task_error(s: Span) -> IResult<Span, ElaborationSystem
)) ))
} }
#[trace]
pub fn elaboration_system_task_warning(s: Span) -> IResult<Span, ElaborationSystemTask> { pub fn elaboration_system_task_warning(s: Span) -> IResult<Span, ElaborationSystemTask> {
let (s, a) = symbol("$warning")(s)?; let (s, a) = symbol("$warning")(s)?;
let (s, b) = opt(paren(opt(list_of_arguments)))(s)?; let (s, b) = opt(paren(opt(list_of_arguments)))(s)?;
@ -258,6 +262,7 @@ pub fn elaboration_system_task_warning(s: Span) -> IResult<Span, ElaborationSyst
)) ))
} }
#[trace]
pub fn elaboration_system_task_info(s: Span) -> IResult<Span, ElaborationSystemTask> { pub fn elaboration_system_task_info(s: Span) -> IResult<Span, ElaborationSystemTask> {
let (s, a) = symbol("$info")(s)?; let (s, a) = symbol("$info")(s)?;
let (s, b) = opt(paren(opt(list_of_arguments)))(s)?; let (s, b) = opt(paren(opt(list_of_arguments)))(s)?;
@ -268,6 +273,7 @@ pub fn elaboration_system_task_info(s: Span) -> IResult<Span, ElaborationSystemT
)) ))
} }
#[trace]
pub fn finish_number(s: Span) -> IResult<Span, FinishNumber> { pub fn finish_number(s: Span) -> IResult<Span, FinishNumber> {
alt(( alt((
map(symbol("0"), |x| FinishNumber::Zero(x)), map(symbol("0"), |x| FinishNumber::Zero(x)),
@ -276,6 +282,7 @@ pub fn finish_number(s: Span) -> IResult<Span, FinishNumber> {
))(s) ))(s)
} }
#[trace]
pub fn module_common_item(s: Span) -> IResult<Span, ModuleCommonItem> { pub fn module_common_item(s: Span) -> IResult<Span, ModuleCommonItem> {
alt(( alt((
map(module_or_generate_item_declaration, |x| { map(module_or_generate_item_declaration, |x| {
@ -306,6 +313,7 @@ pub fn module_common_item(s: Span) -> IResult<Span, ModuleCommonItem> {
))(s) ))(s)
} }
#[trace]
pub fn module_item(s: Span) -> IResult<Span, ModuleItem> { pub fn module_item(s: Span) -> IResult<Span, ModuleItem> {
alt(( alt((
map(pair(port_declaration, symbol(";")), |x| { map(pair(port_declaration, symbol(";")), |x| {
@ -315,6 +323,7 @@ pub fn module_item(s: Span) -> IResult<Span, ModuleItem> {
))(s) ))(s)
} }
#[trace]
pub fn module_or_generate_item(s: Span) -> IResult<Span, ModuleOrGenerateItem> { pub fn module_or_generate_item(s: Span) -> IResult<Span, ModuleOrGenerateItem> {
alt(( alt((
module_or_generate_item_parameter, module_or_generate_item_parameter,
@ -325,6 +334,7 @@ pub fn module_or_generate_item(s: Span) -> IResult<Span, ModuleOrGenerateItem> {
))(s) ))(s)
} }
#[trace]
pub fn module_or_generate_item_parameter(s: Span) -> IResult<Span, ModuleOrGenerateItem> { pub fn module_or_generate_item_parameter(s: Span) -> IResult<Span, ModuleOrGenerateItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = parameter_override(s)?; let (s, b) = parameter_override(s)?;
@ -334,6 +344,7 @@ pub fn module_or_generate_item_parameter(s: Span) -> IResult<Span, ModuleOrGener
)) ))
} }
#[trace]
pub fn module_or_generate_item_gate(s: Span) -> IResult<Span, ModuleOrGenerateItem> { pub fn module_or_generate_item_gate(s: Span) -> IResult<Span, ModuleOrGenerateItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = gate_instantiation(s)?; let (s, b) = gate_instantiation(s)?;
@ -343,6 +354,7 @@ pub fn module_or_generate_item_gate(s: Span) -> IResult<Span, ModuleOrGenerateIt
)) ))
} }
#[trace]
pub fn module_or_generate_item_udp(s: Span) -> IResult<Span, ModuleOrGenerateItem> { pub fn module_or_generate_item_udp(s: Span) -> IResult<Span, ModuleOrGenerateItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = udp_instantiation(s)?; let (s, b) = udp_instantiation(s)?;
@ -352,6 +364,7 @@ pub fn module_or_generate_item_udp(s: Span) -> IResult<Span, ModuleOrGenerateIte
)) ))
} }
#[trace]
pub fn module_or_generate_item_module(s: Span) -> IResult<Span, ModuleOrGenerateItem> { pub fn module_or_generate_item_module(s: Span) -> IResult<Span, ModuleOrGenerateItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = module_instantiation(s)?; let (s, b) = module_instantiation(s)?;
@ -361,6 +374,7 @@ pub fn module_or_generate_item_module(s: Span) -> IResult<Span, ModuleOrGenerate
)) ))
} }
#[trace]
pub fn module_or_generate_item_module_item(s: Span) -> IResult<Span, ModuleOrGenerateItem> { pub fn module_or_generate_item_module_item(s: Span) -> IResult<Span, ModuleOrGenerateItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = module_common_item(s)?; let (s, b) = module_common_item(s)?;
@ -372,6 +386,7 @@ pub fn module_or_generate_item_module_item(s: Span) -> IResult<Span, ModuleOrGen
)) ))
} }
#[trace]
pub fn module_or_generate_item_declaration( pub fn module_or_generate_item_declaration(
s: Span, s: Span,
) -> IResult<Span, ModuleOrGenerateItemDeclaration> { ) -> IResult<Span, ModuleOrGenerateItemDeclaration> {
@ -390,6 +405,7 @@ pub fn module_or_generate_item_declaration(
))(s) ))(s)
} }
#[trace]
pub fn module_or_generate_item_declaration_clocking( pub fn module_or_generate_item_declaration_clocking(
s: Span, s: Span,
) -> IResult<Span, ModuleOrGenerateItemDeclaration> { ) -> IResult<Span, ModuleOrGenerateItemDeclaration> {
@ -405,6 +421,7 @@ pub fn module_or_generate_item_declaration_clocking(
)) ))
} }
#[trace]
pub fn module_or_generate_item_declaration_disable( pub fn module_or_generate_item_declaration_disable(
s: Span, s: Span,
) -> IResult<Span, ModuleOrGenerateItemDeclaration> { ) -> IResult<Span, ModuleOrGenerateItemDeclaration> {
@ -421,6 +438,7 @@ pub fn module_or_generate_item_declaration_disable(
)) ))
} }
#[trace]
pub fn non_port_module_item(s: Span) -> IResult<Span, NonPortModuleItem> { pub fn non_port_module_item(s: Span) -> IResult<Span, NonPortModuleItem> {
alt(( alt((
map(generate_region, |x| NonPortModuleItem::GenerateRegion(x)), map(generate_region, |x| NonPortModuleItem::GenerateRegion(x)),
@ -444,6 +462,7 @@ pub fn non_port_module_item(s: Span) -> IResult<Span, NonPortModuleItem> {
))(s) ))(s)
} }
#[trace]
pub fn non_port_module_item_specparam(s: Span) -> IResult<Span, NonPortModuleItem> { pub fn non_port_module_item_specparam(s: Span) -> IResult<Span, NonPortModuleItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = specparam_declaration(s)?; let (s, b) = specparam_declaration(s)?;
@ -453,6 +472,7 @@ pub fn non_port_module_item_specparam(s: Span) -> IResult<Span, NonPortModuleIte
)) ))
} }
#[trace]
pub fn parameter_override(s: Span) -> IResult<Span, ParameterOverride> { pub fn parameter_override(s: Span) -> IResult<Span, ParameterOverride> {
let (s, a) = symbol("defparam")(s)?; let (s, a) = symbol("defparam")(s)?;
let (s, b) = list_of_defparam_assignments(s)?; let (s, b) = list_of_defparam_assignments(s)?;
@ -460,10 +480,12 @@ pub fn parameter_override(s: Span) -> IResult<Span, ParameterOverride> {
Ok((s, ParameterOverride { nodes: (a, b, c) })) Ok((s, ParameterOverride { nodes: (a, b, c) }))
} }
#[trace]
pub fn bind_directive(s: Span) -> IResult<Span, BindDirective> { pub fn bind_directive(s: Span) -> IResult<Span, BindDirective> {
alt((bind_directive_scope, bind_directive_instance))(s) alt((bind_directive_scope, bind_directive_instance))(s)
} }
#[trace]
pub fn bind_directive_scope(s: Span) -> IResult<Span, BindDirective> { pub fn bind_directive_scope(s: Span) -> IResult<Span, BindDirective> {
let (s, a) = symbol("bind")(s)?; let (s, a) = symbol("bind")(s)?;
let (s, b) = bind_target_scope(s)?; let (s, b) = bind_target_scope(s)?;
@ -478,6 +500,7 @@ pub fn bind_directive_scope(s: Span) -> IResult<Span, BindDirective> {
)) ))
} }
#[trace]
pub fn bind_directive_instance(s: Span) -> IResult<Span, BindDirective> { pub fn bind_directive_instance(s: Span) -> IResult<Span, BindDirective> {
let (s, a) = symbol("bind")(s)?; let (s, a) = symbol("bind")(s)?;
let (s, b) = bind_target_instance(s)?; let (s, b) = bind_target_instance(s)?;
@ -491,6 +514,7 @@ pub fn bind_directive_instance(s: Span) -> IResult<Span, BindDirective> {
)) ))
} }
#[trace]
pub fn bind_target_scope(s: Span) -> IResult<Span, BindTargetScope> { pub fn bind_target_scope(s: Span) -> IResult<Span, BindTargetScope> {
alt(( alt((
map(module_identifier, |x| BindTargetScope::ModuleIdentifier(x)), map(module_identifier, |x| BindTargetScope::ModuleIdentifier(x)),
@ -500,17 +524,20 @@ pub fn bind_target_scope(s: Span) -> IResult<Span, BindTargetScope> {
))(s) ))(s)
} }
#[trace]
pub fn bind_target_instance(s: Span) -> IResult<Span, BindTargetInstance> { pub fn bind_target_instance(s: Span) -> IResult<Span, BindTargetInstance> {
let (s, a) = hierarchical_identifier(s)?; let (s, a) = hierarchical_identifier(s)?;
let (s, b) = constant_bit_select(s)?; let (s, b) = constant_bit_select(s)?;
Ok((s, BindTargetInstance { nodes: (a, b) })) Ok((s, BindTargetInstance { nodes: (a, b) }))
} }
#[trace]
pub fn bind_target_instance_list(s: Span) -> IResult<Span, BindTargetInstanceList> { pub fn bind_target_instance_list(s: Span) -> IResult<Span, BindTargetInstanceList> {
let (s, a) = list(symbol(","), bind_target_instance)(s)?; let (s, a) = list(symbol(","), bind_target_instance)(s)?;
Ok((s, BindTargetInstanceList { nodes: (a,) })) Ok((s, BindTargetInstanceList { nodes: (a,) }))
} }
#[trace]
pub fn bind_instantiation(s: Span) -> IResult<Span, BindInstantiation> { pub fn bind_instantiation(s: Span) -> IResult<Span, BindInstantiation> {
alt(( alt((
map(program_instantiation, |x| { map(program_instantiation, |x| {

View File

@ -218,6 +218,7 @@ pub struct AnsiPortDeclarationParen<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn parameter_port_list(s: Span) -> IResult<Span, ParameterPortList> { pub fn parameter_port_list(s: Span) -> IResult<Span, ParameterPortList> {
alt(( alt((
parameter_port_list_assignment, parameter_port_list_assignment,
@ -226,6 +227,7 @@ pub fn parameter_port_list(s: Span) -> IResult<Span, ParameterPortList> {
))(s) ))(s)
} }
#[trace]
pub fn parameter_port_list_assignment(s: Span) -> IResult<Span, ParameterPortList> { pub fn parameter_port_list_assignment(s: Span) -> IResult<Span, ParameterPortList> {
let (s, a) = symbol("#")(s)?; let (s, a) = symbol("#")(s)?;
let (s, b) = paren(pair( let (s, b) = paren(pair(
@ -238,6 +240,7 @@ pub fn parameter_port_list_assignment(s: Span) -> IResult<Span, ParameterPortLis
)) ))
} }
#[trace]
pub fn parameter_port_list_declaration(s: Span) -> IResult<Span, ParameterPortList> { pub fn parameter_port_list_declaration(s: Span) -> IResult<Span, ParameterPortList> {
let (s, a) = symbol("#")(s)?; let (s, a) = symbol("#")(s)?;
let (s, b) = paren(list(symbol(","), parameter_port_declaration))(s)?; let (s, b) = paren(list(symbol(","), parameter_port_declaration))(s)?;
@ -247,6 +250,7 @@ pub fn parameter_port_list_declaration(s: Span) -> IResult<Span, ParameterPortLi
)) ))
} }
#[trace]
pub fn parameter_port_list_empty(s: Span) -> IResult<Span, ParameterPortList> { pub fn parameter_port_list_empty(s: Span) -> IResult<Span, ParameterPortList> {
let (s, a) = symbol("#")(s)?; let (s, a) = symbol("#")(s)?;
let (s, b) = symbol("(")(s)?; let (s, b) = symbol("(")(s)?;
@ -254,6 +258,7 @@ pub fn parameter_port_list_empty(s: Span) -> IResult<Span, ParameterPortList> {
Ok((s, ParameterPortList::Empty((a, b, c)))) Ok((s, ParameterPortList::Empty((a, b, c))))
} }
#[trace]
pub fn parameter_port_declaration(s: Span) -> IResult<Span, ParameterPortDeclaration> { pub fn parameter_port_declaration(s: Span) -> IResult<Span, ParameterPortDeclaration> {
alt(( alt((
map(parameter_declaration, |x| { map(parameter_declaration, |x| {
@ -267,6 +272,7 @@ pub fn parameter_port_declaration(s: Span) -> IResult<Span, ParameterPortDeclara
))(s) ))(s)
} }
#[trace]
pub fn parameter_port_declaration_param_list(s: Span) -> IResult<Span, ParameterPortDeclaration> { pub fn parameter_port_declaration_param_list(s: Span) -> IResult<Span, ParameterPortDeclaration> {
let (s, a) = data_type(s)?; let (s, a) = data_type(s)?;
let (s, b) = list_of_param_assignments(s)?; let (s, b) = list_of_param_assignments(s)?;
@ -276,6 +282,7 @@ pub fn parameter_port_declaration_param_list(s: Span) -> IResult<Span, Parameter
)) ))
} }
#[trace]
pub fn parameter_port_declaration_type_list(s: Span) -> IResult<Span, ParameterPortDeclaration> { pub fn parameter_port_declaration_type_list(s: Span) -> IResult<Span, ParameterPortDeclaration> {
let (s, a) = symbol("type")(s)?; let (s, a) = symbol("type")(s)?;
let (s, b) = list_of_type_assignments(s)?; let (s, b) = list_of_type_assignments(s)?;
@ -285,11 +292,13 @@ pub fn parameter_port_declaration_type_list(s: Span) -> IResult<Span, ParameterP
)) ))
} }
#[trace]
pub fn list_of_ports(s: Span) -> IResult<Span, ListOfPorts> { pub fn list_of_ports(s: Span) -> IResult<Span, ListOfPorts> {
let (s, a) = paren(list(symbol(","), port))(s)?; let (s, a) = paren(list(symbol(","), port))(s)?;
Ok((s, ListOfPorts { nodes: (a,) })) Ok((s, ListOfPorts { nodes: (a,) }))
} }
#[trace]
pub fn list_of_port_declarations(s: Span) -> IResult<Span, ListOfPortDeclarations> { pub fn list_of_port_declarations(s: Span) -> IResult<Span, ListOfPortDeclarations> {
let (s, a) = paren(opt(list( let (s, a) = paren(opt(list(
symbol(","), symbol(","),
@ -298,6 +307,7 @@ pub fn list_of_port_declarations(s: Span) -> IResult<Span, ListOfPortDeclaration
Ok((s, ListOfPortDeclarations { nodes: (a,) })) Ok((s, ListOfPortDeclarations { nodes: (a,) }))
} }
#[trace]
pub fn port_declaration(s: Span) -> IResult<Span, PortDeclaration> { pub fn port_declaration(s: Span) -> IResult<Span, PortDeclaration> {
alt(( alt((
port_declaration_inout, port_declaration_inout,
@ -308,6 +318,7 @@ pub fn port_declaration(s: Span) -> IResult<Span, PortDeclaration> {
))(s) ))(s)
} }
#[trace]
pub fn port_declaration_inout(s: Span) -> IResult<Span, PortDeclaration> { pub fn port_declaration_inout(s: Span) -> IResult<Span, PortDeclaration> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = inout_declaration(s)?; let (s, b) = inout_declaration(s)?;
@ -317,6 +328,7 @@ pub fn port_declaration_inout(s: Span) -> IResult<Span, PortDeclaration> {
)) ))
} }
#[trace]
pub fn port_declaration_input(s: Span) -> IResult<Span, PortDeclaration> { pub fn port_declaration_input(s: Span) -> IResult<Span, PortDeclaration> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = input_declaration(s)?; let (s, b) = input_declaration(s)?;
@ -326,6 +338,7 @@ pub fn port_declaration_input(s: Span) -> IResult<Span, PortDeclaration> {
)) ))
} }
#[trace]
pub fn port_declaration_output(s: Span) -> IResult<Span, PortDeclaration> { pub fn port_declaration_output(s: Span) -> IResult<Span, PortDeclaration> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = output_declaration(s)?; let (s, b) = output_declaration(s)?;
@ -335,6 +348,7 @@ pub fn port_declaration_output(s: Span) -> IResult<Span, PortDeclaration> {
)) ))
} }
#[trace]
pub fn port_declaration_ref(s: Span) -> IResult<Span, PortDeclaration> { pub fn port_declaration_ref(s: Span) -> IResult<Span, PortDeclaration> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = ref_declaration(s)?; let (s, b) = ref_declaration(s)?;
@ -344,6 +358,7 @@ pub fn port_declaration_ref(s: Span) -> IResult<Span, PortDeclaration> {
)) ))
} }
#[trace]
pub fn port_declaration_interface(s: Span) -> IResult<Span, PortDeclaration> { pub fn port_declaration_interface(s: Span) -> IResult<Span, PortDeclaration> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = interface_port_declaration(s)?; let (s, b) = interface_port_declaration(s)?;
@ -353,15 +368,18 @@ pub fn port_declaration_interface(s: Span) -> IResult<Span, PortDeclaration> {
)) ))
} }
#[trace]
pub fn port(s: Span) -> IResult<Span, Port> { pub fn port(s: Span) -> IResult<Span, Port> {
alt((port_non_named, port_named))(s) alt((port_non_named, port_named))(s)
} }
#[trace]
pub fn port_non_named(s: Span) -> IResult<Span, Port> { pub fn port_non_named(s: Span) -> IResult<Span, Port> {
let (s, a) = opt(port_expression)(s)?; let (s, a) = opt(port_expression)(s)?;
Ok((s, Port::NonNamed(PortNonNamed { nodes: (a,) }))) Ok((s, Port::NonNamed(PortNonNamed { nodes: (a,) })))
} }
#[trace]
pub fn port_named(s: Span) -> IResult<Span, Port> { pub fn port_named(s: Span) -> IResult<Span, Port> {
let (s, a) = symbol(".")(s)?; let (s, a) = symbol(".")(s)?;
let (s, b) = port_identifier(s)?; let (s, b) = port_identifier(s)?;
@ -369,6 +387,7 @@ pub fn port_named(s: Span) -> IResult<Span, Port> {
Ok((s, Port::Named(PortNamed { nodes: (a, b, c) }))) Ok((s, Port::Named(PortNamed { nodes: (a, b, c) })))
} }
#[trace]
pub fn port_expression(s: Span) -> IResult<Span, PortExpression> { pub fn port_expression(s: Span) -> IResult<Span, PortExpression> {
alt(( alt((
map(port_reference, |x| PortExpression::PortReference(x)), map(port_reference, |x| PortExpression::PortReference(x)),
@ -376,6 +395,7 @@ pub fn port_expression(s: Span) -> IResult<Span, PortExpression> {
))(s) ))(s)
} }
#[trace]
pub fn port_expressio_named(s: Span) -> IResult<Span, PortExpression> { pub fn port_expressio_named(s: Span) -> IResult<Span, PortExpression> {
let (s, a) = brace(list(symbol(","), port_reference))(s)?; let (s, a) = brace(list(symbol(","), port_reference))(s)?;
Ok(( Ok((
@ -384,12 +404,14 @@ pub fn port_expressio_named(s: Span) -> IResult<Span, PortExpression> {
)) ))
} }
#[trace]
pub fn port_reference(s: Span) -> IResult<Span, PortReference> { pub fn port_reference(s: Span) -> IResult<Span, PortReference> {
let (s, a) = port_identifier(s)?; let (s, a) = port_identifier(s)?;
let (s, b) = constant_select(s)?; let (s, b) = constant_select(s)?;
Ok((s, PortReference { nodes: (a, b) })) Ok((s, PortReference { nodes: (a, b) }))
} }
#[trace]
pub fn port_direction(s: Span) -> IResult<Span, PortDirection> { pub fn port_direction(s: Span) -> IResult<Span, PortDirection> {
alt(( alt((
map(symbol("input"), |x| PortDirection::Input(x)), map(symbol("input"), |x| PortDirection::Input(x)),
@ -399,18 +421,21 @@ pub fn port_direction(s: Span) -> IResult<Span, PortDirection> {
))(s) ))(s)
} }
#[trace]
pub fn net_port_header(s: Span) -> IResult<Span, NetPortHeader> { pub fn net_port_header(s: Span) -> IResult<Span, NetPortHeader> {
let (s, a) = opt(port_direction)(s)?; let (s, a) = opt(port_direction)(s)?;
let (s, b) = net_port_type(s)?; let (s, b) = net_port_type(s)?;
Ok((s, NetPortHeader { nodes: (a, b) })) Ok((s, NetPortHeader { nodes: (a, b) }))
} }
#[trace]
pub fn variable_port_header(s: Span) -> IResult<Span, VariablePortHeader> { pub fn variable_port_header(s: Span) -> IResult<Span, VariablePortHeader> {
let (s, a) = opt(port_direction)(s)?; let (s, a) = opt(port_direction)(s)?;
let (s, b) = variable_port_type(s)?; let (s, b) = variable_port_type(s)?;
Ok((s, VariablePortHeader { nodes: (a, b) })) Ok((s, VariablePortHeader { nodes: (a, b) }))
} }
#[trace]
pub fn interface_port_header(s: Span) -> IResult<Span, InterfacePortHeader> { pub fn interface_port_header(s: Span) -> IResult<Span, InterfacePortHeader> {
alt(( alt((
interface_port_header_identifier, interface_port_header_identifier,
@ -418,6 +443,7 @@ pub fn interface_port_header(s: Span) -> IResult<Span, InterfacePortHeader> {
))(s) ))(s)
} }
#[trace]
pub fn interface_port_header_identifier(s: Span) -> IResult<Span, InterfacePortHeader> { pub fn interface_port_header_identifier(s: Span) -> IResult<Span, InterfacePortHeader> {
let (s, a) = interface_identifier(s)?; let (s, a) = interface_identifier(s)?;
let (s, b) = opt(pair(symbol("."), modport_identifier))(s)?; let (s, b) = opt(pair(symbol("."), modport_identifier))(s)?;
@ -427,6 +453,7 @@ pub fn interface_port_header_identifier(s: Span) -> IResult<Span, InterfacePortH
)) ))
} }
#[trace]
pub fn interface_port_header_interface(s: Span) -> IResult<Span, InterfacePortHeader> { pub fn interface_port_header_interface(s: Span) -> IResult<Span, InterfacePortHeader> {
let (s, a) = symbol("interface")(s)?; let (s, a) = symbol("interface")(s)?;
let (s, b) = opt(pair(symbol("."), modport_identifier))(s)?; let (s, b) = opt(pair(symbol("."), modport_identifier))(s)?;
@ -436,6 +463,7 @@ pub fn interface_port_header_interface(s: Span) -> IResult<Span, InterfacePortHe
)) ))
} }
#[trace]
pub fn ansi_port_declaration(s: Span) -> IResult<Span, AnsiPortDeclaration> { pub fn ansi_port_declaration(s: Span) -> IResult<Span, AnsiPortDeclaration> {
alt(( alt((
ansi_port_declaration_net, ansi_port_declaration_net,
@ -444,6 +472,7 @@ pub fn ansi_port_declaration(s: Span) -> IResult<Span, AnsiPortDeclaration> {
))(s) ))(s)
} }
#[trace]
pub fn ansi_port_declaration_net(s: Span) -> IResult<Span, AnsiPortDeclaration> { pub fn ansi_port_declaration_net(s: Span) -> IResult<Span, AnsiPortDeclaration> {
let (s, a) = opt(net_port_header_or_interface_port_header)(s)?; let (s, a) = opt(net_port_header_or_interface_port_header)(s)?;
let (s, b) = port_identifier(s)?; let (s, b) = port_identifier(s)?;
@ -457,6 +486,7 @@ pub fn ansi_port_declaration_net(s: Span) -> IResult<Span, AnsiPortDeclaration>
)) ))
} }
#[trace]
pub fn net_port_header_or_interface_port_header( pub fn net_port_header_or_interface_port_header(
s: Span, s: Span,
) -> IResult<Span, NetPortHeaderOrInterfacePortHeader> { ) -> IResult<Span, NetPortHeaderOrInterfacePortHeader> {
@ -470,6 +500,7 @@ pub fn net_port_header_or_interface_port_header(
))(s) ))(s)
} }
#[trace]
pub fn ansi_port_declaration_port(s: Span) -> IResult<Span, AnsiPortDeclaration> { pub fn ansi_port_declaration_port(s: Span) -> IResult<Span, AnsiPortDeclaration> {
let (s, a) = opt(variable_port_header)(s)?; let (s, a) = opt(variable_port_header)(s)?;
let (s, b) = port_identifier(s)?; let (s, b) = port_identifier(s)?;
@ -483,6 +514,7 @@ pub fn ansi_port_declaration_port(s: Span) -> IResult<Span, AnsiPortDeclaration>
)) ))
} }
#[trace]
pub fn ansi_port_declaration_paren(s: Span) -> IResult<Span, AnsiPortDeclaration> { pub fn ansi_port_declaration_paren(s: Span) -> IResult<Span, AnsiPortDeclaration> {
let (s, a) = opt(port_direction)(s)?; let (s, a) = opt(port_direction)(s)?;
let (s, b) = symbol(".")(s)?; let (s, b) = symbol(".")(s)?;

View File

@ -56,6 +56,7 @@ pub enum AnonymousProgramItem<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn package_item(s: Span) -> IResult<Span, PackageItem> { pub fn package_item(s: Span) -> IResult<Span, PackageItem> {
alt(( alt((
map(package_or_generate_item_declaration, |x| { map(package_or_generate_item_declaration, |x| {
@ -71,6 +72,7 @@ pub fn package_item(s: Span) -> IResult<Span, PackageItem> {
))(s) ))(s)
} }
#[trace]
pub fn package_or_generate_item_declaration( pub fn package_or_generate_item_declaration(
s: Span, s: Span,
) -> IResult<Span, PackageOrGenerateItemDeclaration> { ) -> IResult<Span, PackageOrGenerateItemDeclaration> {
@ -118,6 +120,7 @@ pub fn package_or_generate_item_declaration(
))(s) ))(s)
} }
#[trace]
pub fn anonymous_program(s: Span) -> IResult<Span, AnonymousProgram> { pub fn anonymous_program(s: Span) -> IResult<Span, AnonymousProgram> {
let (s, a) = symbol("program")(s)?; let (s, a) = symbol("program")(s)?;
let (s, b) = symbol(";")(s)?; let (s, b) = symbol(";")(s)?;
@ -131,6 +134,7 @@ pub fn anonymous_program(s: Span) -> IResult<Span, AnonymousProgram> {
)) ))
} }
#[trace]
pub fn anonymous_program_item(s: Span) -> IResult<Span, AnonymousProgramItem> { pub fn anonymous_program_item(s: Span) -> IResult<Span, AnonymousProgramItem> {
alt(( alt((
map(task_declaration, |x| { map(task_declaration, |x| {

View File

@ -63,6 +63,7 @@ pub enum ProgramGenerateItem<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn program_item(s: Span) -> IResult<Span, ProgramItem> { pub fn program_item(s: Span) -> IResult<Span, ProgramItem> {
alt(( alt((
map(pair(port_declaration, symbol(";")), |x| { map(pair(port_declaration, symbol(";")), |x| {
@ -74,6 +75,7 @@ pub fn program_item(s: Span) -> IResult<Span, ProgramItem> {
))(s) ))(s)
} }
#[trace]
pub fn non_port_program_item(s: Span) -> IResult<Span, NonPortProgramItem> { pub fn non_port_program_item(s: Span) -> IResult<Span, NonPortProgramItem> {
alt(( alt((
non_port_program_item_assign, non_port_program_item_assign,
@ -90,6 +92,7 @@ pub fn non_port_program_item(s: Span) -> IResult<Span, NonPortProgramItem> {
))(s) ))(s)
} }
#[trace]
pub fn non_port_program_item_assign(s: Span) -> IResult<Span, NonPortProgramItem> { pub fn non_port_program_item_assign(s: Span) -> IResult<Span, NonPortProgramItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = continuous_assign(s)?; let (s, b) = continuous_assign(s)?;
@ -99,6 +102,7 @@ pub fn non_port_program_item_assign(s: Span) -> IResult<Span, NonPortProgramItem
)) ))
} }
#[trace]
pub fn non_port_program_item_module(s: Span) -> IResult<Span, NonPortProgramItem> { pub fn non_port_program_item_module(s: Span) -> IResult<Span, NonPortProgramItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = module_or_generate_item_declaration(s)?; let (s, b) = module_or_generate_item_declaration(s)?;
@ -108,6 +112,7 @@ pub fn non_port_program_item_module(s: Span) -> IResult<Span, NonPortProgramItem
)) ))
} }
#[trace]
pub fn non_port_program_item_initial(s: Span) -> IResult<Span, NonPortProgramItem> { pub fn non_port_program_item_initial(s: Span) -> IResult<Span, NonPortProgramItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = initial_construct(s)?; let (s, b) = initial_construct(s)?;
@ -117,6 +122,7 @@ pub fn non_port_program_item_initial(s: Span) -> IResult<Span, NonPortProgramIte
)) ))
} }
#[trace]
pub fn non_port_program_item_final(s: Span) -> IResult<Span, NonPortProgramItem> { pub fn non_port_program_item_final(s: Span) -> IResult<Span, NonPortProgramItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = final_construct(s)?; let (s, b) = final_construct(s)?;
@ -126,6 +132,7 @@ pub fn non_port_program_item_final(s: Span) -> IResult<Span, NonPortProgramItem>
)) ))
} }
#[trace]
pub fn non_port_program_item_assertion(s: Span) -> IResult<Span, NonPortProgramItem> { pub fn non_port_program_item_assertion(s: Span) -> IResult<Span, NonPortProgramItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = concurrent_assertion_item(s)?; let (s, b) = concurrent_assertion_item(s)?;
@ -135,6 +142,7 @@ pub fn non_port_program_item_assertion(s: Span) -> IResult<Span, NonPortProgramI
)) ))
} }
#[trace]
pub fn program_generate_item(s: Span) -> IResult<Span, ProgramGenerateItem> { pub fn program_generate_item(s: Span) -> IResult<Span, ProgramGenerateItem> {
alt(( alt((
map(loop_generate_construct, |x| { map(loop_generate_construct, |x| {

View File

@ -437,12 +437,14 @@ pub struct TimeunitsDeclarationTimeprecisionTimeunit<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn source_text(s: Span) -> IResult<Span, SourceText> { pub fn source_text(s: Span) -> IResult<Span, SourceText> {
let (s, a) = opt(timeunits_declaration)(s)?; let (s, a) = opt(timeunits_declaration)(s)?;
let (s, b) = many0(description)(s)?; let (s, b) = many0(description)(s)?;
Ok((s, SourceText { nodes: (a, b) })) Ok((s, SourceText { nodes: (a, b) }))
} }
#[trace]
pub fn description(s: Span) -> IResult<Span, Description> { pub fn description(s: Span) -> IResult<Span, Description> {
alt(( alt((
map(module_declaration, |x| Description::ModuleDeclaration(x)), map(module_declaration, |x| Description::ModuleDeclaration(x)),
@ -458,6 +460,7 @@ pub fn description(s: Span) -> IResult<Span, Description> {
))(s) ))(s)
} }
#[trace]
pub fn description_package_item(s: Span) -> IResult<Span, Description> { pub fn description_package_item(s: Span) -> IResult<Span, Description> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = package_item(s)?; let (s, b) = package_item(s)?;
@ -467,6 +470,7 @@ pub fn description_package_item(s: Span) -> IResult<Span, Description> {
)) ))
} }
#[trace]
pub fn description_bind_directive(s: Span) -> IResult<Span, Description> { pub fn description_bind_directive(s: Span) -> IResult<Span, Description> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = bind_directive(s)?; let (s, b) = bind_directive(s)?;
@ -476,6 +480,7 @@ pub fn description_bind_directive(s: Span) -> IResult<Span, Description> {
)) ))
} }
#[trace]
pub fn module_nonansi_header(s: Span) -> IResult<Span, ModuleNonansiHeader> { pub fn module_nonansi_header(s: Span) -> IResult<Span, ModuleNonansiHeader> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = module_keyword(s)?; let (s, b) = module_keyword(s)?;
@ -493,6 +498,7 @@ pub fn module_nonansi_header(s: Span) -> IResult<Span, ModuleNonansiHeader> {
)) ))
} }
#[trace]
pub fn module_ansi_header(s: Span) -> IResult<Span, ModuleAnsiHeader> { pub fn module_ansi_header(s: Span) -> IResult<Span, ModuleAnsiHeader> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = module_keyword(s)?; let (s, b) = module_keyword(s)?;
@ -510,6 +516,7 @@ pub fn module_ansi_header(s: Span) -> IResult<Span, ModuleAnsiHeader> {
)) ))
} }
#[trace]
pub fn module_declaration(s: Span) -> IResult<Span, ModuleDeclaration> { pub fn module_declaration(s: Span) -> IResult<Span, ModuleDeclaration> {
alt(( alt((
module_declaration_nonansi, module_declaration_nonansi,
@ -520,6 +527,7 @@ pub fn module_declaration(s: Span) -> IResult<Span, ModuleDeclaration> {
))(s) ))(s)
} }
#[trace]
pub fn module_declaration_nonansi(s: Span) -> IResult<Span, ModuleDeclaration> { pub fn module_declaration_nonansi(s: Span) -> IResult<Span, ModuleDeclaration> {
let (s, a) = module_nonansi_header(s)?; let (s, a) = module_nonansi_header(s)?;
let (s, b) = opt(timeunits_declaration)(s)?; let (s, b) = opt(timeunits_declaration)(s)?;
@ -534,6 +542,7 @@ pub fn module_declaration_nonansi(s: Span) -> IResult<Span, ModuleDeclaration> {
)) ))
} }
#[trace]
pub fn module_declaration_ansi(s: Span) -> IResult<Span, ModuleDeclaration> { pub fn module_declaration_ansi(s: Span) -> IResult<Span, ModuleDeclaration> {
let (s, a) = module_ansi_header(s)?; let (s, a) = module_ansi_header(s)?;
let (s, b) = opt(timeunits_declaration)(s)?; let (s, b) = opt(timeunits_declaration)(s)?;
@ -548,6 +557,7 @@ pub fn module_declaration_ansi(s: Span) -> IResult<Span, ModuleDeclaration> {
)) ))
} }
#[trace]
pub fn module_declaration_wildcard(s: Span) -> IResult<Span, ModuleDeclaration> { pub fn module_declaration_wildcard(s: Span) -> IResult<Span, ModuleDeclaration> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = module_keyword(s)?; let (s, b) = module_keyword(s)?;
@ -567,6 +577,7 @@ pub fn module_declaration_wildcard(s: Span) -> IResult<Span, ModuleDeclaration>
)) ))
} }
#[trace]
pub fn module_declaration_extern_nonansi(s: Span) -> IResult<Span, ModuleDeclaration> { pub fn module_declaration_extern_nonansi(s: Span) -> IResult<Span, ModuleDeclaration> {
let (s, a) = symbol("extern")(s)?; let (s, a) = symbol("extern")(s)?;
let (s, b) = module_nonansi_header(s)?; let (s, b) = module_nonansi_header(s)?;
@ -576,6 +587,7 @@ pub fn module_declaration_extern_nonansi(s: Span) -> IResult<Span, ModuleDeclara
)) ))
} }
#[trace]
pub fn module_declaration_extern_ansi(s: Span) -> IResult<Span, ModuleDeclaration> { pub fn module_declaration_extern_ansi(s: Span) -> IResult<Span, ModuleDeclaration> {
let (s, a) = symbol("extern")(s)?; let (s, a) = symbol("extern")(s)?;
let (s, b) = module_ansi_header(s)?; let (s, b) = module_ansi_header(s)?;
@ -585,6 +597,7 @@ pub fn module_declaration_extern_ansi(s: Span) -> IResult<Span, ModuleDeclaratio
)) ))
} }
#[trace]
pub fn module_keyword(s: Span) -> IResult<Span, ModuleKeyword> { pub fn module_keyword(s: Span) -> IResult<Span, ModuleKeyword> {
alt(( alt((
map(symbol("module"), |x| ModuleKeyword::Module(x)), map(symbol("module"), |x| ModuleKeyword::Module(x)),
@ -592,6 +605,7 @@ pub fn module_keyword(s: Span) -> IResult<Span, ModuleKeyword> {
))(s) ))(s)
} }
#[trace]
pub fn interface_declaration(s: Span) -> IResult<Span, InterfaceDeclaration> { pub fn interface_declaration(s: Span) -> IResult<Span, InterfaceDeclaration> {
alt(( alt((
interface_declaration_nonansi, interface_declaration_nonansi,
@ -602,6 +616,7 @@ pub fn interface_declaration(s: Span) -> IResult<Span, InterfaceDeclaration> {
))(s) ))(s)
} }
#[trace]
pub fn interface_declaration_nonansi(s: Span) -> IResult<Span, InterfaceDeclaration> { pub fn interface_declaration_nonansi(s: Span) -> IResult<Span, InterfaceDeclaration> {
let (s, a) = interface_nonansi_header(s)?; let (s, a) = interface_nonansi_header(s)?;
let (s, b) = opt(timeunits_declaration)(s)?; let (s, b) = opt(timeunits_declaration)(s)?;
@ -616,6 +631,7 @@ pub fn interface_declaration_nonansi(s: Span) -> IResult<Span, InterfaceDeclarat
)) ))
} }
#[trace]
pub fn interface_declaration_ansi(s: Span) -> IResult<Span, InterfaceDeclaration> { pub fn interface_declaration_ansi(s: Span) -> IResult<Span, InterfaceDeclaration> {
let (s, a) = interface_ansi_header(s)?; let (s, a) = interface_ansi_header(s)?;
let (s, b) = opt(timeunits_declaration)(s)?; let (s, b) = opt(timeunits_declaration)(s)?;
@ -630,6 +646,7 @@ pub fn interface_declaration_ansi(s: Span) -> IResult<Span, InterfaceDeclaration
)) ))
} }
#[trace]
pub fn interface_declaration_wildcard(s: Span) -> IResult<Span, InterfaceDeclaration> { pub fn interface_declaration_wildcard(s: Span) -> IResult<Span, InterfaceDeclaration> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = symbol("interface")(s)?; let (s, b) = symbol("interface")(s)?;
@ -649,6 +666,7 @@ pub fn interface_declaration_wildcard(s: Span) -> IResult<Span, InterfaceDeclara
)) ))
} }
#[trace]
pub fn interface_declaration_extern_nonansi(s: Span) -> IResult<Span, InterfaceDeclaration> { pub fn interface_declaration_extern_nonansi(s: Span) -> IResult<Span, InterfaceDeclaration> {
let (s, a) = symbol("extern")(s)?; let (s, a) = symbol("extern")(s)?;
let (s, b) = interface_nonansi_header(s)?; let (s, b) = interface_nonansi_header(s)?;
@ -658,6 +676,7 @@ pub fn interface_declaration_extern_nonansi(s: Span) -> IResult<Span, InterfaceD
)) ))
} }
#[trace]
pub fn interface_declaration_extern_ansi(s: Span) -> IResult<Span, InterfaceDeclaration> { pub fn interface_declaration_extern_ansi(s: Span) -> IResult<Span, InterfaceDeclaration> {
let (s, a) = symbol("extern")(s)?; let (s, a) = symbol("extern")(s)?;
let (s, b) = interface_ansi_header(s)?; let (s, b) = interface_ansi_header(s)?;
@ -667,6 +686,7 @@ pub fn interface_declaration_extern_ansi(s: Span) -> IResult<Span, InterfaceDecl
)) ))
} }
#[trace]
pub fn interface_nonansi_header(s: Span) -> IResult<Span, InterfaceNonansiHeader> { pub fn interface_nonansi_header(s: Span) -> IResult<Span, InterfaceNonansiHeader> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = symbol("interface")(s)?; let (s, b) = symbol("interface")(s)?;
@ -684,6 +704,7 @@ pub fn interface_nonansi_header(s: Span) -> IResult<Span, InterfaceNonansiHeader
)) ))
} }
#[trace]
pub fn interface_ansi_header(s: Span) -> IResult<Span, InterfaceAnsiHeader> { pub fn interface_ansi_header(s: Span) -> IResult<Span, InterfaceAnsiHeader> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = symbol("interface")(s)?; let (s, b) = symbol("interface")(s)?;
@ -701,6 +722,7 @@ pub fn interface_ansi_header(s: Span) -> IResult<Span, InterfaceAnsiHeader> {
)) ))
} }
#[trace]
pub fn program_declaration(s: Span) -> IResult<Span, ProgramDeclaration> { pub fn program_declaration(s: Span) -> IResult<Span, ProgramDeclaration> {
alt(( alt((
program_declaration_nonansi, program_declaration_nonansi,
@ -711,6 +733,7 @@ pub fn program_declaration(s: Span) -> IResult<Span, ProgramDeclaration> {
))(s) ))(s)
} }
#[trace]
pub fn program_declaration_nonansi(s: Span) -> IResult<Span, ProgramDeclaration> { pub fn program_declaration_nonansi(s: Span) -> IResult<Span, ProgramDeclaration> {
let (s, a) = program_nonansi_header(s)?; let (s, a) = program_nonansi_header(s)?;
let (s, b) = opt(timeunits_declaration)(s)?; let (s, b) = opt(timeunits_declaration)(s)?;
@ -725,6 +748,7 @@ pub fn program_declaration_nonansi(s: Span) -> IResult<Span, ProgramDeclaration>
)) ))
} }
#[trace]
pub fn program_declaration_ansi(s: Span) -> IResult<Span, ProgramDeclaration> { pub fn program_declaration_ansi(s: Span) -> IResult<Span, ProgramDeclaration> {
let (s, a) = program_ansi_header(s)?; let (s, a) = program_ansi_header(s)?;
let (s, b) = opt(timeunits_declaration)(s)?; let (s, b) = opt(timeunits_declaration)(s)?;
@ -739,6 +763,7 @@ pub fn program_declaration_ansi(s: Span) -> IResult<Span, ProgramDeclaration> {
)) ))
} }
#[trace]
pub fn program_declaration_wildcard(s: Span) -> IResult<Span, ProgramDeclaration> { pub fn program_declaration_wildcard(s: Span) -> IResult<Span, ProgramDeclaration> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = symbol("program")(s)?; let (s, b) = symbol("program")(s)?;
@ -757,6 +782,7 @@ pub fn program_declaration_wildcard(s: Span) -> IResult<Span, ProgramDeclaration
)) ))
} }
#[trace]
pub fn program_declaration_extern_nonansi(s: Span) -> IResult<Span, ProgramDeclaration> { pub fn program_declaration_extern_nonansi(s: Span) -> IResult<Span, ProgramDeclaration> {
let (s, a) = symbol("extern")(s)?; let (s, a) = symbol("extern")(s)?;
let (s, b) = program_nonansi_header(s)?; let (s, b) = program_nonansi_header(s)?;
@ -766,6 +792,7 @@ pub fn program_declaration_extern_nonansi(s: Span) -> IResult<Span, ProgramDecla
)) ))
} }
#[trace]
pub fn program_declaration_extern_ansi(s: Span) -> IResult<Span, ProgramDeclaration> { pub fn program_declaration_extern_ansi(s: Span) -> IResult<Span, ProgramDeclaration> {
let (s, a) = symbol("extern")(s)?; let (s, a) = symbol("extern")(s)?;
let (s, b) = program_ansi_header(s)?; let (s, b) = program_ansi_header(s)?;
@ -775,6 +802,7 @@ pub fn program_declaration_extern_ansi(s: Span) -> IResult<Span, ProgramDeclarat
)) ))
} }
#[trace]
pub fn program_nonansi_header(s: Span) -> IResult<Span, ProgramNonansiHeader> { pub fn program_nonansi_header(s: Span) -> IResult<Span, ProgramNonansiHeader> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = symbol("prgogram")(s)?; let (s, b) = symbol("prgogram")(s)?;
@ -792,6 +820,7 @@ pub fn program_nonansi_header(s: Span) -> IResult<Span, ProgramNonansiHeader> {
)) ))
} }
#[trace]
pub fn program_ansi_header(s: Span) -> IResult<Span, ProgramAnsiHeader> { pub fn program_ansi_header(s: Span) -> IResult<Span, ProgramAnsiHeader> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = symbol("program")(s)?; let (s, b) = symbol("program")(s)?;
@ -809,6 +838,7 @@ pub fn program_ansi_header(s: Span) -> IResult<Span, ProgramAnsiHeader> {
)) ))
} }
#[trace]
pub fn checker_declaration(s: Span) -> IResult<Span, CheckerDeclaration> { pub fn checker_declaration(s: Span) -> IResult<Span, CheckerDeclaration> {
let (s, a) = symbol("checker")(s)?; let (s, a) = symbol("checker")(s)?;
let (s, b) = checker_identifier(s)?; let (s, b) = checker_identifier(s)?;
@ -825,6 +855,7 @@ pub fn checker_declaration(s: Span) -> IResult<Span, CheckerDeclaration> {
)) ))
} }
#[trace]
pub fn class_declaration(s: Span) -> IResult<Span, ClassDeclaration> { pub fn class_declaration(s: Span) -> IResult<Span, ClassDeclaration> {
let (s, a) = opt(map(symbol("virtual"), |x| Virtual { nodes: (x,) }))(s)?; let (s, a) = opt(map(symbol("virtual"), |x| Virtual { nodes: (x,) }))(s)?;
let (s, b) = symbol("class")(s)?; let (s, b) = symbol("class")(s)?;
@ -852,12 +883,14 @@ pub fn class_declaration(s: Span) -> IResult<Span, ClassDeclaration> {
)) ))
} }
#[trace]
pub fn interface_class_type(s: Span) -> IResult<Span, InterfaceClassType> { pub fn interface_class_type(s: Span) -> IResult<Span, InterfaceClassType> {
let (s, a) = ps_class_identifier(s)?; let (s, a) = ps_class_identifier(s)?;
let (s, b) = opt(parameter_value_assignment)(s)?; let (s, b) = opt(parameter_value_assignment)(s)?;
Ok((s, InterfaceClassType { nodes: (a, b) })) Ok((s, InterfaceClassType { nodes: (a, b) }))
} }
#[trace]
pub fn interface_class_declaration(s: Span) -> IResult<Span, InterfaceClassDeclaration> { pub fn interface_class_declaration(s: Span) -> IResult<Span, InterfaceClassDeclaration> {
let (s, a) = symbol("interface")(s)?; let (s, a) = symbol("interface")(s)?;
let (s, b) = symbol("class")(s)?; let (s, b) = symbol("class")(s)?;
@ -879,6 +912,7 @@ pub fn interface_class_declaration(s: Span) -> IResult<Span, InterfaceClassDecla
)) ))
} }
#[trace]
pub fn interface_class_item(s: Span) -> IResult<Span, InterfaceClassItem> { pub fn interface_class_item(s: Span) -> IResult<Span, InterfaceClassItem> {
alt(( alt((
map(type_declaration, |x| InterfaceClassItem::TypeDeclaration(x)), map(type_declaration, |x| InterfaceClassItem::TypeDeclaration(x)),
@ -893,6 +927,7 @@ pub fn interface_class_item(s: Span) -> IResult<Span, InterfaceClassItem> {
))(s) ))(s)
} }
#[trace]
pub fn interface_class_item_method(s: Span) -> IResult<Span, InterfaceClassItem> { pub fn interface_class_item_method(s: Span) -> IResult<Span, InterfaceClassItem> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = interface_class_method(s)?; let (s, b) = interface_class_method(s)?;
@ -902,6 +937,7 @@ pub fn interface_class_item_method(s: Span) -> IResult<Span, InterfaceClassItem>
)) ))
} }
#[trace]
pub fn interface_class_method(s: Span) -> IResult<Span, InterfaceClassMethod> { pub fn interface_class_method(s: Span) -> IResult<Span, InterfaceClassMethod> {
let (s, a) = symbol("pure")(s)?; let (s, a) = symbol("pure")(s)?;
let (s, b) = symbol("virtual")(s)?; let (s, b) = symbol("virtual")(s)?;
@ -915,6 +951,7 @@ pub fn interface_class_method(s: Span) -> IResult<Span, InterfaceClassMethod> {
)) ))
} }
#[trace]
pub fn package_declaration(s: Span) -> IResult<Span, PackageDeclaration> { pub fn package_declaration(s: Span) -> IResult<Span, PackageDeclaration> {
let (s, a) = many0(attribute_instance)(s)?; let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = symbol("package")(s)?; let (s, b) = symbol("package")(s)?;
@ -933,6 +970,7 @@ pub fn package_declaration(s: Span) -> IResult<Span, PackageDeclaration> {
)) ))
} }
#[trace]
pub fn timeunits_declaration(s: Span) -> IResult<Span, TimeunitsDeclaration> { pub fn timeunits_declaration(s: Span) -> IResult<Span, TimeunitsDeclaration> {
alt(( alt((
timeunits_declaration_timeunit_timeprecision, timeunits_declaration_timeunit_timeprecision,
@ -942,6 +980,7 @@ pub fn timeunits_declaration(s: Span) -> IResult<Span, TimeunitsDeclaration> {
))(s) ))(s)
} }
#[trace]
pub fn timeunits_declaration_timeunit(s: Span) -> IResult<Span, TimeunitsDeclaration> { pub fn timeunits_declaration_timeunit(s: Span) -> IResult<Span, TimeunitsDeclaration> {
let (s, a) = symbol("timeunit")(s)?; let (s, a) = symbol("timeunit")(s)?;
let (s, b) = time_literal(s)?; let (s, b) = time_literal(s)?;
@ -955,6 +994,7 @@ pub fn timeunits_declaration_timeunit(s: Span) -> IResult<Span, TimeunitsDeclara
)) ))
} }
#[trace]
pub fn timeunits_declaration_timeprecision(s: Span) -> IResult<Span, TimeunitsDeclaration> { pub fn timeunits_declaration_timeprecision(s: Span) -> IResult<Span, TimeunitsDeclaration> {
let (s, a) = symbol("timeprecision")(s)?; let (s, a) = symbol("timeprecision")(s)?;
let (s, b) = time_literal(s)?; let (s, b) = time_literal(s)?;
@ -965,6 +1005,7 @@ pub fn timeunits_declaration_timeprecision(s: Span) -> IResult<Span, TimeunitsDe
)) ))
} }
#[trace]
pub fn timeunits_declaration_timeunit_timeprecision( pub fn timeunits_declaration_timeunit_timeprecision(
s: Span, s: Span,
) -> IResult<Span, TimeunitsDeclaration> { ) -> IResult<Span, TimeunitsDeclaration> {
@ -982,6 +1023,7 @@ pub fn timeunits_declaration_timeunit_timeprecision(
)) ))
} }
#[trace]
pub fn timeunits_declaration_timeprecision_timeunit( pub fn timeunits_declaration_timeprecision_timeunit(
s: Span, s: Span,
) -> IResult<Span, TimeunitsDeclaration> { ) -> IResult<Span, TimeunitsDeclaration> {

View File

@ -14,6 +14,7 @@ pub struct SpecifyBlock<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn specify_block(s: Span) -> IResult<Span, SpecifyBlock> { pub fn specify_block(s: Span) -> IResult<Span, SpecifyBlock> {
Err(Err::Error(make_error(s, ErrorKind::Fix))) Err(Err::Error(make_error(s, ErrorKind::Fix)))
} }

View File

@ -43,20 +43,24 @@ pub struct OutputIdentifierInterface<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn specify_input_terminal_descriptor(s: Span) -> IResult<Span, SpecifyInputTerminalDescriptor> { pub fn specify_input_terminal_descriptor(s: Span) -> IResult<Span, SpecifyInputTerminalDescriptor> {
Err(Err::Error(make_error(s, ErrorKind::Fix))) Err(Err::Error(make_error(s, ErrorKind::Fix)))
} }
#[trace]
pub fn specify_output_terminal_descriptor( pub fn specify_output_terminal_descriptor(
s: Span, s: Span,
) -> IResult<Span, SpecifyOutputTerminalDescriptor> { ) -> IResult<Span, SpecifyOutputTerminalDescriptor> {
Err(Err::Error(make_error(s, ErrorKind::Fix))) Err(Err::Error(make_error(s, ErrorKind::Fix)))
} }
#[trace]
pub fn input_identifier(s: Span) -> IResult<Span, InputIdentifier> { pub fn input_identifier(s: Span) -> IResult<Span, InputIdentifier> {
Err(Err::Error(make_error(s, ErrorKind::Fix))) Err(Err::Error(make_error(s, ErrorKind::Fix)))
} }
#[trace]
pub fn output_identifier(s: Span) -> IResult<Span, OutputIdentifier> { pub fn output_identifier(s: Span) -> IResult<Span, OutputIdentifier> {
Err(Err::Error(make_error(s, ErrorKind::Fix))) Err(Err::Error(make_error(s, ErrorKind::Fix)))
} }

View File

@ -14,6 +14,7 @@ pub struct EdgeIdentifier<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn edge_identifier(s: Span) -> IResult<Span, EdgeIdentifier> { pub fn edge_identifier(s: Span) -> IResult<Span, EdgeIdentifier> {
Err(Err::Error(make_error(s, ErrorKind::Fix))) Err(Err::Error(make_error(s, ErrorKind::Fix)))
} }

View File

@ -14,6 +14,7 @@ pub struct UdpDeclaration<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn udp_declaration(s: Span) -> IResult<Span, UdpDeclaration> { pub fn udp_declaration(s: Span) -> IResult<Span, UdpDeclaration> {
Err(Err::Error(make_error(s, ErrorKind::Fix))) Err(Err::Error(make_error(s, ErrorKind::Fix)))
} }

View File

@ -36,6 +36,7 @@ pub struct UdpInstance<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn udp_instantiation(s: Span) -> IResult<Span, UdpInstantiation> { pub fn udp_instantiation(s: Span) -> IResult<Span, UdpInstantiation> {
let (s, a) = udp_identifier(s)?; let (s, a) = udp_identifier(s)?;
let (s, b) = opt(drive_strength)(s)?; let (s, b) = opt(drive_strength)(s)?;
@ -50,6 +51,7 @@ pub fn udp_instantiation(s: Span) -> IResult<Span, UdpInstantiation> {
)) ))
} }
#[trace]
pub fn udp_instance(s: Span) -> IResult<Span, UdpInstance> { pub fn udp_instance(s: Span) -> IResult<Span, UdpInstance> {
let (s, a) = opt(name_of_instance)(s)?; let (s, a) = opt(name_of_instance)(s)?;
let (s, b) = paren(tuple(( let (s, b) = paren(tuple((

View File

@ -60,7 +60,19 @@ where
} }
pub fn symbol<'a>(t: &'a str) -> impl Fn(Span<'a>) -> IResult<Span<'a>, Symbol<'a>> { pub fn symbol<'a>(t: &'a str) -> impl Fn(Span<'a>) -> IResult<Span<'a>, Symbol<'a>> {
move |s: Span<'a>| map(ws(tag(t.clone())), |x| Symbol { nodes: x })(s) move |s: Span<'a>| {
if cfg!(feature = "trace") {
println!(
"{:<48} : {:<4},{:>032x} : {}",
format!("symbol(\"{}\")", t),
s.offset,
s.extra,
s.fragment
);
}
let (s, x) = map(ws(tag(t.clone())), |x| Symbol { nodes: x })(s)?;
Ok((clear_bit(s), x))
}
} }
pub fn paren<'a, O, F>(f: F) -> impl Fn(Span<'a>) -> IResult<Span<'a>, Paren<O>> pub fn paren<'a, O, F>(f: F) -> impl Fn(Span<'a>) -> IResult<Span<'a>, Paren<O>>
@ -68,6 +80,12 @@ where
F: Fn(Span<'a>) -> IResult<Span<'a>, O>, F: Fn(Span<'a>) -> IResult<Span<'a>, O>,
{ {
move |s: Span<'a>| { move |s: Span<'a>| {
if cfg!(feature = "trace") {
println!(
"{:<48} : {:<4},{:>032x} : {}",
"paren", s.offset, s.extra, s.fragment
);
}
let (s, a) = symbol("(")(s)?; let (s, a) = symbol("(")(s)?;
let (s, b) = f(s)?; let (s, b) = f(s)?;
let (s, c) = symbol(")")(s)?; let (s, c) = symbol(")")(s)?;
@ -80,6 +98,12 @@ where
F: Fn(Span<'a>) -> IResult<Span<'a>, O>, F: Fn(Span<'a>) -> IResult<Span<'a>, O>,
{ {
move |s: Span<'a>| { move |s: Span<'a>| {
if cfg!(feature = "trace") {
println!(
"{:<48} : {:<4},{:>032x} : {}",
"bracket", s.offset, s.extra, s.fragment
);
}
let (s, a) = symbol("[")(s)?; let (s, a) = symbol("[")(s)?;
let (s, b) = f(s)?; let (s, b) = f(s)?;
let (s, c) = symbol("]")(s)?; let (s, c) = symbol("]")(s)?;
@ -92,6 +116,12 @@ where
F: Fn(Span<'a>) -> IResult<Span<'a>, O>, F: Fn(Span<'a>) -> IResult<Span<'a>, O>,
{ {
move |s: Span<'a>| { move |s: Span<'a>| {
if cfg!(feature = "trace") {
println!(
"{:<48} : {:<4},{:>032x} : {}",
"brace", s.offset, s.extra, s.fragment
);
}
let (s, a) = symbol("{")(s)?; let (s, a) = symbol("{")(s)?;
let (s, b) = f(s)?; let (s, b) = f(s)?;
let (s, c) = symbol("}")(s)?; let (s, c) = symbol("}")(s)?;
@ -106,6 +136,12 @@ where
F: Fn(Span<'a>) -> IResult<Span<'a>, O>, F: Fn(Span<'a>) -> IResult<Span<'a>, O>,
{ {
move |s: Span<'a>| { move |s: Span<'a>| {
if cfg!(feature = "trace") {
println!(
"{:<48} : {:<4},{:>032x} : {}",
"apostrophe_brace", s.offset, s.extra, s.fragment
);
}
let (s, a) = symbol("'{")(s)?; let (s, a) = symbol("'{")(s)?;
let (s, b) = f(s)?; let (s, b) = f(s)?;
let (s, c) = symbol("}")(s)?; let (s, c) = symbol("}")(s)?;
@ -135,20 +171,20 @@ where
} }
} }
pub fn rec<'a, O, F>(f: F, id: u32) -> impl Fn(Span<'a>) -> IResult<Span<'a>, O> //pub fn rec<'a, O, F>(f: F, id: u32) -> impl Fn(Span<'a>) -> IResult<Span<'a>, O>
where //where
F: Fn(Span<'a>) -> IResult<Span<'a>, O>, // F: Fn(Span<'a>) -> IResult<Span<'a>, O>,
{ //{
move |s: Span<'a>| { // move |s: Span<'a>| {
if check_bit(s, id) { // if check_bit(s, id) {
return Err(Err::Error(make_error(s, ErrorKind::Fix))); // return Err(Err::Error(make_error(s, ErrorKind::Fix)));
} // }
let s = set_bit(s, id, true); // let s = set_bit(s, id, true);
let (s, x) = f(s)?; // let (s, x) = f(s)?;
let s = set_bit(s, id, false); // let s = set_bit(s, id, false);
Ok((s, x)) // Ok((s, x))
} // }
} //}
pub fn triple<'a, O1, O2, O3, F, G, H>( pub fn triple<'a, O1, O2, O3, F, G, H>(
f: F, f: F,
@ -170,6 +206,7 @@ where
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[trace]
pub fn white_space(s: Span) -> IResult<Span, WhiteSpace> { pub fn white_space(s: Span) -> IResult<Span, WhiteSpace> {
alt(( alt((
map(multispace1, |x| WhiteSpace::Space(x)), map(multispace1, |x| WhiteSpace::Space(x)),
@ -198,8 +235,8 @@ pub fn check_bit(s: Span, id: u32) -> bool {
} }
pub fn set_bit(s: Span, id: u32, bit: bool) -> Span { pub fn set_bit(s: Span, id: u32, bit: bool) -> Span {
let val = if bit { 1u64 << id } else { 0u64 }; let val = if bit { 1u128 << id } else { 0u128 };
let mask = !(1u64 << id); let mask = !(1u128 << id);
let val = (s.extra & mask) | val; let val = (s.extra & mask) | val;
Span { Span {
offset: s.offset, offset: s.offset,
@ -209,6 +246,15 @@ pub fn set_bit(s: Span, id: u32, bit: bool) -> Span {
} }
} }
pub fn clear_bit(s: Span) -> Span {
Span {
offset: s.offset,
line: s.line,
fragment: s.fragment,
extra: 0,
}
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[cfg(test)] #[cfg(test)]
@ -221,3 +267,14 @@ macro_rules! parser_test {
} }
}; };
} }
//macro_rules! s {
// ( $x:expr ) => {
// Span {
// offset: $x.offset,
// line: $x.line,
// fragment: $x.fragment,
// extra: (file!(), line!(), column!()),
// }
// };
//}