Skip to content

Commit

Permalink
Ran rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mysteriouslyseeing committed Dec 1, 2024
1 parent be999e3 commit 294a7ab
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
6 changes: 3 additions & 3 deletions logos-codegen/src/generator/leaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ impl<'a> Generator<'a> {
Some(Callback::SkipCallback(SkipCallback::Label(label))) => {
quote! {
#bump

trait SkipReturn {}
impl SkipReturn for () {}
impl SkipReturn for Skip {}

fn callback(lex: &mut Lexer) -> impl SkipReturn {
#label(lex)
}

callback(lex);

lex.trivia();
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion logos-codegen/src/leaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl Debug for Leaf<'_> {
Some(Callback::Label(ref label)) => write!(f, " ({})", label),
Some(Callback::Inline(_)) => f.write_str(" (<inline>)"),
Some(Callback::Skip(_)) => f.write_str(" (<skip>)"),
Some(Callback::SkipCallback(_)) => f.write_str( "(<skip callback>)"),
Some(Callback::SkipCallback(_)) => f.write_str("(<skip callback>)"),
None => Ok(()),
}
}
Expand Down
11 changes: 9 additions & 2 deletions logos-codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion logos-codegen/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ impl Parser {

Some(inline.into())
}

fn parse_skip_callback(&mut self, tokens: TokenStream) -> Option<SkipCallback> {
let span = tokens.span();
Some(match self.parse_callback(tokens) {
Expand Down

0 comments on commit 294a7ab

Please sign in to comment.