shebling_parser/
lib.rs

1// // TODO: Remove all the #[allow(..)] after development.
2// #![allow(dead_code)]
3
4// mod ast;
5// mod diagnostic;
6// mod error;
7// mod location;
8// mod parser;
9
10// use std::cell::RefCell;
11
12// use diagnostic::{ParseDiagnostic, ParseDiagnosticBuilder};
13// use location::Span;
14
15// // region: Parsing context.
16// #[derive(Clone, Debug)]
17// struct ParseContext {
18//     diags: RefCell<Vec<ParseDiagnostic>>,
19// }
20
21// impl ParseContext {
22//     fn diag(&self, builder: ParseDiagnosticBuilder) {
23//         self.diags.borrow_mut().push(builder.build());
24//     }
25
26//     fn take_diags(&self) -> Vec<ParseDiagnostic> {
27//         self.diags.take()
28//     }
29// }
30// // endregion
31
32// pub(crate) fn source_to_span(source_code: &str) -> Span {
33//     let context = ParseContext {
34//         diags: RefCell::new(Vec::new()),
35//     };
36
37//     nom_locate::LocatedSpan::new_extra(source_code, context)
38// }
39
40// #[allow(unused_variables)]
41// pub fn parse(file_path: impl AsRef<str>, source_code: &str) {
42//     // HACK: When reporting errors, add a newline to the end of the source
43//     // so that miette can highlight the last character.
44
45//     parser::test(file_path, source_code);
46// }