docs and line/offset numbers in paths
This commit is contained in:
parent
af09bcd403
commit
2d9a029130
9 changed files with 366 additions and 116 deletions
|
|
@ -1,10 +1,44 @@
|
|||
#![deny(missing_docs)]
|
||||
#![deny(warnings)]
|
||||
#![doc=include_str!("../README.md")]
|
||||
|
||||
/// The structure of parsed log lines
|
||||
pub mod ast;
|
||||
mod display;
|
||||
mod parse;
|
||||
mod spans;
|
||||
|
||||
#[doc(hidden)]
|
||||
#[macro_export]
|
||||
macro_rules! generate_ast_recognizer {
|
||||
($name: ident, $pattern: pat) => {
|
||||
fn $name(s: &str) -> bool {
|
||||
use logparse::{ast::*, *};
|
||||
let l = parse_input(s).unwrap();
|
||||
if !l.trailing_space.0.is_empty() {
|
||||
eprintln!("trailing space {l:?}");
|
||||
return false;
|
||||
}
|
||||
if l.segments.len() != 1 {
|
||||
eprintln!("more segments {l:?}");
|
||||
return false;
|
||||
}
|
||||
if !l.segments[0].leading_space.0.is_empty() {
|
||||
eprintln!("leading space {l:?}");
|
||||
return false;
|
||||
}
|
||||
if let $pattern = &l.segments[0].token {
|
||||
true
|
||||
} else {
|
||||
eprintln!("pattern {l:?}");
|
||||
false
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod proptesting;
|
||||
|
||||
pub use parse::parse_input;
|
||||
pub use spans::{Config, Kind as SpanKind, Span, into_spans};
|
||||
pub use spans::{Config, Span, SpanKind, into_spans};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue