mirror of
https://codeberg.org/icewind/tf-log-parser.git
synced 2026-06-03 10:14:10 +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,
|
optional: bool,
|
||||||
skip_after: u64,
|
skip_after: u64,
|
||||||
quoted: bool,
|
quoted: bool,
|
||||||
|
subject: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EventParam {
|
impl EventParam {
|
||||||
|
|
@ -190,6 +191,7 @@ impl EventParam {
|
||||||
}
|
}
|
||||||
let quoted =
|
let quoted =
|
||||||
get_attribute_value(&input.attrs, &["event", "quoted"]).unwrap_or(param_name.is_none());
|
get_attribute_value(&input.attrs, &["event", "quoted"]).unwrap_or(param_name.is_none());
|
||||||
|
let subject = contains_attribute(&input.attrs, &["event", "subject"]);
|
||||||
|
|
||||||
Ok(EventParam {
|
Ok(EventParam {
|
||||||
span: input.span(),
|
span: input.span(),
|
||||||
|
|
@ -198,6 +200,7 @@ impl EventParam {
|
||||||
optional,
|
optional,
|
||||||
skip_after,
|
skip_after,
|
||||||
quoted,
|
quoted,
|
||||||
|
subject,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -206,7 +209,9 @@ impl EventParam {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn field_parser(&self) -> TokenStream {
|
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))
|
quote_spanned!(self.span() => quoted(parse_field))
|
||||||
} else {
|
} else {
|
||||||
quote_spanned!(self.span() => parse_field)
|
quote_spanned!(self.span() => parse_field)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::common::{Class, Team};
|
use crate::common::{Class, Team};
|
||||||
use crate::event::{param_parse_with, parse_field, quoted, ParamIter};
|
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 crate::{Error, Event, Result};
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
use std::num::NonZeroU32;
|
use std::num::NonZeroU32;
|
||||||
|
|
@ -28,6 +28,7 @@ pub struct DamageEvent<'a> {
|
||||||
#[derive(Debug, Event)]
|
#[derive(Debug, Event)]
|
||||||
pub struct KillEvent<'a> {
|
pub struct KillEvent<'a> {
|
||||||
#[event(unnamed)]
|
#[event(unnamed)]
|
||||||
|
#[event(subject)]
|
||||||
#[event(skip_after = 1)]
|
#[event(skip_after = 1)]
|
||||||
pub target: RawSubject<'a>,
|
pub target: RawSubject<'a>,
|
||||||
#[event(name = "with")]
|
#[event(name = "with")]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue