mirror of
https://codeberg.org/icewind/tf-log-parser.git
synced 2026-06-03 18:24:09 +02:00
handle quote in names in kills
This commit is contained in:
parent
b32f8dd340
commit
a18068e957
2 changed files with 8 additions and 2 deletions
|
|
@ -158,6 +158,7 @@ pub struct EventParam {
|
|||
optional: bool,
|
||||
skip_after: u64,
|
||||
quoted: bool,
|
||||
subject: bool,
|
||||
}
|
||||
|
||||
impl EventParam {
|
||||
|
|
@ -190,6 +191,7 @@ impl EventParam {
|
|||
}
|
||||
let quoted =
|
||||
get_attribute_value(&input.attrs, &["event", "quoted"]).unwrap_or(param_name.is_none());
|
||||
let subject = contains_attribute(&input.attrs, &["event", "subject"]);
|
||||
|
||||
Ok(EventParam {
|
||||
span: input.span(),
|
||||
|
|
@ -198,6 +200,7 @@ impl EventParam {
|
|||
optional,
|
||||
skip_after,
|
||||
quoted,
|
||||
subject,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -206,7 +209,9 @@ impl EventParam {
|
|||
}
|
||||
|
||||
fn field_parser(&self) -> TokenStream {
|
||||
if self.quoted {
|
||||
if self.subject {
|
||||
quote_spanned!(self.span() => subject_parser)
|
||||
} else if self.quoted {
|
||||
quote_spanned!(self.span() => quoted(parse_field))
|
||||
} else {
|
||||
quote_spanned!(self.span() => parse_field)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::common::{Class, Team};
|
||||
use crate::event::{param_parse_with, parse_field, quoted, ParamIter};
|
||||
use crate::raw_event::RawSubject;
|
||||
use crate::raw_event::{subject_parser, RawSubject};
|
||||
use crate::{Error, Event, Result};
|
||||
use std::net::SocketAddr;
|
||||
use std::num::NonZeroU32;
|
||||
|
|
@ -28,6 +28,7 @@ pub struct DamageEvent<'a> {
|
|||
#[derive(Debug, Event)]
|
||||
pub struct KillEvent<'a> {
|
||||
#[event(unnamed)]
|
||||
#[event(subject)]
|
||||
#[event(skip_after = 1)]
|
||||
pub target: RawSubject<'a>,
|
||||
#[event(name = "with")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue