From 294a7ab3f2e8310908976522765de11fcc133153 Mon Sep 17 00:00:00 2001 From: mysteriouslyseeing <61419567+mysteriouslyseeing@users.noreply.github.com> Date: Sun, 1 Dec 2024 23:13:17 +1100 Subject: [PATCH] Ran rustfmt --- logos-codegen/src/generator/leaf.rs | 6 +++--- logos-codegen/src/leaf.rs | 2 +- logos-codegen/src/lib.rs | 11 +++++++++-- logos-codegen/src/parser/mod.rs | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/logos-codegen/src/generator/leaf.rs b/logos-codegen/src/generator/leaf.rs index 6aaee515..9ee7fb6e 100644 --- a/logos-codegen/src/generator/leaf.rs +++ b/logos-codegen/src/generator/leaf.rs @@ -49,7 +49,7 @@ impl<'a> Generator<'a> { Some(Callback::SkipCallback(SkipCallback::Label(label))) => { quote! { #bump - + trait SkipReturn {} impl SkipReturn for () {} impl SkipReturn for Skip {} @@ -57,7 +57,7 @@ impl<'a> Generator<'a> { fn callback(lex: &mut Lexer) -> impl SkipReturn { #label(lex) } - + callback(lex); lex.trivia(); @@ -74,7 +74,7 @@ impl<'a> Generator<'a> { trait SkipReturn {} impl SkipReturn for () {} impl SkipReturn for Skip {} - + fn callback(#arg: &mut Lexer) -> impl SkipReturn { #body } diff --git a/logos-codegen/src/leaf.rs b/logos-codegen/src/leaf.rs index ba1ae5ff..b3fdfa17 100644 --- a/logos-codegen/src/leaf.rs +++ b/logos-codegen/src/leaf.rs @@ -106,7 +106,7 @@ impl Debug for Leaf<'_> { Some(Callback::Label(ref label)) => write!(f, " ({})", label), Some(Callback::Inline(_)) => f.write_str(" ()"), Some(Callback::Skip(_)) => f.write_str(" ()"), - Some(Callback::SkipCallback(_)) => f.write_str( "()"), + Some(Callback::SkipCallback(_)) => f.write_str("()"), None => Ok(()), } } diff --git a/logos-codegen/src/lib.rs b/logos-codegen/src/lib.rs index cc1be2e3..6ad57274 100644 --- a/logos-codegen/src/lib.rs +++ b/logos-codegen/src/lib.rs @@ -70,9 +70,16 @@ pub fn generate(input: TokenStream) -> TokenStream { let errors = &mut parser.errors; for mut skip in parser.skips.drain(..) { - match skip.literal.to_mir(&parser.subpatterns, IgnoreFlags::Empty, errors) { + match skip + .literal + .to_mir(&parser.subpatterns, IgnoreFlags::Empty, errors) + { Ok(mir) => { - let then = graph.push(Leaf::new_skip(skip.literal.span()).priority(skip.priority.take().unwrap_or_else(|| mir.priority())).callback(Some(skip.into_callback()))); + let then = graph.push( + Leaf::new_skip(skip.literal.span()) + .priority(skip.priority.take().unwrap_or_else(|| mir.priority())) + .callback(Some(skip.into_callback())), + ); let id = graph.regex(mir, then); regex_ids.push(id); diff --git a/logos-codegen/src/parser/mod.rs b/logos-codegen/src/parser/mod.rs index 16d65404..34e11a77 100644 --- a/logos-codegen/src/parser/mod.rs +++ b/logos-codegen/src/parser/mod.rs @@ -352,7 +352,7 @@ impl Parser { Some(inline.into()) } - + fn parse_skip_callback(&mut self, tokens: TokenStream) -> Option { let span = tokens.span(); Some(match self.parse_callback(tokens) {