Move Locate
This commit is contained in:
parent
dc0547461c
commit
ce2b57e811
@ -1,5 +1,7 @@
|
||||
pub mod any_node;
|
||||
pub mod locate;
|
||||
pub mod node;
|
||||
pub(crate) use any_node::*;
|
||||
pub(crate) use locate::*;
|
||||
pub(crate) use node::*;
|
||||
pub(crate) use sv_parser_macro::*;
|
||||
|
18
src/ast/locate.rs
Normal file
18
src/ast/locate.rs
Normal file
@ -0,0 +1,18 @@
|
||||
use crate::parser::*;
|
||||
|
||||
#[derive(Copy, Clone, Default, Debug, PartialEq)]
|
||||
pub struct Locate {
|
||||
offset: usize,
|
||||
line: u32,
|
||||
len: usize,
|
||||
}
|
||||
|
||||
impl<'a> From<Span<'a>> for Locate {
|
||||
fn from(x: Span<'a>) -> Self {
|
||||
Locate {
|
||||
offset: x.offset,
|
||||
line: x.line,
|
||||
len: x.fragment.len(),
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
use crate::ast::*;
|
||||
use crate::parser::*;
|
||||
|
||||
pub(crate) trait Node<'a> {
|
||||
fn next(&'a self) -> RefNodes<'a>;
|
||||
|
@ -1,7 +1,6 @@
|
||||
#![recursion_limit = "256"]
|
||||
pub mod ast;
|
||||
pub mod parser;
|
||||
use ast::*;
|
||||
use parser::*;
|
||||
|
||||
use nom_packrat::storage;
|
||||
|
@ -21,6 +21,8 @@ pub use source_text::*;
|
||||
pub use specify_section::*;
|
||||
pub use udp_declaration_and_instantiation::*;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
pub(crate) const RECURSIVE_FLAG_WORDS: usize = 1;
|
||||
|
||||
#[derive(Copy, Clone, Default, Debug, PartialEq)]
|
||||
@ -32,22 +34,7 @@ pub(crate) struct Extra {
|
||||
|
||||
pub(crate) type Span<'a> = nom_locate::LocatedSpanEx<&'a str, Extra>;
|
||||
|
||||
#[derive(Copy, Clone, Default, Debug, PartialEq)]
|
||||
pub struct Locate {
|
||||
offset: usize,
|
||||
line: u32,
|
||||
len: usize,
|
||||
}
|
||||
|
||||
impl<'a> From<Span<'a>> for Locate {
|
||||
fn from(x: Span<'a>) -> Self {
|
||||
Locate {
|
||||
offset: x.offset,
|
||||
line: x.line,
|
||||
len: x.fragment.len(),
|
||||
}
|
||||
}
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
mod thread_context {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user