File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ //! Module for parsing sql and comments and returning only comments connected to statements
Original file line number Diff line number Diff line change 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-
115pub mod files;
126pub mod ast;
137pub 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;
You can’t perform that action at this time.
0 commit comments