This commit is contained in:
Robin Appelman 2026-11-12 16:58:32 +01:00
commit b03d328ab9
Signed by: robin
SSH key fingerprint: SHA256:kifqgrqnut7q1YUIrI0AdMNC23qiKAS/T9uGFmIYvbE
19 changed files with 1081 additions and 978 deletions

View file

@ -23,7 +23,7 @@ impl<'a> RawEvent<'a> {
}
}
fn event_parser(input: &str) -> Result<RawEvent> {
fn event_parser(input: &str) -> Result<RawEvent<'_>> {
// println!("{}", input);
if input.len() < 24 {
return Err(Error::Skip);
@ -136,7 +136,7 @@ fn test_split_player_subject() {
);
}
pub fn against_subject_parser(input: &str) -> Result<RawSubject> {
pub fn against_subject_parser(input: &str) -> Result<RawSubject<'_>> {
// "against" fields are always players, and unquoted
if input.ends_with("le>") {
Ok(RawSubject::Console)
@ -145,7 +145,7 @@ pub fn against_subject_parser(input: &str) -> Result<RawSubject> {
}
}
pub fn subject_parser(input: &str) -> Result<(&str, RawSubject)> {
pub fn subject_parser(input: &str) -> Result<(&str, RawSubject<'_>)> {
let full = input;
if let Some(input) = input.strip_prefix('"') {
let Ok((player, input)) = split_subject_end(input, 1) else {
@ -313,13 +313,15 @@ pub enum RawEventType {
FlagEvent,
#[token(r#"cvars "#)]
CVars,
#[error]
Unknown,
}
fn event_type_parser(input: &str) -> Result<(&str, RawEventType)> {
let mut lexer = Lexer::new(input);
let ty = lexer.next().unwrap_or(RawEventType::Unknown);
let ty = lexer
.next()
.ok_or(Error::Incomplete)?
.unwrap_or(RawEventType::Unknown);
Ok((lexer.remainder(), ty))
}