clean up error stuff

This commit is contained in:
Schrottkatze 2024-01-07 15:18:39 +01:00
parent 27e9087d9f
commit b8c4d0a6c6

View file

@ -55,25 +55,22 @@ pub fn parse_the_shit_out_of_this_but_manually<'a>(
Ok(Token::Text(s)) => r.push(LanguageStructureThingy::Text(s)), Ok(Token::Text(s)) => r.push(LanguageStructureThingy::Text(s)),
Ok(Token::Newline) => r.push(LanguageStructureThingy::Text("\n".to_owned())), Ok(Token::Newline) => r.push(LanguageStructureThingy::Text("\n".to_owned())),
Ok(Token::ParenOpen) => hehe_sexpression_funy(&mut r, &mut lex), Ok(Token::ParenOpen) => hehe_sexpression_funy(&mut r, &mut lex),
Ok(Token::String(_)) => todo!(), Err(())
Ok(Token::Equals) => todo!(), | Ok(Token::ParenClose)
Ok(Token::Asterisk) => todo!(), | Ok(Token::String(_))
Ok(Token::Underscore) => todo!(), | Ok(Token::Equals)
Ok(Token::Backslash) => todo!(), | Ok(Token::Asterisk)
Ok(Token::WavyThing) => todo!(), | Ok(Token::Underscore)
Ok(Token::Sparkles) => todo!(), | Ok(Token::Backslash)
Ok(Token::HeadingLevelIndicator) => todo!(), | Ok(Token::WavyThing)
Err(()) | Ok(Token::ParenClose) => { | Ok(Token::Sparkles)
| Ok(Token::HeadingLevelIndicator) => {
reporter.report_diagnostic(*file_id, loc, DiagnosticKind::InvalidToken) reporter.report_diagnostic(*file_id, loc, DiagnosticKind::InvalidToken)
} }
} }
} }
reporter.fail_step_if_failed(); reporter.fail_step_if_failed();
// match lex.next() {
// Some(Err(e)) => panic!("mauuu~ :(, e: {e:?}"),
// None => break,
// }
r r
} }
@ -112,3 +109,11 @@ fn hehe_sexpression_funy(r: &mut Vec<LanguageStructureThingy>, lex: &mut Lexer<'
todo!() todo!()
} }
} }
fn mk_simple_sexpression(name: impl ToString, content: impl ToString) -> LanguageStructureThingy {
LanguageStructureThingy::Sexpression {
name: name.to_string(),
attrs: HashMap::new(),
content: Box::new(LanguageStructureThingy::Text(content.to_string())),
}
}