mirror of
https://codeberg.org/icewind/tf-log-parser.git
synced 2026-06-03 18:24:09 +02:00
healspread
This commit is contained in:
parent
747ee7d1a9
commit
d1b3525b2a
10 changed files with 209 additions and 16 deletions
22
src/event/medic.rs
Normal file
22
src/event/medic.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
use crate::raw_event::{subject_parser, RawSubject};
|
||||
use nom::bytes::complete::tag;
|
||||
use nom::character::complete::digit1;
|
||||
use nom::error::ErrorKind;
|
||||
use nom::IResult;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct HealedEvent<'a> {
|
||||
pub subject: RawSubject<'a>,
|
||||
pub amount: u32,
|
||||
}
|
||||
|
||||
pub fn healed_event_parser(input: &str) -> IResult<&str, HealedEvent> {
|
||||
let (input, _) = tag("against ")(input)?;
|
||||
let (input, subject) = subject_parser(input)?;
|
||||
let (input, _) = tag(r#" (healing ""#)(input)?;
|
||||
let (input, raw_amount) = digit1(input)?;
|
||||
let amount = raw_amount
|
||||
.parse()
|
||||
.map_err(|_| nom::Err::Error(nom::error::Error::new(raw_amount, ErrorKind::Digit)))?;
|
||||
Ok((input, HealedEvent { subject, amount }))
|
||||
}
|
||||
3
src/event/mod.rs
Normal file
3
src/event/mod.rs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
mod medic;
|
||||
|
||||
pub use medic::{healed_event_parser, HealedEvent};
|
||||
Loading…
Add table
Add a link
Reference in a new issue