sv_parser_syntaxtree/
lib.rs1#![recursion_limit = "256"]
2#![allow(
3 clippy::module_inception,
4 clippy::large_enum_variant,
5 clippy::type_complexity
6)]
7
8pub mod any_node;
9pub mod behavioral_statements;
10pub mod declarations;
11pub mod expressions;
12pub mod general;
13pub mod instantiations;
14pub mod preprocessor;
15pub mod primitive_instances;
16pub mod source_text;
17pub mod special_node;
18pub mod specify_section;
19pub mod udp_declaration_and_instantiation;
20pub use any_node::*;
21pub use behavioral_statements::*;
22pub use declarations::*;
23pub use expressions::*;
24pub use general::*;
25pub use instantiations::*;
26pub use preprocessor::*;
27pub use primitive_instances::*;
28pub use source_text::*;
29pub use special_node::*;
30pub use specify_section::*;
31pub use udp_declaration_and_instantiation::*;
32
33pub(crate) use sv_parser_macros::*;
34
35#[derive(Copy, Clone, Default, Debug, PartialEq)]
38pub struct Locate {
39 pub offset: usize,
40 pub line: u32,
41 pub len: usize,
42}
43
44impl Locate {
45 pub fn str<'a, 'b>(&'a self, s: &'b str) -> &'b str {
46 &s[self.offset..self.offset + self.len]
47 }
48}
49
50pub trait Node<'a> {
53 fn next(&'a self) -> RefNodes<'a>;
54}
55
56impl<'a> Node<'a> for Locate {
57 fn next(&'a self) -> RefNodes<'a> {
58 vec![].into()
59 }
60}
61
62impl<'a> IntoIterator for &'a Locate {
63 type Item = RefNode<'a>;
64 type IntoIter = Iter<'a>;
65
66 fn into_iter(self) -> Self::IntoIter {
67 let nodes: RefNodes = self.into();
68 Iter { next: nodes }
69 }
70}