Skip to content

Commit 0596fe6

Browse files
committed
comments mod and unit tests completed
1 parent eff517d commit 0596fe6

2 files changed

Lines changed: 2 additions & 47 deletions

File tree

src/docs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//! Module for parsing sql and comments and returning only comments connected to statements

src/lib.rs

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,8 @@
1-
//! High-level library entrypoint for the SQL docs tool.
2-
//!
31
//! Module layout:
42
//! - [`files`] : discover and load `.sql` files from disk
53
//! - [`ast`] : parse SQL into an AST using `sqlparser`
64
//! - [`comments`] : extract and model comments + spans
7-
//!
8-
//! Most users should be able to use the convenience functions
9-
//! [`parse_comments_from_path`] and [`parse_comments_from_dir`].
10-
115
pub mod files;
126
pub mod ast;
137
pub mod comments;
14-
15-
use std::{io, path::{Path, PathBuf}};
16-
17-
use ast::{ParsedSqlFile, ParsedSqlFileSet};
18-
use comments::{CommentError, Comments};
19-
use files::SqlFileSet;
20-
use sqlparser::parser::ParserError;
21-
22-
/// Unified error types
23-
///
24-
/// Wraps:
25-
/// - filesystem errors (`io::Error`)
26-
/// - SQL parsing errors (`sqlparser::parser::ParserError`)
27-
/// - comment extraction errors (`comments::CommentError`)
28-
#[derive(Debug)]
29-
pub enum Error {
30-
/// `std::io::Error` for i/o errors
31-
Io(io::Error),
32-
/// `SqlParse` error for errors with the SQL parsing
33-
SqlParse(ParserError),
34-
/// `Comments` for [`CommentError`]
35-
Comments(CommentError),
36-
}
37-
38-
impl From<io::Error> for Error {
39-
fn from(err: io::Error) -> Self {
40-
Self::Io(err)
41-
}
42-
}
43-
44-
impl From<ParserError> for Error {
45-
fn from(err: ParserError) -> Self {
46-
Self::SqlParse(err)
47-
}
48-
}
49-
50-
impl From<CommentError> for Error {
51-
fn from(err: CommentError) -> Self {
52-
Self::Comments(err)
53-
}
54-
}
8+
pub mod docs;

0 commit comments

Comments
 (0)