From 992418a27d62622695aaa5a34e23be59c4f8b87c Mon Sep 17 00:00:00 2001 From: John Lapeyre Date: Mon, 18 Mar 2024 23:10:15 -0400 Subject: [PATCH] Remove some cruft and correct doc strings related to prev commit (#180) --- crates/oq3_syntax/src/lib.rs | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/crates/oq3_syntax/src/lib.rs b/crates/oq3_syntax/src/lib.rs index fdbf405..e58905c 100644 --- a/crates/oq3_syntax/src/lib.rs +++ b/crates/oq3_syntax/src/lib.rs @@ -118,15 +118,6 @@ impl Parse { } impl Parse { - // FIXME: This is apparently not used anywhere - // pub fn to_syntax(self) -> Parse { - // Parse { - // green: self.green, - // errors: self.errors, - // _ty: PhantomData, - // } - // } - pub fn tree(&self) -> T { T::cast(self.syntax_node()).unwrap() } @@ -216,15 +207,6 @@ impl ParseOrErrors { pub fn tree(&self) -> T { T::cast(self.syntax_node()).unwrap() } - - // May not need to duplicate this, which is implemented for `Parse` - // pub fn ok(self) -> Result>> { - // if self.errors.is_empty() { - // Ok(self.tree()) - // } else { - // Err(self.errors) - // } - // } } /// `SourceFile` represents a parse tree for a single OQ3 file. @@ -243,9 +225,10 @@ impl SourceFile { } } - // If there are lexer errors, do not parse and do not return `Parse`. - // If there are lexer errors, return `(None, Some(errors))` - // If there are no lexer errors, return `(Some(Parse), None)` + /// Lex `text` and parse the result if there are no lexing errors. + /// The green tree is wrapped in `Option` to account for the case + /// that there *are* lexing errors and no parsing is done and no + /// tree is built. pub fn parse_check_lex(text: &str) -> ParseOrErrors { let (green_maybe, mut errors) = parsing::parse_text_check_lex(text); if let Some(ref green) = green_maybe {