Apply nom-packrat

This commit is contained in:
dalance 2019-07-24 12:23:14 +09:00
parent 81e5a8b976
commit 1d22da04a1
78 changed files with 1507 additions and 1575 deletions

View File

@ -17,9 +17,11 @@ 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" }
nom_locate = { path = "../nom_locate" }
str-concat = "*" str-concat = "*"
sv-parser-macro = { path = "./sv-parser-macro" } sv-parser-macro = { path = "./sv-parser-macro" }
nom-packrat = { path = "../nom-packrat/nom-packrat" }
[build-dependencies] [build-dependencies]
walkdir = "2" walkdir = "2"

View File

@ -10,9 +10,15 @@ fn main() {
let dest = Path::new(&out_dir).join("any_node.rs"); let dest = Path::new(&out_dir).join("any_node.rs");
let mut out = File::create(&dest).unwrap(); let mut out = File::create(&dest).unwrap();
let _ = write!(out, "#[derive(Debug, Clone, AnyNode)]\n"); let mut ref_node = String::new();
let _ = write!(out, "pub enum AnyNode<'a> {{\n"); ref_node = format!("{}#[derive(Debug, Clone, RefNode)]\n", ref_node);
let _ = write!(out, " Locate(&'a Locate),\n"); ref_node = format!("{}pub enum RefNode<'a> {{\n", ref_node);
ref_node = format!("{} Locate(&'a Locate),\n", ref_node);
let mut any_node = String::new();
any_node = format!("{}#[derive(Debug, Clone, AnyNode)]\n", any_node);
any_node = format!("{}pub enum AnyNode {{\n", any_node);
any_node = format!("{} Locate(Locate),\n", any_node);
let re_node = Regex::new(r"#\[derive.*Node.*\]").unwrap(); let re_node = Regex::new(r"#\[derive.*Node.*\]").unwrap();
@ -26,7 +32,8 @@ fn main() {
let line = line.unwrap(); let line = line.unwrap();
if hit_node { if hit_node {
let name = line.split_whitespace().nth(2).unwrap().replace("<'a>", ""); let name = line.split_whitespace().nth(2).unwrap().replace("<'a>", "");
let _ = write!(out, " {}(&'a {}),\n", name, name); ref_node = format!("{} {}(&'a {}),\n", ref_node, name, name);
any_node = format!("{} {}({}),\n", any_node, name, name);
hit_node = false; hit_node = false;
} }
if re_node.is_match(&line) { if re_node.is_match(&line) {
@ -36,5 +43,8 @@ fn main() {
} }
} }
let _ = write!(out, "}}\n"); ref_node = format!("{}}}\n", ref_node);
any_node = format!("{}}}\n", any_node);
let _ = write!(out, "{}", ref_node);
let _ = write!(out, "{}", any_node);
} }

View File

@ -1,20 +1,21 @@
use crate::ast::*; use crate::ast::*;
use crate::parser::*; use crate::parser::*;
use core::convert::TryFrom;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
include!(concat!(env!("OUT_DIR"), "/any_node.rs")); include!(concat!(env!("OUT_DIR"), "/any_node.rs"));
pub struct AnyNodes<'a>(pub Vec<AnyNode<'a>>); pub struct RefNodes<'a>(pub Vec<RefNode<'a>>);
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
pub struct Iter<'a> { pub struct Iter<'a> {
pub next: AnyNodes<'a>, pub next: RefNodes<'a>,
} }
impl<'a> Iterator for Iter<'a> { impl<'a> Iterator for Iter<'a> {
type Item = AnyNode<'a>; type Item = RefNode<'a>;
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
let ret = self.next.0.pop(); let ret = self.next.0.pop();
@ -29,21 +30,21 @@ impl<'a> Iterator for Iter<'a> {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
impl<'a> From<Vec<AnyNode<'a>>> for AnyNodes<'a> { impl<'a> From<Vec<RefNode<'a>>> for RefNodes<'a> {
fn from(x: Vec<AnyNode<'a>>) -> Self { fn from(x: Vec<RefNode<'a>>) -> Self {
AnyNodes(x) RefNodes(x)
} }
} }
impl<'a> From<&'a Locate> for AnyNodes<'a> { impl<'a> From<&'a Locate> for RefNodes<'a> {
fn from(x: &'a Locate) -> Self { fn from(x: &'a Locate) -> Self {
vec![AnyNode::Locate(x)].into() vec![RefNode::Locate(x)].into()
} }
} }
impl<'a, T: 'a> From<&'a Vec<T>> for AnyNodes<'a> impl<'a, T: 'a> From<&'a Vec<T>> for RefNodes<'a>
where where
&'a T: Into<AnyNodes<'a>>, &'a T: Into<RefNodes<'a>>,
{ {
fn from(x: &'a Vec<T>) -> Self { fn from(x: &'a Vec<T>) -> Self {
let mut ret = Vec::new(); let mut ret = Vec::new();
@ -54,9 +55,9 @@ where
} }
} }
impl<'a, T: 'a> From<&'a Option<T>> for AnyNodes<'a> impl<'a, T: 'a> From<&'a Option<T>> for RefNodes<'a>
where where
&'a T: Into<AnyNodes<'a>>, &'a T: Into<RefNodes<'a>>,
{ {
fn from(x: &'a Option<T>) -> Self { fn from(x: &'a Option<T>) -> Self {
let mut ret = Vec::new(); let mut ret = Vec::new();
@ -67,9 +68,9 @@ where
} }
} }
impl<'a, T0: 'a> From<&'a (T0,)> for AnyNodes<'a> impl<'a, T0: 'a> From<&'a (T0,)> for RefNodes<'a>
where where
&'a T0: Into<AnyNodes<'a>>, &'a T0: Into<RefNodes<'a>>,
{ {
fn from(x: &'a (T0,)) -> Self { fn from(x: &'a (T0,)) -> Self {
let mut ret = Vec::new(); let mut ret = Vec::new();
@ -79,10 +80,10 @@ where
} }
} }
impl<'a, T0: 'a, T1: 'a> From<&'a (T0, T1)> for AnyNodes<'a> impl<'a, T0: 'a, T1: 'a> From<&'a (T0, T1)> for RefNodes<'a>
where where
&'a T0: Into<AnyNodes<'a>>, &'a T0: Into<RefNodes<'a>>,
&'a T1: Into<AnyNodes<'a>>, &'a T1: Into<RefNodes<'a>>,
{ {
fn from(x: &'a (T0, T1)) -> Self { fn from(x: &'a (T0, T1)) -> Self {
let mut ret = Vec::new(); let mut ret = Vec::new();
@ -93,11 +94,11 @@ where
} }
} }
impl<'a, T0: 'a, T1: 'a, T2: 'a> From<&'a (T0, T1, T2)> for AnyNodes<'a> impl<'a, T0: 'a, T1: 'a, T2: 'a> From<&'a (T0, T1, T2)> for RefNodes<'a>
where where
&'a T0: Into<AnyNodes<'a>>, &'a T0: Into<RefNodes<'a>>,
&'a T1: Into<AnyNodes<'a>>, &'a T1: Into<RefNodes<'a>>,
&'a T2: Into<AnyNodes<'a>>, &'a T2: Into<RefNodes<'a>>,
{ {
fn from(x: &'a (T0, T1, T2)) -> Self { fn from(x: &'a (T0, T1, T2)) -> Self {
let mut ret = Vec::new(); let mut ret = Vec::new();
@ -109,12 +110,12 @@ where
} }
} }
impl<'a, T0: 'a, T1: 'a, T2: 'a, T3: 'a> From<&'a (T0, T1, T2, T3)> for AnyNodes<'a> impl<'a, T0: 'a, T1: 'a, T2: 'a, T3: 'a> From<&'a (T0, T1, T2, T3)> for RefNodes<'a>
where where
&'a T0: Into<AnyNodes<'a>>, &'a T0: Into<RefNodes<'a>>,
&'a T1: Into<AnyNodes<'a>>, &'a T1: Into<RefNodes<'a>>,
&'a T2: Into<AnyNodes<'a>>, &'a T2: Into<RefNodes<'a>>,
&'a T3: Into<AnyNodes<'a>>, &'a T3: Into<RefNodes<'a>>,
{ {
fn from(x: &'a (T0, T1, T2, T3)) -> Self { fn from(x: &'a (T0, T1, T2, T3)) -> Self {
let mut ret = Vec::new(); let mut ret = Vec::new();
@ -127,13 +128,13 @@ where
} }
} }
impl<'a, T0: 'a, T1: 'a, T2: 'a, T3: 'a, T4: 'a> From<&'a (T0, T1, T2, T3, T4)> for AnyNodes<'a> impl<'a, T0: 'a, T1: 'a, T2: 'a, T3: 'a, T4: 'a> From<&'a (T0, T1, T2, T3, T4)> for RefNodes<'a>
where where
&'a T0: Into<AnyNodes<'a>>, &'a T0: Into<RefNodes<'a>>,
&'a T1: Into<AnyNodes<'a>>, &'a T1: Into<RefNodes<'a>>,
&'a T2: Into<AnyNodes<'a>>, &'a T2: Into<RefNodes<'a>>,
&'a T3: Into<AnyNodes<'a>>, &'a T3: Into<RefNodes<'a>>,
&'a T4: Into<AnyNodes<'a>>, &'a T4: Into<RefNodes<'a>>,
{ {
fn from(x: &'a (T0, T1, T2, T3, T4)) -> Self { fn from(x: &'a (T0, T1, T2, T3, T4)) -> Self {
let mut ret = Vec::new(); let mut ret = Vec::new();
@ -148,14 +149,14 @@ where
} }
impl<'a, T0: 'a, T1: 'a, T2: 'a, T3: 'a, T4: 'a, T5: 'a> From<&'a (T0, T1, T2, T3, T4, T5)> impl<'a, T0: 'a, T1: 'a, T2: 'a, T3: 'a, T4: 'a, T5: 'a> From<&'a (T0, T1, T2, T3, T4, T5)>
for AnyNodes<'a> for RefNodes<'a>
where where
&'a T0: Into<AnyNodes<'a>>, &'a T0: Into<RefNodes<'a>>,
&'a T1: Into<AnyNodes<'a>>, &'a T1: Into<RefNodes<'a>>,
&'a T2: Into<AnyNodes<'a>>, &'a T2: Into<RefNodes<'a>>,
&'a T3: Into<AnyNodes<'a>>, &'a T3: Into<RefNodes<'a>>,
&'a T4: Into<AnyNodes<'a>>, &'a T4: Into<RefNodes<'a>>,
&'a T5: Into<AnyNodes<'a>>, &'a T5: Into<RefNodes<'a>>,
{ {
fn from(x: &'a (T0, T1, T2, T3, T4, T5)) -> Self { fn from(x: &'a (T0, T1, T2, T3, T4, T5)) -> Self {
let mut ret = Vec::new(); let mut ret = Vec::new();
@ -171,15 +172,15 @@ where
} }
impl<'a, T0: 'a, T1: 'a, T2: 'a, T3: 'a, T4: 'a, T5: 'a, T6: 'a> impl<'a, T0: 'a, T1: 'a, T2: 'a, T3: 'a, T4: 'a, T5: 'a, T6: 'a>
From<&'a (T0, T1, T2, T3, T4, T5, T6)> for AnyNodes<'a> From<&'a (T0, T1, T2, T3, T4, T5, T6)> for RefNodes<'a>
where where
&'a T0: Into<AnyNodes<'a>>, &'a T0: Into<RefNodes<'a>>,
&'a T1: Into<AnyNodes<'a>>, &'a T1: Into<RefNodes<'a>>,
&'a T2: Into<AnyNodes<'a>>, &'a T2: Into<RefNodes<'a>>,
&'a T3: Into<AnyNodes<'a>>, &'a T3: Into<RefNodes<'a>>,
&'a T4: Into<AnyNodes<'a>>, &'a T4: Into<RefNodes<'a>>,
&'a T5: Into<AnyNodes<'a>>, &'a T5: Into<RefNodes<'a>>,
&'a T6: Into<AnyNodes<'a>>, &'a T6: Into<RefNodes<'a>>,
{ {
fn from(x: &'a (T0, T1, T2, T3, T4, T5, T6)) -> Self { fn from(x: &'a (T0, T1, T2, T3, T4, T5, T6)) -> Self {
let mut ret = Vec::new(); let mut ret = Vec::new();
@ -196,16 +197,16 @@ where
} }
impl<'a, T0: 'a, T1: 'a, T2: 'a, T3: 'a, T4: 'a, T5: 'a, T6: 'a, T7: 'a> impl<'a, T0: 'a, T1: 'a, T2: 'a, T3: 'a, T4: 'a, T5: 'a, T6: 'a, T7: 'a>
From<&'a (T0, T1, T2, T3, T4, T5, T6, T7)> for AnyNodes<'a> From<&'a (T0, T1, T2, T3, T4, T5, T6, T7)> for RefNodes<'a>
where where
&'a T0: Into<AnyNodes<'a>>, &'a T0: Into<RefNodes<'a>>,
&'a T1: Into<AnyNodes<'a>>, &'a T1: Into<RefNodes<'a>>,
&'a T2: Into<AnyNodes<'a>>, &'a T2: Into<RefNodes<'a>>,
&'a T3: Into<AnyNodes<'a>>, &'a T3: Into<RefNodes<'a>>,
&'a T4: Into<AnyNodes<'a>>, &'a T4: Into<RefNodes<'a>>,
&'a T5: Into<AnyNodes<'a>>, &'a T5: Into<RefNodes<'a>>,
&'a T6: Into<AnyNodes<'a>>, &'a T6: Into<RefNodes<'a>>,
&'a T7: Into<AnyNodes<'a>>, &'a T7: Into<RefNodes<'a>>,
{ {
fn from(x: &'a (T0, T1, T2, T3, T4, T5, T6, T7)) -> Self { fn from(x: &'a (T0, T1, T2, T3, T4, T5, T6, T7)) -> Self {
let mut ret = Vec::new(); let mut ret = Vec::new();
@ -223,17 +224,17 @@ where
} }
impl<'a, T0: 'a, T1: 'a, T2: 'a, T3: 'a, T4: 'a, T5: 'a, T6: 'a, T7: 'a, T8: 'a> impl<'a, T0: 'a, T1: 'a, T2: 'a, T3: 'a, T4: 'a, T5: 'a, T6: 'a, T7: 'a, T8: 'a>
From<&'a (T0, T1, T2, T3, T4, T5, T6, T7, T8)> for AnyNodes<'a> From<&'a (T0, T1, T2, T3, T4, T5, T6, T7, T8)> for RefNodes<'a>
where where
&'a T0: Into<AnyNodes<'a>>, &'a T0: Into<RefNodes<'a>>,
&'a T1: Into<AnyNodes<'a>>, &'a T1: Into<RefNodes<'a>>,
&'a T2: Into<AnyNodes<'a>>, &'a T2: Into<RefNodes<'a>>,
&'a T3: Into<AnyNodes<'a>>, &'a T3: Into<RefNodes<'a>>,
&'a T4: Into<AnyNodes<'a>>, &'a T4: Into<RefNodes<'a>>,
&'a T5: Into<AnyNodes<'a>>, &'a T5: Into<RefNodes<'a>>,
&'a T6: Into<AnyNodes<'a>>, &'a T6: Into<RefNodes<'a>>,
&'a T7: Into<AnyNodes<'a>>, &'a T7: Into<RefNodes<'a>>,
&'a T8: Into<AnyNodes<'a>>, &'a T8: Into<RefNodes<'a>>,
{ {
fn from(x: &'a (T0, T1, T2, T3, T4, T5, T6, T7, T8)) -> Self { fn from(x: &'a (T0, T1, T2, T3, T4, T5, T6, T7, T8)) -> Self {
let mut ret = Vec::new(); let mut ret = Vec::new();
@ -252,18 +253,18 @@ where
} }
impl<'a, T0: 'a, T1: 'a, T2: 'a, T3: 'a, T4: 'a, T5: 'a, T6: 'a, T7: 'a, T8: 'a, T9: 'a> impl<'a, T0: 'a, T1: 'a, T2: 'a, T3: 'a, T4: 'a, T5: 'a, T6: 'a, T7: 'a, T8: 'a, T9: 'a>
From<&'a (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)> for AnyNodes<'a> From<&'a (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)> for RefNodes<'a>
where where
&'a T0: Into<AnyNodes<'a>>, &'a T0: Into<RefNodes<'a>>,
&'a T1: Into<AnyNodes<'a>>, &'a T1: Into<RefNodes<'a>>,
&'a T2: Into<AnyNodes<'a>>, &'a T2: Into<RefNodes<'a>>,
&'a T3: Into<AnyNodes<'a>>, &'a T3: Into<RefNodes<'a>>,
&'a T4: Into<AnyNodes<'a>>, &'a T4: Into<RefNodes<'a>>,
&'a T5: Into<AnyNodes<'a>>, &'a T5: Into<RefNodes<'a>>,
&'a T6: Into<AnyNodes<'a>>, &'a T6: Into<RefNodes<'a>>,
&'a T7: Into<AnyNodes<'a>>, &'a T7: Into<RefNodes<'a>>,
&'a T8: Into<AnyNodes<'a>>, &'a T8: Into<RefNodes<'a>>,
&'a T9: Into<AnyNodes<'a>>, &'a T9: Into<RefNodes<'a>>,
{ {
fn from(x: &'a (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)) -> Self { fn from(x: &'a (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)) -> Self {
let mut ret = Vec::new(); let mut ret = Vec::new();
@ -295,19 +296,19 @@ impl<
T8: 'a, T8: 'a,
T9: 'a, T9: 'a,
T10: 'a, T10: 'a,
> From<&'a (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)> for AnyNodes<'a> > From<&'a (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)> for RefNodes<'a>
where where
&'a T0: Into<AnyNodes<'a>>, &'a T0: Into<RefNodes<'a>>,
&'a T1: Into<AnyNodes<'a>>, &'a T1: Into<RefNodes<'a>>,
&'a T2: Into<AnyNodes<'a>>, &'a T2: Into<RefNodes<'a>>,
&'a T3: Into<AnyNodes<'a>>, &'a T3: Into<RefNodes<'a>>,
&'a T4: Into<AnyNodes<'a>>, &'a T4: Into<RefNodes<'a>>,
&'a T5: Into<AnyNodes<'a>>, &'a T5: Into<RefNodes<'a>>,
&'a T6: Into<AnyNodes<'a>>, &'a T6: Into<RefNodes<'a>>,
&'a T7: Into<AnyNodes<'a>>, &'a T7: Into<RefNodes<'a>>,
&'a T8: Into<AnyNodes<'a>>, &'a T8: Into<RefNodes<'a>>,
&'a T9: Into<AnyNodes<'a>>, &'a T9: Into<RefNodes<'a>>,
&'a T10: Into<AnyNodes<'a>>, &'a T10: Into<RefNodes<'a>>,
{ {
fn from(x: &'a (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)) -> Self { fn from(x: &'a (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)) -> Self {
let mut ret = Vec::new(); let mut ret = Vec::new();
@ -327,15 +328,15 @@ where
} }
} }
impl<'a, T> From<&'a Paren<T>> for AnyNodes<'a> impl<'a, T> From<&'a Paren<T>> for RefNodes<'a>
where where
&'a T: Into<AnyNodes<'a>>, &'a T: Into<RefNodes<'a>>,
{ {
fn from(x: &'a Paren<T>) -> Self { fn from(x: &'a Paren<T>) -> Self {
let mut ret = Vec::new(); let mut ret = Vec::new();
let (a, b, c) = &x.nodes; let (a, b, c) = &x.nodes;
let mut a: AnyNodes<'a> = a.into(); let mut a: RefNodes<'a> = a.into();
let mut c: AnyNodes<'a> = c.into(); let mut c: RefNodes<'a> = c.into();
ret.append(&mut a.0); ret.append(&mut a.0);
ret.append(&mut b.into().0); ret.append(&mut b.into().0);
ret.append(&mut c.0); ret.append(&mut c.0);
@ -343,15 +344,15 @@ where
} }
} }
impl<'a, T> From<&'a Brace<T>> for AnyNodes<'a> impl<'a, T> From<&'a Brace<T>> for RefNodes<'a>
where where
&'a T: Into<AnyNodes<'a>>, &'a T: Into<RefNodes<'a>>,
{ {
fn from(x: &'a Brace<T>) -> Self { fn from(x: &'a Brace<T>) -> Self {
let mut ret = Vec::new(); let mut ret = Vec::new();
let (a, b, c) = &x.nodes; let (a, b, c) = &x.nodes;
let mut a: AnyNodes<'a> = a.into(); let mut a: RefNodes<'a> = a.into();
let mut c: AnyNodes<'a> = c.into(); let mut c: RefNodes<'a> = c.into();
ret.append(&mut a.0); ret.append(&mut a.0);
ret.append(&mut b.into().0); ret.append(&mut b.into().0);
ret.append(&mut c.0); ret.append(&mut c.0);
@ -359,15 +360,15 @@ where
} }
} }
impl<'a, T> From<&'a Bracket<T>> for AnyNodes<'a> impl<'a, T> From<&'a Bracket<T>> for RefNodes<'a>
where where
&'a T: Into<AnyNodes<'a>>, &'a T: Into<RefNodes<'a>>,
{ {
fn from(x: &'a Bracket<T>) -> Self { fn from(x: &'a Bracket<T>) -> Self {
let mut ret = Vec::new(); let mut ret = Vec::new();
let (a, b, c) = &x.nodes; let (a, b, c) = &x.nodes;
let mut a: AnyNodes<'a> = a.into(); let mut a: RefNodes<'a> = a.into();
let mut c: AnyNodes<'a> = c.into(); let mut c: RefNodes<'a> = c.into();
ret.append(&mut a.0); ret.append(&mut a.0);
ret.append(&mut b.into().0); ret.append(&mut b.into().0);
ret.append(&mut c.0); ret.append(&mut c.0);
@ -375,15 +376,15 @@ where
} }
} }
impl<'a, T> From<&'a ApostropheBrace<T>> for AnyNodes<'a> impl<'a, T> From<&'a ApostropheBrace<T>> for RefNodes<'a>
where where
&'a T: Into<AnyNodes<'a>>, &'a T: Into<RefNodes<'a>>,
{ {
fn from(x: &'a ApostropheBrace<T>) -> Self { fn from(x: &'a ApostropheBrace<T>) -> Self {
let mut ret = Vec::new(); let mut ret = Vec::new();
let (a, b, c) = &x.nodes; let (a, b, c) = &x.nodes;
let mut a: AnyNodes<'a> = a.into(); let mut a: RefNodes<'a> = a.into();
let mut c: AnyNodes<'a> = c.into(); let mut c: RefNodes<'a> = c.into();
ret.append(&mut a.0); ret.append(&mut a.0);
ret.append(&mut b.into().0); ret.append(&mut b.into().0);
ret.append(&mut c.0); ret.append(&mut c.0);
@ -391,28 +392,28 @@ where
} }
} }
impl<'a, T, U> From<&'a List<T, U>> for AnyNodes<'a> impl<'a, T, U> From<&'a List<T, U>> for RefNodes<'a>
where where
&'a T: Into<AnyNodes<'a>>, &'a T: Into<RefNodes<'a>>,
&'a U: Into<AnyNodes<'a>>, &'a U: Into<RefNodes<'a>>,
{ {
fn from(x: &'a List<T, U>) -> Self { fn from(x: &'a List<T, U>) -> Self {
let mut ret = Vec::new(); let mut ret = Vec::new();
let (t, u) = &x.nodes; let (t, u) = &x.nodes;
let mut u: AnyNodes<'a> = u.into(); let mut u: RefNodes<'a> = u.into();
ret.append(&mut t.into().0); ret.append(&mut t.into().0);
ret.append(&mut u.0); ret.append(&mut u.0);
ret.into() ret.into()
} }
} }
impl<'a, T: 'a> From<&'a Box<T>> for AnyNodes<'a> impl<'a, T: 'a> From<&'a Box<T>> for RefNodes<'a>
where where
&'a T: Into<AnyNodes<'a>>, &'a T: Into<RefNodes<'a>>,
{ {
fn from(x: &'a Box<T>) -> Self { fn from(x: &'a Box<T>) -> Self {
let mut ret = Vec::new(); let mut ret = Vec::new();
let mut x: AnyNodes<'a> = x.into(); let mut x: RefNodes<'a> = x.into();
ret.append(&mut x.0); ret.append(&mut x.0);
ret.into() ret.into()
} }

View File

@ -2,11 +2,11 @@ use crate::ast::*;
use crate::parser::*; use crate::parser::*;
pub trait Node<'a> { pub trait Node<'a> {
fn next(&'a self) -> AnyNodes<'a>; fn next(&'a self) -> RefNodes<'a>;
} }
impl<'a> Node<'a> for Locate { impl<'a> Node<'a> for Locate {
fn next(&'a self) -> AnyNodes<'a> { fn next(&'a self) -> RefNodes<'a> {
vec![].into() vec![].into()
} }
} }

View File

@ -1,3 +1,7 @@
#![recursion_limit = "128"] #![recursion_limit = "128"]
pub mod ast; pub mod ast;
pub mod parser; pub mod parser;
use nom_packrat::storage;
storage!(ast::AnyNode);

View File

@ -7,13 +7,13 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum AssertionItem { pub enum AssertionItem {
Concurrent(ConcurrentAssertionItem), Concurrent(ConcurrentAssertionItem),
Immediate(DeferredImmediateAssetionItem), Immediate(DeferredImmediateAssetionItem),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DeferredImmediateAssetionItem { pub struct DeferredImmediateAssetionItem {
pub nodes: ( pub nodes: (
Option<(BlockIdentifier, Symbol)>, Option<(BlockIdentifier, Symbol)>,
@ -21,64 +21,64 @@ pub struct DeferredImmediateAssetionItem {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ProceduralAssertionStatement { pub enum ProceduralAssertionStatement {
Concurrent(ConcurrentAssertionStatement), Concurrent(ConcurrentAssertionStatement),
Immediate(ImmediateAssetionStatement), Immediate(ImmediateAssetionStatement),
Checker(CheckerInstantiation), Checker(CheckerInstantiation),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ImmediateAssetionStatement { pub enum ImmediateAssetionStatement {
Simple(SimpleImmediateAssertionStatement), Simple(SimpleImmediateAssertionStatement),
Deferred(DeferredImmediateAssertionStatement), Deferred(DeferredImmediateAssertionStatement),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum SimpleImmediateAssertionStatement { pub enum SimpleImmediateAssertionStatement {
Assert(SimpleImmediateAssertStatement), Assert(SimpleImmediateAssertStatement),
Assume(SimpleImmediateAssumeStatement), Assume(SimpleImmediateAssumeStatement),
Cover(SimpleImmediateCoverStatement), Cover(SimpleImmediateCoverStatement),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SimpleImmediateAssertStatement { pub struct SimpleImmediateAssertStatement {
pub nodes: (Keyword, Paren<Expression>, ActionBlock), pub nodes: (Keyword, Paren<Expression>, ActionBlock),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SimpleImmediateAssumeStatement { pub struct SimpleImmediateAssumeStatement {
pub nodes: (Keyword, Paren<Expression>, ActionBlock), pub nodes: (Keyword, Paren<Expression>, ActionBlock),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SimpleImmediateCoverStatement { pub struct SimpleImmediateCoverStatement {
pub nodes: (Keyword, Paren<Expression>, StatementOrNull), pub nodes: (Keyword, Paren<Expression>, StatementOrNull),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum DeferredImmediateAssertionStatement { pub enum DeferredImmediateAssertionStatement {
Assert(DeferredImmediateAssertStatement), Assert(DeferredImmediateAssertStatement),
Assume(DeferredImmediateAssumeStatement), Assume(DeferredImmediateAssumeStatement),
Cover(DeferredImmediateCoverStatement), Cover(DeferredImmediateCoverStatement),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DeferredImmediateAssertStatement { pub struct DeferredImmediateAssertStatement {
pub nodes: (Keyword, AssertTiming, Paren<Expression>, ActionBlock), pub nodes: (Keyword, AssertTiming, Paren<Expression>, ActionBlock),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DeferredImmediateAssumeStatement { pub struct DeferredImmediateAssumeStatement {
pub nodes: (Keyword, AssertTiming, Paren<Expression>, ActionBlock), pub nodes: (Keyword, AssertTiming, Paren<Expression>, ActionBlock),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DeferredImmediateCoverStatement { pub struct DeferredImmediateCoverStatement {
pub nodes: (Keyword, AssertTiming, Paren<Expression>, StatementOrNull), pub nodes: (Keyword, AssertTiming, Paren<Expression>, StatementOrNull),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum AssertTiming { pub enum AssertTiming {
Zero(Symbol), Zero(Symbol),
Final(Keyword), Final(Keyword),

View File

@ -8,14 +8,14 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum CaseStatement { pub enum CaseStatement {
Normal(CaseStatementNormal), Normal(CaseStatementNormal),
Matches(CaseStatementMatches), Matches(CaseStatementMatches),
Inside(CaseStatementInside), Inside(CaseStatementInside),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CaseStatementNormal { pub struct CaseStatementNormal {
pub nodes: ( pub nodes: (
Option<UniquePriority>, Option<UniquePriority>,
@ -27,7 +27,7 @@ pub struct CaseStatementNormal {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CaseStatementMatches { pub struct CaseStatementMatches {
pub nodes: ( pub nodes: (
Option<UniquePriority>, Option<UniquePriority>,
@ -40,7 +40,7 @@ pub struct CaseStatementMatches {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CaseStatementInside { pub struct CaseStatementInside {
pub nodes: ( pub nodes: (
Option<UniquePriority>, Option<UniquePriority>,
@ -53,41 +53,41 @@ pub struct CaseStatementInside {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum CaseKeyword { pub enum CaseKeyword {
Case(Keyword), Case(Keyword),
Casez(Keyword), Casez(Keyword),
Casex(Keyword), Casex(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CaseExpression { pub struct CaseExpression {
pub nodes: (Expression,), pub nodes: (Expression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum CaseItem { pub enum CaseItem {
NonDefault(CaseItemNondefault), NonDefault(CaseItemNondefault),
Default(CaseItemDefault), Default(CaseItemDefault),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CaseItemNondefault { pub struct CaseItemNondefault {
pub nodes: (List<Symbol, CaseItemExpression>, Symbol, StatementOrNull), pub nodes: (List<Symbol, CaseItemExpression>, Symbol, StatementOrNull),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CaseItemDefault { pub struct CaseItemDefault {
pub nodes: (Keyword, Option<Symbol>, StatementOrNull), pub nodes: (Keyword, Option<Symbol>, StatementOrNull),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum CasePatternItem { pub enum CasePatternItem {
NonDefault(CasePatternItemNondefault), NonDefault(CasePatternItemNondefault),
Default(CaseItemDefault), Default(CaseItemDefault),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CasePatternItemNondefault { pub struct CasePatternItemNondefault {
pub nodes: ( pub nodes: (
Pattern, Pattern,
@ -97,38 +97,38 @@ pub struct CasePatternItemNondefault {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum CaseInsideItem { pub enum CaseInsideItem {
NonDefault(CaseInsideItemNondefault), NonDefault(CaseInsideItemNondefault),
Default(CaseItemDefault), Default(CaseItemDefault),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CaseInsideItemNondefault { pub struct CaseInsideItemNondefault {
pub nodes: (OpenRangeList, Symbol, StatementOrNull), pub nodes: (OpenRangeList, Symbol, StatementOrNull),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CaseItemExpression { pub struct CaseItemExpression {
pub nodes: (Expression,), pub nodes: (Expression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct RandcaseStatement { pub struct RandcaseStatement {
pub nodes: (Keyword, RandcaseItem, Vec<RandcaseItem>, Keyword), pub nodes: (Keyword, RandcaseItem, Vec<RandcaseItem>, Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct RandcaseItem { pub struct RandcaseItem {
pub nodes: (Expression, Symbol, StatementOrNull), pub nodes: (Expression, Symbol, StatementOrNull),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct OpenRangeList { pub struct OpenRangeList {
pub nodes: (List<Symbol, OpenValueRange>,), pub nodes: (List<Symbol, OpenValueRange>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct OpenValueRange { pub struct OpenValueRange {
pub nodes: (ValueRange,), pub nodes: (ValueRange,),
} }

View File

@ -8,13 +8,13 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ClockingDeclaration { pub enum ClockingDeclaration {
Local(ClockingDeclarationLocal), Local(ClockingDeclarationLocal),
Global(ClockingDeclarationGlobal), Global(ClockingDeclarationGlobal),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClockingDeclarationLocal { pub struct ClockingDeclarationLocal {
pub nodes: ( pub nodes: (
Option<Default>, Option<Default>,
@ -28,12 +28,12 @@ pub struct ClockingDeclarationLocal {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Default { pub struct Default {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClockingDeclarationGlobal { pub struct ClockingDeclarationGlobal {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -46,67 +46,67 @@ pub struct ClockingDeclarationGlobal {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ClockingEvent { pub enum ClockingEvent {
Identifier(ClockingEventIdentifier), Identifier(ClockingEventIdentifier),
Expression(ClockingEventExpression), Expression(ClockingEventExpression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClockingEventIdentifier { pub struct ClockingEventIdentifier {
pub nodes: (Symbol, Identifier), pub nodes: (Symbol, Identifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClockingEventExpression { pub struct ClockingEventExpression {
pub nodes: (Symbol, Paren<EventExpression>), pub nodes: (Symbol, Paren<EventExpression>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ClockingItem { pub enum ClockingItem {
Default(ClockingItemDefault), Default(ClockingItemDefault),
Direction(ClockingItemDirection), Direction(ClockingItemDirection),
Assertion(ClockingItemAssertion), Assertion(ClockingItemAssertion),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClockingItemDefault { pub struct ClockingItemDefault {
pub nodes: (Keyword, DefaultSkew, Symbol), pub nodes: (Keyword, DefaultSkew, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClockingItemDirection { pub struct ClockingItemDirection {
pub nodes: (ClockingDirection, ListOfClockingDeclAssign, Symbol), pub nodes: (ClockingDirection, ListOfClockingDeclAssign, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClockingItemAssertion { pub struct ClockingItemAssertion {
pub nodes: (Vec<AttributeInstance>, AssertionItemDeclaration), pub nodes: (Vec<AttributeInstance>, AssertionItemDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum DefaultSkew { pub enum DefaultSkew {
Input(DefaultSkewInput), Input(DefaultSkewInput),
Output(DefaultSkewOutput), Output(DefaultSkewOutput),
InputOutput(DefaultSkewInputOutput), InputOutput(DefaultSkewInputOutput),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DefaultSkewInput { pub struct DefaultSkewInput {
pub nodes: (Keyword, ClockingSkew), pub nodes: (Keyword, ClockingSkew),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DefaultSkewOutput { pub struct DefaultSkewOutput {
pub nodes: (Keyword, ClockingSkew), pub nodes: (Keyword, ClockingSkew),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DefaultSkewInputOutput { pub struct DefaultSkewInputOutput {
pub nodes: (Keyword, ClockingSkew, Keyword, ClockingSkew), pub nodes: (Keyword, ClockingSkew, Keyword, ClockingSkew),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ClockingDirection { pub enum ClockingDirection {
Input(ClockingDirectionInput), Input(ClockingDirectionInput),
Output(ClockingDirectionOutput), Output(ClockingDirectionOutput),
@ -114,75 +114,75 @@ pub enum ClockingDirection {
Inout(Keyword), Inout(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClockingDirectionInput { pub struct ClockingDirectionInput {
pub nodes: (Keyword, Option<ClockingSkew>), pub nodes: (Keyword, Option<ClockingSkew>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClockingDirectionOutput { pub struct ClockingDirectionOutput {
pub nodes: (Keyword, Option<ClockingSkew>), pub nodes: (Keyword, Option<ClockingSkew>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClockingDirectionInputOutput { pub struct ClockingDirectionInputOutput {
pub nodes: (Keyword, Option<ClockingSkew>, Keyword, Option<ClockingSkew>), pub nodes: (Keyword, Option<ClockingSkew>, Keyword, Option<ClockingSkew>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfClockingDeclAssign { pub struct ListOfClockingDeclAssign {
pub nodes: (List<Symbol, ClockingDeclAssign>,), pub nodes: (List<Symbol, ClockingDeclAssign>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClockingDeclAssign { pub struct ClockingDeclAssign {
pub nodes: (SignalIdentifier, Option<(Symbol, Expression)>), pub nodes: (SignalIdentifier, Option<(Symbol, Expression)>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ClockingSkew { pub enum ClockingSkew {
Edge(ClockingSkewEdge), Edge(ClockingSkewEdge),
DelayControl(DelayControl), DelayControl(DelayControl),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClockingSkewEdge { pub struct ClockingSkewEdge {
pub nodes: (EdgeIdentifier, Option<DelayControl>), pub nodes: (EdgeIdentifier, Option<DelayControl>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClockingDrive { pub struct ClockingDrive {
pub nodes: (ClockvarExpression, Symbol, Option<CycleDelay>, Expression), pub nodes: (ClockvarExpression, Symbol, Option<CycleDelay>, Expression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum CycleDelay { pub enum CycleDelay {
Integral(CycleDelayIntegral), Integral(CycleDelayIntegral),
Identifier(CycleDelayIdentifier), Identifier(CycleDelayIdentifier),
Expression(CycleDelayExpression), Expression(CycleDelayExpression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CycleDelayIntegral { pub struct CycleDelayIntegral {
pub nodes: (Symbol, IntegralNumber), pub nodes: (Symbol, IntegralNumber),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CycleDelayIdentifier { pub struct CycleDelayIdentifier {
pub nodes: (Symbol, Identifier), pub nodes: (Symbol, Identifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CycleDelayExpression { pub struct CycleDelayExpression {
pub nodes: (Symbol, Paren<Expression>), pub nodes: (Symbol, Paren<Expression>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Clockvar { pub struct Clockvar {
pub nodes: (HierarchicalIdentifier,), pub nodes: (HierarchicalIdentifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClockvarExpression { pub struct ClockvarExpression {
pub nodes: (Clockvar, Select), pub nodes: (Clockvar, Select),
} }

View File

@ -8,7 +8,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConditionalStatement { pub struct ConditionalStatement {
pub nodes: ( pub nodes: (
Option<UniquePriority>, Option<UniquePriority>,
@ -20,25 +20,25 @@ pub struct ConditionalStatement {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum UniquePriority { pub enum UniquePriority {
Unique(Keyword), Unique(Keyword),
Unique0(Keyword), Unique0(Keyword),
Priority(Keyword), Priority(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CondPredicate { pub struct CondPredicate {
pub nodes: (List<Symbol, ExpressionOrCondPattern>,), pub nodes: (List<Symbol, ExpressionOrCondPattern>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ExpressionOrCondPattern { pub enum ExpressionOrCondPattern {
Expression(Expression), Expression(Expression),
CondPattern(CondPattern), CondPattern(CondPattern),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CondPattern { pub struct CondPattern {
pub nodes: (Expression, Keyword, Pattern), pub nodes: (Expression, Keyword, Pattern),
} }

View File

@ -6,13 +6,13 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ContinuousAssign { pub enum ContinuousAssign {
Net(ContinuousAssignNet), Net(ContinuousAssignNet),
Variable(ContinuousAssignVariable), Variable(ContinuousAssignVariable),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ContinuousAssignNet { pub struct ContinuousAssignNet {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -23,7 +23,7 @@ pub struct ContinuousAssignNet {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ContinuousAssignVariable { pub struct ContinuousAssignVariable {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -33,17 +33,17 @@ pub struct ContinuousAssignVariable {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfNetAssignments { pub struct ListOfNetAssignments {
pub nodes: (List<Symbol, NetAssignment>,), pub nodes: (List<Symbol, NetAssignment>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfVariableAssignments { pub struct ListOfVariableAssignments {
pub nodes: (List<Symbol, VariableAssignment>,), pub nodes: (List<Symbol, VariableAssignment>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NetAlias { pub struct NetAlias {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -54,7 +54,7 @@ pub struct NetAlias {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NetAssignment { pub struct NetAssignment {
pub nodes: (NetLvalue, Symbol, Expression), pub nodes: (NetLvalue, Symbol, Expression),
} }

View File

@ -7,7 +7,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum LoopStatement { pub enum LoopStatement {
Forever(LoopStatementForever), Forever(LoopStatementForever),
Repeat(LoopStatementRepeat), Repeat(LoopStatementRepeat),
@ -17,22 +17,22 @@ pub enum LoopStatement {
Foreach(LoopStatementForeach), Foreach(LoopStatementForeach),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LoopStatementForever { pub struct LoopStatementForever {
pub nodes: (Keyword, StatementOrNull), pub nodes: (Keyword, StatementOrNull),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LoopStatementRepeat { pub struct LoopStatementRepeat {
pub nodes: (Keyword, Paren<Expression>, StatementOrNull), pub nodes: (Keyword, Paren<Expression>, StatementOrNull),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LoopStatementWhile { pub struct LoopStatementWhile {
pub nodes: (Keyword, Paren<Expression>, StatementOrNull), pub nodes: (Keyword, Paren<Expression>, StatementOrNull),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LoopStatementFor { pub struct LoopStatementFor {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -47,12 +47,12 @@ pub struct LoopStatementFor {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LoopStatementDoWhile { pub struct LoopStatementDoWhile {
pub nodes: (Keyword, StatementOrNull, Keyword, Paren<Expression>, Symbol), pub nodes: (Keyword, StatementOrNull, Keyword, Paren<Expression>, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LoopStatementForeach { pub struct LoopStatementForeach {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -61,18 +61,18 @@ pub struct LoopStatementForeach {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ForInitialization { pub enum ForInitialization {
ListOfVariableAssignments(ListOfVariableAssignments), ListOfVariableAssignments(ListOfVariableAssignments),
Declaration(ForInitializationDeclaration), Declaration(ForInitializationDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ForInitializationDeclaration { pub struct ForInitializationDeclaration {
pub nodes: (List<Symbol, ForVariableDeclaration>,), pub nodes: (List<Symbol, ForVariableDeclaration>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ForVariableDeclaration { pub struct ForVariableDeclaration {
pub nodes: ( pub nodes: (
Option<Var>, Option<Var>,
@ -81,24 +81,24 @@ pub struct ForVariableDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Var { pub struct Var {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ForStep { pub struct ForStep {
pub nodes: (List<Symbol, ForStepAssignment>,), pub nodes: (List<Symbol, ForStepAssignment>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ForStepAssignment { pub enum ForStepAssignment {
OperatorAssignment(OperatorAssignment), OperatorAssignment(OperatorAssignment),
IncOrDecExpression(IncOrDecExpression), IncOrDecExpression(IncOrDecExpression),
FunctionSubroutineCall(FunctionSubroutineCall), FunctionSubroutineCall(FunctionSubroutineCall),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LoopVariables { pub struct LoopVariables {
pub nodes: (List<Symbol, Option<IndexVariableIdentifier>>,), pub nodes: (List<Symbol, Option<IndexVariableIdentifier>>,),
} }

View File

@ -8,18 +8,18 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ActionBlock { pub enum ActionBlock {
StatementOrNull(StatementOrNull), StatementOrNull(StatementOrNull),
Else(ActionBlockElse), Else(ActionBlockElse),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ActionBlockElse { pub struct ActionBlockElse {
pub nodes: (Option<Statement>, Keyword, StatementOrNull), pub nodes: (Option<Statement>, Keyword, StatementOrNull),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SeqBlock { pub struct SeqBlock {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -31,7 +31,7 @@ pub struct SeqBlock {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ParBlock { pub struct ParBlock {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -43,7 +43,7 @@ pub struct ParBlock {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum JoinKeyword { pub enum JoinKeyword {
Join(Keyword), Join(Keyword),
JoinAny(Keyword), JoinAny(Keyword),

View File

@ -7,7 +7,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum Pattern { pub enum Pattern {
Variable(Box<PatternVariable>), Variable(Box<PatternVariable>),
Asterisk(Symbol), Asterisk(Symbol),
@ -17,27 +17,27 @@ pub enum Pattern {
IdentifierList(Box<PatternIdentifierList>), IdentifierList(Box<PatternIdentifierList>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PatternVariable { pub struct PatternVariable {
pub nodes: (Symbol, VariableIdentifier), pub nodes: (Symbol, VariableIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PatternTagged { pub struct PatternTagged {
pub nodes: (Keyword, MemberIdentifier, Option<Pattern>), pub nodes: (Keyword, MemberIdentifier, Option<Pattern>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PatternList { pub struct PatternList {
pub nodes: (ApostropheBrace<List<Symbol, Pattern>>,), pub nodes: (ApostropheBrace<List<Symbol, Pattern>>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PatternIdentifierList { pub struct PatternIdentifierList {
pub nodes: (ApostropheBrace<List<Symbol, (MemberIdentifier, Symbol, Pattern)>>,), pub nodes: (ApostropheBrace<List<Symbol, (MemberIdentifier, Symbol, Pattern)>>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum AssignmentPattern { pub enum AssignmentPattern {
List(AssignmentPatternList), List(AssignmentPatternList),
Structure(AssignmentPatternStructure), Structure(AssignmentPatternStructure),
@ -45,50 +45,50 @@ pub enum AssignmentPattern {
Repeat(AssignmentPatternRepeat), Repeat(AssignmentPatternRepeat),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct AssignmentPatternList { pub struct AssignmentPatternList {
pub nodes: (ApostropheBrace<List<Symbol, Expression>>,), pub nodes: (ApostropheBrace<List<Symbol, Expression>>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct AssignmentPatternStructure { pub struct AssignmentPatternStructure {
pub nodes: (ApostropheBrace<List<Symbol, (StructurePatternKey, Symbol, Expression)>>,), pub nodes: (ApostropheBrace<List<Symbol, (StructurePatternKey, Symbol, Expression)>>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct AssignmentPatternArray { pub struct AssignmentPatternArray {
pub nodes: (ApostropheBrace<List<Symbol, (ArrayPatternKey, Symbol, Expression)>>,), pub nodes: (ApostropheBrace<List<Symbol, (ArrayPatternKey, Symbol, Expression)>>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct AssignmentPatternRepeat { pub struct AssignmentPatternRepeat {
pub nodes: (ApostropheBrace<(ConstantExpression, Brace<List<Symbol, Expression>>)>,), pub nodes: (ApostropheBrace<(ConstantExpression, Brace<List<Symbol, Expression>>)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum StructurePatternKey { pub enum StructurePatternKey {
MemberIdentifier(MemberIdentifier), MemberIdentifier(MemberIdentifier),
AssignmentPatternKey(AssignmentPatternKey), AssignmentPatternKey(AssignmentPatternKey),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ArrayPatternKey { pub enum ArrayPatternKey {
ConstantExpression(ConstantExpression), ConstantExpression(ConstantExpression),
AssignmentPatternKey(AssignmentPatternKey), AssignmentPatternKey(AssignmentPatternKey),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum AssignmentPatternKey { pub enum AssignmentPatternKey {
SimpleType(SimpleType), SimpleType(SimpleType),
Default(Keyword), Default(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct AssignmentPatternExpression { pub struct AssignmentPatternExpression {
pub nodes: (Option<AssignmentPatternExpressionType>, AssignmentPattern), pub nodes: (Option<AssignmentPatternExpressionType>, AssignmentPattern),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum AssignmentPatternExpressionType { pub enum AssignmentPatternExpressionType {
PsTypeIdentifier(PsTypeIdentifier), PsTypeIdentifier(PsTypeIdentifier),
PsParameterIdentifier(PsParameterIdentifier), PsParameterIdentifier(PsParameterIdentifier),
@ -96,17 +96,17 @@ pub enum AssignmentPatternExpressionType {
TypeReference(TypeReference), TypeReference(TypeReference),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstantAssignmentPatternExpression { pub struct ConstantAssignmentPatternExpression {
pub nodes: (AssignmentPatternExpression,), pub nodes: (AssignmentPatternExpression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct AssignmentPatternNetLvalue { pub struct AssignmentPatternNetLvalue {
pub nodes: (ApostropheBrace<List<Symbol, NetLvalue>>,), pub nodes: (ApostropheBrace<List<Symbol, NetLvalue>>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct AssignmentPatternVariableLvalue { pub struct AssignmentPatternVariableLvalue {
pub nodes: (ApostropheBrace<List<Symbol, VariableLvalue>>,), pub nodes: (ApostropheBrace<List<Symbol, VariableLvalue>>,),
} }
@ -253,7 +253,7 @@ pub fn assignment_pattern_key(s: Span) -> IResult<Span, AssignmentPatternKey> {
))(s) ))(s)
} }
#[parser(Memoize)] #[parser]
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)?;
@ -280,7 +280,7 @@ pub fn assignment_pattern_expression_type(
))(s) ))(s)
} }
#[parser(Memoize)] #[parser]
pub fn constant_assignment_pattern_expression( pub fn constant_assignment_pattern_expression(
s: Span, s: Span,
) -> IResult<Span, ConstantAssignmentPatternExpression> { ) -> IResult<Span, ConstantAssignmentPatternExpression> {

View File

@ -6,17 +6,17 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InitialConstruct { pub struct InitialConstruct {
pub nodes: (Keyword, StatementOrNull), pub nodes: (Keyword, StatementOrNull),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct AlwaysConstruct { pub struct AlwaysConstruct {
pub nodes: (AlwaysKeyword, Statement), pub nodes: (AlwaysKeyword, Statement),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum AlwaysKeyword { pub enum AlwaysKeyword {
Always(Keyword), Always(Keyword),
AlwaysComb(Keyword), AlwaysComb(Keyword),
@ -24,12 +24,12 @@ pub enum AlwaysKeyword {
AlwaysFf(Keyword), AlwaysFf(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct FinalConstruct { pub struct FinalConstruct {
pub nodes: (Keyword, FunctionStatement), pub nodes: (Keyword, FunctionStatement),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum BlockingAssignment { pub enum BlockingAssignment {
Variable(BlockingAssignmentVariable), Variable(BlockingAssignmentVariable),
NonrangeVariable(BlockingAssignmentNonrangeVariable), NonrangeVariable(BlockingAssignmentNonrangeVariable),
@ -37,7 +37,7 @@ pub enum BlockingAssignment {
OperatorAssignment(OperatorAssignment), OperatorAssignment(OperatorAssignment),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BlockingAssignmentVariable { pub struct BlockingAssignmentVariable {
pub nodes: ( pub nodes: (
VariableLvalue, VariableLvalue,
@ -47,12 +47,12 @@ pub struct BlockingAssignmentVariable {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BlockingAssignmentNonrangeVariable { pub struct BlockingAssignmentNonrangeVariable {
pub nodes: (NonrangeVariableLvalue, Symbol, DynamicArrayNew), pub nodes: (NonrangeVariableLvalue, Symbol, DynamicArrayNew),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BlockingAssignmentHierarchicalVariable { pub struct BlockingAssignmentHierarchicalVariable {
pub nodes: ( pub nodes: (
Option<ImplicitClassHandleOrClassScopeOrPackageScope>, Option<ImplicitClassHandleOrClassScopeOrPackageScope>,
@ -63,17 +63,17 @@ pub struct BlockingAssignmentHierarchicalVariable {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct OperatorAssignment { pub struct OperatorAssignment {
pub nodes: (VariableLvalue, AssignmentOperator, Expression), pub nodes: (VariableLvalue, AssignmentOperator, Expression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct AssignmentOperator { pub struct AssignmentOperator {
pub nodes: (Symbol,), pub nodes: (Symbol,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NonblockingAssignment { pub struct NonblockingAssignment {
pub nodes: ( pub nodes: (
VariableLvalue, VariableLvalue,
@ -83,7 +83,7 @@ pub struct NonblockingAssignment {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ProceduralContinuousAssignment { pub enum ProceduralContinuousAssignment {
Assign(ProceduralContinuousAssignmentAssign), Assign(ProceduralContinuousAssignmentAssign),
Deassign(ProceduralContinuousAssignmentDeassign), Deassign(ProceduralContinuousAssignmentDeassign),
@ -93,37 +93,37 @@ pub enum ProceduralContinuousAssignment {
ReleaseNet(ProceduralContinuousAssignmentReleaseNet), ReleaseNet(ProceduralContinuousAssignmentReleaseNet),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ProceduralContinuousAssignmentAssign { pub struct ProceduralContinuousAssignmentAssign {
pub nodes: (Keyword, VariableAssignment), pub nodes: (Keyword, VariableAssignment),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ProceduralContinuousAssignmentDeassign { pub struct ProceduralContinuousAssignmentDeassign {
pub nodes: (Keyword, VariableLvalue), pub nodes: (Keyword, VariableLvalue),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ProceduralContinuousAssignmentForceVariable { pub struct ProceduralContinuousAssignmentForceVariable {
pub nodes: (Keyword, VariableAssignment), pub nodes: (Keyword, VariableAssignment),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ProceduralContinuousAssignmentForceNet { pub struct ProceduralContinuousAssignmentForceNet {
pub nodes: (Keyword, NetAssignment), pub nodes: (Keyword, NetAssignment),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ProceduralContinuousAssignmentReleaseVariable { pub struct ProceduralContinuousAssignmentReleaseVariable {
pub nodes: (Keyword, VariableLvalue), pub nodes: (Keyword, VariableLvalue),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ProceduralContinuousAssignmentReleaseNet { pub struct ProceduralContinuousAssignmentReleaseNet {
pub nodes: (Keyword, NetLvalue), pub nodes: (Keyword, NetLvalue),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct VariableAssignment { pub struct VariableAssignment {
pub nodes: (VariableLvalue, Symbol, Expression), pub nodes: (VariableLvalue, Symbol, Expression),
} }

View File

@ -8,7 +8,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct RandsequenceStatement { pub struct RandsequenceStatement {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -19,7 +19,7 @@ pub struct RandsequenceStatement {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Production { pub struct Production {
pub nodes: ( pub nodes: (
Option<DataTypeOrVoid>, Option<DataTypeOrVoid>,
@ -31,7 +31,7 @@ pub struct Production {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct RsRule { pub struct RsRule {
pub nodes: ( pub nodes: (
RsProductionList, RsProductionList,
@ -39,18 +39,18 @@ pub struct RsRule {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum RsProductionList { pub enum RsProductionList {
Prod(RsProductionListProd), Prod(RsProductionListProd),
Join(RsProductionListJoin), Join(RsProductionListJoin),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct RsProductionListProd { pub struct RsProductionListProd {
pub nodes: (RsProd, Vec<RsProd>), pub nodes: (RsProd, Vec<RsProd>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct RsProductionListJoin { pub struct RsProductionListJoin {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -62,24 +62,24 @@ pub struct RsProductionListJoin {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum WeightSpecification { pub enum WeightSpecification {
IntegralNumber(IntegralNumber), IntegralNumber(IntegralNumber),
PsIdentifier(PsIdentifier), PsIdentifier(PsIdentifier),
Expression(WeightSpecificationExpression), Expression(WeightSpecificationExpression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct WeightSpecificationExpression { pub struct WeightSpecificationExpression {
pub nodes: (Paren<Expression>,), pub nodes: (Paren<Expression>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct RsCodeBlock { pub struct RsCodeBlock {
pub nodes: (Brace<(Vec<DataDeclaration>, Vec<StatementOrNull>)>,), pub nodes: (Brace<(Vec<DataDeclaration>, Vec<StatementOrNull>)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum RsProd { pub enum RsProd {
ProductionItem(ProductionItem), ProductionItem(ProductionItem),
RsCodeBlock(RsCodeBlock), RsCodeBlock(RsCodeBlock),
@ -88,12 +88,12 @@ pub enum RsProd {
RsCase(RsCase), RsCase(RsCase),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ProductionItem { pub struct ProductionItem {
pub nodes: (ProductionIdentifier, Option<Paren<ListOfArguments>>), pub nodes: (ProductionIdentifier, Option<Paren<ListOfArguments>>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct RsIfElse { pub struct RsIfElse {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -103,12 +103,12 @@ pub struct RsIfElse {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct RsRepeat { pub struct RsRepeat {
pub nodes: (Keyword, Paren<Expression>, ProductionItem), pub nodes: (Keyword, Paren<Expression>, ProductionItem),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct RsCase { pub struct RsCase {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -119,13 +119,13 @@ pub struct RsCase {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum RsCaseItem { pub enum RsCaseItem {
NonDefault(RsCaseItemNondefault), NonDefault(RsCaseItemNondefault),
Default(RsCaseItemDefault), Default(RsCaseItemDefault),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct RsCaseItemNondefault { pub struct RsCaseItemNondefault {
pub nodes: ( pub nodes: (
List<Symbol, CaseItemExpression>, List<Symbol, CaseItemExpression>,
@ -135,7 +135,7 @@ pub struct RsCaseItemNondefault {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct RsCaseItemDefault { pub struct RsCaseItemDefault {
pub nodes: (Keyword, Option<Symbol>, ProductionItem, Symbol), pub nodes: (Keyword, Option<Symbol>, ProductionItem, Symbol),
} }

View File

@ -8,18 +8,18 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum StatementOrNull { pub enum StatementOrNull {
Statement(Statement), Statement(Statement),
Attribute(StatementOrNullAttribute), Attribute(StatementOrNullAttribute),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct StatementOrNullAttribute { pub struct StatementOrNullAttribute {
pub nodes: (Vec<AttributeInstance>, Symbol), pub nodes: (Vec<AttributeInstance>, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Statement { pub struct Statement {
pub nodes: ( pub nodes: (
Option<(BlockIdentifier, Symbol)>, Option<(BlockIdentifier, Symbol)>,
@ -28,7 +28,7 @@ pub struct Statement {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum StatementItem { pub enum StatementItem {
BlockingAssignment(Box<(BlockingAssignment, Symbol)>), BlockingAssignment(Box<(BlockingAssignment, Symbol)>),
NonblockingAssignment(Box<(NonblockingAssignment, Symbol)>), NonblockingAssignment(Box<(NonblockingAssignment, Symbol)>),
@ -52,23 +52,23 @@ pub enum StatementItem {
ExpectPropertyStatement(Box<ExpectPropertyStatement>), ExpectPropertyStatement(Box<ExpectPropertyStatement>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct FunctionStatement { pub struct FunctionStatement {
pub nodes: (Statement,), pub nodes: (Statement,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum FunctionStatementOrNull { pub enum FunctionStatementOrNull {
Statement(FunctionStatement), Statement(FunctionStatement),
Attribute(FunctionStatementOrNullAttribute), Attribute(FunctionStatementOrNullAttribute),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct FunctionStatementOrNullAttribute { pub struct FunctionStatementOrNullAttribute {
pub nodes: (Vec<AttributeInstance>, Symbol), pub nodes: (Vec<AttributeInstance>, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct VariableIdentifierList { pub struct VariableIdentifierList {
pub nodes: (List<Symbol, VariableIdentifier>,), pub nodes: (List<Symbol, VariableIdentifier>,),
} }

View File

@ -7,13 +7,13 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum SubroutineCallStatement { pub enum SubroutineCallStatement {
SubroutineCall((SubroutineCall, Symbol)), SubroutineCall((SubroutineCall, Symbol)),
Function(SubroutineCallStatementFunction), Function(SubroutineCallStatementFunction),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SubroutineCallStatementFunction { pub struct SubroutineCallStatementFunction {
pub nodes: (Keyword, Symbol, Paren<FunctionSubroutineCall>, Symbol), pub nodes: (Keyword, Symbol, Paren<FunctionSubroutineCall>, Symbol),
} }

View File

@ -7,40 +7,40 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ProceduralTimingControlStatement { pub struct ProceduralTimingControlStatement {
pub nodes: (ProceduralTimingControl, StatementOrNull), pub nodes: (ProceduralTimingControl, StatementOrNull),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum DelayOrEventControl { pub enum DelayOrEventControl {
Delay(DelayControl), Delay(DelayControl),
Event(EventControl), Event(EventControl),
Repeat(DelayOrEventControlRepeat), Repeat(DelayOrEventControlRepeat),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DelayOrEventControlRepeat { pub struct DelayOrEventControlRepeat {
pub nodes: (Keyword, Paren<Expression>, EventControl), pub nodes: (Keyword, Paren<Expression>, EventControl),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum DelayControl { pub enum DelayControl {
Delay(DelayControlDelay), Delay(DelayControlDelay),
Mintypmax(DelayControlMintypmax), Mintypmax(DelayControlMintypmax),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DelayControlDelay { pub struct DelayControlDelay {
pub nodes: (Symbol, DelayValue), pub nodes: (Symbol, DelayValue),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DelayControlMintypmax { pub struct DelayControlMintypmax {
pub nodes: (Symbol, Paren<MintypmaxExpression>), pub nodes: (Symbol, Paren<MintypmaxExpression>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum EventControl { pub enum EventControl {
EventIdentifier(EventControlEventIdentifier), EventIdentifier(EventControlEventIdentifier),
EventExpression(EventControlEventExpression), EventExpression(EventControlEventExpression),
@ -49,32 +49,32 @@ pub enum EventControl {
SequenceIdentifier(EventControlSequenceIdentifier), SequenceIdentifier(EventControlSequenceIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EventControlEventIdentifier { pub struct EventControlEventIdentifier {
pub nodes: (Symbol, HierarchicalEventIdentifier), pub nodes: (Symbol, HierarchicalEventIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EventControlEventExpression { pub struct EventControlEventExpression {
pub nodes: (Symbol, Paren<EventExpression>), pub nodes: (Symbol, Paren<EventExpression>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EventControlAsterisk { pub struct EventControlAsterisk {
pub nodes: (Symbol,), pub nodes: (Symbol,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EventControlParenAsterisk { pub struct EventControlParenAsterisk {
pub nodes: (Symbol, Paren<Symbol>), pub nodes: (Symbol, Paren<Symbol>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EventControlSequenceIdentifier { pub struct EventControlSequenceIdentifier {
pub nodes: (Symbol, PsOrHierarchicalSequenceIdentifier), pub nodes: (Symbol, PsOrHierarchicalSequenceIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum EventExpression { pub enum EventExpression {
Expression(Box<EventExpressionExpression>), Expression(Box<EventExpressionExpression>),
Sequence(Box<EventExpressionSequence>), Sequence(Box<EventExpressionSequence>),
@ -83,7 +83,7 @@ pub enum EventExpression {
Paren(Box<EventExpressionParen>), Paren(Box<EventExpressionParen>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EventExpressionExpression { pub struct EventExpressionExpression {
pub nodes: ( pub nodes: (
Option<EdgeIdentifier>, Option<EdgeIdentifier>,
@ -92,73 +92,73 @@ pub struct EventExpressionExpression {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EventExpressionSequence { pub struct EventExpressionSequence {
pub nodes: (SequenceInstance, Option<(Keyword, Expression)>), pub nodes: (SequenceInstance, Option<(Keyword, Expression)>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EventExpressionOr { pub struct EventExpressionOr {
pub nodes: (EventExpression, Keyword, EventExpression), pub nodes: (EventExpression, Keyword, EventExpression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EventExpressionComma { pub struct EventExpressionComma {
pub nodes: (EventExpression, Symbol, EventExpression), pub nodes: (EventExpression, Symbol, EventExpression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EventExpressionParen { pub struct EventExpressionParen {
pub nodes: (Paren<EventExpression>,), pub nodes: (Paren<EventExpression>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ProceduralTimingControl { pub enum ProceduralTimingControl {
DelayControl(DelayControl), DelayControl(DelayControl),
EventControl(EventControl), EventControl(EventControl),
CycleDelay(CycleDelay), CycleDelay(CycleDelay),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum JumpStatement { pub enum JumpStatement {
Return(JumpStatementReturn), Return(JumpStatementReturn),
Break(JumpStatementBreak), Break(JumpStatementBreak),
Continue(JumpStatementContinue), Continue(JumpStatementContinue),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct JumpStatementReturn { pub struct JumpStatementReturn {
pub nodes: (Keyword, Option<Expression>, Symbol), pub nodes: (Keyword, Option<Expression>, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct JumpStatementBreak { pub struct JumpStatementBreak {
pub nodes: (Keyword, Symbol), pub nodes: (Keyword, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct JumpStatementContinue { pub struct JumpStatementContinue {
pub nodes: (Keyword, Symbol), pub nodes: (Keyword, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum WaitStatement { pub enum WaitStatement {
Wait(WaitStatementWait), Wait(WaitStatementWait),
Fork(WaitStatementFork), Fork(WaitStatementFork),
Order(WaitStatementOrder), Order(WaitStatementOrder),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct WaitStatementWait { pub struct WaitStatementWait {
pub nodes: (Keyword, Paren<Expression>, StatementOrNull), pub nodes: (Keyword, Paren<Expression>, StatementOrNull),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct WaitStatementFork { pub struct WaitStatementFork {
pub nodes: (Keyword, Keyword, Symbol), pub nodes: (Keyword, Keyword, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct WaitStatementOrder { pub struct WaitStatementOrder {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -167,18 +167,18 @@ pub struct WaitStatementOrder {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum EventTrigger { pub enum EventTrigger {
Named(EventTriggerNamed), Named(EventTriggerNamed),
Nonblocking(EventTriggerNonblocking), Nonblocking(EventTriggerNonblocking),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EventTriggerNamed { pub struct EventTriggerNamed {
pub nodes: (Symbol, HierarchicalEventIdentifier, Symbol), pub nodes: (Symbol, HierarchicalEventIdentifier, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EventTriggerNonblocking { pub struct EventTriggerNonblocking {
pub nodes: ( pub nodes: (
Symbol, Symbol,
@ -188,24 +188,24 @@ pub struct EventTriggerNonblocking {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum DisableStatement { pub enum DisableStatement {
Task(DisableStatementTask), Task(DisableStatementTask),
Block(DisableStatementBlock), Block(DisableStatementBlock),
Fork(DisableStatementFork), Fork(DisableStatementFork),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DisableStatementTask { pub struct DisableStatementTask {
pub nodes: (Keyword, HierarchicalTaskIdentifier, Symbol), pub nodes: (Keyword, HierarchicalTaskIdentifier, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DisableStatementBlock { pub struct DisableStatementBlock {
pub nodes: (Keyword, HierarchicalBlockIdentifier, Symbol), pub nodes: (Keyword, HierarchicalBlockIdentifier, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DisableStatementFork { pub struct DisableStatementFork {
pub nodes: (Keyword, Keyword, Symbol), pub nodes: (Keyword, Keyword, Symbol),
} }

View File

@ -8,13 +8,13 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ConcurrentAssertionItem { pub enum ConcurrentAssertionItem {
Statement(ConcurrentAssertionItemStatement), Statement(ConcurrentAssertionItemStatement),
CheckerInstantiation(CheckerInstantiation), CheckerInstantiation(CheckerInstantiation),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConcurrentAssertionItemStatement { pub struct ConcurrentAssertionItemStatement {
pub nodes: ( pub nodes: (
Option<(BlockIdentifier, Symbol)>, Option<(BlockIdentifier, Symbol)>,
@ -22,7 +22,7 @@ pub struct ConcurrentAssertionItemStatement {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ConcurrentAssertionStatement { pub enum ConcurrentAssertionStatement {
AssertPropertyStatement(AssertPropertyStatement), AssertPropertyStatement(AssertPropertyStatement),
AssumePropertyStatement(AssumePropertyStatement), AssumePropertyStatement(AssumePropertyStatement),
@ -31,27 +31,27 @@ pub enum ConcurrentAssertionStatement {
RestrictPropertyStatement(RestrictPropertyStatement), RestrictPropertyStatement(RestrictPropertyStatement),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct AssertPropertyStatement { pub struct AssertPropertyStatement {
pub nodes: (Keyword, Keyword, Paren<PropertySpec>, ActionBlock), pub nodes: (Keyword, Keyword, Paren<PropertySpec>, ActionBlock),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct AssumePropertyStatement { pub struct AssumePropertyStatement {
pub nodes: (Keyword, Keyword, Paren<PropertySpec>, ActionBlock), pub nodes: (Keyword, Keyword, Paren<PropertySpec>, ActionBlock),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CoverPropertyStatement { pub struct CoverPropertyStatement {
pub nodes: (Keyword, Keyword, Paren<PropertySpec>, StatementOrNull), pub nodes: (Keyword, Keyword, Paren<PropertySpec>, StatementOrNull),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ExpectPropertyStatement { pub struct ExpectPropertyStatement {
pub nodes: (Keyword, Paren<PropertySpec>, ActionBlock), pub nodes: (Keyword, Paren<PropertySpec>, ActionBlock),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CoverSequenceStatement { pub struct CoverSequenceStatement {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -65,12 +65,12 @@ pub struct CoverSequenceStatement {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct RestrictPropertyStatement { pub struct RestrictPropertyStatement {
pub nodes: (Keyword, Keyword, Paren<PropertySpec>, Symbol), pub nodes: (Keyword, Keyword, Paren<PropertySpec>, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyInstance { pub struct PropertyInstance {
pub nodes: ( pub nodes: (
PsOrHierarchicalPropertyIdentifier, PsOrHierarchicalPropertyIdentifier,
@ -78,13 +78,13 @@ pub struct PropertyInstance {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PropertyListOfArguments { pub enum PropertyListOfArguments {
Ordered(PropertyListOfArgumentsOrdered), Ordered(PropertyListOfArgumentsOrdered),
Named(PropertyListOfArgumentsNamed), Named(PropertyListOfArgumentsNamed),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyListOfArgumentsOrdered { pub struct PropertyListOfArgumentsOrdered {
pub nodes: ( pub nodes: (
List<Symbol, Option<PropertyActualArg>>, List<Symbol, Option<PropertyActualArg>>,
@ -92,25 +92,25 @@ pub struct PropertyListOfArgumentsOrdered {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyListOfArgumentsNamed { pub struct PropertyListOfArgumentsNamed {
pub nodes: (List<Symbol, (Symbol, Identifier, Paren<Option<PropertyActualArg>>)>,), pub nodes: (List<Symbol, (Symbol, Identifier, Paren<Option<PropertyActualArg>>)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PropertyActualArg { pub enum PropertyActualArg {
PropertyExpr(PropertyExpr), PropertyExpr(PropertyExpr),
SequenceActualArg(SequenceActualArg), SequenceActualArg(SequenceActualArg),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum AssertionItemDeclaration { pub enum AssertionItemDeclaration {
PropertyDeclaration(PropertyDeclaration), PropertyDeclaration(PropertyDeclaration),
SequenceDeclaration(SequenceDeclaration), SequenceDeclaration(SequenceDeclaration),
LetDeclaration(LetDeclaration), LetDeclaration(LetDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyDeclaration { pub struct PropertyDeclaration {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -125,12 +125,12 @@ pub struct PropertyDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyPortList { pub struct PropertyPortList {
pub nodes: (List<Symbol, PropertyPortItem>,), pub nodes: (List<Symbol, PropertyPortItem>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyPortItem { pub struct PropertyPortItem {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -142,18 +142,18 @@ pub struct PropertyPortItem {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PropertyLvarPortDirection { pub enum PropertyLvarPortDirection {
Input(Keyword), Input(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PropertyFormalType { pub enum PropertyFormalType {
SequenceFormalType(SequenceFormalType), SequenceFormalType(SequenceFormalType),
Property(Keyword), Property(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertySpec { pub struct PropertySpec {
pub nodes: ( pub nodes: (
Option<ClockingEvent>, Option<ClockingEvent>,
@ -162,7 +162,7 @@ pub struct PropertySpec {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PropertyExpr { pub enum PropertyExpr {
SequenceExpr(SequenceExpr), SequenceExpr(SequenceExpr),
Strong(PropertyExprStrong), Strong(PropertyExprStrong),
@ -197,47 +197,47 @@ pub enum PropertyExpr {
ClockingEvent(Box<PropertyExprClockingEvent>), ClockingEvent(Box<PropertyExprClockingEvent>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprStrong { pub struct PropertyExprStrong {
pub nodes: (Keyword, Paren<SequenceExpr>), pub nodes: (Keyword, Paren<SequenceExpr>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprWeak { pub struct PropertyExprWeak {
pub nodes: (Keyword, Paren<SequenceExpr>), pub nodes: (Keyword, Paren<SequenceExpr>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprParen { pub struct PropertyExprParen {
pub nodes: (Paren<SequenceExpr>,), pub nodes: (Paren<SequenceExpr>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprNot { pub struct PropertyExprNot {
pub nodes: (Keyword, PropertyExpr), pub nodes: (Keyword, PropertyExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprOr { pub struct PropertyExprOr {
pub nodes: (PropertyExpr, Keyword, PropertyExpr), pub nodes: (PropertyExpr, Keyword, PropertyExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprAnd { pub struct PropertyExprAnd {
pub nodes: (PropertyExpr, Keyword, PropertyExpr), pub nodes: (PropertyExpr, Keyword, PropertyExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprImplicationOverlapped { pub struct PropertyExprImplicationOverlapped {
pub nodes: (SequenceExpr, Symbol, PropertyExpr), pub nodes: (SequenceExpr, Symbol, PropertyExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprImplicationNonoverlapped { pub struct PropertyExprImplicationNonoverlapped {
pub nodes: (SequenceExpr, Symbol, PropertyExpr), pub nodes: (SequenceExpr, Symbol, PropertyExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprIf { pub struct PropertyExprIf {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -247,7 +247,7 @@ pub struct PropertyExprIf {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprCase { pub struct PropertyExprCase {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -258,27 +258,27 @@ pub struct PropertyExprCase {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprFollowedByOverlapped { pub struct PropertyExprFollowedByOverlapped {
pub nodes: (SequenceExpr, Symbol, PropertyExpr), pub nodes: (SequenceExpr, Symbol, PropertyExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprFollowedByNonoverlapped { pub struct PropertyExprFollowedByNonoverlapped {
pub nodes: (SequenceExpr, Symbol, PropertyExpr), pub nodes: (SequenceExpr, Symbol, PropertyExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprNexttime { pub struct PropertyExprNexttime {
pub nodes: (Keyword, Option<Bracket<ConstantExpression>>, PropertyExpr), pub nodes: (Keyword, Option<Bracket<ConstantExpression>>, PropertyExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprSNexttime { pub struct PropertyExprSNexttime {
pub nodes: (Keyword, Option<Bracket<ConstantExpression>>, PropertyExpr), pub nodes: (Keyword, Option<Bracket<ConstantExpression>>, PropertyExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprAlways { pub struct PropertyExprAlways {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -287,7 +287,7 @@ pub struct PropertyExprAlways {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprSAlways { pub struct PropertyExprSAlways {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -296,12 +296,12 @@ pub struct PropertyExprSAlways {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprEventually { pub struct PropertyExprEventually {
pub nodes: (Keyword, Bracket<ConstantRange>, PropertyExpr), pub nodes: (Keyword, Bracket<ConstantRange>, PropertyExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprSEventually { pub struct PropertyExprSEventually {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -310,78 +310,78 @@ pub struct PropertyExprSEventually {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprUntil { pub struct PropertyExprUntil {
pub nodes: (PropertyExpr, Keyword, PropertyExpr), pub nodes: (PropertyExpr, Keyword, PropertyExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprSUntil { pub struct PropertyExprSUntil {
pub nodes: (PropertyExpr, Keyword, PropertyExpr), pub nodes: (PropertyExpr, Keyword, PropertyExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprUntilWith { pub struct PropertyExprUntilWith {
pub nodes: (PropertyExpr, Keyword, PropertyExpr), pub nodes: (PropertyExpr, Keyword, PropertyExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprSUntilWith { pub struct PropertyExprSUntilWith {
pub nodes: (PropertyExpr, Keyword, PropertyExpr), pub nodes: (PropertyExpr, Keyword, PropertyExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprImplies { pub struct PropertyExprImplies {
pub nodes: (PropertyExpr, Keyword, PropertyExpr), pub nodes: (PropertyExpr, Keyword, PropertyExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprIff { pub struct PropertyExprIff {
pub nodes: (PropertyExpr, Keyword, PropertyExpr), pub nodes: (PropertyExpr, Keyword, PropertyExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprAcceptOn { pub struct PropertyExprAcceptOn {
pub nodes: (Keyword, Paren<ExpressionOrDist>, PropertyExpr), pub nodes: (Keyword, Paren<ExpressionOrDist>, PropertyExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprRejectOn { pub struct PropertyExprRejectOn {
pub nodes: (Keyword, Paren<ExpressionOrDist>, PropertyExpr), pub nodes: (Keyword, Paren<ExpressionOrDist>, PropertyExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprSyncAcceptOn { pub struct PropertyExprSyncAcceptOn {
pub nodes: (Keyword, Paren<ExpressionOrDist>, PropertyExpr), pub nodes: (Keyword, Paren<ExpressionOrDist>, PropertyExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprSyncRejectOn { pub struct PropertyExprSyncRejectOn {
pub nodes: (Keyword, Paren<ExpressionOrDist>, PropertyExpr), pub nodes: (Keyword, Paren<ExpressionOrDist>, PropertyExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprClockingEvent { pub struct PropertyExprClockingEvent {
pub nodes: (ClockingEvent, PropertyExpr), pub nodes: (ClockingEvent, PropertyExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PropertyCaseItem { pub enum PropertyCaseItem {
Nondefault(PropertyCaseItemNondefault), Nondefault(PropertyCaseItemNondefault),
Default(PropertyCaseItemDefault), Default(PropertyCaseItemDefault),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyCaseItemNondefault { pub struct PropertyCaseItemNondefault {
pub nodes: (List<Symbol, ExpressionOrDist>, Symbol, PropertyExpr, Symbol), pub nodes: (List<Symbol, ExpressionOrDist>, Symbol, PropertyExpr, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyCaseItemDefault { pub struct PropertyCaseItemDefault {
pub nodes: (Keyword, Option<Symbol>, PropertyExpr, Symbol), pub nodes: (Keyword, Option<Symbol>, PropertyExpr, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequenceDeclaration { pub struct SequenceDeclaration {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -396,12 +396,12 @@ pub struct SequenceDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequencePortList { pub struct SequencePortList {
pub nodes: (List<Symbol, SequencePortItem>,), pub nodes: (List<Symbol, SequencePortItem>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequencePortItem { pub struct SequencePortItem {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -413,21 +413,21 @@ pub struct SequencePortItem {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum SequenceLvarPortDirection { pub enum SequenceLvarPortDirection {
Input(Keyword), Input(Keyword),
Inout(Keyword), Inout(Keyword),
Output(Keyword), Output(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum SequenceFormalType { pub enum SequenceFormalType {
DataTypeOrImplicit(DataTypeOrImplicit), DataTypeOrImplicit(DataTypeOrImplicit),
Sequence(Keyword), Sequence(Keyword),
Untyped(Keyword), Untyped(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum SequenceExpr { pub enum SequenceExpr {
CycleDelayExpr(Box<SequenceExprCycleDelayExpr>), CycleDelayExpr(Box<SequenceExprCycleDelayExpr>),
ExprCycleDelayExpr(Box<SequenceExprExprCycleDelayExpr>), ExprCycleDelayExpr(Box<SequenceExprExprCycleDelayExpr>),
@ -443,7 +443,7 @@ pub enum SequenceExpr {
ClockingEvent(Box<SequenceExprClockingEvent>), ClockingEvent(Box<SequenceExprClockingEvent>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequenceExprCycleDelayExpr { pub struct SequenceExprCycleDelayExpr {
pub nodes: ( pub nodes: (
CycleDelayRange, CycleDelayRange,
@ -452,7 +452,7 @@ pub struct SequenceExprCycleDelayExpr {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequenceExprExprCycleDelayExpr { pub struct SequenceExprExprCycleDelayExpr {
pub nodes: ( pub nodes: (
SequenceExpr, SequenceExpr,
@ -462,17 +462,17 @@ pub struct SequenceExprExprCycleDelayExpr {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequenceExprExpression { pub struct SequenceExprExpression {
pub nodes: (ExpressionOrDist, Option<BooleanAbbrev>), pub nodes: (ExpressionOrDist, Option<BooleanAbbrev>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequenceExprInstance { pub struct SequenceExprInstance {
pub nodes: (SequenceInstance, Option<SequenceAbbrev>), pub nodes: (SequenceInstance, Option<SequenceAbbrev>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequenceExprParen { pub struct SequenceExprParen {
pub nodes: ( pub nodes: (
Paren<(SequenceExpr, Vec<(Symbol, SequenceMatchItem)>)>, Paren<(SequenceExpr, Vec<(Symbol, SequenceMatchItem)>)>,
@ -480,22 +480,22 @@ pub struct SequenceExprParen {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequenceExprAnd { pub struct SequenceExprAnd {
pub nodes: (SequenceExpr, Keyword, SequenceExpr), pub nodes: (SequenceExpr, Keyword, SequenceExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequenceExprIntersect { pub struct SequenceExprIntersect {
pub nodes: (SequenceExpr, Keyword, SequenceExpr), pub nodes: (SequenceExpr, Keyword, SequenceExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequenceExprOr { pub struct SequenceExprOr {
pub nodes: (SequenceExpr, Keyword, SequenceExpr), pub nodes: (SequenceExpr, Keyword, SequenceExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequenceExprFirstMatch { pub struct SequenceExprFirstMatch {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -503,22 +503,22 @@ pub struct SequenceExprFirstMatch {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequenceExprThroughout { pub struct SequenceExprThroughout {
pub nodes: (ExpressionOrDist, Keyword, SequenceExpr), pub nodes: (ExpressionOrDist, Keyword, SequenceExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequenceExprWithin { pub struct SequenceExprWithin {
pub nodes: (SequenceExpr, Keyword, SequenceExpr), pub nodes: (SequenceExpr, Keyword, SequenceExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequenceExprClockingEvent { pub struct SequenceExprClockingEvent {
pub nodes: (ClockingEvent, SequenceExpr), pub nodes: (ClockingEvent, SequenceExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum CycleDelayRange { pub enum CycleDelayRange {
Primary(CycleDelayRangePrimary), Primary(CycleDelayRangePrimary),
Expression(CycleDelayRangeExpression), Expression(CycleDelayRangeExpression),
@ -526,39 +526,39 @@ pub enum CycleDelayRange {
Plus(CycleDelayRangePlus), Plus(CycleDelayRangePlus),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CycleDelayRangePrimary { pub struct CycleDelayRangePrimary {
pub nodes: (Symbol, ConstantPrimary), pub nodes: (Symbol, ConstantPrimary),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CycleDelayRangeExpression { pub struct CycleDelayRangeExpression {
pub nodes: (Symbol, Bracket<CycleDelayConstRangeExpression>), pub nodes: (Symbol, Bracket<CycleDelayConstRangeExpression>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CycleDelayRangeAsterisk { pub struct CycleDelayRangeAsterisk {
pub nodes: (Symbol, Bracket<Symbol>), pub nodes: (Symbol, Bracket<Symbol>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CycleDelayRangePlus { pub struct CycleDelayRangePlus {
pub nodes: (Symbol, Bracket<Symbol>), pub nodes: (Symbol, Bracket<Symbol>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequenceMethodCall { pub struct SequenceMethodCall {
pub nodes: (SequenceInstance, Symbol, MethodIdentifier), pub nodes: (SequenceInstance, Symbol, MethodIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum SequenceMatchItem { pub enum SequenceMatchItem {
OperatorAssignment(OperatorAssignment), OperatorAssignment(OperatorAssignment),
IncOrDecExpression(IncOrDecExpression), IncOrDecExpression(IncOrDecExpression),
SubroutineCall(SubroutineCall), SubroutineCall(SubroutineCall),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequenceInstance { pub struct SequenceInstance {
pub nodes: ( pub nodes: (
PsOrHierarchicalSequenceIdentifier, PsOrHierarchicalSequenceIdentifier,
@ -566,13 +566,13 @@ pub struct SequenceInstance {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum SequenceListOfArguments { pub enum SequenceListOfArguments {
Ordered(SequenceListOfArgumentsOrdered), Ordered(SequenceListOfArgumentsOrdered),
Named(SequenceListOfArgumentsNamed), Named(SequenceListOfArgumentsNamed),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequenceListOfArgumentsOrdered { pub struct SequenceListOfArgumentsOrdered {
pub nodes: ( pub nodes: (
List<Symbol, Option<SequenceActualArg>>, List<Symbol, Option<SequenceActualArg>>,
@ -580,89 +580,89 @@ pub struct SequenceListOfArgumentsOrdered {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequenceListOfArgumentsNamed { pub struct SequenceListOfArgumentsNamed {
pub nodes: (List<Symbol, (Symbol, Identifier, Paren<Option<SequenceActualArg>>)>,), pub nodes: (List<Symbol, (Symbol, Identifier, Paren<Option<SequenceActualArg>>)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum SequenceActualArg { pub enum SequenceActualArg {
EventExpression(EventExpression), EventExpression(EventExpression),
SequenceExpr(SequenceExpr), SequenceExpr(SequenceExpr),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum BooleanAbbrev { pub enum BooleanAbbrev {
ConsecutiveRepetition(ConsecutiveRepetition), ConsecutiveRepetition(ConsecutiveRepetition),
NonConsecutiveRepetition(NonConsecutiveRepetition), NonConsecutiveRepetition(NonConsecutiveRepetition),
GotoRepetition(GotoRepetition), GotoRepetition(GotoRepetition),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequenceAbbrev { pub struct SequenceAbbrev {
pub nodes: (ConsecutiveRepetition,), pub nodes: (ConsecutiveRepetition,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ConsecutiveRepetition { pub enum ConsecutiveRepetition {
Expression(ConsecutiveRepetitionExpression), Expression(ConsecutiveRepetitionExpression),
Asterisk(ConsecutiveRepetitionAsterisk), Asterisk(ConsecutiveRepetitionAsterisk),
Plus(ConsecutiveRepetitionPlus), Plus(ConsecutiveRepetitionPlus),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConsecutiveRepetitionExpression { pub struct ConsecutiveRepetitionExpression {
pub nodes: (Bracket<(Symbol, ConstOrRangeExpression)>,), pub nodes: (Bracket<(Symbol, ConstOrRangeExpression)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConsecutiveRepetitionAsterisk { pub struct ConsecutiveRepetitionAsterisk {
pub nodes: (Bracket<Symbol>,), pub nodes: (Bracket<Symbol>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConsecutiveRepetitionPlus { pub struct ConsecutiveRepetitionPlus {
pub nodes: (Bracket<Symbol>,), pub nodes: (Bracket<Symbol>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NonConsecutiveRepetition { pub struct NonConsecutiveRepetition {
pub nodes: (Bracket<(Symbol, ConstOrRangeExpression)>,), pub nodes: (Bracket<(Symbol, ConstOrRangeExpression)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct GotoRepetition { pub struct GotoRepetition {
pub nodes: (Bracket<(Symbol, ConstOrRangeExpression)>,), pub nodes: (Bracket<(Symbol, ConstOrRangeExpression)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ConstOrRangeExpression { pub enum ConstOrRangeExpression {
ConstantExpression(ConstantExpression), ConstantExpression(ConstantExpression),
CycleDelayConstRangeExpression(CycleDelayConstRangeExpression), CycleDelayConstRangeExpression(CycleDelayConstRangeExpression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum CycleDelayConstRangeExpression { pub enum CycleDelayConstRangeExpression {
Binary(CycleDelayConstRangeExpressionBinary), Binary(CycleDelayConstRangeExpressionBinary),
Dollar(CycleDelayConstRangeExpressionDollar), Dollar(CycleDelayConstRangeExpressionDollar),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CycleDelayConstRangeExpressionBinary { pub struct CycleDelayConstRangeExpressionBinary {
pub nodes: (ConstantExpression, Symbol, ConstantExpression), pub nodes: (ConstantExpression, Symbol, ConstantExpression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CycleDelayConstRangeExpressionDollar { pub struct CycleDelayConstRangeExpressionDollar {
pub nodes: (ConstantExpression, Symbol, Symbol), pub nodes: (ConstantExpression, Symbol, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ExpressionOrDist { pub struct ExpressionOrDist {
pub nodes: (Expression, Option<(Keyword, Brace<DistList>)>), pub nodes: (Expression, Option<(Keyword, Brace<DistList>)>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct AssertionVariableDeclaration { pub struct AssertionVariableDeclaration {
pub nodes: (VarDataType, ListOfVariableDeclAssignments, Symbol), pub nodes: (VarDataType, ListOfVariableDeclAssignments, Symbol),
} }
@ -1601,7 +1601,7 @@ pub fn cycle_delay_range_plus(s: Span) -> IResult<Span, CycleDelayRange> {
)) ))
} }
#[parser(Memoize)] #[parser]
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)?;

View File

@ -6,7 +6,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum BlockItemDeclaration { pub enum BlockItemDeclaration {
Data(BlockItemDeclarationData), Data(BlockItemDeclarationData),
LocalParameter(BlockItemDeclarationLocalParameter), LocalParameter(BlockItemDeclarationLocalParameter),
@ -14,12 +14,12 @@ pub enum BlockItemDeclaration {
Let(BlockItemDeclarationLet), Let(BlockItemDeclarationLet),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BlockItemDeclarationData { pub struct BlockItemDeclarationData {
pub nodes: (Vec<AttributeInstance>, DataDeclaration), pub nodes: (Vec<AttributeInstance>, DataDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BlockItemDeclarationLocalParameter { pub struct BlockItemDeclarationLocalParameter {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -28,7 +28,7 @@ pub struct BlockItemDeclarationLocalParameter {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BlockItemDeclarationParameter { pub struct BlockItemDeclarationParameter {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -37,7 +37,7 @@ pub struct BlockItemDeclarationParameter {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BlockItemDeclarationLet { pub struct BlockItemDeclarationLet {
pub nodes: (Vec<AttributeInstance>, LetDeclaration), pub nodes: (Vec<AttributeInstance>, LetDeclaration),
} }

View File

@ -8,7 +8,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CovergroupDeclaration { pub struct CovergroupDeclaration {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -22,34 +22,34 @@ pub struct CovergroupDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum CoverageSpecOrOption { pub enum CoverageSpecOrOption {
Spec(CoverageSpecOrOptionSpec), Spec(CoverageSpecOrOptionSpec),
Option(CoverageSpecOrOptionOption), Option(CoverageSpecOrOptionOption),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CoverageSpecOrOptionSpec { pub struct CoverageSpecOrOptionSpec {
pub nodes: (Vec<AttributeInstance>, CoverageSpec), pub nodes: (Vec<AttributeInstance>, CoverageSpec),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CoverageSpecOrOptionOption { pub struct CoverageSpecOrOptionOption {
pub nodes: (Vec<AttributeInstance>, CoverageOption, Symbol), pub nodes: (Vec<AttributeInstance>, CoverageOption, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum CoverageOption { pub enum CoverageOption {
Option(CoverageOptionOption), Option(CoverageOptionOption),
TypeOption(CoverageOptionTypeOption), TypeOption(CoverageOptionTypeOption),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CoverageOptionOption { pub struct CoverageOptionOption {
pub nodes: (Keyword, Symbol, MemberIdentifier, Symbol, Expression), pub nodes: (Keyword, Symbol, MemberIdentifier, Symbol, Expression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CoverageOptionTypeOption { pub struct CoverageOptionTypeOption {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -60,70 +60,70 @@ pub struct CoverageOptionTypeOption {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum CoverageSpec { pub enum CoverageSpec {
CoverPoint(CoverPoint), CoverPoint(CoverPoint),
CoverCross(CoverCross), CoverCross(CoverCross),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum CoverageEvent { pub enum CoverageEvent {
ClockingEvent(ClockingEvent), ClockingEvent(ClockingEvent),
Sample(CoverageEventSample), Sample(CoverageEventSample),
At(CoverageEventAt), At(CoverageEventAt),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CoverageEventSample { pub struct CoverageEventSample {
pub nodes: (Keyword, Keyword, Keyword, Paren<Option<TfPortList>>), pub nodes: (Keyword, Keyword, Keyword, Paren<Option<TfPortList>>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CoverageEventAt { pub struct CoverageEventAt {
pub nodes: (Symbol, Paren<BlockEventExpression>), pub nodes: (Symbol, Paren<BlockEventExpression>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum BlockEventExpression { pub enum BlockEventExpression {
Or(Box<BlockEventExpressionOr>), Or(Box<BlockEventExpressionOr>),
Begin(BlockEventExpressionBegin), Begin(BlockEventExpressionBegin),
End(BlockEventExpressionEnd), End(BlockEventExpressionEnd),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BlockEventExpressionOr { pub struct BlockEventExpressionOr {
pub nodes: (BlockEventExpression, Keyword, BlockEventExpression), pub nodes: (BlockEventExpression, Keyword, BlockEventExpression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BlockEventExpressionBegin { pub struct BlockEventExpressionBegin {
pub nodes: (Keyword, HierarchicalBtfIdentifier), pub nodes: (Keyword, HierarchicalBtfIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BlockEventExpressionEnd { pub struct BlockEventExpressionEnd {
pub nodes: (Keyword, HierarchicalBtfIdentifier), pub nodes: (Keyword, HierarchicalBtfIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum HierarchicalBtfIdentifier { pub enum HierarchicalBtfIdentifier {
HierarchicalTfIdentifier(HierarchicalTfIdentifier), HierarchicalTfIdentifier(HierarchicalTfIdentifier),
HierarchicalBlockIdentifier(HierarchicalBlockIdentifier), HierarchicalBlockIdentifier(HierarchicalBlockIdentifier),
Method(HierarchicalBtfIdentifierMethod), Method(HierarchicalBtfIdentifierMethod),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct HierarchicalBtfIdentifierMethod { pub struct HierarchicalBtfIdentifierMethod {
pub nodes: (Option<HierarchicalIdentifierOrClassScope>, MethodIdentifier), pub nodes: (Option<HierarchicalIdentifierOrClassScope>, MethodIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum HierarchicalIdentifierOrClassScope { pub enum HierarchicalIdentifierOrClassScope {
HierarchicalIdentifier((HierarchicalIdentifier, Symbol)), HierarchicalIdentifier((HierarchicalIdentifier, Symbol)),
ClassScope(ClassScope), ClassScope(ClassScope),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CoverPoint { pub struct CoverPoint {
pub nodes: ( pub nodes: (
Option<(Option<DataTypeOrImplicit>, CoverPointIdentifier, Symbol)>, Option<(Option<DataTypeOrImplicit>, CoverPointIdentifier, Symbol)>,
@ -134,18 +134,18 @@ pub struct CoverPoint {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum BinsOrEmpty { pub enum BinsOrEmpty {
NonEmpty(BinsOrEmptyNonEmpty), NonEmpty(BinsOrEmptyNonEmpty),
Empty(Symbol), Empty(Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BinsOrEmptyNonEmpty { pub struct BinsOrEmptyNonEmpty {
pub nodes: (Brace<(Vec<AttributeInstance>, Vec<(BinsOrOptions, Symbol)>)>,), pub nodes: (Brace<(Vec<AttributeInstance>, Vec<(BinsOrOptions, Symbol)>)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum BinsOrOptions { pub enum BinsOrOptions {
CoverageOption(CoverageOption), CoverageOption(CoverageOption),
Covergroup(BinsOrOptionsCovergroup), Covergroup(BinsOrOptionsCovergroup),
@ -156,7 +156,7 @@ pub enum BinsOrOptions {
DefaultSequence(BinsOrOptionsDefaultSequence), DefaultSequence(BinsOrOptionsDefaultSequence),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BinsOrOptionsCovergroup { pub struct BinsOrOptionsCovergroup {
pub nodes: ( pub nodes: (
Option<Wildcard>, Option<Wildcard>,
@ -170,12 +170,12 @@ pub struct BinsOrOptionsCovergroup {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Wildcard { pub struct Wildcard {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BinsOrOptionsCoverPoint { pub struct BinsOrOptionsCoverPoint {
pub nodes: ( pub nodes: (
Option<Wildcard>, Option<Wildcard>,
@ -190,7 +190,7 @@ pub struct BinsOrOptionsCoverPoint {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BinsOrOptionsSetCovergroup { pub struct BinsOrOptionsSetCovergroup {
pub nodes: ( pub nodes: (
Option<Wildcard>, Option<Wildcard>,
@ -203,7 +203,7 @@ pub struct BinsOrOptionsSetCovergroup {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BinsOrOptionsTransList { pub struct BinsOrOptionsTransList {
pub nodes: ( pub nodes: (
Option<Wildcard>, Option<Wildcard>,
@ -216,7 +216,7 @@ pub struct BinsOrOptionsTransList {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BinsOrOptionsDefault { pub struct BinsOrOptionsDefault {
pub nodes: ( pub nodes: (
BinsKeyword, BinsKeyword,
@ -228,7 +228,7 @@ pub struct BinsOrOptionsDefault {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BinsOrOptionsDefaultSequence { pub struct BinsOrOptionsDefaultSequence {
pub nodes: ( pub nodes: (
BinsKeyword, BinsKeyword,
@ -240,24 +240,24 @@ pub struct BinsOrOptionsDefaultSequence {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum BinsKeyword { pub enum BinsKeyword {
Bins(Keyword), Bins(Keyword),
IllegalBins(Keyword), IllegalBins(Keyword),
IgnoreBins(Keyword), IgnoreBins(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TransList { pub struct TransList {
pub nodes: (List<Symbol, Paren<TransSet>>,), pub nodes: (List<Symbol, Paren<TransSet>>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TransSet { pub struct TransSet {
pub nodes: (List<Symbol, TransRangeList>,), pub nodes: (List<Symbol, TransRangeList>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum TransRangeList { pub enum TransRangeList {
TransItem(TransItem), TransItem(TransItem),
Asterisk(TransRangeListAsterisk), Asterisk(TransRangeListAsterisk),
@ -265,38 +265,38 @@ pub enum TransRangeList {
Equal(TransRangeListEqual), Equal(TransRangeListEqual),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TransRangeListAsterisk { pub struct TransRangeListAsterisk {
pub nodes: (TransItem, Bracket<(Symbol, RepeatRange)>), pub nodes: (TransItem, Bracket<(Symbol, RepeatRange)>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TransRangeListArrow { pub struct TransRangeListArrow {
pub nodes: (TransItem, Bracket<(Symbol, RepeatRange)>), pub nodes: (TransItem, Bracket<(Symbol, RepeatRange)>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TransRangeListEqual { pub struct TransRangeListEqual {
pub nodes: (TransItem, Bracket<(Symbol, RepeatRange)>), pub nodes: (TransItem, Bracket<(Symbol, RepeatRange)>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TransItem { pub struct TransItem {
pub nodes: (CovergroupRangeList,), pub nodes: (CovergroupRangeList,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum RepeatRange { pub enum RepeatRange {
CovergroupExpression(CovergroupExpression), CovergroupExpression(CovergroupExpression),
Binary(RepeatRangeBinary), Binary(RepeatRangeBinary),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct RepeatRangeBinary { pub struct RepeatRangeBinary {
pub nodes: (CovergroupExpression, Symbol, CovergroupExpression), pub nodes: (CovergroupExpression, Symbol, CovergroupExpression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CoverCross { pub struct CoverCross {
pub nodes: ( pub nodes: (
Option<(CrossIdentifier, Symbol)>, Option<(CrossIdentifier, Symbol)>,
@ -307,51 +307,51 @@ pub struct CoverCross {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfCrossItems { pub struct ListOfCrossItems {
pub nodes: (CrossItem, List<Symbol, CrossItem>), pub nodes: (CrossItem, List<Symbol, CrossItem>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum CrossItem { pub enum CrossItem {
CoverPointIdentifier(CoverPointIdentifier), CoverPointIdentifier(CoverPointIdentifier),
VariableIdentifier(VariableIdentifier), VariableIdentifier(VariableIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum CrossBody { pub enum CrossBody {
NonEmpty(CrossBodyNonEmpty), NonEmpty(CrossBodyNonEmpty),
Empty(Symbol), Empty(Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CrossBodyNonEmpty { pub struct CrossBodyNonEmpty {
pub nodes: (Brace<Vec<(CrossBodyItem, Symbol)>>,), pub nodes: (Brace<Vec<(CrossBodyItem, Symbol)>>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum CrossBodyItem { pub enum CrossBodyItem {
FunctionDeclaration(FunctionDeclaration), FunctionDeclaration(FunctionDeclaration),
BinsSelectionOrOption((BinsSelectionOrOption, Symbol)), BinsSelectionOrOption((BinsSelectionOrOption, Symbol)),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum BinsSelectionOrOption { pub enum BinsSelectionOrOption {
Coverage(BinsSelectionOrOptionCoverage), Coverage(BinsSelectionOrOptionCoverage),
Bins(BinsSelectionOrOptionBins), Bins(BinsSelectionOrOptionBins),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BinsSelectionOrOptionCoverage { pub struct BinsSelectionOrOptionCoverage {
pub nodes: (Vec<AttributeInstance>, CoverageOption), pub nodes: (Vec<AttributeInstance>, CoverageOption),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BinsSelectionOrOptionBins { pub struct BinsSelectionOrOptionBins {
pub nodes: (Vec<AttributeInstance>, BinsSelection), pub nodes: (Vec<AttributeInstance>, BinsSelection),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BinsSelection { pub struct BinsSelection {
pub nodes: ( pub nodes: (
BinsKeyword, BinsKeyword,
@ -362,7 +362,7 @@ pub struct BinsSelection {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum SelectExpression { pub enum SelectExpression {
SelectCondition(SelectCondition), SelectCondition(SelectCondition),
Not(SelectExpressionNot), Not(SelectExpressionNot),
@ -374,27 +374,27 @@ pub enum SelectExpression {
CrossSet(SelectExpressionCrossSet), CrossSet(SelectExpressionCrossSet),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SelectExpressionNot { pub struct SelectExpressionNot {
pub nodes: (Symbol, SelectCondition), pub nodes: (Symbol, SelectCondition),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SelectExpressionAnd { pub struct SelectExpressionAnd {
pub nodes: (SelectExpression, Symbol, SelectExpression), pub nodes: (SelectExpression, Symbol, SelectExpression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SelectExpressionOr { pub struct SelectExpressionOr {
pub nodes: (SelectExpression, Symbol, SelectExpression), pub nodes: (SelectExpression, Symbol, SelectExpression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SelectExpressionParen { pub struct SelectExpressionParen {
pub nodes: (Paren<SelectExpression>,), pub nodes: (Paren<SelectExpression>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SelectExpressionWith { pub struct SelectExpressionWith {
pub nodes: ( pub nodes: (
SelectExpression, SelectExpression,
@ -404,7 +404,7 @@ pub struct SelectExpressionWith {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SelectExpressionCrossSet { pub struct SelectExpressionCrossSet {
pub nodes: ( pub nodes: (
CrossSetExpression, CrossSetExpression,
@ -412,7 +412,7 @@ pub struct SelectExpressionCrossSet {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SelectCondition { pub struct SelectCondition {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -421,54 +421,54 @@ pub struct SelectCondition {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum BinsExpression { pub enum BinsExpression {
VariableIdentifier(VariableIdentifier), VariableIdentifier(VariableIdentifier),
CoverPoint(BinsExpressionCoverPoint), CoverPoint(BinsExpressionCoverPoint),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BinsExpressionCoverPoint { pub struct BinsExpressionCoverPoint {
pub nodes: (CoverPointIdentifier, Option<(Symbol, BinIdentifier)>), pub nodes: (CoverPointIdentifier, Option<(Symbol, BinIdentifier)>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CovergroupRangeList { pub struct CovergroupRangeList {
pub nodes: (List<Symbol, CovergroupValueRange>,), pub nodes: (List<Symbol, CovergroupValueRange>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum CovergroupValueRange { pub enum CovergroupValueRange {
CovergroupExpression(CovergroupExpression), CovergroupExpression(CovergroupExpression),
Binary(CovergroupValueRangeBinary), Binary(CovergroupValueRangeBinary),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CovergroupValueRangeBinary { pub struct CovergroupValueRangeBinary {
pub nodes: (Bracket<(CovergroupExpression, Symbol, CovergroupExpression)>,), pub nodes: (Bracket<(CovergroupExpression, Symbol, CovergroupExpression)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct WithCovergroupExpression { pub struct WithCovergroupExpression {
pub nodes: (CovergroupExpression,), pub nodes: (CovergroupExpression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SetCovergroupExpression { pub struct SetCovergroupExpression {
pub nodes: (CovergroupExpression,), pub nodes: (CovergroupExpression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct IntegerCovergroupExpression { pub struct IntegerCovergroupExpression {
pub nodes: (CovergroupExpression,), pub nodes: (CovergroupExpression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CrossSetExpression { pub struct CrossSetExpression {
pub nodes: (CovergroupExpression,), pub nodes: (CovergroupExpression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CovergroupExpression { pub struct CovergroupExpression {
pub nodes: (Expression,), pub nodes: (Expression,),
} }

View File

@ -8,7 +8,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DefparamAssignment { pub struct DefparamAssignment {
pub nodes: ( pub nodes: (
HierarchicalParameterIdentifier, HierarchicalParameterIdentifier,
@ -17,7 +17,7 @@ pub struct DefparamAssignment {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NetDeclAssignment { pub struct NetDeclAssignment {
pub nodes: ( pub nodes: (
NetIdentifier, NetIdentifier,
@ -26,7 +26,7 @@ pub struct NetDeclAssignment {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ParamAssignment { pub struct ParamAssignment {
pub nodes: ( pub nodes: (
ParameterIdentifier, ParameterIdentifier,
@ -35,29 +35,29 @@ pub struct ParamAssignment {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum SpecparamAssignment { pub enum SpecparamAssignment {
Mintypmax(SpecparamAssignmentMintypmax), Mintypmax(SpecparamAssignmentMintypmax),
PulseControlSpecparam(PulseControlSpecparam), PulseControlSpecparam(PulseControlSpecparam),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SpecparamAssignmentMintypmax { pub struct SpecparamAssignmentMintypmax {
pub nodes: (SpecparamIdentifier, Symbol, ConstantMintypmaxExpression), pub nodes: (SpecparamIdentifier, Symbol, ConstantMintypmaxExpression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TypeAssignment { pub struct TypeAssignment {
pub nodes: (TypeIdentifier, Option<(Symbol, DataType)>), pub nodes: (TypeIdentifier, Option<(Symbol, DataType)>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PulseControlSpecparam { pub enum PulseControlSpecparam {
WithoutDescriptor(PulseControlSpecparamWithoutDescriptor), WithoutDescriptor(PulseControlSpecparamWithoutDescriptor),
WithDescriptor(PulseControlSpecparamWithDescriptor), WithDescriptor(PulseControlSpecparamWithDescriptor),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PulseControlSpecparamWithoutDescriptor { pub struct PulseControlSpecparamWithoutDescriptor {
pub nodes: ( pub nodes: (
Symbol, Symbol,
@ -66,7 +66,7 @@ pub struct PulseControlSpecparamWithoutDescriptor {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PulseControlSpecparamWithDescriptor { pub struct PulseControlSpecparamWithDescriptor {
pub nodes: ( pub nodes: (
Symbol, Symbol,
@ -78,29 +78,29 @@ pub struct PulseControlSpecparamWithDescriptor {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ErrorLimitValue { pub struct ErrorLimitValue {
pub nodes: (LimitValue,), pub nodes: (LimitValue,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct RejectLimitValue { pub struct RejectLimitValue {
pub nodes: (LimitValue,), pub nodes: (LimitValue,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LimitValue { pub struct LimitValue {
pub nodes: (ConstantMintypmaxExpression,), pub nodes: (ConstantMintypmaxExpression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum VariableDeclAssignment { pub enum VariableDeclAssignment {
Variable(VariableDeclAssignmentVariable), Variable(VariableDeclAssignmentVariable),
DynamicArray(VariableDeclAssignmentDynamicArray), DynamicArray(VariableDeclAssignmentDynamicArray),
Class(VariableDeclAssignmentClass), Class(VariableDeclAssignmentClass),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct VariableDeclAssignmentVariable { pub struct VariableDeclAssignmentVariable {
pub nodes: ( pub nodes: (
VariableIdentifier, VariableIdentifier,
@ -109,7 +109,7 @@ pub struct VariableDeclAssignmentVariable {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct VariableDeclAssignmentDynamicArray { pub struct VariableDeclAssignmentDynamicArray {
pub nodes: ( pub nodes: (
DynamicArrayVariableIdentifier, DynamicArrayVariableIdentifier,
@ -119,28 +119,28 @@ pub struct VariableDeclAssignmentDynamicArray {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct VariableDeclAssignmentClass { pub struct VariableDeclAssignmentClass {
pub nodes: (ClassVariableIdentifier, Option<(Symbol, ClassNew)>), pub nodes: (ClassVariableIdentifier, Option<(Symbol, ClassNew)>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ClassNew { pub enum ClassNew {
Argument(ClassNewArgument), Argument(ClassNewArgument),
Expression(ClassNewExpression), Expression(ClassNewExpression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassNewArgument { pub struct ClassNewArgument {
pub nodes: (Option<ClassScope>, Keyword, Option<Paren<ListOfArguments>>), pub nodes: (Option<ClassScope>, Keyword, Option<Paren<ListOfArguments>>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassNewExpression { pub struct ClassNewExpression {
pub nodes: (Keyword, Expression), pub nodes: (Keyword, Expression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DynamicArrayNew { pub struct DynamicArrayNew {
pub nodes: (Keyword, Bracket<Expression>, Option<Paren<Expression>>), pub nodes: (Keyword, Bracket<Expression>, Option<Paren<Expression>>),
} }

View File

@ -7,47 +7,47 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfDefparamAssignments { pub struct ListOfDefparamAssignments {
pub nodes: (List<Symbol, DefparamAssignment>,), pub nodes: (List<Symbol, DefparamAssignment>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfGenvarIdentifiers { pub struct ListOfGenvarIdentifiers {
pub nodes: (List<Symbol, GenvarIdentifier>,), pub nodes: (List<Symbol, GenvarIdentifier>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfInterfaceIdentifiers { pub struct ListOfInterfaceIdentifiers {
pub nodes: (List<Symbol, (InterfaceIdentifier, Vec<UnpackedDimension>)>,), pub nodes: (List<Symbol, (InterfaceIdentifier, Vec<UnpackedDimension>)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfNetDeclAssignments { pub struct ListOfNetDeclAssignments {
pub nodes: (List<Symbol, NetDeclAssignment>,), pub nodes: (List<Symbol, NetDeclAssignment>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfParamAssignments { pub struct ListOfParamAssignments {
pub nodes: (List<Symbol, ParamAssignment>,), pub nodes: (List<Symbol, ParamAssignment>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfPortIdentifiers { pub struct ListOfPortIdentifiers {
pub nodes: (List<Symbol, (PortIdentifier, Vec<UnpackedDimension>)>,), pub nodes: (List<Symbol, (PortIdentifier, Vec<UnpackedDimension>)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfUdpPortIdentifiers { pub struct ListOfUdpPortIdentifiers {
pub nodes: (List<Symbol, PortIdentifier>,), pub nodes: (List<Symbol, PortIdentifier>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfSpecparamAssignments { pub struct ListOfSpecparamAssignments {
pub nodes: (List<Symbol, SpecparamAssignment>,), pub nodes: (List<Symbol, SpecparamAssignment>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfTfVariableIdentifiers { pub struct ListOfTfVariableIdentifiers {
pub nodes: ( pub nodes: (
List< List<
@ -61,22 +61,22 @@ pub struct ListOfTfVariableIdentifiers {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfTypeAssignments { pub struct ListOfTypeAssignments {
pub nodes: (List<Symbol, TypeAssignment>,), pub nodes: (List<Symbol, TypeAssignment>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfVariableDeclAssignments { pub struct ListOfVariableDeclAssignments {
pub nodes: (List<Symbol, VariableDeclAssignment>,), pub nodes: (List<Symbol, VariableDeclAssignment>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfVariableIdentifiers { pub struct ListOfVariableIdentifiers {
pub nodes: (List<Symbol, (VariableIdentifier, Vec<VariableDimension>)>,), pub nodes: (List<Symbol, (VariableIdentifier, Vec<VariableDimension>)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfVariablePortIdentifiers { pub struct ListOfVariablePortIdentifiers {
pub nodes: ( pub nodes: (
List< List<

View File

@ -7,50 +7,50 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum UnpackedDimension { pub enum UnpackedDimension {
Range(UnpackedDimensionRange), Range(UnpackedDimensionRange),
Expression(UnpackedDimensionExpression), Expression(UnpackedDimensionExpression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UnpackedDimensionRange { pub struct UnpackedDimensionRange {
pub nodes: (Bracket<ConstantRange>,), pub nodes: (Bracket<ConstantRange>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UnpackedDimensionExpression { pub struct UnpackedDimensionExpression {
pub nodes: (Bracket<ConstantExpression>,), pub nodes: (Bracket<ConstantExpression>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PackedDimension { pub enum PackedDimension {
Range(PackedDimensionRange), Range(PackedDimensionRange),
UnsizedDimension(UnsizedDimension), UnsizedDimension(UnsizedDimension),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PackedDimensionRange { pub struct PackedDimensionRange {
pub nodes: (Bracket<ConstantRange>,), pub nodes: (Bracket<ConstantRange>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum AssociativeDimension { pub enum AssociativeDimension {
DataType(AssociativeDimensionDataType), DataType(AssociativeDimensionDataType),
Asterisk(AssociativeDimensionAsterisk), Asterisk(AssociativeDimensionAsterisk),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct AssociativeDimensionDataType { pub struct AssociativeDimensionDataType {
pub nodes: (Bracket<DataType>,), pub nodes: (Bracket<DataType>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct AssociativeDimensionAsterisk { pub struct AssociativeDimensionAsterisk {
pub nodes: (Bracket<Symbol>,), pub nodes: (Bracket<Symbol>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum VariableDimension { pub enum VariableDimension {
UnsizedDimension(UnsizedDimension), UnsizedDimension(UnsizedDimension),
UnpackedDimension(UnpackedDimension), UnpackedDimension(UnpackedDimension),
@ -58,12 +58,12 @@ pub enum VariableDimension {
QueueDimension(QueueDimension), QueueDimension(QueueDimension),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct QueueDimension { pub struct QueueDimension {
pub nodes: (Bracket<(Symbol, Option<(Symbol, ConstantExpression)>)>,), pub nodes: (Bracket<(Symbol, Option<(Symbol, ConstantExpression)>)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UnsizedDimension { pub struct UnsizedDimension {
pub nodes: (Symbol, Symbol), pub nodes: (Symbol, Symbol),
} }

View File

@ -7,18 +7,18 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum Delay3 { pub enum Delay3 {
Single(Delay3Single), Single(Delay3Single),
Mintypmax(Delay3Mintypmax), Mintypmax(Delay3Mintypmax),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Delay3Single { pub struct Delay3Single {
pub nodes: (Symbol, DelayValue), pub nodes: (Symbol, DelayValue),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Delay3Mintypmax { pub struct Delay3Mintypmax {
pub nodes: ( pub nodes: (
Symbol, Symbol,
@ -33,18 +33,18 @@ pub struct Delay3Mintypmax {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum Delay2 { pub enum Delay2 {
Single(Delay2Single), Single(Delay2Single),
Mintypmax(Delay2Mintypmax), Mintypmax(Delay2Mintypmax),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Delay2Single { pub struct Delay2Single {
pub nodes: (Symbol, DelayValue), pub nodes: (Symbol, DelayValue),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Delay2Mintypmax { pub struct Delay2Mintypmax {
pub nodes: ( pub nodes: (
Symbol, Symbol,
@ -52,7 +52,7 @@ pub struct Delay2Mintypmax {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum DelayValue { pub enum DelayValue {
UnsignedNumber(UnsignedNumber), UnsignedNumber(UnsignedNumber),
RealNumber(RealNumber), RealNumber(RealNumber),

View File

@ -8,24 +8,24 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum FunctionDataTypeOrImplicit { pub enum FunctionDataTypeOrImplicit {
DataTypeOrVoid(DataTypeOrVoid), DataTypeOrVoid(DataTypeOrVoid),
ImplicitDataType(ImplicitDataType), ImplicitDataType(ImplicitDataType),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct FunctionDeclaration { pub struct FunctionDeclaration {
pub nodes: (Keyword, Option<Lifetime>, FunctionBodyDeclaration), pub nodes: (Keyword, Option<Lifetime>, FunctionBodyDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum FunctionBodyDeclaration { pub enum FunctionBodyDeclaration {
WithoutPort(FunctionBodyDeclarationWithoutPort), WithoutPort(FunctionBodyDeclarationWithoutPort),
WithPort(FunctionBodyDeclarationWithPort), WithPort(FunctionBodyDeclarationWithPort),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct FunctionBodyDeclarationWithoutPort { pub struct FunctionBodyDeclarationWithoutPort {
pub nodes: ( pub nodes: (
Option<FunctionDataTypeOrImplicit>, Option<FunctionDataTypeOrImplicit>,
@ -39,7 +39,7 @@ pub struct FunctionBodyDeclarationWithoutPort {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct FunctionBodyDeclarationWithPort { pub struct FunctionBodyDeclarationWithPort {
pub nodes: ( pub nodes: (
Option<FunctionDataTypeOrImplicit>, Option<FunctionDataTypeOrImplicit>,
@ -54,13 +54,13 @@ pub struct FunctionBodyDeclarationWithPort {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum InterfaceIdentifierOrClassScope { pub enum InterfaceIdentifierOrClassScope {
InterfaceIdentifier((InterfaceIdentifier, Symbol)), InterfaceIdentifier((InterfaceIdentifier, Symbol)),
ClassScope(ClassScope), ClassScope(ClassScope),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct FunctionPrototype { pub struct FunctionPrototype {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -70,7 +70,7 @@ pub struct FunctionPrototype {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum DpiImportExport { pub enum DpiImportExport {
ImportFunction(DpiImportExportImportFunction), ImportFunction(DpiImportExportImportFunction),
ImportTask(DpiImportExportImportTask), ImportTask(DpiImportExportImportTask),
@ -78,7 +78,7 @@ pub enum DpiImportExport {
ExportTask(DpiImportExportExportTask), ExportTask(DpiImportExportExportTask),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DpiImportExportImportFunction { pub struct DpiImportExportImportFunction {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -90,7 +90,7 @@ pub struct DpiImportExportImportFunction {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DpiImportExportImportTask { pub struct DpiImportExportImportTask {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -102,7 +102,7 @@ pub struct DpiImportExportImportTask {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DpiImportExportExportFunction { pub struct DpiImportExportExportFunction {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -114,7 +114,7 @@ pub struct DpiImportExportExportFunction {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DpiImportExportExportTask { pub struct DpiImportExportExportTask {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -126,29 +126,29 @@ pub struct DpiImportExportExportTask {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum DpiSpecString { pub enum DpiSpecString {
DpiC(Keyword), DpiC(Keyword),
Dpi(Keyword), Dpi(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum DpiFunctionImportProperty { pub enum DpiFunctionImportProperty {
Context(Keyword), Context(Keyword),
Pure(Keyword), Pure(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum DpiTaskImportProperty { pub enum DpiTaskImportProperty {
Context(Keyword), Context(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DpiFunctionProto { pub struct DpiFunctionProto {
pub nodes: (FunctionPrototype,), pub nodes: (FunctionPrototype,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DpiTaskProto { pub struct DpiTaskProto {
pub nodes: (TaskPrototype,), pub nodes: (TaskPrototype,),
} }

View File

@ -7,12 +7,12 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModportDeclaration { pub struct ModportDeclaration {
pub nodes: (Keyword, List<Symbol, ModportItem>, Symbol), pub nodes: (Keyword, List<Symbol, ModportItem>, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModportItem { pub struct ModportItem {
pub nodes: ( pub nodes: (
ModportIdentifier, ModportIdentifier,
@ -20,66 +20,66 @@ pub struct ModportItem {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ModportPortsDeclaraton { pub enum ModportPortsDeclaraton {
Simple(ModportPortsDeclaratonSimple), Simple(ModportPortsDeclaratonSimple),
Tf(ModportPortsDeclaratonTf), Tf(ModportPortsDeclaratonTf),
Clocking(ModportPortsDeclaratonClocking), Clocking(ModportPortsDeclaratonClocking),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModportPortsDeclaratonSimple { pub struct ModportPortsDeclaratonSimple {
pub nodes: (Vec<AttributeInstance>, ModportSimplePortsDeclaration), pub nodes: (Vec<AttributeInstance>, ModportSimplePortsDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModportPortsDeclaratonTf { pub struct ModportPortsDeclaratonTf {
pub nodes: (Vec<AttributeInstance>, ModportTfPortsDeclaration), pub nodes: (Vec<AttributeInstance>, ModportTfPortsDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModportPortsDeclaratonClocking { pub struct ModportPortsDeclaratonClocking {
pub nodes: (Vec<AttributeInstance>, ModportClockingDeclaration), pub nodes: (Vec<AttributeInstance>, ModportClockingDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModportClockingDeclaration { pub struct ModportClockingDeclaration {
pub nodes: (Keyword, ClockingIdentifier), pub nodes: (Keyword, ClockingIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModportSimplePortsDeclaration { pub struct ModportSimplePortsDeclaration {
pub nodes: (PortDirection, List<Symbol, ModportSimplePort>), pub nodes: (PortDirection, List<Symbol, ModportSimplePort>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ModportSimplePort { pub enum ModportSimplePort {
Ordered(ModportSimplePortOrdered), Ordered(ModportSimplePortOrdered),
Named(ModportSimplePortNamed), Named(ModportSimplePortNamed),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModportSimplePortOrdered { pub struct ModportSimplePortOrdered {
pub nodes: (PortIdentifier,), pub nodes: (PortIdentifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModportSimplePortNamed { pub struct ModportSimplePortNamed {
pub nodes: (Symbol, PortIdentifier, Paren<Option<Expression>>), pub nodes: (Symbol, PortIdentifier, Paren<Option<Expression>>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModportTfPortsDeclaration { pub struct ModportTfPortsDeclaration {
pub nodes: (ImportExport, List<Symbol, ModportTfPort>), pub nodes: (ImportExport, List<Symbol, ModportTfPort>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ModportTfPort { pub enum ModportTfPort {
MethodPrototype(MethodPrototype), MethodPrototype(MethodPrototype),
TfIdentifier(TfIdentifier), TfIdentifier(TfIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ImportExport { pub enum ImportExport {
Import(Keyword), Import(Keyword),
Export(Keyword), Export(Keyword),

View File

@ -8,7 +8,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LetDeclaration { pub struct LetDeclaration {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -20,17 +20,17 @@ pub struct LetDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LetIdentifier { pub struct LetIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LetPortList { pub struct LetPortList {
pub nodes: (List<Symbol, LetPortItem>,), pub nodes: (List<Symbol, LetPortItem>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LetPortItem { pub struct LetPortItem {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -41,13 +41,13 @@ pub struct LetPortItem {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum LetFormalType { pub enum LetFormalType {
DataTypeOrImplicit(DataTypeOrImplicit), DataTypeOrImplicit(DataTypeOrImplicit),
Untyped(Keyword), Untyped(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LetExpression { pub struct LetExpression {
pub nodes: ( pub nodes: (
Option<PackageScope>, Option<PackageScope>,
@ -56,13 +56,13 @@ pub struct LetExpression {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum LetListOfArguments { pub enum LetListOfArguments {
Ordered(LetListOfArgumentsOrdered), Ordered(LetListOfArgumentsOrdered),
Named(LetListOfArgumentsNamed), Named(LetListOfArgumentsNamed),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LetListOfArgumentsOrdered { pub struct LetListOfArgumentsOrdered {
pub nodes: ( pub nodes: (
List<Symbol, Option<LetActualArg>>, List<Symbol, Option<LetActualArg>>,
@ -70,12 +70,12 @@ pub struct LetListOfArgumentsOrdered {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LetListOfArgumentsNamed { pub struct LetListOfArgumentsNamed {
pub nodes: (List<Symbol, (Symbol, Identifier, Paren<Option<LetActualArg>>)>,), pub nodes: (List<Symbol, (Symbol, Identifier, Paren<Option<LetActualArg>>)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LetActualArg { pub struct LetActualArg {
pub nodes: (Expression,), pub nodes: (Expression,),
} }
@ -135,7 +135,7 @@ pub fn let_formal_type(s: Span) -> IResult<Span, LetFormalType> {
))(s) ))(s)
} }
#[parser(Memoize)] #[parser]
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)?;

View File

@ -6,13 +6,13 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum LocalParameterDeclaration { pub enum LocalParameterDeclaration {
Param(LocalParameterDeclarationParam), Param(LocalParameterDeclarationParam),
Type(LocalParameterDeclarationType), Type(LocalParameterDeclarationType),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LocalParameterDeclarationParam { pub struct LocalParameterDeclarationParam {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -21,18 +21,18 @@ pub struct LocalParameterDeclarationParam {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LocalParameterDeclarationType { pub struct LocalParameterDeclarationType {
pub nodes: (Keyword, Keyword, ListOfTypeAssignments), pub nodes: (Keyword, Keyword, ListOfTypeAssignments),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ParameterDeclaration { pub enum ParameterDeclaration {
Param(ParameterDeclarationParam), Param(ParameterDeclarationParam),
Type(ParameterDeclarationType), Type(ParameterDeclarationType),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ParameterDeclarationParam { pub struct ParameterDeclarationParam {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -41,12 +41,12 @@ pub struct ParameterDeclarationParam {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ParameterDeclarationType { pub struct ParameterDeclarationType {
pub nodes: (Keyword, Keyword, ListOfTypeAssignments), pub nodes: (Keyword, Keyword, ListOfTypeAssignments),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SpecparamDeclaration { pub struct SpecparamDeclaration {
pub nodes: ( pub nodes: (
Keyword, Keyword,

View File

@ -8,7 +8,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum CastingType { pub enum CastingType {
SimpleType(Box<SimpleType>), SimpleType(Box<SimpleType>),
ConstantPrimary(Box<ConstantPrimary>), ConstantPrimary(Box<ConstantPrimary>),
@ -17,7 +17,7 @@ pub enum CastingType {
Const(Keyword), Const(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum DataType { pub enum DataType {
Vector(DataTypeVector), Vector(DataTypeVector),
Atom(DataTypeAtom), Atom(DataTypeAtom),
@ -34,17 +34,17 @@ pub enum DataType {
TypeReference(Box<TypeReference>), TypeReference(Box<TypeReference>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DataTypeVector { pub struct DataTypeVector {
pub nodes: (IntegerVectorType, Option<Signing>, Vec<PackedDimension>), pub nodes: (IntegerVectorType, Option<Signing>, Vec<PackedDimension>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DataTypeAtom { pub struct DataTypeAtom {
pub nodes: (IntegerAtomType, Option<Signing>), pub nodes: (IntegerAtomType, Option<Signing>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DataTypeStructUnion { pub struct DataTypeStructUnion {
pub nodes: ( pub nodes: (
StructUnion, StructUnion,
@ -54,12 +54,12 @@ pub struct DataTypeStructUnion {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Packed { pub struct Packed {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DataTypeEnum { pub struct DataTypeEnum {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -69,7 +69,7 @@ pub struct DataTypeEnum {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DataTypeVirtual { pub struct DataTypeVirtual {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -80,12 +80,12 @@ pub struct DataTypeVirtual {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Interface { pub struct Interface {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DataTypeType { pub struct DataTypeType {
pub nodes: ( pub nodes: (
Option<PackageScopeOrClassScope>, Option<PackageScopeOrClassScope>,
@ -94,40 +94,40 @@ pub struct DataTypeType {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum DataTypeOrImplicit { pub enum DataTypeOrImplicit {
DataType(DataType), DataType(DataType),
ImplicitDataType(ImplicitDataType), ImplicitDataType(ImplicitDataType),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ImplicitDataType { pub struct ImplicitDataType {
pub nodes: (Option<Signing>, Vec<PackedDimension>), pub nodes: (Option<Signing>, Vec<PackedDimension>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum EnumBaseType { pub enum EnumBaseType {
Atom(EnumBaseTypeAtom), Atom(EnumBaseTypeAtom),
Vector(EnumBaseTypeVector), Vector(EnumBaseTypeVector),
Type(EnumBaseTypeType), Type(EnumBaseTypeType),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EnumBaseTypeAtom { pub struct EnumBaseTypeAtom {
pub nodes: (IntegerAtomType, Option<Signing>), pub nodes: (IntegerAtomType, Option<Signing>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EnumBaseTypeVector { pub struct EnumBaseTypeVector {
pub nodes: (IntegerVectorType, Option<Signing>, Option<PackedDimension>), pub nodes: (IntegerVectorType, Option<Signing>, Option<PackedDimension>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EnumBaseTypeType { pub struct EnumBaseTypeType {
pub nodes: (TypeIdentifier, Option<PackedDimension>), pub nodes: (TypeIdentifier, Option<PackedDimension>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EnumNameDeclaration { pub struct EnumNameDeclaration {
pub nodes: ( pub nodes: (
EnumIdentifier, EnumIdentifier,
@ -136,12 +136,12 @@ pub struct EnumNameDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassScope { pub struct ClassScope {
pub nodes: (ClassType, Symbol), pub nodes: (ClassType, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassType { pub struct ClassType {
pub nodes: ( pub nodes: (
PsClassIdentifier, PsClassIdentifier,
@ -150,13 +150,13 @@ pub struct ClassType {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum IntegerType { pub enum IntegerType {
IntegerVectorType(IntegerVectorType), IntegerVectorType(IntegerVectorType),
IntegerAtomType(IntegerAtomType), IntegerAtomType(IntegerAtomType),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum IntegerAtomType { pub enum IntegerAtomType {
Byte(Keyword), Byte(Keyword),
Shortint(Keyword), Shortint(Keyword),
@ -166,21 +166,21 @@ pub enum IntegerAtomType {
Time(Keyword), Time(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum IntegerVectorType { pub enum IntegerVectorType {
Bit(Keyword), Bit(Keyword),
Logic(Keyword), Logic(Keyword),
Reg(Keyword), Reg(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum NonIntegerType { pub enum NonIntegerType {
Shortreal(Keyword), Shortreal(Keyword),
Real(Keyword), Real(Keyword),
Realtime(Keyword), Realtime(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum NetType { pub enum NetType {
Supply0(Keyword), Supply0(Keyword),
Supply1(Keyword), Supply1(Keyword),
@ -196,46 +196,46 @@ pub enum NetType {
Wor(Keyword), Wor(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum NetPortType { pub enum NetPortType {
DataType(NetPortTypeDataType), DataType(NetPortTypeDataType),
NetTypeIdentifier(NetTypeIdentifier), NetTypeIdentifier(NetTypeIdentifier),
Interconnect(NetPortTypeInterconnect), Interconnect(NetPortTypeInterconnect),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NetPortTypeDataType { pub struct NetPortTypeDataType {
pub nodes: (Option<NetType>, DataTypeOrImplicit), pub nodes: (Option<NetType>, DataTypeOrImplicit),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NetPortTypeInterconnect { pub struct NetPortTypeInterconnect {
pub nodes: (Keyword, ImplicitDataType), pub nodes: (Keyword, ImplicitDataType),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct VariablePortType { pub struct VariablePortType {
pub nodes: (VarDataType,), pub nodes: (VarDataType,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum VarDataType { pub enum VarDataType {
DataType(DataType), DataType(DataType),
Var(VarDataTypeVar), Var(VarDataTypeVar),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct VarDataTypeVar { pub struct VarDataTypeVar {
pub nodes: (Keyword, DataTypeOrImplicit), pub nodes: (Keyword, DataTypeOrImplicit),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum Signing { pub enum Signing {
Signed(Keyword), Signed(Keyword),
Unsigned(Keyword), Unsigned(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum SimpleType { pub enum SimpleType {
IntegerType(IntegerType), IntegerType(IntegerType),
NonIntegerType(NonIntegerType), NonIntegerType(NonIntegerType),
@ -243,7 +243,7 @@ pub enum SimpleType {
PsParameterIdentifier(PsParameterIdentifier), PsParameterIdentifier(PsParameterIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct StructUnionMember { pub struct StructUnionMember {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -254,31 +254,31 @@ pub struct StructUnionMember {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum DataTypeOrVoid { pub enum DataTypeOrVoid {
DataType(DataType), DataType(DataType),
Void(Keyword), Void(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum StructUnion { pub enum StructUnion {
Struct(Keyword), Struct(Keyword),
Union(Keyword), Union(Keyword),
UnionTagged((Keyword, Keyword)), UnionTagged((Keyword, Keyword)),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum TypeReference { pub enum TypeReference {
Expression(TypeReferenceExpression), Expression(TypeReferenceExpression),
DataType(TypeReferenceDataType), DataType(TypeReferenceDataType),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TypeReferenceExpression { pub struct TypeReferenceExpression {
pub nodes: (Keyword, Paren<Expression>), pub nodes: (Keyword, Paren<Expression>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TypeReferenceDataType { pub struct TypeReferenceDataType {
pub nodes: (Keyword, Paren<DataType>), pub nodes: (Keyword, Paren<DataType>),
} }
@ -638,7 +638,7 @@ pub fn struct_union(s: Span) -> IResult<Span, StructUnion> {
))(s) ))(s)
} }
#[parser(Memoize)] #[parser]
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)
} }

View File

@ -7,7 +7,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InoutDeclaration { pub struct InoutDeclaration {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -16,13 +16,13 @@ pub struct InoutDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum InputDeclaration { pub enum InputDeclaration {
Net(InputDeclarationNet), Net(InputDeclarationNet),
Variable(InputDeclarationVariable), Variable(InputDeclarationVariable),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InputDeclarationNet { pub struct InputDeclarationNet {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -31,7 +31,7 @@ pub struct InputDeclarationNet {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InputDeclarationVariable { pub struct InputDeclarationVariable {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -40,13 +40,13 @@ pub struct InputDeclarationVariable {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum OutputDeclaration { pub enum OutputDeclaration {
Net(OutputDeclarationNet), Net(OutputDeclarationNet),
Variable(OutputDeclarationVariable), Variable(OutputDeclarationVariable),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct OutputDeclarationNet { pub struct OutputDeclarationNet {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -55,7 +55,7 @@ pub struct OutputDeclarationNet {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct OutputDeclarationVariable { pub struct OutputDeclarationVariable {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -64,7 +64,7 @@ pub struct OutputDeclarationVariable {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InterfacePortDeclaration { pub struct InterfacePortDeclaration {
pub nodes: ( pub nodes: (
InterfaceIdentifier, InterfaceIdentifier,
@ -73,7 +73,7 @@ pub struct InterfacePortDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct RefDeclaration { pub struct RefDeclaration {
pub nodes: ( pub nodes: (
Keyword, Keyword,

View File

@ -6,7 +6,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum DriveStrength { pub enum DriveStrength {
Strength01(DriveStrength01), Strength01(DriveStrength01),
Strength10(DriveStrength10), Strength10(DriveStrength10),
@ -16,37 +16,37 @@ pub enum DriveStrength {
Strengthz1(DriveStrengthz1), Strengthz1(DriveStrengthz1),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DriveStrength01 { pub struct DriveStrength01 {
pub nodes: (Paren<(Strength0, Symbol, Strength1)>,), pub nodes: (Paren<(Strength0, Symbol, Strength1)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DriveStrength10 { pub struct DriveStrength10 {
pub nodes: (Paren<(Strength1, Symbol, Strength0)>,), pub nodes: (Paren<(Strength1, Symbol, Strength0)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DriveStrength0z { pub struct DriveStrength0z {
pub nodes: (Paren<(Strength0, Symbol, Keyword)>,), pub nodes: (Paren<(Strength0, Symbol, Keyword)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DriveStrength1z { pub struct DriveStrength1z {
pub nodes: (Paren<(Strength1, Symbol, Keyword)>,), pub nodes: (Paren<(Strength1, Symbol, Keyword)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DriveStrengthz1 { pub struct DriveStrengthz1 {
pub nodes: (Paren<(Keyword, Symbol, Strength1)>,), pub nodes: (Paren<(Keyword, Symbol, Strength1)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DriveStrengthz0 { pub struct DriveStrengthz0 {
pub nodes: (Paren<(Keyword, Symbol, Strength0)>,), pub nodes: (Paren<(Keyword, Symbol, Strength0)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum Strength0 { pub enum Strength0 {
Supply0(Keyword), Supply0(Keyword),
Strong0(Keyword), Strong0(Keyword),
@ -54,7 +54,7 @@ pub enum Strength0 {
Weak0(Keyword), Weak0(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum Strength1 { pub enum Strength1 {
Supply1(Keyword), Supply1(Keyword),
Strong1(Keyword), Strong1(Keyword),
@ -62,24 +62,24 @@ pub enum Strength1 {
Weak1(Keyword), Weak1(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ChargeStrength { pub enum ChargeStrength {
Small(ChargeStrengthSmall), Small(ChargeStrengthSmall),
Medium(ChargeStrengthMedium), Medium(ChargeStrengthMedium),
Large(ChargeStrengthLarge), Large(ChargeStrengthLarge),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ChargeStrengthSmall { pub struct ChargeStrengthSmall {
pub nodes: (Paren<Keyword>,), pub nodes: (Paren<Keyword>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ChargeStrengthMedium { pub struct ChargeStrengthMedium {
pub nodes: (Paren<Keyword>,), pub nodes: (Paren<Keyword>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ChargeStrengthLarge { pub struct ChargeStrengthLarge {
pub nodes: (Paren<Keyword>,), pub nodes: (Paren<Keyword>,),
} }

View File

@ -8,18 +8,18 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TaskDeclaration { pub struct TaskDeclaration {
pub nodes: (Keyword, Option<Lifetime>, TaskBodyDeclaration), pub nodes: (Keyword, Option<Lifetime>, TaskBodyDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum TaskBodyDeclaration { pub enum TaskBodyDeclaration {
WithoutPort(TaskBodyDeclarationWithoutPort), WithoutPort(TaskBodyDeclarationWithoutPort),
WithPort(TaskBodyDeclarationWithPort), WithPort(TaskBodyDeclarationWithPort),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TaskBodyDeclarationWithoutPort { pub struct TaskBodyDeclarationWithoutPort {
pub nodes: ( pub nodes: (
Option<InterfaceIdentifierOrClassScope>, Option<InterfaceIdentifierOrClassScope>,
@ -32,7 +32,7 @@ pub struct TaskBodyDeclarationWithoutPort {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TaskBodyDeclarationWithPort { pub struct TaskBodyDeclarationWithPort {
pub nodes: ( pub nodes: (
Option<InterfaceIdentifierOrClassScope>, Option<InterfaceIdentifierOrClassScope>,
@ -46,18 +46,18 @@ pub struct TaskBodyDeclarationWithPort {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum TfItemDeclaration { pub enum TfItemDeclaration {
BlockItemDeclaration(BlockItemDeclaration), BlockItemDeclaration(BlockItemDeclaration),
TfPortDeclaration(TfPortDeclaration), TfPortDeclaration(TfPortDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TfPortList { pub struct TfPortList {
pub nodes: (List<Symbol, TfPortItem>,), pub nodes: (List<Symbol, TfPortItem>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TfPortItem { pub struct TfPortItem {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -72,13 +72,13 @@ pub struct TfPortItem {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum TfPortDirection { pub enum TfPortDirection {
PortDirection(PortDirection), PortDirection(PortDirection),
ConstRef((Keyword, Keyword)), ConstRef((Keyword, Keyword)),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TfPortDeclaration { pub struct TfPortDeclaration {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -90,7 +90,7 @@ pub struct TfPortDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TaskPrototype { pub struct TaskPrototype {
pub nodes: (Keyword, TaskIdentifier, Option<Paren<Option<TfPortList>>>), pub nodes: (Keyword, TaskIdentifier, Option<Paren<Option<TfPortList>>>),
} }

View File

@ -8,7 +8,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum DataDeclaration { pub enum DataDeclaration {
Variable(DataDeclarationVariable), Variable(DataDeclarationVariable),
TypeDeclaration(TypeDeclaration), TypeDeclaration(TypeDeclaration),
@ -16,7 +16,7 @@ pub enum DataDeclaration {
NetTypeDeclaration(NetTypeDeclaration), NetTypeDeclaration(NetTypeDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DataDeclarationVariable { pub struct DataDeclarationVariable {
pub nodes: ( pub nodes: (
Option<Const>, Option<Const>,
@ -28,12 +28,12 @@ pub struct DataDeclarationVariable {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Const { pub struct Const {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PackageImportDeclaration { pub struct PackageImportDeclaration {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -42,34 +42,34 @@ pub struct PackageImportDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PackageImportItem { pub enum PackageImportItem {
Identifier(PackageImportItemIdentifier), Identifier(PackageImportItemIdentifier),
Asterisk(PackageImportItemAsterisk), Asterisk(PackageImportItemAsterisk),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PackageImportItemIdentifier { pub struct PackageImportItemIdentifier {
pub nodes: (PackageIdentifier, Symbol, Identifier), pub nodes: (PackageIdentifier, Symbol, Identifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PackageImportItemAsterisk { pub struct PackageImportItemAsterisk {
pub nodes: (PackageIdentifier, Symbol, Symbol), pub nodes: (PackageIdentifier, Symbol, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PackageExportDeclaration { pub enum PackageExportDeclaration {
Asterisk(PackageExportDeclarationAsterisk), Asterisk(PackageExportDeclarationAsterisk),
Item(PackageExportDeclarationItem), Item(PackageExportDeclarationItem),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PackageExportDeclarationAsterisk { pub struct PackageExportDeclarationAsterisk {
pub nodes: (Keyword, Symbol, Symbol), pub nodes: (Keyword, Symbol, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PackageExportDeclarationItem { pub struct PackageExportDeclarationItem {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -78,19 +78,19 @@ pub struct PackageExportDeclarationItem {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct GenvarDeclaration { pub struct GenvarDeclaration {
pub nodes: (Keyword, ListOfGenvarIdentifiers, Symbol), pub nodes: (Keyword, ListOfGenvarIdentifiers, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum NetDeclaration { pub enum NetDeclaration {
NetType(NetDeclarationNetType), NetType(NetDeclarationNetType),
NetTypeIdentifier(NetDeclarationNetTypeIdentifier), NetTypeIdentifier(NetDeclarationNetTypeIdentifier),
Interconnect(NetDeclarationInterconnect), Interconnect(NetDeclarationInterconnect),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NetDeclarationNetType { pub struct NetDeclarationNetType {
pub nodes: ( pub nodes: (
NetType, NetType,
@ -103,19 +103,19 @@ pub struct NetDeclarationNetType {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum Strength { pub enum Strength {
Drive(DriveStrength), Drive(DriveStrength),
Charge(ChargeStrength), Charge(ChargeStrength),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum VectorScalar { pub enum VectorScalar {
Vectored(Keyword), Vectored(Keyword),
Scalared(Keyword), Scalared(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NetDeclarationNetTypeIdentifier { pub struct NetDeclarationNetTypeIdentifier {
pub nodes: ( pub nodes: (
NetTypeIdentifier, NetTypeIdentifier,
@ -125,7 +125,7 @@ pub struct NetDeclarationNetTypeIdentifier {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NetDeclarationInterconnect { pub struct NetDeclarationInterconnect {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -138,14 +138,14 @@ pub struct NetDeclarationInterconnect {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum TypeDeclaration { pub enum TypeDeclaration {
DataType(TypeDeclarationDataType), DataType(TypeDeclarationDataType),
Interface(TypeDeclarationInterface), Interface(TypeDeclarationInterface),
Reserved(TypeDeclarationReserved), Reserved(TypeDeclarationReserved),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TypeDeclarationDataType { pub struct TypeDeclarationDataType {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -156,7 +156,7 @@ pub struct TypeDeclarationDataType {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TypeDeclarationInterface { pub struct TypeDeclarationInterface {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -169,7 +169,7 @@ pub struct TypeDeclarationInterface {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TypeDeclarationReserved { pub struct TypeDeclarationReserved {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -179,7 +179,7 @@ pub struct TypeDeclarationReserved {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum TypeDeclarationKeyword { pub enum TypeDeclarationKeyword {
Enum(Keyword), Enum(Keyword),
Struct(Keyword), Struct(Keyword),
@ -188,13 +188,13 @@ pub enum TypeDeclarationKeyword {
InterfaceClass((Keyword, Keyword)), InterfaceClass((Keyword, Keyword)),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum NetTypeDeclaration { pub enum NetTypeDeclaration {
DataType(NetTypeDeclarationDataType), DataType(NetTypeDeclarationDataType),
NetType(NetTypeDeclarationNetType), NetType(NetTypeDeclarationNetType),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NetTypeDeclarationDataType { pub struct NetTypeDeclarationDataType {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -209,7 +209,7 @@ pub struct NetTypeDeclarationDataType {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NetTypeDeclarationNetType { pub struct NetTypeDeclarationNetType {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -220,7 +220,7 @@ pub struct NetTypeDeclarationNetType {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum Lifetime { pub enum Lifetime {
Static(Keyword), Static(Keyword),
Automatic(Keyword), Automatic(Keyword),

View File

@ -7,75 +7,63 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Concatenation { pub struct Concatenation {
pub nodes: (Brace<List<Symbol, Expression>>,), pub nodes: (Brace<List<Symbol, Expression>>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstantConcatenation { pub struct ConstantConcatenation {
pub nodes: (Brace<List<Symbol, ConstantExpression>>,), pub nodes: (Brace<List<Symbol, ConstantExpression>>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstantMultipleConcatenation { pub struct ConstantMultipleConcatenation {
pub nodes: (Brace<(ConstantExpression, ConstantConcatenation)>,), pub nodes: (Brace<(ConstantExpression, ConstantConcatenation)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModulePathConcatenation { pub struct ModulePathConcatenation {
pub nodes: (Brace<List<Symbol, ModulePathExpression>>,), pub nodes: (Brace<List<Symbol, ModulePathExpression>>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModulePathMultipleConcatenation { pub struct ModulePathMultipleConcatenation {
pub nodes: (Brace<(ConstantExpression, ModulePathConcatenation)>,), pub nodes: (Brace<(ConstantExpression, ModulePathConcatenation)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct MultipleConcatenation { pub struct MultipleConcatenation {
pub nodes: (Brace<(Expression, Concatenation)>,), pub nodes: (Brace<(Expression, Concatenation)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct StreamingConcatenation { pub struct StreamingConcatenation {
pub nodes: ( pub nodes: (Brace<(StreamOperator, Option<SliceSize>, StreamConcatenation)>,),
Brace<
(
StreamOperator,
Option<SliceSize>,
StreamConcatenation,
),
>,
),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct StreamOperator { pub struct StreamOperator {
pub nodes: (Symbol,), pub nodes: (Symbol,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum SliceSize { pub enum SliceSize {
SimpleType(SimpleType), SimpleType(SimpleType),
ConstantExpression(ConstantExpression), ConstantExpression(ConstantExpression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct StreamConcatenation { pub struct StreamConcatenation {
pub nodes: (Brace<List<Symbol, StreamExpression>>,), pub nodes: (Brace<List<Symbol, StreamExpression>>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct StreamExpression { pub struct StreamExpression {
pub nodes: ( pub nodes: (Expression, Option<(Keyword, Bracket<ArrayRangeExpression>)>),
Expression,
Option<(Keyword, Bracket< ArrayRangeExpression>)>,
),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ArrayRangeExpression { pub enum ArrayRangeExpression {
Expression(Expression), Expression(Expression),
Colon(ArrayRangeExpressionColon), Colon(ArrayRangeExpressionColon),
@ -83,22 +71,22 @@ pub enum ArrayRangeExpression {
MinusColon(ArrayRangeExpressionMinusColon), MinusColon(ArrayRangeExpressionMinusColon),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ArrayRangeExpressionColon { pub struct ArrayRangeExpressionColon {
pub nodes: (Expression, Symbol, Expression), pub nodes: (Expression, Symbol, Expression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ArrayRangeExpressionPlusColon { pub struct ArrayRangeExpressionPlusColon {
pub nodes: (Expression, Symbol, Expression), pub nodes: (Expression, Symbol, Expression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ArrayRangeExpressionMinusColon { pub struct ArrayRangeExpressionMinusColon {
pub nodes: (Expression, Symbol, Expression), pub nodes: (Expression, Symbol, Expression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EmptyUnpackedArrayConcatenation { pub struct EmptyUnpackedArrayConcatenation {
pub nodes: (Symbol, Symbol), pub nodes: (Symbol, Symbol),
} }
@ -143,7 +131,7 @@ pub fn multiple_concatenation(s: Span) -> IResult<Span, MultipleConcatenation> {
Ok((s, MultipleConcatenation { nodes: (a,) })) Ok((s, MultipleConcatenation { nodes: (a,) }))
} }
#[parser(Memoize)] #[parser]
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,

View File

@ -6,24 +6,24 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum NetLvalue { pub enum NetLvalue {
Identifier(NetLvalueIdentifier), Identifier(NetLvalueIdentifier),
Lvalue(Box<NetLvalueLvalue>), Lvalue(Box<NetLvalueLvalue>),
Pattern(Box<NetLvaluePattern>), Pattern(Box<NetLvaluePattern>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NetLvalueIdentifier { pub struct NetLvalueIdentifier {
pub nodes: (PsOrHierarchicalNetIdentifier, ConstantSelect), pub nodes: (PsOrHierarchicalNetIdentifier, ConstantSelect),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NetLvalueLvalue { pub struct NetLvalueLvalue {
pub nodes: (Brace<List<Symbol, NetLvalue>>,), pub nodes: (Brace<List<Symbol, NetLvalue>>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NetLvaluePattern { pub struct NetLvaluePattern {
pub nodes: ( pub nodes: (
Option<AssignmentPatternExpressionType>, Option<AssignmentPatternExpressionType>,
@ -31,7 +31,7 @@ pub struct NetLvaluePattern {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum VariableLvalue { pub enum VariableLvalue {
Identifier(VariableLvalueIdentifier), Identifier(VariableLvalueIdentifier),
Lvalue(Box<VariableLvalueLvalue>), Lvalue(Box<VariableLvalueLvalue>),
@ -39,7 +39,7 @@ pub enum VariableLvalue {
StreamingConcatenation(StreamingConcatenation), StreamingConcatenation(StreamingConcatenation),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct VariableLvalueIdentifier { pub struct VariableLvalueIdentifier {
pub nodes: ( pub nodes: (
Option<ImplicitClassHandleOrPackageScope>, Option<ImplicitClassHandleOrPackageScope>,
@ -48,12 +48,12 @@ pub struct VariableLvalueIdentifier {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct VariableLvalueLvalue { pub struct VariableLvalueLvalue {
pub nodes: (Brace<List<Symbol, VariableLvalue>>,), pub nodes: (Brace<List<Symbol, VariableLvalue>>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct VariableLvaluePattern { pub struct VariableLvaluePattern {
pub nodes: ( pub nodes: (
Option<AssignmentPatternExpressionType>, Option<AssignmentPatternExpressionType>,
@ -61,7 +61,7 @@ pub struct VariableLvaluePattern {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NonrangeVariableLvalue { pub struct NonrangeVariableLvalue {
pub nodes: ( pub nodes: (
Option<ImplicitClassHandleOrPackageScope>, Option<ImplicitClassHandleOrPackageScope>,

View File

@ -4,34 +4,27 @@ use nom::branch::*;
use nom::combinator::*; use nom::combinator::*;
use nom::multi::*; use nom::multi::*;
use nom::IResult; use nom::IResult;
use nom_packrat::packrat_parser;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum IncOrDecExpression { pub enum IncOrDecExpression {
Prefix(IncOrDecExpressionPrefix), Prefix(IncOrDecExpressionPrefix),
Suffix(IncOrDecExpressionSuffix), Suffix(IncOrDecExpressionSuffix),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct IncOrDecExpressionPrefix { pub struct IncOrDecExpressionPrefix {
pub nodes: ( pub nodes: (IncOrDecOperator, Vec<AttributeInstance>, VariableLvalue),
IncOrDecOperator,
Vec<AttributeInstance>,
VariableLvalue,
),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct IncOrDecExpressionSuffix { pub struct IncOrDecExpressionSuffix {
pub nodes: ( pub nodes: (VariableLvalue, Vec<AttributeInstance>, IncOrDecOperator),
VariableLvalue,
Vec<AttributeInstance>,
IncOrDecOperator,
),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConditionalExpression { pub struct ConditionalExpression {
pub nodes: ( pub nodes: (
CondPredicate, CondPredicate,
@ -43,7 +36,7 @@ pub struct ConditionalExpression {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ConstantExpression { pub enum ConstantExpression {
ConstantPrimary(Box<ConstantPrimary>), ConstantPrimary(Box<ConstantPrimary>),
Unary(Box<ConstantExpressionUnary>), Unary(Box<ConstantExpressionUnary>),
@ -51,16 +44,12 @@ pub enum ConstantExpression {
Ternary(Box<ConstantExpressionTernary>), Ternary(Box<ConstantExpressionTernary>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstantExpressionUnary { pub struct ConstantExpressionUnary {
pub nodes: ( pub nodes: (UnaryOperator, Vec<AttributeInstance>, ConstantPrimary),
UnaryOperator,
Vec<AttributeInstance>,
ConstantPrimary,
),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstantExpressionBinary { pub struct ConstantExpressionBinary {
pub nodes: ( pub nodes: (
ConstantExpression, ConstantExpression,
@ -70,7 +59,7 @@ pub struct ConstantExpressionBinary {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstantExpressionTernary { pub struct ConstantExpressionTernary {
pub nodes: ( pub nodes: (
ConstantExpression, ConstantExpression,
@ -82,13 +71,13 @@ pub struct ConstantExpressionTernary {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ConstantMintypmaxExpression { pub enum ConstantMintypmaxExpression {
Unary(ConstantExpression), Unary(ConstantExpression),
Ternary(ConstantMintypmaxExpressionTernary), Ternary(ConstantMintypmaxExpressionTernary),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstantMintypmaxExpressionTernary { pub struct ConstantMintypmaxExpressionTernary {
pub nodes: ( pub nodes: (
ConstantExpression, ConstantExpression,
@ -99,43 +88,43 @@ pub struct ConstantMintypmaxExpressionTernary {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ConstantParamExpression { pub enum ConstantParamExpression {
ConstantMintypmaxExpression(ConstantMintypmaxExpression), ConstantMintypmaxExpression(ConstantMintypmaxExpression),
DataType(DataType), DataType(DataType),
Dollar(Symbol), Dollar(Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ParamExpression { pub enum ParamExpression {
MintypmaxExpression(MintypmaxExpression), MintypmaxExpression(MintypmaxExpression),
DataType(Box<DataType>), DataType(Box<DataType>),
Dollar(Symbol), Dollar(Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ConstantRangeExpression { pub enum ConstantRangeExpression {
ConstantExpression(ConstantExpression), ConstantExpression(ConstantExpression),
ConstantPartSelectRange(ConstantPartSelectRange), ConstantPartSelectRange(ConstantPartSelectRange),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ConstantPartSelectRange { pub enum ConstantPartSelectRange {
ConstantRange(ConstantRange), ConstantRange(ConstantRange),
ConstantIndexedRange(ConstantIndexedRange), ConstantIndexedRange(ConstantIndexedRange),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstantRange { pub struct ConstantRange {
pub nodes: (ConstantExpression, Symbol, ConstantExpression), pub nodes: (ConstantExpression, Symbol, ConstantExpression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstantIndexedRange { pub struct ConstantIndexedRange {
pub nodes: (ConstantExpression, Symbol, ConstantExpression), pub nodes: (ConstantExpression, Symbol, ConstantExpression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum Expression { pub enum Expression {
Primary(Box<Primary>), Primary(Box<Primary>),
Unary(Box<ExpressionUnary>), Unary(Box<ExpressionUnary>),
@ -147,17 +136,17 @@ pub enum Expression {
TaggedUnionExpression(Box<TaggedUnionExpression>), TaggedUnionExpression(Box<TaggedUnionExpression>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ExpressionUnary { pub struct ExpressionUnary {
pub nodes: (UnaryOperator, Vec<AttributeInstance>, Primary), pub nodes: (UnaryOperator, Vec<AttributeInstance>, Primary),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ExpressionOperatorAssignment { pub struct ExpressionOperatorAssignment {
pub nodes: (Paren<OperatorAssignment>,), pub nodes: (Paren<OperatorAssignment>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ExpressionBinary { pub struct ExpressionBinary {
pub nodes: ( pub nodes: (
Expression, Expression,
@ -167,45 +156,39 @@ pub struct ExpressionBinary {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TaggedUnionExpression { pub struct TaggedUnionExpression {
pub nodes: (Keyword, MemberIdentifier, Option<Expression>), pub nodes: (Keyword, MemberIdentifier, Option<Expression>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InsideExpression { pub struct InsideExpression {
pub nodes: (Expression, Keyword, Brace<OpenRangeList>), pub nodes: (Expression, Keyword, Brace<OpenRangeList>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ValueRange { pub enum ValueRange {
Expression(Expression), Expression(Expression),
Binary(ValueRangeBinary), Binary(ValueRangeBinary),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ValueRangeBinary { pub struct ValueRangeBinary {
pub nodes: (Bracket<(Expression, Symbol, Expression)>,), pub nodes: (Bracket<(Expression, Symbol, Expression)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum MintypmaxExpression { pub enum MintypmaxExpression {
Expression(Expression), Expression(Expression),
Ternary(MintypmaxExpressionTernary), Ternary(MintypmaxExpressionTernary),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct MintypmaxExpressionTernary { pub struct MintypmaxExpressionTernary {
pub nodes: ( pub nodes: (Expression, Symbol, Expression, Symbol, Expression),
Expression,
Symbol,
Expression,
Symbol,
Expression,
),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModulePathConditionalExpression { pub struct ModulePathConditionalExpression {
pub nodes: ( pub nodes: (
ModulePathExpression, ModulePathExpression,
@ -217,7 +200,7 @@ pub struct ModulePathConditionalExpression {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ModulePathExpression { pub enum ModulePathExpression {
ModulePathPrimary(Box<ModulePathPrimary>), ModulePathPrimary(Box<ModulePathPrimary>),
Unary(Box<ModulePathExpressionUnary>), Unary(Box<ModulePathExpressionUnary>),
@ -225,7 +208,7 @@ pub enum ModulePathExpression {
ModulePathConditionalExpression(Box<ModulePathConditionalExpression>), ModulePathConditionalExpression(Box<ModulePathConditionalExpression>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModulePathExpressionUnary { pub struct ModulePathExpressionUnary {
pub nodes: ( pub nodes: (
UnaryModulePathOperator, UnaryModulePathOperator,
@ -234,7 +217,7 @@ pub struct ModulePathExpressionUnary {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModulePathExpressionBinary { pub struct ModulePathExpressionBinary {
pub nodes: ( pub nodes: (
ModulePathExpression, ModulePathExpression,
@ -244,13 +227,13 @@ pub struct ModulePathExpressionBinary {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ModulePathMintypmaxExpression { pub enum ModulePathMintypmaxExpression {
ModulePathExpression(ModulePathExpression), ModulePathExpression(ModulePathExpression),
Ternary(ModulePathMintypmaxExpressionTernary), Ternary(ModulePathMintypmaxExpressionTernary),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModulePathMintypmaxExpressionTernary { pub struct ModulePathMintypmaxExpressionTernary {
pub nodes: ( pub nodes: (
ModulePathExpression, ModulePathExpression,
@ -261,25 +244,25 @@ pub struct ModulePathMintypmaxExpressionTernary {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PartSelectRange { pub enum PartSelectRange {
ConstantRange(ConstantRange), ConstantRange(ConstantRange),
IndexedRange(IndexedRange), IndexedRange(IndexedRange),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct IndexedRange { pub struct IndexedRange {
pub nodes: (Expression, Symbol, ConstantExpression), pub nodes: (Expression, Symbol, ConstantExpression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct GenvarExpression { pub struct GenvarExpression {
pub nodes: (ConstantExpression,), pub nodes: (ConstantExpression,),
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[parser(Memoize)] #[parser]
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)
} }
@ -306,7 +289,7 @@ pub fn inc_or_dec_expression_suffix(s: Span) -> IResult<Span, IncOrDecExpression
)) ))
} }
#[parser(MaybeRecursive, Memoize)] #[parser(MaybeRecursive)]
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)?;
@ -322,7 +305,8 @@ pub fn conditional_expression(s: Span) -> IResult<Span, ConditionalExpression> {
)) ))
} }
#[parser(Memoize)] #[packrat_parser]
#[parser]
pub fn constant_expression(s: Span) -> IResult<Span, ConstantExpression> { pub fn constant_expression(s: Span) -> IResult<Span, ConstantExpression> {
alt(( alt((
constant_expression_unary, constant_expression_unary,
@ -334,7 +318,7 @@ pub fn constant_expression(s: Span) -> IResult<Span, ConstantExpression> {
))(s) ))(s)
} }
#[parser(Memoize)] #[parser]
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)?;
@ -345,7 +329,7 @@ pub fn constant_expression_unary(s: Span) -> IResult<Span, ConstantExpression> {
)) ))
} }
#[parser(MaybeRecursive, Memoize)] #[parser(MaybeRecursive)]
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)?;
@ -359,7 +343,7 @@ pub fn constant_expression_binary(s: Span) -> IResult<Span, ConstantExpression>
)) ))
} }
#[parser(MaybeRecursive, Memoize)] #[parser(MaybeRecursive)]
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)?;
@ -464,7 +448,8 @@ pub fn constant_indexed_range(s: Span) -> IResult<Span, ConstantIndexedRange> {
Ok((s, ConstantIndexedRange { nodes: (a, b, c) })) Ok((s, ConstantIndexedRange { nodes: (a, b, c) }))
} }
#[parser(Memoize)] #[packrat_parser]
#[parser]
pub fn expression(s: Span) -> IResult<Span, Expression> { pub fn expression(s: Span) -> IResult<Span, Expression> {
alt(( alt((
expression_unary, expression_unary,
@ -486,7 +471,7 @@ pub fn expression(s: Span) -> IResult<Span, Expression> {
))(s) ))(s)
} }
#[parser(Memoize)] #[parser]
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)?;
@ -497,7 +482,7 @@ pub fn expression_unary(s: Span) -> IResult<Span, Expression> {
)) ))
} }
#[parser(Memoize)] #[parser]
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((
@ -506,7 +491,7 @@ pub fn expression_operator_assignment(s: Span) -> IResult<Span, Expression> {
)) ))
} }
#[parser(MaybeRecursive, Memoize)] #[parser(MaybeRecursive)]
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)?;
@ -520,7 +505,7 @@ pub fn expression_binary(s: Span) -> IResult<Span, Expression> {
)) ))
} }
#[parser(Memoize)] #[parser]
pub fn tagged_union_expression(s: Span) -> IResult<Span, TaggedUnionExpression> { pub fn tagged_union_expression(s: Span) -> IResult<Span, TaggedUnionExpression> {
let (s, a) = keyword("tagged")(s)?; let (s, a) = keyword("tagged")(s)?;
let (s, b) = member_identifier(s)?; let (s, b) = member_identifier(s)?;
@ -528,7 +513,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) }))
} }
#[parser(MaybeRecursive, Memoize)] #[parser(MaybeRecursive)]
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) = keyword("inside")(s)?; let (s, b) = keyword("inside")(s)?;

View File

@ -7,16 +7,17 @@ use nom::combinator::*;
use nom::multi::*; use nom::multi::*;
use nom::sequence::*; use nom::sequence::*;
use nom::IResult; use nom::IResult;
use nom_packrat::packrat_parser;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum Number { pub enum Number {
IntegralNumber(IntegralNumber), IntegralNumber(IntegralNumber),
RealNumber(RealNumber), RealNumber(RealNumber),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum IntegralNumber { pub enum IntegralNumber {
DecimalNumber(DecimalNumber), DecimalNumber(DecimalNumber),
OctalNumber(OctalNumber), OctalNumber(OctalNumber),
@ -24,7 +25,7 @@ pub enum IntegralNumber {
HexNumber(HexNumber), HexNumber(HexNumber),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum DecimalNumber { pub enum DecimalNumber {
UnsignedNumber(UnsignedNumber), UnsignedNumber(UnsignedNumber),
BaseUnsigned(DecimalNumberBaseUnsigned), BaseUnsigned(DecimalNumberBaseUnsigned),
@ -32,59 +33,59 @@ pub enum DecimalNumber {
BaseZNumber(DecimalNumberBaseZNumber), BaseZNumber(DecimalNumberBaseZNumber),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DecimalNumberBaseUnsigned { pub struct DecimalNumberBaseUnsigned {
pub nodes: (Option<Size>, DecimalBase, UnsignedNumber), pub nodes: (Option<Size>, DecimalBase, UnsignedNumber),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DecimalNumberBaseXNumber { pub struct DecimalNumberBaseXNumber {
pub nodes: (Option<Size>, DecimalBase, XNumber), pub nodes: (Option<Size>, DecimalBase, XNumber),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DecimalNumberBaseZNumber { pub struct DecimalNumberBaseZNumber {
pub nodes: (Option<Size>, DecimalBase, ZNumber), pub nodes: (Option<Size>, DecimalBase, ZNumber),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BinaryNumber { pub struct BinaryNumber {
pub nodes: (Option<Size>, BinaryBase, BinaryValue), pub nodes: (Option<Size>, BinaryBase, BinaryValue),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct OctalNumber { pub struct OctalNumber {
pub nodes: (Option<Size>, OctalBase, OctalValue), pub nodes: (Option<Size>, OctalBase, OctalValue),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct HexNumber { pub struct HexNumber {
pub nodes: (Option<Size>, HexBase, HexValue), pub nodes: (Option<Size>, HexBase, HexValue),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum Sign { pub enum Sign {
Plus(Symbol), Plus(Symbol),
Minus(Symbol), Minus(Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Size { pub struct Size {
pub nodes: (NonZeroUnsignedNumber,), pub nodes: (NonZeroUnsignedNumber,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NonZeroUnsignedNumber { pub struct NonZeroUnsignedNumber {
pub nodes: (Locate, Vec<WhiteSpace>), pub nodes: (Locate, Vec<WhiteSpace>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum RealNumber { pub enum RealNumber {
FixedPointNumber(FixedPointNumber), FixedPointNumber(FixedPointNumber),
Floating(RealNumberFloating), Floating(RealNumberFloating),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct RealNumberFloating { pub struct RealNumberFloating {
pub nodes: ( pub nodes: (
UnsignedNumber, UnsignedNumber,
@ -95,73 +96,74 @@ pub struct RealNumberFloating {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct FixedPointNumber { pub struct FixedPointNumber {
pub nodes: (UnsignedNumber, Symbol, UnsignedNumber), pub nodes: (UnsignedNumber, Symbol, UnsignedNumber),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Exp { pub struct Exp {
pub nodes: (Symbol,), pub nodes: (Symbol,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UnsignedNumber { pub struct UnsignedNumber {
pub nodes: (Locate, Vec<WhiteSpace>), pub nodes: (Locate, Vec<WhiteSpace>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BinaryValue { pub struct BinaryValue {
pub nodes: (Locate, Vec<WhiteSpace>), pub nodes: (Locate, Vec<WhiteSpace>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct OctalValue { pub struct OctalValue {
pub nodes: (Locate, Vec<WhiteSpace>), pub nodes: (Locate, Vec<WhiteSpace>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct HexValue { pub struct HexValue {
pub nodes: (Locate, Vec<WhiteSpace>), pub nodes: (Locate, Vec<WhiteSpace>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DecimalBase { pub struct DecimalBase {
pub nodes: (Locate, Vec<WhiteSpace>), pub nodes: (Locate, Vec<WhiteSpace>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BinaryBase { pub struct BinaryBase {
pub nodes: (Locate, Vec<WhiteSpace>), pub nodes: (Locate, Vec<WhiteSpace>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct OctalBase { pub struct OctalBase {
pub nodes: (Locate, Vec<WhiteSpace>), pub nodes: (Locate, Vec<WhiteSpace>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct HexBase { pub struct HexBase {
pub nodes: (Locate, Vec<WhiteSpace>), pub nodes: (Locate, Vec<WhiteSpace>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct XNumber { pub struct XNumber {
pub nodes: (Locate, Vec<WhiteSpace>), pub nodes: (Locate, Vec<WhiteSpace>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ZNumber { pub struct ZNumber {
pub nodes: (Locate, Vec<WhiteSpace>), pub nodes: (Locate, Vec<WhiteSpace>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UnbasedUnsizedLiteral { pub struct UnbasedUnsizedLiteral {
pub nodes: (Symbol,), pub nodes: (Symbol,),
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[packrat_parser]
#[parser] #[parser]
pub fn number(s: Span) -> IResult<Span, Number> { pub fn number(s: Span) -> IResult<Span, Number> {
alt(( alt((

View File

@ -5,27 +5,27 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UnaryOperator { pub struct UnaryOperator {
pub nodes: (Symbol,), pub nodes: (Symbol,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BinaryOperator { pub struct BinaryOperator {
pub nodes: (Symbol,), pub nodes: (Symbol,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct IncOrDecOperator { pub struct IncOrDecOperator {
pub nodes: (Symbol,), pub nodes: (Symbol,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UnaryModulePathOperator { pub struct UnaryModulePathOperator {
pub nodes: (Symbol,), pub nodes: (Symbol,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BinaryModulePathOperator { pub struct BinaryModulePathOperator {
pub nodes: (Symbol,), pub nodes: (Symbol,),
} }

View File

@ -4,10 +4,11 @@ use nom::branch::*;
use nom::combinator::*; use nom::combinator::*;
use nom::multi::*; use nom::multi::*;
use nom::IResult; use nom::IResult;
use nom_packrat::packrat_parser;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ConstantPrimary { pub enum ConstantPrimary {
PrimaryLiteral(PrimaryLiteral), PrimaryLiteral(PrimaryLiteral),
PsParameter(ConstantPrimaryPsParameter), PsParameter(ConstantPrimaryPsParameter),
@ -26,12 +27,12 @@ pub enum ConstantPrimary {
Null(Keyword), Null(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstantPrimaryPsParameter { pub struct ConstantPrimaryPsParameter {
pub nodes: (PsParameterIdentifier, ConstantSelect), pub nodes: (PsParameterIdentifier, ConstantSelect),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstantPrimarySpecparam { pub struct ConstantPrimarySpecparam {
pub nodes: ( pub nodes: (
SpecparamIdentifier, SpecparamIdentifier,
@ -39,17 +40,17 @@ pub struct ConstantPrimarySpecparam {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstantPrimaryFormalPort { pub struct ConstantPrimaryFormalPort {
pub nodes: (FormalPortIdentifier, ConstantSelect), pub nodes: (FormalPortIdentifier, ConstantSelect),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstantPrimaryEnum { pub struct ConstantPrimaryEnum {
pub nodes: (PackageScopeOrClassScope, EnumIdentifier), pub nodes: (PackageScopeOrClassScope, EnumIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstantPrimaryConcatenation { pub struct ConstantPrimaryConcatenation {
pub nodes: ( pub nodes: (
ConstantConcatenation, ConstantConcatenation,
@ -57,7 +58,7 @@ pub struct ConstantPrimaryConcatenation {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstantPrimaryMultipleConcatenation { pub struct ConstantPrimaryMultipleConcatenation {
pub nodes: ( pub nodes: (
ConstantMultipleConcatenation, ConstantMultipleConcatenation,
@ -65,12 +66,12 @@ pub struct ConstantPrimaryMultipleConcatenation {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstantPrimaryMintypmaxExpression { pub struct ConstantPrimaryMintypmaxExpression {
pub nodes: (Paren<ConstantMintypmaxExpression>,), pub nodes: (Paren<ConstantMintypmaxExpression>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ModulePathPrimary { pub enum ModulePathPrimary {
Number(Number), Number(Number),
Identifier(Identifier), Identifier(Identifier),
@ -80,12 +81,12 @@ pub enum ModulePathPrimary {
Mintypmax(ModulePathPrimaryMintypmax), Mintypmax(ModulePathPrimaryMintypmax),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModulePathPrimaryMintypmax { pub struct ModulePathPrimaryMintypmax {
pub nodes: (Paren<ModulePathMintypmaxExpression>,), pub nodes: (Paren<ModulePathMintypmaxExpression>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum Primary { pub enum Primary {
PrimaryLiteral(PrimaryLiteral), PrimaryLiteral(PrimaryLiteral),
Hierarchical(PrimaryHierarchical), Hierarchical(PrimaryHierarchical),
@ -104,7 +105,7 @@ pub enum Primary {
Null(Keyword), Null(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PrimaryHierarchical { pub struct PrimaryHierarchical {
pub nodes: ( pub nodes: (
Option<ClassQualifierOrPackageScope>, Option<ClassQualifierOrPackageScope>,
@ -113,45 +114,39 @@ pub struct PrimaryHierarchical {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PrimaryConcatenation { pub struct PrimaryConcatenation {
pub nodes: (Concatenation, Option<Bracket<RangeExpression>>), pub nodes: (Concatenation, Option<Bracket<RangeExpression>>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PrimaryMultipleConcatenation { pub struct PrimaryMultipleConcatenation {
pub nodes: ( pub nodes: (MultipleConcatenation, Option<Bracket<RangeExpression>>),
MultipleConcatenation,
Option<Bracket< RangeExpression>>,
),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PrimaryMintypmaxExpression { pub struct PrimaryMintypmaxExpression {
pub nodes: (Paren<MintypmaxExpression>,), pub nodes: (Paren<MintypmaxExpression>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ClassQualifierOrPackageScope { pub enum ClassQualifierOrPackageScope {
ClassQualifier(ClassQualifier), ClassQualifier(ClassQualifier),
PackageScope(PackageScope), PackageScope(PackageScope),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassQualifier { pub struct ClassQualifier {
pub nodes: ( pub nodes: (Option<Local>, Option<ImplicitClassHandleOrClassScope>),
Option<Local>,
Option<ImplicitClassHandleOrClassScope>,
),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum RangeExpression { pub enum RangeExpression {
Expression(Expression), Expression(Expression),
PartSelectRange(PartSelectRange), PartSelectRange(PartSelectRange),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PrimaryLiteral { pub enum PrimaryLiteral {
Number(Number), Number(Number),
TimeLiteral(TimeLiteral), TimeLiteral(TimeLiteral),
@ -159,23 +154,23 @@ pub enum PrimaryLiteral {
StringLiteral(StringLiteral), StringLiteral(StringLiteral),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum TimeLiteral { pub enum TimeLiteral {
Unsigned(TimeLiteralUnsigned), Unsigned(TimeLiteralUnsigned),
FixedPoint(TimeLiteralFixedPoint), FixedPoint(TimeLiteralFixedPoint),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TimeLiteralUnsigned { pub struct TimeLiteralUnsigned {
pub nodes: (UnsignedNumber, TimeUnit), pub nodes: (UnsignedNumber, TimeUnit),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TimeLiteralFixedPoint { pub struct TimeLiteralFixedPoint {
pub nodes: (FixedPointNumber, TimeUnit), pub nodes: (FixedPointNumber, TimeUnit),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum TimeUnit { pub enum TimeUnit {
S(Keyword), S(Keyword),
MS(Keyword), MS(Keyword),
@ -185,19 +180,19 @@ pub enum TimeUnit {
FS(Keyword), FS(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ImplicitClassHandle { pub enum ImplicitClassHandle {
This(Keyword), This(Keyword),
Super(Keyword), Super(Keyword),
ThisSuper((Keyword, Symbol, Keyword)), ThisSuper((Keyword, Symbol, Keyword)),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BitSelect { pub struct BitSelect {
nodes: (Vec<Bracket<Expression>>,), nodes: (Vec<Bracket<Expression>>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Select { pub struct Select {
pub nodes: ( pub nodes: (
Option<( Option<(
@ -210,7 +205,7 @@ pub struct Select {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NonrangeSelect { pub struct NonrangeSelect {
pub nodes: ( pub nodes: (
Option<( Option<(
@ -222,12 +217,12 @@ pub struct NonrangeSelect {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstantBitSelect { pub struct ConstantBitSelect {
nodes: (Vec<Bracket<ConstantExpression>>,), nodes: (Vec<Bracket<ConstantExpression>>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstantSelect { pub struct ConstantSelect {
pub nodes: ( pub nodes: (
Option<( Option<(
@ -240,28 +235,25 @@ pub struct ConstantSelect {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstantCast { pub struct ConstantCast {
pub nodes: ( pub nodes: (CastingType, Symbol, Paren<ConstantExpression>),
CastingType,
Symbol,
Paren< ConstantExpression>,
),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstantLetExpression { pub struct ConstantLetExpression {
pub nodes: (LetExpression,), pub nodes: (LetExpression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Cast { pub struct Cast {
pub nodes: (CastingType, Symbol, Paren<Expression>), pub nodes: (CastingType, Symbol, Paren<Expression>),
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[parser(Memoize)] #[packrat_parser]
#[parser]
pub fn constant_primary(s: Span) -> IResult<Span, ConstantPrimary> { pub fn constant_primary(s: Span) -> IResult<Span, ConstantPrimary> {
alt(( alt((
map(keyword("null"), |x| ConstantPrimary::Null(x)), map(keyword("null"), |x| ConstantPrimary::Null(x)),
@ -288,7 +280,7 @@ pub fn constant_primary(s: Span) -> IResult<Span, ConstantPrimary> {
))(s) ))(s)
} }
#[parser(Memoize)] #[parser]
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)?;
@ -298,7 +290,7 @@ pub fn constant_primary_ps_parameter(s: Span) -> IResult<Span, ConstantPrimary>
)) ))
} }
#[parser(Memoize)] #[parser]
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)?;
@ -308,7 +300,7 @@ pub fn constant_primary_specparam(s: Span) -> IResult<Span, ConstantPrimary> {
)) ))
} }
#[parser(Memoize)] #[parser]
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)?;
@ -318,7 +310,7 @@ pub fn constant_primary_formal_port(s: Span) -> IResult<Span, ConstantPrimary> {
)) ))
} }
#[parser(Memoize)] #[parser]
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)?;
@ -328,7 +320,7 @@ pub fn constant_primary_enum(s: Span) -> IResult<Span, ConstantPrimary> {
)) ))
} }
#[parser(Memoize)] #[parser]
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)?;
@ -338,7 +330,7 @@ pub fn constant_primary_concatenation(s: Span) -> IResult<Span, ConstantPrimary>
)) ))
} }
#[parser(Memoize)] #[parser]
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)?;
@ -350,7 +342,7 @@ pub fn constant_primary_multiple_concatenation(s: Span) -> IResult<Span, Constan
)) ))
} }
#[parser(Memoize)] #[parser]
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((
@ -386,7 +378,8 @@ pub fn module_path_primary_mintypmax_expression(s: Span) -> IResult<Span, Module
)) ))
} }
#[parser(Memoize)] #[packrat_parser]
#[parser]
pub fn primary(s: Span) -> IResult<Span, Primary> { pub fn primary(s: Span) -> IResult<Span, Primary> {
alt(( alt((
map(keyword("this"), |x| Primary::This(x)), map(keyword("this"), |x| Primary::This(x)),
@ -414,7 +407,7 @@ pub fn primary(s: Span) -> IResult<Span, Primary> {
))(s) ))(s)
} }
#[parser(Memoize)] #[parser]
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)?;
@ -425,7 +418,7 @@ pub fn primary_hierarchical(s: Span) -> IResult<Span, Primary> {
)) ))
} }
#[parser(Memoize)] #[parser]
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)?;
@ -445,7 +438,7 @@ pub fn primary_multiple_concatenation(s: Span) -> IResult<Span, Primary> {
)) ))
} }
#[parser(Memoize)] #[parser]
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((
@ -481,7 +474,7 @@ pub fn range_expression(s: Span) -> IResult<Span, RangeExpression> {
))(s) ))(s)
} }
#[parser(Memoize)] #[parser]
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)),
@ -589,7 +582,7 @@ pub fn constant_select(s: Span) -> IResult<Span, ConstantSelect> {
Ok((s, ConstantSelect { nodes: (a, b, c) })) Ok((s, ConstantSelect { nodes: (a, b, c) }))
} }
#[parser(MaybeRecursive, Memoize)] #[parser(MaybeRecursive)]
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)?;
@ -597,13 +590,13 @@ pub fn constant_cast(s: Span) -> IResult<Span, ConstantCast> {
Ok((s, ConstantCast { nodes: (a, b, c) })) Ok((s, ConstantCast { nodes: (a, b, c) }))
} }
#[parser(Memoize)] #[parser]
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,) }))
} }
#[parser(MaybeRecursive, Memoize)] #[parser(MaybeRecursive)]
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

@ -8,7 +8,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct StringLiteral { pub struct StringLiteral {
pub nodes: (Locate, Vec<WhiteSpace>), pub nodes: (Locate, Vec<WhiteSpace>),
} }

View File

@ -8,12 +8,12 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstantFunctionCall { pub struct ConstantFunctionCall {
pub nodes: (FunctionSubroutineCall,), pub nodes: (FunctionSubroutineCall,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TfCall { pub struct TfCall {
pub nodes: ( pub nodes: (
PsOrHierarchicalTfIdentifier, PsOrHierarchicalTfIdentifier,
@ -22,22 +22,19 @@ pub struct TfCall {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum SystemTfCall { pub enum SystemTfCall {
ArgOptionl(SystemTfCallArgOptional), ArgOptionl(SystemTfCallArgOptional),
ArgDataType(SystemTfCallArgDataType), ArgDataType(SystemTfCallArgDataType),
ArgExpression(SystemTfCallArgExpression), ArgExpression(SystemTfCallArgExpression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SystemTfCallArgOptional { pub struct SystemTfCallArgOptional {
pub nodes: ( pub nodes: (SystemTfIdentifier, Option<Paren<ListOfArguments>>),
SystemTfIdentifier,
Option<Paren< ListOfArguments>>,
),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SystemTfCallArgDataType { pub struct SystemTfCallArgDataType {
pub nodes: ( pub nodes: (
SystemTfIdentifier, SystemTfIdentifier,
@ -45,21 +42,18 @@ pub struct SystemTfCallArgDataType {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SystemTfCallArgExpression { pub struct SystemTfCallArgExpression {
pub nodes: ( pub nodes: (
SystemTfIdentifier, SystemTfIdentifier,
Paren< Paren<(
(
List<Symbol, Option<Expression>>, List<Symbol, Option<Expression>>,
Option<(Symbol, Option<ClockingEvent>)>, Option<(Symbol, Option<ClockingEvent>)>,
), )>,
>,
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum SubroutineCall { pub enum SubroutineCall {
TfCall(Box<TfCall>), TfCall(Box<TfCall>),
SystemTfCall(Box<SystemTfCall>), SystemTfCall(Box<SystemTfCall>),
@ -67,62 +61,52 @@ pub enum SubroutineCall {
Randomize(Box<SubroutineCallRandomize>), Randomize(Box<SubroutineCallRandomize>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SubroutineCallRandomize { pub struct SubroutineCallRandomize {
pub nodes: (Option<(Keyword, Symbol)>, RandomizeCall), pub nodes: (Option<(Keyword, Symbol)>, RandomizeCall),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct FunctionSubroutineCall { pub struct FunctionSubroutineCall {
pub nodes: (SubroutineCall,), pub nodes: (SubroutineCall,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ListOfArguments { pub enum ListOfArguments {
Ordered(ListOfArgumentsOrdered), Ordered(ListOfArgumentsOrdered),
Named(ListOfArgumentsNamed), Named(ListOfArgumentsNamed),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfArgumentsOrdered { pub struct ListOfArgumentsOrdered {
pub nodes: ( pub nodes: (
List<Symbol, Option<Expression>>, List<Symbol, Option<Expression>>,
Vec<( Vec<(Symbol, Symbol, Identifier, Paren<Option<Expression>>)>,
Symbol,
Symbol,
Identifier,
Paren< Option<Expression>>,
)>,
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfArgumentsNamed { pub struct ListOfArgumentsNamed {
pub nodes: ( pub nodes: (
Symbol, Symbol,
Identifier, Identifier,
Paren<Option<Expression>>, Paren<Option<Expression>>,
Vec<( Vec<(Symbol, Symbol, Identifier, Paren<Option<Expression>>)>,
Symbol,
Symbol,
Identifier,
Paren< Option<Expression>>,
)>,
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct MethodCall { pub struct MethodCall {
pub nodes: (MethodCallRoot, Symbol, MethodCallBody), pub nodes: (MethodCallRoot, Symbol, MethodCallBody),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum MethodCallBody { pub enum MethodCallBody {
User(MethodCallBodyUser), User(MethodCallBodyUser),
BuiltInMethodCall(BuiltInMethodCall), BuiltInMethodCall(BuiltInMethodCall),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct MethodCallBodyUser { pub struct MethodCallBodyUser {
pub nodes: ( pub nodes: (
MethodIdentifier, MethodIdentifier,
@ -131,13 +115,13 @@ pub struct MethodCallBodyUser {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum BuiltInMethodCall { pub enum BuiltInMethodCall {
ArrayManipulationCall(ArrayManipulationCall), ArrayManipulationCall(ArrayManipulationCall),
RandomizeCall(RandomizeCall), RandomizeCall(RandomizeCall),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ArrayManipulationCall { pub struct ArrayManipulationCall {
pub nodes: ( pub nodes: (
ArrayMethodName, ArrayMethodName,
@ -147,7 +131,7 @@ pub struct ArrayManipulationCall {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct RandomizeCall { pub struct RandomizeCall {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -161,19 +145,19 @@ pub struct RandomizeCall {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum VariableIdentifierListOrNull { pub enum VariableIdentifierListOrNull {
VariableIdentifierList(VariableIdentifierList), VariableIdentifierList(VariableIdentifierList),
Null(Keyword), Null(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum MethodCallRoot { pub enum MethodCallRoot {
Primary(Primary), Primary(Primary),
ImplicitClassHandle(ImplicitClassHandle), ImplicitClassHandle(ImplicitClassHandle),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ArrayMethodName { pub enum ArrayMethodName {
MethodIdentifier(MethodIdentifier), MethodIdentifier(MethodIdentifier),
Unique(Keyword), Unique(Keyword),
@ -262,7 +246,7 @@ pub fn subroutine_call_randomize(s: Span) -> IResult<Span, SubroutineCall> {
)) ))
} }
#[parser(Memoize)] #[parser]
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)
} }

View File

@ -6,12 +6,12 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct AttributeInstance { pub struct AttributeInstance {
pub nodes: (Symbol, List<Symbol, AttrSpec>, Symbol), pub nodes: (Symbol, List<Symbol, AttrSpec>, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct AttrSpec { pub struct AttrSpec {
pub nodes: (Identifier, Option<(Symbol, ConstantExpression)>), pub nodes: (Identifier, Option<(Symbol, ConstantExpression)>),
} }

View File

@ -6,7 +6,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Comment { pub struct Comment {
nodes: (Locate,), nodes: (Locate,),
} }

View File

@ -7,6 +7,7 @@ use nom::error::*;
use nom::multi::*; use nom::multi::*;
use nom::sequence::*; use nom::sequence::*;
use nom::{Err, IResult}; use nom::{Err, IResult};
use nom_packrat::packrat_parser;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -14,142 +15,142 @@ pub const AZ_: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";
pub const AZ09_: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"; pub const AZ09_: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
pub const AZ09_DOLLAR: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$"; pub const AZ09_DOLLAR: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$";
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ArrayIdentifier { pub struct ArrayIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BlockIdentifier { pub struct BlockIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BinIdentifier { pub struct BinIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CIdentifier { pub struct CIdentifier {
pub nodes: (Locate, Vec<WhiteSpace>), pub nodes: (Locate, Vec<WhiteSpace>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CellIdentifier { pub struct CellIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CheckerIdentifier { pub struct CheckerIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassIdentifier { pub struct ClassIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassVariableIdentifier { pub struct ClassVariableIdentifier {
pub nodes: (VariableIdentifier,), pub nodes: (VariableIdentifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClockingIdentifier { pub struct ClockingIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConfigIdentifier { pub struct ConfigIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstIdentifier { pub struct ConstIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstraintIdentifier { pub struct ConstraintIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CovergroupIdentifier { pub struct CovergroupIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CovergroupVariableIdentifier { pub struct CovergroupVariableIdentifier {
pub nodes: (VariableIdentifier,), pub nodes: (VariableIdentifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CoverPointIdentifier { pub struct CoverPointIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CrossIdentifier { pub struct CrossIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DynamicArrayVariableIdentifier { pub struct DynamicArrayVariableIdentifier {
pub nodes: (VariableIdentifier,), pub nodes: (VariableIdentifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EnumIdentifier { pub struct EnumIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EscapedIdentifier { pub struct EscapedIdentifier {
pub nodes: (Locate, Vec<WhiteSpace>), pub nodes: (Locate, Vec<WhiteSpace>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct FormalIdentifier { pub struct FormalIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct FormalPortIdentifier { pub struct FormalPortIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct FunctionIdentifier { pub struct FunctionIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct GenerateBlockIdentifier { pub struct GenerateBlockIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct GenvarIdentifier { pub struct GenvarIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct HierarchicalArrayIdentifier { pub struct HierarchicalArrayIdentifier {
pub nodes: (HierarchicalIdentifier,), pub nodes: (HierarchicalIdentifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct HierarchicalBlockIdentifier { pub struct HierarchicalBlockIdentifier {
pub nodes: (HierarchicalIdentifier,), pub nodes: (HierarchicalIdentifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct HierarchicalEventIdentifier { pub struct HierarchicalEventIdentifier {
pub nodes: (HierarchicalIdentifier,), pub nodes: (HierarchicalIdentifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct HierarchicalIdentifier { pub struct HierarchicalIdentifier {
pub nodes: ( pub nodes: (
Option<Root>, Option<Root>,
@ -158,189 +159,189 @@ pub struct HierarchicalIdentifier {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Root { pub struct Root {
pub nodes: (Keyword, Symbol), pub nodes: (Keyword, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct HierarchicalNetIdentifier { pub struct HierarchicalNetIdentifier {
pub nodes: (HierarchicalIdentifier,), pub nodes: (HierarchicalIdentifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct HierarchicalParameterIdentifier { pub struct HierarchicalParameterIdentifier {
pub nodes: (HierarchicalIdentifier,), pub nodes: (HierarchicalIdentifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct HierarchicalPropertyIdentifier { pub struct HierarchicalPropertyIdentifier {
pub nodes: (HierarchicalIdentifier,), pub nodes: (HierarchicalIdentifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct HierarchicalSequenceIdentifier { pub struct HierarchicalSequenceIdentifier {
pub nodes: (HierarchicalIdentifier,), pub nodes: (HierarchicalIdentifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct HierarchicalTaskIdentifier { pub struct HierarchicalTaskIdentifier {
pub nodes: (HierarchicalIdentifier,), pub nodes: (HierarchicalIdentifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct HierarchicalTfIdentifier { pub struct HierarchicalTfIdentifier {
pub nodes: (HierarchicalIdentifier,), pub nodes: (HierarchicalIdentifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct HierarchicalVariableIdentifier { pub struct HierarchicalVariableIdentifier {
pub nodes: (HierarchicalIdentifier,), pub nodes: (HierarchicalIdentifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum Identifier { pub enum Identifier {
SimpleIdentifier(SimpleIdentifier), SimpleIdentifier(SimpleIdentifier),
EscapedIdentifier(EscapedIdentifier), EscapedIdentifier(EscapedIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct IndexVariableIdentifier { pub struct IndexVariableIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InterfaceIdentifier { pub struct InterfaceIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InterfaceInstanceIdentifier { pub struct InterfaceInstanceIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InoutPortIdentifier { pub struct InoutPortIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InputPortIdentifier { pub struct InputPortIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InstanceIdentifier { pub struct InstanceIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LibraryIdentifier { pub struct LibraryIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct MemberIdentifier { pub struct MemberIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct MethodIdentifier { pub struct MethodIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModportIdentifier { pub struct ModportIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModuleIdentifier { pub struct ModuleIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NetIdentifier { pub struct NetIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NetTypeIdentifier { pub struct NetTypeIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct OutputPortIdentifier { pub struct OutputPortIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PackageIdentifier { pub struct PackageIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PackageScope { pub enum PackageScope {
Package(PackageScopePackage), Package(PackageScopePackage),
Unit(Unit), Unit(Unit),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PackageScopePackage { pub struct PackageScopePackage {
pub nodes: (PackageIdentifier, Symbol), pub nodes: (PackageIdentifier, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Unit { pub struct Unit {
pub nodes: (Keyword, Symbol), pub nodes: (Keyword, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ParameterIdentifier { pub struct ParameterIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PortIdentifier { pub struct PortIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ProductionIdentifier { pub struct ProductionIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ProgramIdentifier { pub struct ProgramIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyIdentifier { pub struct PropertyIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PsClassIdentifier { pub struct PsClassIdentifier {
pub nodes: (Option<PackageScope>, ClassIdentifier), pub nodes: (Option<PackageScope>, ClassIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PsCovergroupIdentifier { pub struct PsCovergroupIdentifier {
pub nodes: (Option<PackageScope>, CovergroupIdentifier), pub nodes: (Option<PackageScope>, CovergroupIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PsCheckerIdentifier { pub struct PsCheckerIdentifier {
pub nodes: (Option<PackageScope>, CheckerIdentifier), pub nodes: (Option<PackageScope>, CheckerIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PsIdentifier { pub struct PsIdentifier {
pub nodes: (Option<PackageScope>, Identifier), pub nodes: (Option<PackageScope>, Identifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PsOrHierarchicalArrayIdentifier { pub struct PsOrHierarchicalArrayIdentifier {
pub nodes: ( pub nodes: (
Option<ImplicitClassHandleOrClassScopeOrPackageScope>, Option<ImplicitClassHandleOrClassScopeOrPackageScope>,
@ -348,82 +349,82 @@ pub struct PsOrHierarchicalArrayIdentifier {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PsOrHierarchicalNetIdentifier { pub enum PsOrHierarchicalNetIdentifier {
PackageScope(PsOrHierarchicalNetIdentifierPackageScope), PackageScope(PsOrHierarchicalNetIdentifierPackageScope),
HierarchicalNetIdentifier(HierarchicalNetIdentifier), HierarchicalNetIdentifier(HierarchicalNetIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PsOrHierarchicalNetIdentifierPackageScope { pub struct PsOrHierarchicalNetIdentifierPackageScope {
pub nodes: (Option<PackageScope>, NetIdentifier), pub nodes: (Option<PackageScope>, NetIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PsOrHierarchicalNetIdentifierHierarchical { pub struct PsOrHierarchicalNetIdentifierHierarchical {
pub nodes: (HierarchicalNetIdentifier), pub nodes: (HierarchicalNetIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PsOrHierarchicalPropertyIdentifier { pub enum PsOrHierarchicalPropertyIdentifier {
PackageScope(PsOrHierarchicalPropertyIdentifierPackageScope), PackageScope(PsOrHierarchicalPropertyIdentifierPackageScope),
HierarchicalPropertyIdentifier(HierarchicalPropertyIdentifier), HierarchicalPropertyIdentifier(HierarchicalPropertyIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PsOrHierarchicalPropertyIdentifierPackageScope { pub struct PsOrHierarchicalPropertyIdentifierPackageScope {
pub nodes: (Option<PackageScope>, PropertyIdentifier), pub nodes: (Option<PackageScope>, PropertyIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PsOrHierarchicalPropertyIdentifierHierarchical { pub struct PsOrHierarchicalPropertyIdentifierHierarchical {
pub nodes: (HierarchicalPropertyIdentifier), pub nodes: (HierarchicalPropertyIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PsOrHierarchicalSequenceIdentifier { pub enum PsOrHierarchicalSequenceIdentifier {
PackageScope(PsOrHierarchicalSequenceIdentifierPackageScope), PackageScope(PsOrHierarchicalSequenceIdentifierPackageScope),
HierarchicalSequenceIdentifier(HierarchicalSequenceIdentifier), HierarchicalSequenceIdentifier(HierarchicalSequenceIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PsOrHierarchicalSequenceIdentifierPackageScope { pub struct PsOrHierarchicalSequenceIdentifierPackageScope {
pub nodes: (Option<PackageScope>, SequenceIdentifier), pub nodes: (Option<PackageScope>, SequenceIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PsOrHierarchicalSequenceIdentifierHierarchical { pub struct PsOrHierarchicalSequenceIdentifierHierarchical {
pub nodes: (HierarchicalSequenceIdentifier), pub nodes: (HierarchicalSequenceIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PsOrHierarchicalTfIdentifier { pub enum PsOrHierarchicalTfIdentifier {
PackageScope(PsOrHierarchicalTfIdentifierPackageScope), PackageScope(PsOrHierarchicalTfIdentifierPackageScope),
HierarchicalTfIdentifier(HierarchicalTfIdentifier), HierarchicalTfIdentifier(HierarchicalTfIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PsOrHierarchicalTfIdentifierPackageScope { pub struct PsOrHierarchicalTfIdentifierPackageScope {
pub nodes: (Option<PackageScope>, TfIdentifier), pub nodes: (Option<PackageScope>, TfIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PsOrHierarchicalTfIdentifierHierarchical { pub struct PsOrHierarchicalTfIdentifierHierarchical {
pub nodes: (HierarchicalTfIdentifier), pub nodes: (HierarchicalTfIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PsParameterIdentifier { pub enum PsParameterIdentifier {
Scope(PsParameterIdentifierScope), Scope(PsParameterIdentifierScope),
Generate(PsParameterIdentifierGenerate), Generate(PsParameterIdentifierGenerate),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PsParameterIdentifierScope { pub struct PsParameterIdentifierScope {
pub nodes: (Option<PackageScopeOrClassScope>, ParameterIdentifier), pub nodes: (Option<PackageScopeOrClassScope>, ParameterIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PsParameterIdentifierGenerate { pub struct PsParameterIdentifierGenerate {
pub nodes: ( pub nodes: (
Vec<( Vec<(
@ -435,103 +436,103 @@ pub struct PsParameterIdentifierGenerate {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PsTypeIdentifier { pub struct PsTypeIdentifier {
pub nodes: (Option<LocalOrPackageScopeOrClassScope>, TypeIdentifier), pub nodes: (Option<LocalOrPackageScopeOrClassScope>, TypeIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum LocalOrPackageScopeOrClassScope { pub enum LocalOrPackageScopeOrClassScope {
Local(Local), Local(Local),
PackageScope(PackageScope), PackageScope(PackageScope),
ClassScope(ClassScope), ClassScope(ClassScope),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Local { pub struct Local {
pub nodes: (Keyword, Symbol), pub nodes: (Keyword, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequenceIdentifier { pub struct SequenceIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SignalIdentifier { pub struct SignalIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SimpleIdentifier { pub struct SimpleIdentifier {
pub nodes: (Locate, Vec<WhiteSpace>), pub nodes: (Locate, Vec<WhiteSpace>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SpecparamIdentifier { pub struct SpecparamIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SystemTfIdentifier { pub struct SystemTfIdentifier {
pub nodes: (Locate, Vec<WhiteSpace>), pub nodes: (Locate, Vec<WhiteSpace>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TaskIdentifier { pub struct TaskIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TfIdentifier { pub struct TfIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TerminalIdentifier { pub struct TerminalIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TopmoduleIdentifier { pub struct TopmoduleIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TypeIdentifier { pub struct TypeIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UdpIdentifier { pub struct UdpIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct VariableIdentifier { pub struct VariableIdentifier {
pub nodes: (Identifier,), pub nodes: (Identifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ImplicitClassHandleOrClassScopeOrPackageScope { pub enum ImplicitClassHandleOrClassScopeOrPackageScope {
ImplicitClassHandle((ImplicitClassHandle, Symbol)), ImplicitClassHandle((ImplicitClassHandle, Symbol)),
ClassScope(ClassScope), ClassScope(ClassScope),
PackageScope(PackageScope), PackageScope(PackageScope),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ImplicitClassHandleOrPackageScope { pub enum ImplicitClassHandleOrPackageScope {
ImplicitClassHandle((ImplicitClassHandle, Symbol)), ImplicitClassHandle((ImplicitClassHandle, Symbol)),
PackageScope(PackageScope), PackageScope(PackageScope),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ImplicitClassHandleOrClassScope { pub enum ImplicitClassHandleOrClassScope {
ImplicitClassHandle((ImplicitClassHandle, Symbol)), ImplicitClassHandle((ImplicitClassHandle, Symbol)),
ClassScope(ClassScope), ClassScope(ClassScope),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PackageScopeOrClassScope { pub enum PackageScopeOrClassScope {
PackageScope(PackageScope), PackageScope(PackageScope),
ClassScope(ClassScope), ClassScope(ClassScope),
@ -725,6 +726,7 @@ pub fn hierarchical_event_identifier(s: Span) -> IResult<Span, HierarchicalEvent
Ok((s, HierarchicalEventIdentifier { nodes: (a,) })) Ok((s, HierarchicalEventIdentifier { nodes: (a,) }))
} }
#[packrat_parser]
#[parser] #[parser]
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)?;
@ -784,6 +786,7 @@ pub fn hierarchical_variable_identifier(s: Span) -> IResult<Span, HierarchicalVa
Ok((s, HierarchicalVariableIdentifier { nodes: (a,) })) Ok((s, HierarchicalVariableIdentifier { nodes: (a,) }))
} }
#[packrat_parser]
#[parser] #[parser]
pub fn identifier(s: Span) -> IResult<Span, Identifier> { pub fn identifier(s: Span) -> IResult<Span, Identifier> {
alt(( alt((
@ -1200,6 +1203,7 @@ pub fn udp_identifier(s: Span) -> IResult<Span, UdpIdentifier> {
Ok((s, UdpIdentifier { nodes: (a,) })) Ok((s, UdpIdentifier { nodes: (a,) }))
} }
#[packrat_parser]
#[parser] #[parser]
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)?;

View File

@ -7,7 +7,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CheckerInstantiation { pub struct CheckerInstantiation {
pub nodes: ( pub nodes: (
PsCheckerIdentifier, PsCheckerIdentifier,
@ -17,34 +17,34 @@ pub struct CheckerInstantiation {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ListOfCheckerPortConnections { pub enum ListOfCheckerPortConnections {
Ordered(ListOfCheckerPortConnectionsOrdered), Ordered(ListOfCheckerPortConnectionsOrdered),
Named(ListOfCheckerPortConnectionsNamed), Named(ListOfCheckerPortConnectionsNamed),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfCheckerPortConnectionsOrdered { pub struct ListOfCheckerPortConnectionsOrdered {
pub nodes: (List<Symbol, OrderedCheckerPortConnection>,), pub nodes: (List<Symbol, OrderedCheckerPortConnection>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfCheckerPortConnectionsNamed { pub struct ListOfCheckerPortConnectionsNamed {
pub nodes: (List<Symbol, NamedCheckerPortConnection>,), pub nodes: (List<Symbol, NamedCheckerPortConnection>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct OrderedCheckerPortConnection { pub struct OrderedCheckerPortConnection {
pub nodes: (Vec<AttributeInstance>, Option<PropertyActualArg>), pub nodes: (Vec<AttributeInstance>, Option<PropertyActualArg>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum NamedCheckerPortConnection { pub enum NamedCheckerPortConnection {
Identifier(NamedCheckerPortConnectionIdentifier), Identifier(NamedCheckerPortConnectionIdentifier),
Asterisk(NamedCheckerPortConnectionAsterisk), Asterisk(NamedCheckerPortConnectionAsterisk),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NamedCheckerPortConnectionIdentifier { pub struct NamedCheckerPortConnectionIdentifier {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -54,7 +54,7 @@ pub struct NamedCheckerPortConnectionIdentifier {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NamedCheckerPortConnectionAsterisk { pub struct NamedCheckerPortConnectionAsterisk {
pub nodes: (Vec<AttributeInstance>, Symbol), pub nodes: (Vec<AttributeInstance>, Symbol),
} }

View File

@ -8,12 +8,12 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct GenerateRegion { pub struct GenerateRegion {
pub nodes: (Keyword, Vec<GenerateItem>, Keyword), pub nodes: (Keyword, Vec<GenerateItem>, Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LoopGenerateConstruct { pub struct LoopGenerateConstruct {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -31,7 +31,7 @@ pub struct LoopGenerateConstruct {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct GenvarInitialization { pub struct GenvarInitialization {
pub nodes: ( pub nodes: (
Option<Genvar>, Option<Genvar>,
@ -41,19 +41,19 @@ pub struct GenvarInitialization {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Genvar { pub struct Genvar {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum GenvarIteration { pub enum GenvarIteration {
Assignment(GenvarIterationAssignment), Assignment(GenvarIterationAssignment),
Prefix(GenvarIterationPrefix), Prefix(GenvarIterationPrefix),
Suffix(GenvarIterationSuffix), Suffix(GenvarIterationSuffix),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct GenvarIterationAssignment { pub struct GenvarIterationAssignment {
pub nodes: ( pub nodes: (
GenvarIdentifier, GenvarIdentifier,
@ -62,23 +62,23 @@ pub struct GenvarIterationAssignment {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct GenvarIterationPrefix { pub struct GenvarIterationPrefix {
pub nodes: (IncOrDecOperator, GenvarIdentifier), pub nodes: (IncOrDecOperator, GenvarIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct GenvarIterationSuffix { pub struct GenvarIterationSuffix {
pub nodes: (GenvarIdentifier, IncOrDecOperator), pub nodes: (GenvarIdentifier, IncOrDecOperator),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ConditionalGenerateConstruct { pub enum ConditionalGenerateConstruct {
If(IfGenerateConstruct), If(IfGenerateConstruct),
Case(CaseGenerateConstruct), Case(CaseGenerateConstruct),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct IfGenerateConstruct { pub struct IfGenerateConstruct {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -88,7 +88,7 @@ pub struct IfGenerateConstruct {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CaseGenerateConstruct { pub struct CaseGenerateConstruct {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -98,13 +98,13 @@ pub struct CaseGenerateConstruct {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum CaseGenerateItem { pub enum CaseGenerateItem {
Nondefault(CaseGenerateItemNondefault), Nondefault(CaseGenerateItemNondefault),
Default(CaseGenerateItemDefault), Default(CaseGenerateItemDefault),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CaseGenerateItemNondefault { pub struct CaseGenerateItemNondefault {
pub nodes: ( pub nodes: (
List<Symbol, ConstantExpression>, List<Symbol, ConstantExpression>,
@ -113,18 +113,18 @@ pub struct CaseGenerateItemNondefault {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CaseGenerateItemDefault { pub struct CaseGenerateItemDefault {
pub nodes: (Keyword, Option<Symbol>, GenerateBlock), pub nodes: (Keyword, Option<Symbol>, GenerateBlock),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum GenerateBlock { pub enum GenerateBlock {
GenerateItem(GenerateItem), GenerateItem(GenerateItem),
Multiple(GenerateBlockMultiple), Multiple(GenerateBlockMultiple),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct GenerateBlockMultiple { pub struct GenerateBlockMultiple {
pub nodes: ( pub nodes: (
Option<(GenerateBlockIdentifier, Symbol)>, Option<(GenerateBlockIdentifier, Symbol)>,
@ -136,7 +136,7 @@ pub struct GenerateBlockMultiple {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum GenerateItem { pub enum GenerateItem {
ModuleOrGenerateItem(ModuleOrGenerateItem), ModuleOrGenerateItem(ModuleOrGenerateItem),
InterfaceOrGenerateItem(InterfaceOrGenerateItem), InterfaceOrGenerateItem(InterfaceOrGenerateItem),

View File

@ -5,7 +5,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InterfaceInstantiation { pub struct InterfaceInstantiation {
pub nodes: ( pub nodes: (
InterfaceIdentifier, InterfaceIdentifier,

View File

@ -7,7 +7,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModuleInstantiation { pub struct ModuleInstantiation {
pub nodes: ( pub nodes: (
ModuleIdentifier, ModuleIdentifier,
@ -17,7 +17,7 @@ pub struct ModuleInstantiation {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ParameterValueAssignment { pub struct ParameterValueAssignment {
pub nodes: ( pub nodes: (
Symbol, Symbol,
@ -25,28 +25,28 @@ pub struct ParameterValueAssignment {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ListOfParameterAssignments { pub enum ListOfParameterAssignments {
Ordered(ListOfParameterAssignmentsOrdered), Ordered(ListOfParameterAssignmentsOrdered),
Named(ListOfParameterAssignmentsNamed), Named(ListOfParameterAssignmentsNamed),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfParameterAssignmentsOrdered { pub struct ListOfParameterAssignmentsOrdered {
pub nodes: (List<Symbol, OrderedParameterAssignment>,), pub nodes: (List<Symbol, OrderedParameterAssignment>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfParameterAssignmentsNamed { pub struct ListOfParameterAssignmentsNamed {
pub nodes: (List<Symbol, NamedParameterAssignment>,), pub nodes: (List<Symbol, NamedParameterAssignment>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct OrderedParameterAssignment { pub struct OrderedParameterAssignment {
pub nodes: (ParamExpression,), pub nodes: (ParamExpression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NamedParameterAssignment { pub struct NamedParameterAssignment {
pub nodes: ( pub nodes: (
Symbol, Symbol,
@ -55,7 +55,7 @@ pub struct NamedParameterAssignment {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct HierarchicalInstance { pub struct HierarchicalInstance {
pub nodes: ( pub nodes: (
NameOfInstance, NameOfInstance,
@ -63,39 +63,39 @@ pub struct HierarchicalInstance {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NameOfInstance { pub struct NameOfInstance {
pub nodes: (InstanceIdentifier, Vec<UnpackedDimension>), pub nodes: (InstanceIdentifier, Vec<UnpackedDimension>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ListOfPortConnections { pub enum ListOfPortConnections {
Ordered(ListOfPortConnectionsOrdered), Ordered(ListOfPortConnectionsOrdered),
Named(ListOfPortConnectionsNamed), Named(ListOfPortConnectionsNamed),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfPortConnectionsOrdered { pub struct ListOfPortConnectionsOrdered {
pub nodes: (List<Symbol, OrderedPortConnection>,), pub nodes: (List<Symbol, OrderedPortConnection>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfPortConnectionsNamed { pub struct ListOfPortConnectionsNamed {
pub nodes: (List<Symbol, NamedPortConnection>,), pub nodes: (List<Symbol, NamedPortConnection>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct OrderedPortConnection { pub struct OrderedPortConnection {
pub nodes: (Vec<AttributeInstance>, Option<Expression>), pub nodes: (Vec<AttributeInstance>, Option<Expression>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum NamedPortConnection { pub enum NamedPortConnection {
Identifier(NamedPortConnectionIdentifier), Identifier(NamedPortConnectionIdentifier),
Asterisk(NamedPortConnectionAsterisk), Asterisk(NamedPortConnectionAsterisk),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NamedPortConnectionIdentifier { pub struct NamedPortConnectionIdentifier {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -105,7 +105,7 @@ pub struct NamedPortConnectionIdentifier {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NamedPortConnectionAsterisk { pub struct NamedPortConnectionAsterisk {
pub nodes: (Vec<AttributeInstance>, Symbol), pub nodes: (Vec<AttributeInstance>, Symbol),
} }

View File

@ -5,7 +5,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ProgramInstantiation { pub struct ProgramInstantiation {
pub nodes: ( pub nodes: (
ProgramIdentifier, ProgramIdentifier,

View File

@ -5,37 +5,37 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CmosSwitchtype { pub struct CmosSwitchtype {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EnableGatetype { pub struct EnableGatetype {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct MosSwitchtype { pub struct MosSwitchtype {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NInputGatetype { pub struct NInputGatetype {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NOutputGatetype { pub struct NOutputGatetype {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PassEnSwitchtype { pub struct PassEnSwitchtype {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PassSwitchtype { pub struct PassSwitchtype {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }

View File

@ -7,7 +7,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum GateInstantiation { pub enum GateInstantiation {
Cmos(GateInstantiationCmos), Cmos(GateInstantiationCmos),
Enable(GateInstantiationEnable), Enable(GateInstantiationEnable),
@ -20,7 +20,7 @@ pub enum GateInstantiation {
Pullup(GateInstantiationPullup), Pullup(GateInstantiationPullup),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct GateInstantiationCmos { pub struct GateInstantiationCmos {
pub nodes: ( pub nodes: (
CmosSwitchtype, CmosSwitchtype,
@ -30,7 +30,7 @@ pub struct GateInstantiationCmos {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct GateInstantiationEnable { pub struct GateInstantiationEnable {
pub nodes: ( pub nodes: (
EnableGatetype, EnableGatetype,
@ -41,7 +41,7 @@ pub struct GateInstantiationEnable {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct GateInstantiationMos { pub struct GateInstantiationMos {
pub nodes: ( pub nodes: (
MosSwitchtype, MosSwitchtype,
@ -51,7 +51,7 @@ pub struct GateInstantiationMos {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct GateInstantiationNInput { pub struct GateInstantiationNInput {
pub nodes: ( pub nodes: (
NInputGatetype, NInputGatetype,
@ -62,7 +62,7 @@ pub struct GateInstantiationNInput {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct GateInstantiationNOutput { pub struct GateInstantiationNOutput {
pub nodes: ( pub nodes: (
NOutputGatetype, NOutputGatetype,
@ -73,7 +73,7 @@ pub struct GateInstantiationNOutput {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct GateInstantiationPassEn { pub struct GateInstantiationPassEn {
pub nodes: ( pub nodes: (
PassEnSwitchtype, PassEnSwitchtype,
@ -83,7 +83,7 @@ pub struct GateInstantiationPassEn {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct GateInstantiationPass { pub struct GateInstantiationPass {
pub nodes: ( pub nodes: (
PassSwitchtype, PassSwitchtype,
@ -92,7 +92,7 @@ pub struct GateInstantiationPass {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct GateInstantiationPulldown { pub struct GateInstantiationPulldown {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -102,7 +102,7 @@ pub struct GateInstantiationPulldown {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct GateInstantiationPullup { pub struct GateInstantiationPullup {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -112,7 +112,7 @@ pub struct GateInstantiationPullup {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CmosSwitchInstance { pub struct CmosSwitchInstance {
pub nodes: ( pub nodes: (
Option<NameOfInstance>, Option<NameOfInstance>,
@ -131,7 +131,7 @@ pub struct CmosSwitchInstance {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EnableGateInstance { pub struct EnableGateInstance {
pub nodes: ( pub nodes: (
Option<NameOfInstance>, Option<NameOfInstance>,
@ -148,7 +148,7 @@ pub struct EnableGateInstance {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct MosSwitchInstance { pub struct MosSwitchInstance {
pub nodes: ( pub nodes: (
Option<NameOfInstance>, Option<NameOfInstance>,
@ -165,7 +165,7 @@ pub struct MosSwitchInstance {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NInputGateInstance { pub struct NInputGateInstance {
pub nodes: ( pub nodes: (
Option<NameOfInstance>, Option<NameOfInstance>,
@ -180,7 +180,7 @@ pub struct NInputGateInstance {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NOutputGateInstance { pub struct NOutputGateInstance {
pub nodes: ( pub nodes: (
Option<NameOfInstance>, Option<NameOfInstance>,
@ -195,7 +195,7 @@ pub struct NOutputGateInstance {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PassSwitchInstance { pub struct PassSwitchInstance {
pub nodes: ( pub nodes: (
Option<NameOfInstance>, Option<NameOfInstance>,
@ -203,7 +203,7 @@ pub struct PassSwitchInstance {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PassEnableSwitchInstance { pub struct PassEnableSwitchInstance {
pub nodes: ( pub nodes: (
Option<NameOfInstance>, Option<NameOfInstance>,
@ -220,7 +220,7 @@ pub struct PassEnableSwitchInstance {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PullGateInstance { pub struct PullGateInstance {
pub nodes: (Option<NameOfInstance>, Paren< OutputTerminal>), pub nodes: (Option<NameOfInstance>, Paren< OutputTerminal>),
} }

View File

@ -5,46 +5,46 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PulldownStrength { pub enum PulldownStrength {
Strength01(PulldownStrength01), Strength01(PulldownStrength01),
Strength10(PulldownStrength10), Strength10(PulldownStrength10),
Strength0(PulldownStrength0), Strength0(PulldownStrength0),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PulldownStrength01 { pub struct PulldownStrength01 {
pub nodes: (Paren< (Strength0, Symbol, Strength1)>,), pub nodes: (Paren< (Strength0, Symbol, Strength1)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PulldownStrength10 { pub struct PulldownStrength10 {
pub nodes: (Paren< (Strength1, Symbol, Strength0)>,), pub nodes: (Paren< (Strength1, Symbol, Strength0)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PulldownStrength0 { pub struct PulldownStrength0 {
pub nodes: (Paren< Strength0>,), pub nodes: (Paren< Strength0>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PullupStrength { pub enum PullupStrength {
Strength01(PullupStrength01), Strength01(PullupStrength01),
Strength10(PullupStrength10), Strength10(PullupStrength10),
Strength1(PullupStrength1), Strength1(PullupStrength1),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PullupStrength01 { pub struct PullupStrength01 {
pub nodes: (Paren< (Strength0, Symbol, Strength1)>,), pub nodes: (Paren< (Strength0, Symbol, Strength1)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PullupStrength10 { pub struct PullupStrength10 {
pub nodes: (Paren< (Strength1, Symbol, Strength0)>,), pub nodes: (Paren< (Strength1, Symbol, Strength0)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PullupStrength1 { pub struct PullupStrength1 {
pub nodes: (Paren< Strength1>,), pub nodes: (Paren< Strength1>,),
} }

View File

@ -4,32 +4,32 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EnableTerminal { pub struct EnableTerminal {
pub nodes: (Expression,), pub nodes: (Expression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InoutTerminal { pub struct InoutTerminal {
pub nodes: (NetLvalue,), pub nodes: (NetLvalue,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InputTerminal { pub struct InputTerminal {
pub nodes: (Expression,), pub nodes: (Expression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NcontrolTerminal { pub struct NcontrolTerminal {
pub nodes: (Expression,), pub nodes: (Expression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct OutputTerminal { pub struct OutputTerminal {
pub nodes: (NetLvalue,), pub nodes: (NetLvalue,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PcontrolTerminal { pub struct PcontrolTerminal {
pub nodes: (Expression,), pub nodes: (Expression,),
} }

View File

@ -8,12 +8,12 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CheckerPortList { pub struct CheckerPortList {
pub nodes: (List<Symbol, CheckerPortItem>,), pub nodes: (List<Symbol, CheckerPortItem>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CheckerPortItem { pub struct CheckerPortItem {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -25,13 +25,13 @@ pub struct CheckerPortItem {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum CheckerPortDirection { pub enum CheckerPortDirection {
Input(Keyword), Input(Keyword),
Output(Keyword), Output(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum CheckerOrGenerateItem { pub enum CheckerOrGenerateItem {
CheckerOrGenerateItemDeclaration(CheckerOrGenerateItemDeclaration), CheckerOrGenerateItemDeclaration(CheckerOrGenerateItemDeclaration),
InitialConstruct(InitialConstruct), InitialConstruct(InitialConstruct),
@ -42,7 +42,7 @@ pub enum CheckerOrGenerateItem {
CheckerGenerateItem(CheckerGenerateItem), CheckerGenerateItem(CheckerGenerateItem),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum CheckerOrGenerateItemDeclaration { pub enum CheckerOrGenerateItemDeclaration {
Data(CheckerOrGenerateItemDeclarationData), Data(CheckerOrGenerateItemDeclarationData),
FunctionDeclaration(FunctionDeclaration), FunctionDeclaration(FunctionDeclaration),
@ -56,22 +56,22 @@ pub enum CheckerOrGenerateItemDeclaration {
Empty(Symbol), Empty(Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CheckerOrGenerateItemDeclarationData { pub struct CheckerOrGenerateItemDeclarationData {
pub nodes: (Option<Rand>, DataDeclaration), pub nodes: (Option<Rand>, DataDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Rand { pub struct Rand {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CheckerOrGenerateItemDeclarationClocking { pub struct CheckerOrGenerateItemDeclarationClocking {
pub nodes: (Keyword, Keyword, ClockingIdentifier, Symbol), pub nodes: (Keyword, Keyword, ClockingIdentifier, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CheckerOrGenerateItemDeclarationDisable { pub struct CheckerOrGenerateItemDeclarationDisable {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -82,7 +82,7 @@ pub struct CheckerOrGenerateItemDeclarationDisable {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum CheckerGenerateItem { pub enum CheckerGenerateItem {
LoopGenerateConstruct(Box<LoopGenerateConstruct>), LoopGenerateConstruct(Box<LoopGenerateConstruct>),
ConditionalGenerateConstruct(Box<ConditionalGenerateConstruct>), ConditionalGenerateConstruct(Box<ConditionalGenerateConstruct>),

View File

@ -8,7 +8,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ClassItem { pub enum ClassItem {
Property(ClassItemProperty), Property(ClassItemProperty),
Method(ClassItemMethod), Method(ClassItemMethod),
@ -20,43 +20,43 @@ pub enum ClassItem {
Empty(Symbol), Empty(Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassItemProperty { pub struct ClassItemProperty {
pub nodes: (Vec<AttributeInstance>, ClassProperty), pub nodes: (Vec<AttributeInstance>, ClassProperty),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassItemMethod { pub struct ClassItemMethod {
pub nodes: (Vec<AttributeInstance>, ClassMethod), pub nodes: (Vec<AttributeInstance>, ClassMethod),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassItemConstraint { pub struct ClassItemConstraint {
pub nodes: (Vec<AttributeInstance>, ClassConstraint), pub nodes: (Vec<AttributeInstance>, ClassConstraint),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassItemDeclaration { pub struct ClassItemDeclaration {
pub nodes: (Vec<AttributeInstance>, ClassDeclaration), pub nodes: (Vec<AttributeInstance>, ClassDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassItemCovergroup { pub struct ClassItemCovergroup {
pub nodes: (Vec<AttributeInstance>, CovergroupDeclaration), pub nodes: (Vec<AttributeInstance>, CovergroupDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ClassProperty { pub enum ClassProperty {
NonConst(ClassPropertyNonConst), NonConst(ClassPropertyNonConst),
Const(ClassPropertyConst), Const(ClassPropertyConst),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassPropertyNonConst { pub struct ClassPropertyNonConst {
pub nodes: (Vec<PropertyQualifier>, DataDeclaration), pub nodes: (Vec<PropertyQualifier>, DataDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassPropertyConst { pub struct ClassPropertyConst {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -68,7 +68,7 @@ pub struct ClassPropertyConst {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ClassMethod { pub enum ClassMethod {
Task(ClassMethodTask), Task(ClassMethodTask),
Function(ClassMethodFunction), Function(ClassMethodFunction),
@ -78,17 +78,17 @@ pub enum ClassMethod {
ExternConstructor(ClassMethodExternConstructor), ExternConstructor(ClassMethodExternConstructor),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassMethodTask { pub struct ClassMethodTask {
pub nodes: (Vec<MethodQualifier>, TaskDeclaration), pub nodes: (Vec<MethodQualifier>, TaskDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassMethodFunction { pub struct ClassMethodFunction {
pub nodes: (Vec<MethodQualifier>, FunctionDeclaration), pub nodes: (Vec<MethodQualifier>, FunctionDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassMethodPureVirtual { pub struct ClassMethodPureVirtual {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -99,7 +99,7 @@ pub struct ClassMethodPureVirtual {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassMethodExternMethod { pub struct ClassMethodExternMethod {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -109,12 +109,12 @@ pub struct ClassMethodExternMethod {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassMethodConstructor { pub struct ClassMethodConstructor {
pub nodes: (Vec<MethodQualifier>, ClassConstructorDeclaration), pub nodes: (Vec<MethodQualifier>, ClassConstructorDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassMethodExternConstructor { pub struct ClassMethodExternConstructor {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -123,7 +123,7 @@ pub struct ClassMethodExternConstructor {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassConstructorPrototype { pub struct ClassConstructorPrototype {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -133,45 +133,45 @@ pub struct ClassConstructorPrototype {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ClassConstraint { pub enum ClassConstraint {
ConstraintPrototype(ConstraintPrototype), ConstraintPrototype(ConstraintPrototype),
ConstraintDeclaration(ConstraintDeclaration), ConstraintDeclaration(ConstraintDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ClassItemQualifier { pub enum ClassItemQualifier {
Static(Keyword), Static(Keyword),
Protected(Keyword), Protected(Keyword),
Local(Keyword), Local(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PropertyQualifier { pub enum PropertyQualifier {
RandomQualifier(RandomQualifier), RandomQualifier(RandomQualifier),
ClassItemQualifier(ClassItemQualifier), ClassItemQualifier(ClassItemQualifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum RandomQualifier { pub enum RandomQualifier {
Rand(Keyword), Rand(Keyword),
Randc(Keyword), Randc(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum MethodQualifier { pub enum MethodQualifier {
Virtual(Keyword), Virtual(Keyword),
PureVirtual((Keyword, Keyword)), PureVirtual((Keyword, Keyword)),
ClassItemQualifier(ClassItemQualifier), ClassItemQualifier(ClassItemQualifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum MethodPrototype { pub enum MethodPrototype {
TaskPrototype(TaskPrototype), TaskPrototype(TaskPrototype),
FunctionPrototype(FunctionPrototype), FunctionPrototype(FunctionPrototype),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassConstructorDeclaration { pub struct ClassConstructorDeclaration {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -193,7 +193,7 @@ pub struct ClassConstructorDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct New { pub struct New {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }

View File

@ -8,7 +8,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConfigDeclaration { pub struct ConfigDeclaration {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -22,7 +22,7 @@ pub struct ConfigDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DesignStatement { pub struct DesignStatement {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -34,7 +34,7 @@ pub struct DesignStatement {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ConfigRuleStatement { pub enum ConfigRuleStatement {
Default(ConfigRuleStatementDefault), Default(ConfigRuleStatementDefault),
InstLib(ConfigRuleStatementInstLib), InstLib(ConfigRuleStatementInstLib),
@ -43,42 +43,42 @@ pub enum ConfigRuleStatement {
CellUse(ConfigRuleStatementCellUse), CellUse(ConfigRuleStatementCellUse),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConfigRuleStatementDefault { pub struct ConfigRuleStatementDefault {
pub nodes: (DefaultClause, LiblistClause, Symbol), pub nodes: (DefaultClause, LiblistClause, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConfigRuleStatementInstLib { pub struct ConfigRuleStatementInstLib {
pub nodes: (InstClause, LiblistClause, Symbol), pub nodes: (InstClause, LiblistClause, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConfigRuleStatementInstUse { pub struct ConfigRuleStatementInstUse {
pub nodes: (InstClause, UseClause, Symbol), pub nodes: (InstClause, UseClause, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConfigRuleStatementCellLib { pub struct ConfigRuleStatementCellLib {
pub nodes: (CellClause, LiblistClause, Symbol), pub nodes: (CellClause, LiblistClause, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConfigRuleStatementCellUse { pub struct ConfigRuleStatementCellUse {
pub nodes: (CellClause, UseClause, Symbol), pub nodes: (CellClause, UseClause, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DefaultClause { pub struct DefaultClause {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InstClause { pub struct InstClause {
pub nodes: (Keyword, InstName), pub nodes: (Keyword, InstName),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InstName { pub struct InstName {
pub nodes: ( pub nodes: (
TopmoduleIdentifier, TopmoduleIdentifier,
@ -86,7 +86,7 @@ pub struct InstName {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CellClause { pub struct CellClause {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -95,19 +95,19 @@ pub struct CellClause {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LiblistClause { pub struct LiblistClause {
pub nodes: (Keyword, Vec<LibraryIdentifier>), pub nodes: (Keyword, Vec<LibraryIdentifier>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum UseClause { pub enum UseClause {
Cell(UseClauseCell), Cell(UseClauseCell),
Named(UseClauseNamed), Named(UseClauseNamed),
CellNamed(UseClauseCellNamed), CellNamed(UseClauseCellNamed),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UseClauseCell { pub struct UseClauseCell {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -117,7 +117,7 @@ pub struct UseClauseCell {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UseClauseNamed { pub struct UseClauseNamed {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -126,7 +126,7 @@ pub struct UseClauseNamed {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UseClauseCellNamed { pub struct UseClauseCellNamed {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -137,7 +137,7 @@ pub struct UseClauseCellNamed {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Config { pub struct Config {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }

View File

@ -8,7 +8,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstraintDeclaration { pub struct ConstraintDeclaration {
pub nodes: ( pub nodes: (
Option<Static>, Option<Static>,
@ -18,23 +18,23 @@ pub struct ConstraintDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Static { pub struct Static {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstraintBlock { pub struct ConstraintBlock {
pub nodes: (Brace< Vec<ConstraintBlockItem>>,), pub nodes: (Brace< Vec<ConstraintBlockItem>>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ConstraintBlockItem { pub enum ConstraintBlockItem {
Solve(ConstraintBlockItemSolve), Solve(ConstraintBlockItemSolve),
ConstraintExpression(ConstraintExpression), ConstraintExpression(ConstraintExpression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstraintBlockItemSolve { pub struct ConstraintBlockItemSolve {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -45,12 +45,12 @@ pub struct ConstraintBlockItemSolve {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SolveBeforeList { pub struct SolveBeforeList {
pub nodes: (List<Symbol, ConstraintPrimary>,), pub nodes: (List<Symbol, ConstraintPrimary>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstraintPrimary { pub struct ConstraintPrimary {
pub nodes: ( pub nodes: (
Option<ImplicitClassHandleOrClassScope>, Option<ImplicitClassHandleOrClassScope>,
@ -59,7 +59,7 @@ pub struct ConstraintPrimary {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ConstraintExpression { pub enum ConstraintExpression {
Expression(ConstraintExpressionExpression), Expression(ConstraintExpressionExpression),
UniquenessConstraint((UniquenessConstraint, Symbol)), UniquenessConstraint((UniquenessConstraint, Symbol)),
@ -69,22 +69,22 @@ pub enum ConstraintExpression {
Disable(ConstraintExpressionDisable), Disable(ConstraintExpressionDisable),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstraintExpressionExpression { pub struct ConstraintExpressionExpression {
pub nodes: (Option<Soft>, ExpressionOrDist, Symbol), pub nodes: (Option<Soft>, ExpressionOrDist, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Soft { pub struct Soft {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstraintExpressionArrow { pub struct ConstraintExpressionArrow {
pub nodes: (Expression, Symbol, ConstraintSet), pub nodes: (Expression, Symbol, ConstraintSet),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstraintExpressionIf { pub struct ConstraintExpressionIf {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -94,7 +94,7 @@ pub struct ConstraintExpressionIf {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstraintExpressionForeach { pub struct ConstraintExpressionForeach {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -109,54 +109,54 @@ pub struct ConstraintExpressionForeach {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstraintExpressionDisable { pub struct ConstraintExpressionDisable {
pub nodes: (Keyword, Keyword, ConstraintPrimary, Symbol), pub nodes: (Keyword, Keyword, ConstraintPrimary, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UniquenessConstraint { pub struct UniquenessConstraint {
pub nodes: (Keyword, Brace< OpenRangeList>), pub nodes: (Keyword, Brace< OpenRangeList>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ConstraintSet { pub enum ConstraintSet {
ConstraintExpression(Box<ConstraintExpression>), ConstraintExpression(Box<ConstraintExpression>),
Brace(ConstraintSetBrace), Brace(ConstraintSetBrace),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstraintSetBrace { pub struct ConstraintSetBrace {
pub nodes: (Brace< Vec<ConstraintExpression>>,), pub nodes: (Brace< Vec<ConstraintExpression>>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DistList { pub struct DistList {
pub nodes: (List<Symbol, DistItem>,), pub nodes: (List<Symbol, DistItem>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DistItem { pub struct DistItem {
pub nodes: (ValueRange, Option<DistWeight>), pub nodes: (ValueRange, Option<DistWeight>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum DistWeight { pub enum DistWeight {
Equal(DistWeightEqual), Equal(DistWeightEqual),
Divide(DistWeightDivide), Divide(DistWeightDivide),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DistWeightEqual { pub struct DistWeightEqual {
pub nodes: (Symbol, Expression), pub nodes: (Symbol, Expression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DistWeightDivide { pub struct DistWeightDivide {
pub nodes: (Symbol, Expression), pub nodes: (Symbol, Expression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ConstraintPrototype { pub struct ConstraintPrototype {
pub nodes: ( pub nodes: (
Option<ConstraintPrototypeQualifier>, Option<ConstraintPrototypeQualifier>,
@ -167,13 +167,13 @@ pub struct ConstraintPrototype {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ConstraintPrototypeQualifier { pub enum ConstraintPrototypeQualifier {
Extern(Keyword), Extern(Keyword),
Pure(Keyword), Pure(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ExternConstraintDeclaration { pub struct ExternConstraintDeclaration {
pub nodes: ( pub nodes: (
Option<Static>, Option<Static>,
@ -184,7 +184,7 @@ pub struct ExternConstraintDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct IdentifierList { pub struct IdentifierList {
pub nodes: (List<Symbol, Identifier>,), pub nodes: (List<Symbol, Identifier>,),
} }

View File

@ -8,45 +8,45 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum InterfaceOrGenerateItem { pub enum InterfaceOrGenerateItem {
Module(InterfaceOrGenerateItemModule), Module(InterfaceOrGenerateItemModule),
Extern(InterfaceOrGenerateItemExtern), Extern(InterfaceOrGenerateItemExtern),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InterfaceOrGenerateItemModule { pub struct InterfaceOrGenerateItemModule {
pub nodes: (Vec<AttributeInstance>, ModuleCommonItem), pub nodes: (Vec<AttributeInstance>, ModuleCommonItem),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InterfaceOrGenerateItemExtern { pub struct InterfaceOrGenerateItemExtern {
pub nodes: (Vec<AttributeInstance>, ExternTfDeclaration), pub nodes: (Vec<AttributeInstance>, ExternTfDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ExternTfDeclaration { pub enum ExternTfDeclaration {
Method(ExternTfDeclarationMethod), Method(ExternTfDeclarationMethod),
Task(ExternTfDeclarationTask), Task(ExternTfDeclarationTask),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ExternTfDeclarationMethod { pub struct ExternTfDeclarationMethod {
pub nodes: (Keyword, MethodPrototype, Symbol), pub nodes: (Keyword, MethodPrototype, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ExternTfDeclarationTask { pub struct ExternTfDeclarationTask {
pub nodes: (Keyword, Keyword, TaskPrototype, Symbol), pub nodes: (Keyword, Keyword, TaskPrototype, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum InterfaceItem { pub enum InterfaceItem {
PortDeclaration((PortDeclaration, Symbol)), PortDeclaration((PortDeclaration, Symbol)),
NonPortInterfaceItem(NonPortInterfaceItem), NonPortInterfaceItem(NonPortInterfaceItem),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum NonPortInterfaceItem { pub enum NonPortInterfaceItem {
GenerateRegion(GenerateRegion), GenerateRegion(GenerateRegion),
InterfaceOrGenerateItem(InterfaceOrGenerateItem), InterfaceOrGenerateItem(InterfaceOrGenerateItem),

View File

@ -8,12 +8,12 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LibraryText { pub struct LibraryText {
pub nodes: (Vec<LibraryDescription>,), pub nodes: (Vec<LibraryDescription>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum LibraryDescription { pub enum LibraryDescription {
LibraryDeclaration(LibraryDeclaration), LibraryDeclaration(LibraryDeclaration),
IncludeStatement(IncludeStatement), IncludeStatement(IncludeStatement),
@ -21,7 +21,7 @@ pub enum LibraryDescription {
Null(Symbol), Null(Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LibraryDeclaration { pub struct LibraryDeclaration {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -32,12 +32,12 @@ pub struct LibraryDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct IncludeStatement { pub struct IncludeStatement {
pub nodes: (Keyword, FilePathSpec, Symbol), pub nodes: (Keyword, FilePathSpec, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct FilePathSpec { pub struct FilePathSpec {
pub nodes: (StringLiteral,), pub nodes: (StringLiteral,),
} }

View File

@ -8,15 +8,15 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ElaborationSystemTask { pub enum ElaborationSystemTask {
Fatal(ElaborationSystemTaskFatal), TaskFatal(ElaborationSystemTaskFatal),
Error(ElaborationSystemTaskError), TaskError(ElaborationSystemTaskError),
Warning(ElaborationSystemTaskWarning), TaskWarning(ElaborationSystemTaskWarning),
Info(ElaborationSystemTaskInfo), TaskInfo(ElaborationSystemTaskInfo),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ElaborationSystemTaskFatal { pub struct ElaborationSystemTaskFatal {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -25,41 +25,29 @@ pub struct ElaborationSystemTaskFatal {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ElaborationSystemTaskError { pub struct ElaborationSystemTaskError {
pub nodes: ( pub nodes: (Keyword, Option<Paren<Option<ListOfArguments>>>, Symbol),
Keyword,
Option<Paren< Option<ListOfArguments>>>,
Symbol,
),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ElaborationSystemTaskWarning { pub struct ElaborationSystemTaskWarning {
pub nodes: ( pub nodes: (Keyword, Option<Paren<Option<ListOfArguments>>>, Symbol),
Keyword,
Option<Paren< Option<ListOfArguments>>>,
Symbol,
),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ElaborationSystemTaskInfo { pub struct ElaborationSystemTaskInfo {
pub nodes: ( pub nodes: (Keyword, Option<Paren<Option<ListOfArguments>>>, Symbol),
Keyword,
Option<Paren< Option<ListOfArguments>>>,
Symbol,
),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum FinishNumber { pub enum FinishNumber {
Zero(Symbol), Zero(Symbol),
One(Symbol), One(Symbol),
Two(Symbol), Two(Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ModuleCommonItem { pub enum ModuleCommonItem {
ModuleOrGenerateItemDeclaration(ModuleOrGenerateItemDeclaration), ModuleOrGenerateItemDeclaration(ModuleOrGenerateItemDeclaration),
InterfaceInstantiation(InterfaceInstantiation), InterfaceInstantiation(InterfaceInstantiation),
@ -76,13 +64,13 @@ pub enum ModuleCommonItem {
ElaborationSystemTask(ElaborationSystemTask), ElaborationSystemTask(ElaborationSystemTask),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ModuleItem { pub enum ModuleItem {
PortDeclaration((PortDeclaration, Symbol)), PortDeclaration((PortDeclaration, Symbol)),
NonPortModuleItem(NonPortModuleItem), NonPortModuleItem(NonPortModuleItem),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ModuleOrGenerateItem { pub enum ModuleOrGenerateItem {
Parameter(ModuleOrGenerateItemParameter), Parameter(ModuleOrGenerateItemParameter),
Gate(ModuleOrGenerateItemGate), Gate(ModuleOrGenerateItemGate),
@ -91,32 +79,32 @@ pub enum ModuleOrGenerateItem {
ModuleItem(Box<ModuleOrGenerateItemModuleItem>), ModuleItem(Box<ModuleOrGenerateItemModuleItem>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModuleOrGenerateItemParameter { pub struct ModuleOrGenerateItemParameter {
pub nodes: (Vec<AttributeInstance>, ParameterOverride), pub nodes: (Vec<AttributeInstance>, ParameterOverride),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModuleOrGenerateItemGate { pub struct ModuleOrGenerateItemGate {
pub nodes: (Vec<AttributeInstance>, GateInstantiation), pub nodes: (Vec<AttributeInstance>, GateInstantiation),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModuleOrGenerateItemUdp { pub struct ModuleOrGenerateItemUdp {
pub nodes: (Vec<AttributeInstance>, UdpInstantiation), pub nodes: (Vec<AttributeInstance>, UdpInstantiation),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModuleOrGenerateItemModule { pub struct ModuleOrGenerateItemModule {
pub nodes: (Vec<AttributeInstance>, ModuleInstantiation), pub nodes: (Vec<AttributeInstance>, ModuleInstantiation),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModuleOrGenerateItemModuleItem { pub struct ModuleOrGenerateItemModuleItem {
pub nodes: (Vec<AttributeInstance>, ModuleCommonItem), pub nodes: (Vec<AttributeInstance>, ModuleCommonItem),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ModuleOrGenerateItemDeclaration { pub enum ModuleOrGenerateItemDeclaration {
PackageOrGenerateItemDeclaration(PackageOrGenerateItemDeclaration), PackageOrGenerateItemDeclaration(PackageOrGenerateItemDeclaration),
GenvarDeclaration(GenvarDeclaration), GenvarDeclaration(GenvarDeclaration),
@ -125,23 +113,17 @@ pub enum ModuleOrGenerateItemDeclaration {
Disable(ModuleOrGenerateItemDeclarationDisable), Disable(ModuleOrGenerateItemDeclarationDisable),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModuleOrGenerateItemDeclarationClocking { pub struct ModuleOrGenerateItemDeclarationClocking {
pub nodes: (Keyword, Keyword, ClockingIdentifier, Symbol), pub nodes: (Keyword, Keyword, ClockingIdentifier, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModuleOrGenerateItemDeclarationDisable { pub struct ModuleOrGenerateItemDeclarationDisable {
pub nodes: ( pub nodes: (Keyword, Keyword, Keyword, ExpressionOrDist, Symbol),
Keyword,
Keyword,
Keyword,
ExpressionOrDist,
Symbol,
),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum NonPortModuleItem { pub enum NonPortModuleItem {
GenerateRegion(GenerateRegion), GenerateRegion(GenerateRegion),
ModuleOrGenerateItem(ModuleOrGenerateItem), ModuleOrGenerateItem(ModuleOrGenerateItem),
@ -153,23 +135,23 @@ pub enum NonPortModuleItem {
TimeunitsDeclaration(TimeunitsDeclaration), TimeunitsDeclaration(TimeunitsDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NonPortModuleItemSpecparam { pub struct NonPortModuleItemSpecparam {
pub nodes: (Vec<AttributeInstance>, SpecparamDeclaration), pub nodes: (Vec<AttributeInstance>, SpecparamDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ParameterOverride { pub struct ParameterOverride {
pub nodes: (Keyword, ListOfDefparamAssignments, Symbol), pub nodes: (Keyword, ListOfDefparamAssignments, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum BindDirective { pub enum BindDirective {
Scope(BindDirectiveScope), Scope(BindDirectiveScope),
Instance(BindDirectiveInstance), Instance(BindDirectiveInstance),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BindDirectiveScope { pub struct BindDirectiveScope {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -180,33 +162,28 @@ pub struct BindDirectiveScope {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BindDirectiveInstance { pub struct BindDirectiveInstance {
pub nodes: ( pub nodes: (Keyword, BindTargetInstance, BindInstantiation, Symbol),
Keyword,
BindTargetInstance,
BindInstantiation,
Symbol,
),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum BindTargetScope { pub enum BindTargetScope {
ModuleIdentifier(ModuleIdentifier), ModuleIdentifier(ModuleIdentifier),
InterfaceIdentifier(InterfaceIdentifier), InterfaceIdentifier(InterfaceIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BindTargetInstance { pub struct BindTargetInstance {
pub nodes: (HierarchicalIdentifier, ConstantBitSelect), pub nodes: (HierarchicalIdentifier, ConstantBitSelect),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BindTargetInstanceList { pub struct BindTargetInstanceList {
pub nodes: (List<Symbol, BindTargetInstance>,), pub nodes: (List<Symbol, BindTargetInstance>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum BindInstantiation { pub enum BindInstantiation {
ProgramInstantiation(ProgramInstantiation), ProgramInstantiation(ProgramInstantiation),
ModuleInstantiation(ModuleInstantiation), ModuleInstantiation(ModuleInstantiation),
@ -236,7 +213,7 @@ pub fn elaboration_system_task_fatal(s: Span) -> IResult<Span, ElaborationSystem
let (s, c) = symbol(";")(s)?; let (s, c) = symbol(";")(s)?;
Ok(( Ok((
s, s,
ElaborationSystemTask::Fatal(ElaborationSystemTaskFatal { nodes: (a, b, c) }), ElaborationSystemTask::TaskFatal(ElaborationSystemTaskFatal { nodes: (a, b, c) }),
)) ))
} }
@ -247,7 +224,7 @@ pub fn elaboration_system_task_error(s: Span) -> IResult<Span, ElaborationSystem
let (s, c) = symbol(";")(s)?; let (s, c) = symbol(";")(s)?;
Ok(( Ok((
s, s,
ElaborationSystemTask::Error(ElaborationSystemTaskError { nodes: (a, b, c) }), ElaborationSystemTask::TaskError(ElaborationSystemTaskError { nodes: (a, b, c) }),
)) ))
} }
@ -258,7 +235,7 @@ pub fn elaboration_system_task_warning(s: Span) -> IResult<Span, ElaborationSyst
let (s, c) = symbol(";")(s)?; let (s, c) = symbol(";")(s)?;
Ok(( Ok((
s, s,
ElaborationSystemTask::Warning(ElaborationSystemTaskWarning { nodes: (a, b, c) }), ElaborationSystemTask::TaskWarning(ElaborationSystemTaskWarning { nodes: (a, b, c) }),
)) ))
} }
@ -269,7 +246,7 @@ pub fn elaboration_system_task_info(s: Span) -> IResult<Span, ElaborationSystemT
let (s, c) = symbol(";")(s)?; let (s, c) = symbol(";")(s)?;
Ok(( Ok((
s, s,
ElaborationSystemTask::Info(ElaborationSystemTaskInfo { nodes: (a, b, c) }), ElaborationSystemTask::TaskInfo(ElaborationSystemTaskInfo { nodes: (a, b, c) }),
)) ))
} }

View File

@ -8,14 +8,14 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ParameterPortList { pub enum ParameterPortList {
Assignment(ParameterPortListAssignment), Assignment(ParameterPortListAssignment),
Declaration(ParameterPortListDeclaration), Declaration(ParameterPortListDeclaration),
Empty((Symbol, Symbol, Symbol)), Empty((Symbol, Symbol, Symbol)),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ParameterPortListAssignment { pub struct ParameterPortListAssignment {
pub nodes: ( pub nodes: (
Symbol, Symbol,
@ -29,7 +29,7 @@ pub struct ParameterPortListAssignment {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ParameterPortListDeclaration { pub struct ParameterPortListDeclaration {
pub nodes: ( pub nodes: (
Symbol, Symbol,
@ -37,7 +37,7 @@ pub struct ParameterPortListDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ParameterPortDeclaration { pub enum ParameterPortDeclaration {
ParameterDeclaration(ParameterDeclaration), ParameterDeclaration(ParameterDeclaration),
LocalParameterDeclaration(LocalParameterDeclaration), LocalParameterDeclaration(LocalParameterDeclaration),
@ -45,29 +45,29 @@ pub enum ParameterPortDeclaration {
TypeList(ParameterPortDeclarationTypeList), TypeList(ParameterPortDeclarationTypeList),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ParameterPortDeclarationParamList { pub struct ParameterPortDeclarationParamList {
pub nodes: (DataType, ListOfParamAssignments), pub nodes: (DataType, ListOfParamAssignments),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ParameterPortDeclarationTypeList { pub struct ParameterPortDeclarationTypeList {
pub nodes: (Keyword, ListOfTypeAssignments), pub nodes: (Keyword, ListOfTypeAssignments),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfPorts { pub struct ListOfPorts {
pub nodes: (Paren< List<Symbol, Port>>,), pub nodes: (Paren< List<Symbol, Port>>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfPortDeclarations { pub struct ListOfPortDeclarations {
pub nodes: ( pub nodes: (
Paren< Option<List<Symbol, (Vec<AttributeInstance>, AnsiPortDeclaration)>>>, Paren< Option<List<Symbol, (Vec<AttributeInstance>, AnsiPortDeclaration)>>>,
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PortDeclaration { pub enum PortDeclaration {
Inout(PortDeclarationInout), Inout(PortDeclarationInout),
Input(PortDeclarationInput), Input(PortDeclarationInput),
@ -76,43 +76,43 @@ pub enum PortDeclaration {
Interface(PortDeclarationInterface), Interface(PortDeclarationInterface),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PortDeclarationInout { pub struct PortDeclarationInout {
pub nodes: (Vec<AttributeInstance>, InoutDeclaration), pub nodes: (Vec<AttributeInstance>, InoutDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PortDeclarationInput { pub struct PortDeclarationInput {
pub nodes: (Vec<AttributeInstance>, InputDeclaration), pub nodes: (Vec<AttributeInstance>, InputDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PortDeclarationOutput { pub struct PortDeclarationOutput {
pub nodes: (Vec<AttributeInstance>, OutputDeclaration), pub nodes: (Vec<AttributeInstance>, OutputDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PortDeclarationRef { pub struct PortDeclarationRef {
pub nodes: (Vec<AttributeInstance>, RefDeclaration), pub nodes: (Vec<AttributeInstance>, RefDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PortDeclarationInterface { pub struct PortDeclarationInterface {
pub nodes: (Vec<AttributeInstance>, InterfacePortDeclaration), pub nodes: (Vec<AttributeInstance>, InterfacePortDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum Port { pub enum Port {
NonNamed(PortNonNamed), NonNamed(PortNonNamed),
Named(PortNamed), Named(PortNamed),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PortNonNamed { pub struct PortNonNamed {
pub nodes: (Option<PortExpression>,), pub nodes: (Option<PortExpression>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PortNamed { pub struct PortNamed {
pub nodes: ( pub nodes: (
Symbol, Symbol,
@ -121,23 +121,23 @@ pub struct PortNamed {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PortExpression { pub enum PortExpression {
PortReference(PortReference), PortReference(PortReference),
Brace(PortExpressionBrace), Brace(PortExpressionBrace),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PortExpressionBrace { pub struct PortExpressionBrace {
pub nodes: (Brace< List<Symbol, PortReference>>,), pub nodes: (Brace< List<Symbol, PortReference>>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PortReference { pub struct PortReference {
pub nodes: (PortIdentifier, ConstantSelect), pub nodes: (PortIdentifier, ConstantSelect),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PortDirection { pub enum PortDirection {
Input(Keyword), Input(Keyword),
Output(Keyword), Output(Keyword),
@ -145,23 +145,23 @@ pub enum PortDirection {
Ref(Keyword), Ref(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NetPortHeader { pub struct NetPortHeader {
pub nodes: (Option<PortDirection>, NetPortType), pub nodes: (Option<PortDirection>, NetPortType),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct VariablePortHeader { pub struct VariablePortHeader {
pub nodes: (Option<PortDirection>, VariablePortType), pub nodes: (Option<PortDirection>, VariablePortType),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum InterfacePortHeader { pub enum InterfacePortHeader {
Identifier(InterfacePortHeaderIdentifier), Identifier(InterfacePortHeaderIdentifier),
Interface(InterfacePortHeaderInterface), Interface(InterfacePortHeaderInterface),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InterfacePortHeaderIdentifier { pub struct InterfacePortHeaderIdentifier {
pub nodes: ( pub nodes: (
InterfaceIdentifier, InterfaceIdentifier,
@ -169,24 +169,24 @@ pub struct InterfacePortHeaderIdentifier {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InterfacePortHeaderInterface { pub struct InterfacePortHeaderInterface {
pub nodes: (Keyword, Option<(Symbol, ModportIdentifier)>), pub nodes: (Keyword, Option<(Symbol, ModportIdentifier)>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum NetPortHeaderOrInterfacePortHeader { pub enum NetPortHeaderOrInterfacePortHeader {
NetPortHeader(NetPortHeader), NetPortHeader(NetPortHeader),
InterfacePortHeader(InterfacePortHeader), InterfacePortHeader(InterfacePortHeader),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum AnsiPortDeclaration { pub enum AnsiPortDeclaration {
Net(AnsiPortDeclarationNet), Net(AnsiPortDeclarationNet),
Variable(AnsiPortDeclarationVariable), Variable(AnsiPortDeclarationVariable),
Paren(AnsiPortDeclarationParen), Paren(AnsiPortDeclarationParen),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct AnsiPortDeclarationNet { pub struct AnsiPortDeclarationNet {
pub nodes: ( pub nodes: (
Option<NetPortHeaderOrInterfacePortHeader>, Option<NetPortHeaderOrInterfacePortHeader>,
@ -196,7 +196,7 @@ pub struct AnsiPortDeclarationNet {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct AnsiPortDeclarationVariable { pub struct AnsiPortDeclarationVariable {
pub nodes: ( pub nodes: (
Option<VariablePortHeader>, Option<VariablePortHeader>,
@ -206,7 +206,7 @@ pub struct AnsiPortDeclarationVariable {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct AnsiPortDeclarationParen { pub struct AnsiPortDeclarationParen {
pub nodes: ( pub nodes: (
Option<PortDirection>, Option<PortDirection>,

View File

@ -8,7 +8,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PackageItem { pub enum PackageItem {
PackageOrGenerateItemDeclaration(PackageOrGenerateItemDeclaration), PackageOrGenerateItemDeclaration(PackageOrGenerateItemDeclaration),
AnonymousProgram(AnonymousProgram), AnonymousProgram(AnonymousProgram),
@ -16,7 +16,7 @@ pub enum PackageItem {
TimeunitsDeclaration(TimeunitsDeclaration), TimeunitsDeclaration(TimeunitsDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PackageOrGenerateItemDeclaration { pub enum PackageOrGenerateItemDeclaration {
NetDeclaration(NetDeclaration), NetDeclaration(NetDeclaration),
DataDeclaration(DataDeclaration), DataDeclaration(DataDeclaration),
@ -34,7 +34,7 @@ pub enum PackageOrGenerateItemDeclaration {
Empty(Symbol), Empty(Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct AnonymousProgram { pub struct AnonymousProgram {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -44,7 +44,7 @@ pub struct AnonymousProgram {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum AnonymousProgramItem { pub enum AnonymousProgramItem {
TaskDeclaration(TaskDeclaration), TaskDeclaration(TaskDeclaration),
FunctionDeclaration(FunctionDeclaration), FunctionDeclaration(FunctionDeclaration),

View File

@ -8,13 +8,13 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ProgramItem { pub enum ProgramItem {
PortDeclaration((PortDeclaration, Symbol)), PortDeclaration((PortDeclaration, Symbol)),
NonPortProgramItem(NonPortProgramItem), NonPortProgramItem(NonPortProgramItem),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum NonPortProgramItem { pub enum NonPortProgramItem {
Assign(NonPortProgramItemAssign), Assign(NonPortProgramItemAssign),
Module(NonPortProgramItemModule), Module(NonPortProgramItemModule),
@ -25,12 +25,12 @@ pub enum NonPortProgramItem {
ProgramGenerateItem(ProgramGenerateItem), ProgramGenerateItem(ProgramGenerateItem),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NonPortProgramItemAssign { pub struct NonPortProgramItemAssign {
pub nodes: (Vec<AttributeInstance>, ContinuousAssign), pub nodes: (Vec<AttributeInstance>, ContinuousAssign),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NonPortProgramItemModule { pub struct NonPortProgramItemModule {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -38,22 +38,22 @@ pub struct NonPortProgramItemModule {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NonPortProgramItemInitial { pub struct NonPortProgramItemInitial {
pub nodes: (Vec<AttributeInstance>, InitialConstruct), pub nodes: (Vec<AttributeInstance>, InitialConstruct),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NonPortProgramItemFinal { pub struct NonPortProgramItemFinal {
pub nodes: (Vec<AttributeInstance>, FinalConstruct), pub nodes: (Vec<AttributeInstance>, FinalConstruct),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NonPortProgramItemAssertion { pub struct NonPortProgramItemAssertion {
pub nodes: (Vec<AttributeInstance>, ConcurrentAssertionItem), pub nodes: (Vec<AttributeInstance>, ConcurrentAssertionItem),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ProgramGenerateItem { pub enum ProgramGenerateItem {
LoopGenerateConstruct(LoopGenerateConstruct), LoopGenerateConstruct(LoopGenerateConstruct),
ConditionalGenerateConstruct(ConditionalGenerateConstruct), ConditionalGenerateConstruct(ConditionalGenerateConstruct),

View File

@ -8,12 +8,12 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SourceText { pub struct SourceText {
pub nodes: (Option<TimeunitsDeclaration>, Vec<Description>), pub nodes: (Option<TimeunitsDeclaration>, Vec<Description>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum Description { pub enum Description {
ModuleDeclaration(ModuleDeclaration), ModuleDeclaration(ModuleDeclaration),
UdpDeclaration(UdpDeclaration), UdpDeclaration(UdpDeclaration),
@ -25,17 +25,17 @@ pub enum Description {
ConfigDeclaration(ConfigDeclaration), ConfigDeclaration(ConfigDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DescriptionPackageItem { pub struct DescriptionPackageItem {
pub nodes: (Vec<AttributeInstance>, PackageItem), pub nodes: (Vec<AttributeInstance>, PackageItem),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DescriptionBindDirective { pub struct DescriptionBindDirective {
pub nodes: (Vec<AttributeInstance>, BindDirective), pub nodes: (Vec<AttributeInstance>, BindDirective),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModuleNonansiHeader { pub struct ModuleNonansiHeader {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -49,7 +49,7 @@ pub struct ModuleNonansiHeader {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModuleAnsiHeader { pub struct ModuleAnsiHeader {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -63,7 +63,7 @@ pub struct ModuleAnsiHeader {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ModuleDeclaration { pub enum ModuleDeclaration {
Nonansi(ModuleDeclarationNonansi), Nonansi(ModuleDeclarationNonansi),
Ansi(ModuleDeclarationAnsi), Ansi(ModuleDeclarationAnsi),
@ -72,7 +72,7 @@ pub enum ModuleDeclaration {
ExternAnsi(ModuleDeclarationExternAnsi), ExternAnsi(ModuleDeclarationExternAnsi),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModuleDeclarationNonansi { pub struct ModuleDeclarationNonansi {
pub nodes: ( pub nodes: (
ModuleNonansiHeader, ModuleNonansiHeader,
@ -83,7 +83,7 @@ pub struct ModuleDeclarationNonansi {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModuleDeclarationAnsi { pub struct ModuleDeclarationAnsi {
pub nodes: ( pub nodes: (
ModuleAnsiHeader, ModuleAnsiHeader,
@ -94,7 +94,7 @@ pub struct ModuleDeclarationAnsi {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModuleDeclarationWildcard { pub struct ModuleDeclarationWildcard {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -110,23 +110,23 @@ pub struct ModuleDeclarationWildcard {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModuleDeclarationExternNonansi { pub struct ModuleDeclarationExternNonansi {
pub nodes: (Keyword, ModuleNonansiHeader), pub nodes: (Keyword, ModuleNonansiHeader),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ModuleDeclarationExternAnsi { pub struct ModuleDeclarationExternAnsi {
pub nodes: (Keyword, ModuleAnsiHeader), pub nodes: (Keyword, ModuleAnsiHeader),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ModuleKeyword { pub enum ModuleKeyword {
Module(Keyword), Module(Keyword),
Macromodule(Keyword), Macromodule(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum InterfaceDeclaration { pub enum InterfaceDeclaration {
Nonansi(InterfaceDeclarationNonansi), Nonansi(InterfaceDeclarationNonansi),
Ansi(InterfaceDeclarationAnsi), Ansi(InterfaceDeclarationAnsi),
@ -135,7 +135,7 @@ pub enum InterfaceDeclaration {
ExternAnsi(InterfaceDeclarationExternAnsi), ExternAnsi(InterfaceDeclarationExternAnsi),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InterfaceDeclarationNonansi { pub struct InterfaceDeclarationNonansi {
pub nodes: ( pub nodes: (
InterfaceNonansiHeader, InterfaceNonansiHeader,
@ -146,7 +146,7 @@ pub struct InterfaceDeclarationNonansi {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InterfaceDeclarationAnsi { pub struct InterfaceDeclarationAnsi {
pub nodes: ( pub nodes: (
InterfaceAnsiHeader, InterfaceAnsiHeader,
@ -157,7 +157,7 @@ pub struct InterfaceDeclarationAnsi {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InterfaceDeclarationWildcard { pub struct InterfaceDeclarationWildcard {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -173,17 +173,17 @@ pub struct InterfaceDeclarationWildcard {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InterfaceDeclarationExternNonansi { pub struct InterfaceDeclarationExternNonansi {
pub nodes: (Keyword, InterfaceNonansiHeader), pub nodes: (Keyword, InterfaceNonansiHeader),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InterfaceDeclarationExternAnsi { pub struct InterfaceDeclarationExternAnsi {
pub nodes: (Keyword, InterfaceAnsiHeader), pub nodes: (Keyword, InterfaceAnsiHeader),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InterfaceNonansiHeader { pub struct InterfaceNonansiHeader {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -197,7 +197,7 @@ pub struct InterfaceNonansiHeader {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InterfaceAnsiHeader { pub struct InterfaceAnsiHeader {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -211,7 +211,7 @@ pub struct InterfaceAnsiHeader {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ProgramDeclaration { pub enum ProgramDeclaration {
Nonansi(ProgramDeclarationNonansi), Nonansi(ProgramDeclarationNonansi),
Ansi(ProgramDeclarationAnsi), Ansi(ProgramDeclarationAnsi),
@ -220,7 +220,7 @@ pub enum ProgramDeclaration {
ExternAnsi(ProgramDeclarationExternAnsi), ExternAnsi(ProgramDeclarationExternAnsi),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ProgramDeclarationNonansi { pub struct ProgramDeclarationNonansi {
pub nodes: ( pub nodes: (
ProgramNonansiHeader, ProgramNonansiHeader,
@ -231,7 +231,7 @@ pub struct ProgramDeclarationNonansi {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ProgramDeclarationAnsi { pub struct ProgramDeclarationAnsi {
pub nodes: ( pub nodes: (
ProgramAnsiHeader, ProgramAnsiHeader,
@ -242,7 +242,7 @@ pub struct ProgramDeclarationAnsi {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ProgramDeclarationWildcard { pub struct ProgramDeclarationWildcard {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -257,17 +257,17 @@ pub struct ProgramDeclarationWildcard {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ProgramDeclarationExternNonansi { pub struct ProgramDeclarationExternNonansi {
pub nodes: (Keyword, ProgramNonansiHeader), pub nodes: (Keyword, ProgramNonansiHeader),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ProgramDeclarationExternAnsi { pub struct ProgramDeclarationExternAnsi {
pub nodes: (Keyword, ProgramAnsiHeader), pub nodes: (Keyword, ProgramAnsiHeader),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ProgramNonansiHeader { pub struct ProgramNonansiHeader {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -281,7 +281,7 @@ pub struct ProgramNonansiHeader {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ProgramAnsiHeader { pub struct ProgramAnsiHeader {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -295,7 +295,7 @@ pub struct ProgramAnsiHeader {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CheckerDeclaration { pub struct CheckerDeclaration {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -308,7 +308,7 @@ pub struct CheckerDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ClassDeclaration { pub struct ClassDeclaration {
pub nodes: ( pub nodes: (
Option<Virtual>, Option<Virtual>,
@ -329,17 +329,17 @@ pub struct ClassDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Virtual { pub struct Virtual {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InterfaceClassType { pub struct InterfaceClassType {
pub nodes: (PsClassIdentifier, Option<ParameterValueAssignment>), pub nodes: (PsClassIdentifier, Option<ParameterValueAssignment>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InterfaceClassDeclaration { pub struct InterfaceClassDeclaration {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -354,7 +354,7 @@ pub struct InterfaceClassDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum InterfaceClassItem { pub enum InterfaceClassItem {
TypeDeclaration(TypeDeclaration), TypeDeclaration(TypeDeclaration),
Method(InterfaceClassItemMethod), Method(InterfaceClassItemMethod),
@ -363,17 +363,17 @@ pub enum InterfaceClassItem {
Null(Symbol), Null(Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InterfaceClassItemMethod { pub struct InterfaceClassItemMethod {
pub nodes: (Vec<AttributeInstance>, InterfaceClassMethod), pub nodes: (Vec<AttributeInstance>, InterfaceClassMethod),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InterfaceClassMethod { pub struct InterfaceClassMethod {
pub nodes: (Keyword, Keyword, MethodPrototype, Symbol), pub nodes: (Keyword, Keyword, MethodPrototype, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PackageDeclaration { pub struct PackageDeclaration {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -388,7 +388,7 @@ pub struct PackageDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum TimeunitsDeclaration { pub enum TimeunitsDeclaration {
Timeunit(TimeunitsDeclarationTimeunit), Timeunit(TimeunitsDeclarationTimeunit),
Timeprecision(TimeunitsDeclarationTimeprecision), Timeprecision(TimeunitsDeclarationTimeprecision),
@ -396,7 +396,7 @@ pub enum TimeunitsDeclaration {
TimeprecisionTimeunit(TimeunitsDeclarationTimeprecisionTimeunit), TimeprecisionTimeunit(TimeunitsDeclarationTimeprecisionTimeunit),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TimeunitsDeclarationTimeunit { pub struct TimeunitsDeclarationTimeunit {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -406,12 +406,12 @@ pub struct TimeunitsDeclarationTimeunit {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TimeunitsDeclarationTimeprecision { pub struct TimeunitsDeclarationTimeprecision {
pub nodes: (Keyword, TimeLiteral, Symbol), pub nodes: (Keyword, TimeLiteral, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TimeunitsDeclarationTimeunitTimeprecision { pub struct TimeunitsDeclarationTimeunitTimeprecision {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -423,7 +423,7 @@ pub struct TimeunitsDeclarationTimeunitTimeprecision {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TimeunitsDeclarationTimeprecisionTimeunit { pub struct TimeunitsDeclarationTimeprecisionTimeunit {
pub nodes: ( pub nodes: (
Keyword, Keyword,

View File

@ -7,12 +7,12 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SpecifyBlock { pub struct SpecifyBlock {
pub nodes: (Keyword, Vec<SpecifyItem>, Keyword), pub nodes: (Keyword, Vec<SpecifyItem>, Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum SpecifyItem { pub enum SpecifyItem {
SpecparamDeclaration(SpecparamDeclaration), SpecparamDeclaration(SpecparamDeclaration),
PulsestyleDeclaration(PulsestyleDeclaration), PulsestyleDeclaration(PulsestyleDeclaration),
@ -21,12 +21,12 @@ pub enum SpecifyItem {
SystemTimingCheck(SystemTimingCheck), SystemTimingCheck(SystemTimingCheck),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PulsestyleDeclaration { pub struct PulsestyleDeclaration {
pub nodes: (Keyword, ListOfPathOutputs, Symbol), pub nodes: (Keyword, ListOfPathOutputs, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ShowcancelledDeclaration { pub struct ShowcancelledDeclaration {
pub nodes: (Keyword, ListOfPathOutputs, Symbol), pub nodes: (Keyword, ListOfPathOutputs, Symbol),
} }

View File

@ -6,36 +6,36 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SpecifyInputTerminalDescriptor { pub struct SpecifyInputTerminalDescriptor {
pub nodes: (InputIdentifier, Option<Bracket<ConstantRangeExpression>>), pub nodes: (InputIdentifier, Option<Bracket<ConstantRangeExpression>>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SpecifyOutputTerminalDescriptor { pub struct SpecifyOutputTerminalDescriptor {
pub nodes: (OutputIdentifier, Option<Bracket<ConstantRangeExpression>>), pub nodes: (OutputIdentifier, Option<Bracket<ConstantRangeExpression>>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum InputIdentifier { pub enum InputIdentifier {
InputPortIdentifier(InputPortIdentifier), InputPortIdentifier(InputPortIdentifier),
InoutPortIdentifier(InoutPortIdentifier), InoutPortIdentifier(InoutPortIdentifier),
Interface(InputIdentifierInterface), Interface(InputIdentifierInterface),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InputIdentifierInterface { pub struct InputIdentifierInterface {
pub nodes: (InterfaceIdentifier, Symbol, PortIdentifier), pub nodes: (InterfaceIdentifier, Symbol, PortIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum OutputIdentifier { pub enum OutputIdentifier {
OutputPortIdentifier(OutputPortIdentifier), OutputPortIdentifier(OutputPortIdentifier),
InoutPortIdentifier(InoutPortIdentifier), InoutPortIdentifier(InoutPortIdentifier),
Interface(OutputIdentifierInterface), Interface(OutputIdentifierInterface),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct OutputIdentifierInterface { pub struct OutputIdentifierInterface {
pub nodes: (InterfaceIdentifier, Symbol, PortIdentifier), pub nodes: (InterfaceIdentifier, Symbol, PortIdentifier),
} }

View File

@ -7,30 +7,30 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PathDeclaration { pub enum PathDeclaration {
SimplePathDeclaration((SimplePathDeclaration, Symbol)), SimplePathDeclaration((SimplePathDeclaration, Symbol)),
EdgeSensitivePathDeclaration((EdgeSensitivePathDeclaration, Symbol)), EdgeSensitivePathDeclaration((EdgeSensitivePathDeclaration, Symbol)),
StateDependentPathDeclaration((StateDependentPathDeclaration, Symbol)), StateDependentPathDeclaration((StateDependentPathDeclaration, Symbol)),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum SimplePathDeclaration { pub enum SimplePathDeclaration {
Parallel(SimplePathDeclarationParallel), Parallel(SimplePathDeclarationParallel),
Full(SimplePathDeclarationFull), Full(SimplePathDeclarationFull),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SimplePathDeclarationParallel { pub struct SimplePathDeclarationParallel {
pub nodes: (ParallelPathDescription, Symbol, PathDelayValue), pub nodes: (ParallelPathDescription, Symbol, PathDelayValue),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SimplePathDeclarationFull { pub struct SimplePathDeclarationFull {
pub nodes: (FullPathDescription, Symbol, PathDelayValue), pub nodes: (FullPathDescription, Symbol, PathDelayValue),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ParallelPathDescription { pub struct ParallelPathDescription {
pub nodes: ( pub nodes: (
Paren<( Paren<(
@ -42,7 +42,7 @@ pub struct ParallelPathDescription {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct FullPathDescription { pub struct FullPathDescription {
pub nodes: ( pub nodes: (
Paren<( Paren<(
@ -54,12 +54,12 @@ pub struct FullPathDescription {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfPathInputs { pub struct ListOfPathInputs {
pub nodes: (List<Symbol, SpecifyInputTerminalDescriptor>,), pub nodes: (List<Symbol, SpecifyInputTerminalDescriptor>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfPathOutputs { pub struct ListOfPathOutputs {
pub nodes: (List<Symbol, SpecifyOutputTerminalDescriptor>,), pub nodes: (List<Symbol, SpecifyOutputTerminalDescriptor>,),
} }

View File

@ -7,48 +7,48 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum PathDelayValue { pub enum PathDelayValue {
ListOfPathDelayExpressions(ListOfPathDelayExpressions), ListOfPathDelayExpressions(ListOfPathDelayExpressions),
Paren(PathDelayValueParen), Paren(PathDelayValueParen),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PathDelayValueParen { pub struct PathDelayValueParen {
pub nodes: (Paren<ListOfPathDelayExpressions>,), pub nodes: (Paren<ListOfPathDelayExpressions>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfPathDelayExpressions { pub struct ListOfPathDelayExpressions {
pub nodes: (List<Symbol, TPathDelayExpression>,), pub nodes: (List<Symbol, TPathDelayExpression>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TPathDelayExpression { pub struct TPathDelayExpression {
pub nodes: (PathDelayExpression,), pub nodes: (PathDelayExpression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PathDelayExpression { pub struct PathDelayExpression {
pub nodes: (ConstantMintypmaxExpression,), pub nodes: (ConstantMintypmaxExpression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum EdgeSensitivePathDeclaration { pub enum EdgeSensitivePathDeclaration {
Parallel(EdgeSensitivePathDeclarationParallel), Parallel(EdgeSensitivePathDeclarationParallel),
Full(EdgeSensitivePathDeclarationFull), Full(EdgeSensitivePathDeclarationFull),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EdgeSensitivePathDeclarationParallel { pub struct EdgeSensitivePathDeclarationParallel {
pub nodes: (ParallelEdgeSensitivePathDescription, Symbol, PathDelayValue), pub nodes: (ParallelEdgeSensitivePathDescription, Symbol, PathDelayValue),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EdgeSensitivePathDeclarationFull { pub struct EdgeSensitivePathDeclarationFull {
pub nodes: (FullEdgeSensitivePathDescription, Symbol, PathDelayValue), pub nodes: (FullEdgeSensitivePathDescription, Symbol, PathDelayValue),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ParallelEdgeSensitivePathDescription { pub struct ParallelEdgeSensitivePathDescription {
pub nodes: ( pub nodes: (
Paren<( Paren<(
@ -66,7 +66,7 @@ pub struct ParallelEdgeSensitivePathDescription {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct FullEdgeSensitivePathDescription { pub struct FullEdgeSensitivePathDescription {
pub nodes: ( pub nodes: (
Paren<( Paren<(
@ -84,31 +84,31 @@ pub struct FullEdgeSensitivePathDescription {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DataSourceExpression { pub struct DataSourceExpression {
pub nodes: (Expression,), pub nodes: (Expression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum EdgeIdentifier { pub enum EdgeIdentifier {
Posedge(Keyword), Posedge(Keyword),
Negedge(Keyword), Negedge(Keyword),
Edge(Keyword), Edge(Keyword),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum StateDependentPathDeclaration { pub enum StateDependentPathDeclaration {
IfSimple(StateDependentPathDeclarationIfSimple), IfSimple(StateDependentPathDeclarationIfSimple),
IfEdgeSensitive(StateDependentPathDeclarationIfEdgeSensitive), IfEdgeSensitive(StateDependentPathDeclarationIfEdgeSensitive),
IfNone(StateDependentPathDeclarationIfNone), IfNone(StateDependentPathDeclarationIfNone),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct StateDependentPathDeclarationIfSimple { pub struct StateDependentPathDeclarationIfSimple {
pub nodes: (Keyword, Paren<ModulePathExpression>, SimplePathDeclaration), pub nodes: (Keyword, Paren<ModulePathExpression>, SimplePathDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct StateDependentPathDeclarationIfEdgeSensitive { pub struct StateDependentPathDeclarationIfEdgeSensitive {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -117,12 +117,12 @@ pub struct StateDependentPathDeclarationIfEdgeSensitive {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct StateDependentPathDeclarationIfNone { pub struct StateDependentPathDeclarationIfNone {
pub nodes: (Keyword, SimplePathDeclaration), pub nodes: (Keyword, SimplePathDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PolarityOperator { pub struct PolarityOperator {
pub nodes: (Symbol,), pub nodes: (Symbol,),
} }

View File

@ -6,84 +6,84 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TimecheckCondition { pub struct TimecheckCondition {
pub nodes: (MintypmaxExpression,), pub nodes: (MintypmaxExpression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ControlledReferenceEvent { pub struct ControlledReferenceEvent {
pub nodes: (ControlledTimingCheckEvent,), pub nodes: (ControlledTimingCheckEvent,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DataEvent { pub struct DataEvent {
pub nodes: (TimingCheckEvent,), pub nodes: (TimingCheckEvent,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum DelayedData { pub enum DelayedData {
TerminalIdentifier(TerminalIdentifier), TerminalIdentifier(TerminalIdentifier),
WithMintypmax(DelayedDataWithMintypmax), WithMintypmax(DelayedDataWithMintypmax),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DelayedDataWithMintypmax { pub struct DelayedDataWithMintypmax {
pub nodes: (TerminalIdentifier, Bracket<ConstantMintypmaxExpression>), pub nodes: (TerminalIdentifier, Bracket<ConstantMintypmaxExpression>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum DelayedReference { pub enum DelayedReference {
TerminalIdentifier(TerminalIdentifier), TerminalIdentifier(TerminalIdentifier),
WithMintypmax(DelayedReferenceWithMintypmax), WithMintypmax(DelayedReferenceWithMintypmax),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct DelayedReferenceWithMintypmax { pub struct DelayedReferenceWithMintypmax {
pub nodes: (TerminalIdentifier, Bracket<ConstantMintypmaxExpression>), pub nodes: (TerminalIdentifier, Bracket<ConstantMintypmaxExpression>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EndEdgeOffset { pub struct EndEdgeOffset {
pub nodes: (MintypmaxExpression,), pub nodes: (MintypmaxExpression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EventBasedFlag { pub struct EventBasedFlag {
pub nodes: (ConstantExpression,), pub nodes: (ConstantExpression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Notifier { pub struct Notifier {
pub nodes: (VariableIdentifier,), pub nodes: (VariableIdentifier,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ReferenceEvent { pub struct ReferenceEvent {
pub nodes: (TimingCheckEvent,), pub nodes: (TimingCheckEvent,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct RemainActiveFlag { pub struct RemainActiveFlag {
pub nodes: (ConstantMintypmaxExpression,), pub nodes: (ConstantMintypmaxExpression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TimestampCondition { pub struct TimestampCondition {
pub nodes: (MintypmaxExpression,), pub nodes: (MintypmaxExpression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct StartEdgeOffset { pub struct StartEdgeOffset {
pub nodes: (MintypmaxExpression,), pub nodes: (MintypmaxExpression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Threshold { pub struct Threshold {
pub nodes: (ConstantExpression,), pub nodes: (ConstantExpression,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TimingCheckLimit { pub struct TimingCheckLimit {
pub nodes: (Expression,), pub nodes: (Expression,),
} }

View File

@ -7,7 +7,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum SystemTimingCheck { pub enum SystemTimingCheck {
SetupTimingCheck(SetupTimingCheck), SetupTimingCheck(SetupTimingCheck),
HoldTimingCheck(HoldTimingCheck), HoldTimingCheck(HoldTimingCheck),
@ -23,7 +23,7 @@ pub enum SystemTimingCheck {
NochargeTimingCheck(NochargeTimingCheck), NochargeTimingCheck(NochargeTimingCheck),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SetupTimingCheck { pub struct SetupTimingCheck {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -39,7 +39,7 @@ pub struct SetupTimingCheck {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct HoldTimingCheck { pub struct HoldTimingCheck {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -55,7 +55,7 @@ pub struct HoldTimingCheck {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SetupholdTimingCheck { pub struct SetupholdTimingCheck {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -89,7 +89,7 @@ pub struct SetupholdTimingCheck {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct RecoveryTimingCheck { pub struct RecoveryTimingCheck {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -105,7 +105,7 @@ pub struct RecoveryTimingCheck {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct RemovalTimingCheck { pub struct RemovalTimingCheck {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -121,7 +121,7 @@ pub struct RemovalTimingCheck {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct RecremTimingCheck { pub struct RecremTimingCheck {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -155,7 +155,7 @@ pub struct RecremTimingCheck {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SkewTimingCheck { pub struct SkewTimingCheck {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -171,7 +171,7 @@ pub struct SkewTimingCheck {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TimeskewTimingCheck { pub struct TimeskewTimingCheck {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -195,7 +195,7 @@ pub struct TimeskewTimingCheck {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct FullskewTimingCheck { pub struct FullskewTimingCheck {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -221,7 +221,7 @@ pub struct FullskewTimingCheck {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PeriodTimingCheck { pub struct PeriodTimingCheck {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -235,7 +235,7 @@ pub struct PeriodTimingCheck {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct WidthTimingCheck { pub struct WidthTimingCheck {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -251,7 +251,7 @@ pub struct WidthTimingCheck {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NochargeTimingCheck { pub struct NochargeTimingCheck {
pub nodes: ( pub nodes: (
Keyword, Keyword,

View File

@ -7,7 +7,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TimingCheckEvent { pub struct TimingCheckEvent {
pub nodes: ( pub nodes: (
Option<TimingCheckEventControl>, Option<TimingCheckEventControl>,
@ -16,7 +16,7 @@ pub struct TimingCheckEvent {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ControlledTimingCheckEvent { pub struct ControlledTimingCheckEvent {
pub nodes: ( pub nodes: (
TimingCheckEventControl, TimingCheckEventControl,
@ -25,7 +25,7 @@ pub struct ControlledTimingCheckEvent {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum TimingCheckEventControl { pub enum TimingCheckEventControl {
Posedge(Keyword), Posedge(Keyword),
Negedge(Keyword), Negedge(Keyword),
@ -33,51 +33,51 @@ pub enum TimingCheckEventControl {
EdgeControlSpecifier(EdgeControlSpecifier), EdgeControlSpecifier(EdgeControlSpecifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum SpecifyTerminalDescriptor { pub enum SpecifyTerminalDescriptor {
SpecifyInputTerminalDescriptor(SpecifyInputTerminalDescriptor), SpecifyInputTerminalDescriptor(SpecifyInputTerminalDescriptor),
SpecifyOutputTerminalDescriptor(SpecifyOutputTerminalDescriptor), SpecifyOutputTerminalDescriptor(SpecifyOutputTerminalDescriptor),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EdgeControlSpecifier { pub struct EdgeControlSpecifier {
pub nodes: (Keyword, Bracket<List<Symbol, EdgeDescriptor>>), pub nodes: (Keyword, Bracket<List<Symbol, EdgeDescriptor>>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EdgeDescriptor { pub struct EdgeDescriptor {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum TimingCheckCondition { pub enum TimingCheckCondition {
ScalarTimingCheckCondition(ScalarTimingCheckCondition), ScalarTimingCheckCondition(ScalarTimingCheckCondition),
Paren(TimingCheckConditionParen), Paren(TimingCheckConditionParen),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct TimingCheckConditionParen { pub struct TimingCheckConditionParen {
pub nodes: (Paren<ScalarTimingCheckCondition>,), pub nodes: (Paren<ScalarTimingCheckCondition>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum ScalarTimingCheckCondition { pub enum ScalarTimingCheckCondition {
Expression(Expression), Expression(Expression),
Unary(ScalarTimingCheckConditionUnary), Unary(ScalarTimingCheckConditionUnary),
Binary(ScalarTimingCheckConditionBinary), Binary(ScalarTimingCheckConditionBinary),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ScalarTimingCheckConditionUnary { pub struct ScalarTimingCheckConditionUnary {
pub nodes: (Symbol, Expression), pub nodes: (Symbol, Expression),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ScalarTimingCheckConditionBinary { pub struct ScalarTimingCheckConditionBinary {
pub nodes: (Expression, Symbol, ScalarConstant), pub nodes: (Expression, Symbol, ScalarConstant),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ScalarConstant { pub struct ScalarConstant {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }

View File

@ -8,13 +8,13 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum UdpBody { pub enum UdpBody {
CombinationalBody(CombinationalBody), CombinationalBody(CombinationalBody),
SequentialBody(SequentialBody), SequentialBody(SequentialBody),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CombinationalBody { pub struct CombinationalBody {
pub nodes: ( pub nodes: (
Keyword, Keyword,
@ -24,12 +24,12 @@ pub struct CombinationalBody {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CombinationalEntry { pub struct CombinationalEntry {
pub nodes: (LevelInputList, Symbol, OutputSymbol, Symbol), pub nodes: (LevelInputList, Symbol, OutputSymbol, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequentialBody { pub struct SequentialBody {
pub nodes: ( pub nodes: (
Option<UdpInitialStatement>, Option<UdpInitialStatement>,
@ -40,17 +40,17 @@ pub struct SequentialBody {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UdpInitialStatement { pub struct UdpInitialStatement {
pub nodes: (Keyword, OutputPortIdentifier, Symbol, InitVal, Symbol), pub nodes: (Keyword, OutputPortIdentifier, Symbol, InitVal, Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct InitVal { pub struct InitVal {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequentialEntry { pub struct SequentialEntry {
pub nodes: ( pub nodes: (
SeqInputList, SeqInputList,
@ -62,55 +62,55 @@ pub struct SequentialEntry {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum SeqInputList { pub enum SeqInputList {
LevelInputList(LevelInputList), LevelInputList(LevelInputList),
EdgeInputList(EdgeInputList), EdgeInputList(EdgeInputList),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LevelInputList { pub struct LevelInputList {
pub nodes: (LevelSymbol, Vec<LevelSymbol>), pub nodes: (LevelSymbol, Vec<LevelSymbol>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EdgeInputList { pub struct EdgeInputList {
pub nodes: (Vec<LevelSymbol>, EdgeIndicator, Vec<LevelSymbol>), pub nodes: (Vec<LevelSymbol>, EdgeIndicator, Vec<LevelSymbol>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum EdgeIndicator { pub enum EdgeIndicator {
Paren(EdgeIndicatorParen), Paren(EdgeIndicatorParen),
EdgeSymbol(EdgeSymbol), EdgeSymbol(EdgeSymbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EdgeIndicatorParen { pub struct EdgeIndicatorParen {
pub nodes: (Paren<(LevelSymbol, LevelSymbol)>,), pub nodes: (Paren<(LevelSymbol, LevelSymbol)>,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CurrentState { pub struct CurrentState {
pub nodes: (LevelSymbol,), pub nodes: (LevelSymbol,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum NextState { pub enum NextState {
OutputSymbol(OutputSymbol), OutputSymbol(OutputSymbol),
Minus(Symbol), Minus(Symbol),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct OutputSymbol { pub struct OutputSymbol {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LevelSymbol { pub struct LevelSymbol {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EdgeSymbol { pub struct EdgeSymbol {
pub nodes: (Keyword,), pub nodes: (Keyword,),
} }

View File

@ -8,7 +8,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UdpNonansiDeclaration { pub struct UdpNonansiDeclaration {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -19,7 +19,7 @@ pub struct UdpNonansiDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UdpAnsiDeclaration { pub struct UdpAnsiDeclaration {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -30,7 +30,7 @@ pub struct UdpAnsiDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum UdpDeclaration { pub enum UdpDeclaration {
Nonansi(UdpDeclarationNonansi), Nonansi(UdpDeclarationNonansi),
Ansi(UdpDeclarationAnsi), Ansi(UdpDeclarationAnsi),
@ -39,7 +39,7 @@ pub enum UdpDeclaration {
Wildcard(UdpDeclarationWildcard), Wildcard(UdpDeclarationWildcard),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UdpDeclarationNonansi { pub struct UdpDeclarationNonansi {
pub nodes: ( pub nodes: (
UdpNonansiDeclaration, UdpNonansiDeclaration,
@ -51,7 +51,7 @@ pub struct UdpDeclarationNonansi {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UdpDeclarationAnsi { pub struct UdpDeclarationAnsi {
pub nodes: ( pub nodes: (
UdpAnsiDeclaration, UdpAnsiDeclaration,
@ -61,17 +61,17 @@ pub struct UdpDeclarationAnsi {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UdpDeclarationExternNonansi { pub struct UdpDeclarationExternNonansi {
pub nodes: (Keyword, UdpNonansiDeclaration), pub nodes: (Keyword, UdpNonansiDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UdpDeclarationExternAnsi { pub struct UdpDeclarationExternAnsi {
pub nodes: (Keyword, UdpAnsiDeclaration), pub nodes: (Keyword, UdpAnsiDeclaration),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UdpDeclarationWildcard { pub struct UdpDeclarationWildcard {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,

View File

@ -7,7 +7,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UdpInstantiation { pub struct UdpInstantiation {
pub nodes: ( pub nodes: (
UdpIdentifier, UdpIdentifier,
@ -18,7 +18,7 @@ pub struct UdpInstantiation {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UdpInstance { pub struct UdpInstance {
pub nodes: ( pub nodes: (
Option<NameOfInstance>, Option<NameOfInstance>,

View File

@ -8,7 +8,7 @@ use nom::IResult;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UdpPortList { pub struct UdpPortList {
pub nodes: ( pub nodes: (
OutputPortIdentifier, OutputPortIdentifier,
@ -17,7 +17,7 @@ pub struct UdpPortList {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UdpDeclarationPortList { pub struct UdpDeclarationPortList {
pub nodes: ( pub nodes: (
UdpOutputDeclaration, UdpOutputDeclaration,
@ -26,25 +26,25 @@ pub struct UdpDeclarationPortList {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum UdpPortDeclaration { pub enum UdpPortDeclaration {
UdpOutputDeclaration((UdpOutputDeclaration, Symbol)), UdpOutputDeclaration((UdpOutputDeclaration, Symbol)),
UdpInputDeclaration((UdpInputDeclaration, Symbol)), UdpInputDeclaration((UdpInputDeclaration, Symbol)),
UdpRegDeclaration((UdpRegDeclaration, Symbol)), UdpRegDeclaration((UdpRegDeclaration, Symbol)),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum UdpOutputDeclaration { pub enum UdpOutputDeclaration {
Nonreg(UdpOutputDeclarationNonreg), Nonreg(UdpOutputDeclarationNonreg),
Reg(UdpOutputDeclarationReg), Reg(UdpOutputDeclarationReg),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UdpOutputDeclarationNonreg { pub struct UdpOutputDeclarationNonreg {
pub nodes: (Vec<AttributeInstance>, Keyword, PortIdentifier), pub nodes: (Vec<AttributeInstance>, Keyword, PortIdentifier),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UdpOutputDeclarationReg { pub struct UdpOutputDeclarationReg {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -55,7 +55,7 @@ pub struct UdpOutputDeclarationReg {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UdpInputDeclaration { pub struct UdpInputDeclaration {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,
@ -64,7 +64,7 @@ pub struct UdpInputDeclaration {
), ),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct UdpRegDeclaration { pub struct UdpRegDeclaration {
pub nodes: ( pub nodes: (
Vec<AttributeInstance>, Vec<AttributeInstance>,

View File

@ -261,43 +261,43 @@ const KEYWORDS: &[&str] = &[
"xor", "xor",
]; ];
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Symbol { pub struct Symbol {
pub nodes: (Locate, Vec<WhiteSpace>), pub nodes: (Locate, Vec<WhiteSpace>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct Keyword { pub struct Keyword {
pub nodes: (Locate, Vec<WhiteSpace>), pub nodes: (Locate, Vec<WhiteSpace>),
} }
#[derive(Debug, Node)] #[derive(Clone, Debug, Node)]
pub enum WhiteSpace { pub enum WhiteSpace {
Space(Locate), Space(Locate),
Comment(Comment), Comment(Comment),
} }
#[derive(Debug)] #[derive(Clone, Debug)]
pub struct Paren<T> { pub struct Paren<T> {
pub nodes: (Symbol, T, Symbol), pub nodes: (Symbol, T, Symbol),
} }
#[derive(Debug)] #[derive(Clone, Debug)]
pub struct Brace<T> { pub struct Brace<T> {
pub nodes: (Symbol, T, Symbol), pub nodes: (Symbol, T, Symbol),
} }
#[derive(Debug)] #[derive(Clone, Debug)]
pub struct Bracket<T> { pub struct Bracket<T> {
pub nodes: (Symbol, T, Symbol), pub nodes: (Symbol, T, Symbol),
} }
#[derive(Debug)] #[derive(Clone, Debug)]
pub struct ApostropheBrace<T> { pub struct ApostropheBrace<T> {
pub nodes: (Symbol, T, Symbol), pub nodes: (Symbol, T, Symbol),
} }
#[derive(Debug)] #[derive(Clone, Debug)]
pub struct List<T, U> { pub struct List<T, U> {
pub nodes: (U, Vec<(T, U)>), pub nodes: (U, Vec<(T, U)>),
} }

View File

@ -53,23 +53,29 @@ fn impl_node(ast: &DeriveInput) -> TokenStream {
let gen = quote! { let gen = quote! {
impl<'a> Node<'a> for #name { impl<'a> Node<'a> for #name {
fn next(&'a self) -> AnyNodes<'a> { fn next(&'a self) -> RefNodes<'a> {
#next #next
} }
} }
impl<'a> From<&'a #name> for AnyNodes<'a> { impl<'a> From<&'a #name> for RefNodes<'a> {
fn from(x: &'a #name) -> Self { fn from(x: &'a #name) -> Self {
vec![AnyNode::#name(x)].into() vec![RefNode::#name(x)].into()
}
}
impl From<#name> for AnyNode {
fn from(x: #name) -> Self {
AnyNode::#name(x)
} }
} }
impl<'a> IntoIterator for &'a #name { impl<'a> IntoIterator for &'a #name {
type Item = AnyNode<'a>; type Item = RefNode<'a>;
type IntoIter = Iter<'a>; type IntoIter = Iter<'a>;
fn into_iter(self) -> Self::IntoIter { fn into_iter(self) -> Self::IntoIter {
let nodes: AnyNodes = self.into(); let nodes: RefNodes = self.into();
Iter { next: nodes } Iter { next: nodes }
} }
} }
@ -93,7 +99,45 @@ fn impl_any_node(ast: &DeriveInput) -> TokenStream {
for v in &data.variants { for v in &data.variants {
let ident = &v.ident; let ident = &v.ident;
let item = quote! { let item = quote! {
AnyNode::#ident(x) => x.next(), impl TryFrom<AnyNode> for #ident {
type Error = ();
fn try_from(x: AnyNode) -> Result<Self, Self::Error> {
match x {
AnyNode::#ident(x) => Ok(x),
_ => Err(()),
}
}
}
};
items = quote! {
#items
#item
};
}
let gen = quote! {
#items
};
gen.into()
}
#[proc_macro_derive(RefNode)]
pub fn ref_node_derive(input: TokenStream) -> TokenStream {
let ast = syn::parse(input).unwrap();
impl_ref_node(&ast)
}
fn impl_ref_node(ast: &DeriveInput) -> TokenStream {
let ref data = match ast.data {
Enum(ref data) => data,
_ => unreachable!(),
};
let mut items = quote! {};
for v in &data.variants {
let ident = &v.ident;
let item = quote! {
RefNode::#ident(x) => x.next(),
}; };
items = quote! { items = quote! {
#items #items
@ -104,7 +148,7 @@ fn impl_any_node(ast: &DeriveInput) -> TokenStream {
let name = &ast.ident; let name = &ast.ident;
let gen = quote! { let gen = quote! {
impl<'a> #name<'a> { impl<'a> #name<'a> {
fn next(&self) -> AnyNodes<'a> { fn next(&self) -> RefNodes<'a> {
match self { match self {
#items #items
} }
@ -122,7 +166,7 @@ pub fn parser(attr: TokenStream, item: TokenStream) -> TokenStream {
} }
fn impl_parser(attr: &AttributeArgs, item: &ItemFn) -> TokenStream { fn impl_parser(attr: &AttributeArgs, item: &ItemFn) -> TokenStream {
let (maybe_recursive, ambiguous, memoize) = impl_parser_attribute(attr); let (maybe_recursive, ambiguous) = impl_parser_attribute(attr);
let trace = impl_parser_trace(&item); let trace = impl_parser_trace(&item);
let trace = parse_macro_input!(trace as Stmt); let trace = parse_macro_input!(trace as Stmt);
@ -147,27 +191,15 @@ fn impl_parser(attr: &AttributeArgs, item: &ItemFn) -> TokenStream {
let clear_recursive_flags = parse_macro_input!(clear_recursive_flags as Expr); let clear_recursive_flags = parse_macro_input!(clear_recursive_flags as Expr);
let clear_recursive_flags = Stmt::Expr(clear_recursive_flags); let clear_recursive_flags = Stmt::Expr(clear_recursive_flags);
let check_failed_memo = impl_parser_check_failed_memo(&item);
let check_failed_memo = parse_macro_input!(check_failed_memo as Stmt);
let set_failed_memo = impl_parser_set_failed_memo(&item);
let set_failed_memo = parse_macro_input!(set_failed_memo as Stmt);
let mut item = item.clone(); let mut item = item.clone();
item.block.stmts.clear(); item.block.stmts.clear();
item.block.stmts.push(trace); item.block.stmts.push(trace);
if memoize {
item.block.stmts.push(check_failed_memo);
}
if maybe_recursive { if maybe_recursive {
item.block.stmts.push(check_recursive_flag); item.block.stmts.push(check_recursive_flag);
item.block.stmts.push(set_recursive_flag); item.block.stmts.push(set_recursive_flag);
} }
item.block.stmts.push(body); item.block.stmts.push(body);
if memoize {
item.block.stmts.push(set_failed_memo);
}
item.block.stmts.push(body_unwrap); item.block.stmts.push(body_unwrap);
item.block.stmts.push(clear_recursive_flags); item.block.stmts.push(clear_recursive_flags);
@ -177,21 +209,19 @@ fn impl_parser(attr: &AttributeArgs, item: &ItemFn) -> TokenStream {
gen.into() gen.into()
} }
fn impl_parser_attribute(attr: &AttributeArgs) -> (bool, bool, bool) { fn impl_parser_attribute(attr: &AttributeArgs) -> (bool, bool) {
let mut maybe_recursive = false; let mut maybe_recursive = false;
let mut ambiguous = false; let mut ambiguous = false;
let mut memoize = false;
for a in attr { for a in attr {
match a { match a {
NestedMeta::Meta(Meta::Word(x)) if x == "MaybeRecursive" => maybe_recursive = true, NestedMeta::Meta(Meta::Word(x)) if x == "MaybeRecursive" => maybe_recursive = true,
NestedMeta::Meta(Meta::Word(x)) if x == "Ambiguous" => ambiguous = true, NestedMeta::Meta(Meta::Word(x)) if x == "Ambiguous" => ambiguous = true,
NestedMeta::Meta(Meta::Word(x)) if x == "Memoize" => memoize = true,
_ => panic!(), _ => panic!(),
} }
} }
(maybe_recursive, ambiguous, memoize) (maybe_recursive, ambiguous)
} }
fn impl_parser_trace(item: &ItemFn) -> TokenStream { fn impl_parser_trace(item: &ItemFn) -> TokenStream {
@ -325,51 +355,3 @@ fn impl_parser_clear_recursive_flags(_item: &ItemFn) -> TokenStream {
}; };
gen.into() gen.into()
} }
fn impl_parser_check_failed_memo(item: &ItemFn) -> TokenStream {
let ident = &item.ident;
let gen = quote! {
let offset = {
//if thread_context::FAILED_MEMO.with(|m| { m.borrow().get(&(stringify!(#ident), s.offset)).is_some() }) {
// #[cfg(feature = "trace")]
// println!("{:<128} : memoized failure", format!("{}{}", " ".repeat(s.extra.depth), stringify!(#ident)));
// return Err(nom::Err::Error(nom::error::make_error(s, nom::error::ErrorKind::Fix)));
//}
if let Some(x) = thread_context::FAILED_MEMO.with(|m| { if let Some(x) = m.borrow().get(&(stringify!(#ident), s.offset)) { Some(*x) } else { None } }) {
if x {
#[cfg(feature = "trace")]
println!("{:<128} : memoized failure", format!("{}{}", " ".repeat(s.extra.depth), stringify!(#ident)));
return Err(nom::Err::Error(nom::error::make_error(s, nom::error::ErrorKind::Fix)));
} else {
#[cfg(feature = "trace")]
println!("{:<128} : memoized success", format!("{}{}", " ".repeat(s.extra.depth), stringify!(#ident)));
}
}
s.offset
};
};
gen.into()
}
fn impl_parser_set_failed_memo(item: &ItemFn) -> TokenStream {
let ident = &item.ident;
let gen = quote! {
//if body_ret.is_err() {
// thread_context::FAILED_MEMO.with(|m| {
// m.borrow_mut().insert((stringify!(#ident), offset), ());
// })
//}
if body_ret.is_err() {
thread_context::FAILED_MEMO.with(|m| {
m.borrow_mut().insert((stringify!(#ident), offset), true);
})
} else {
thread_context::FAILED_MEMO.with(|m| {
m.borrow_mut().insert((stringify!(#ident), offset), false);
})
}
};
gen.into()
}