diff options
author | Daniel <kingdread@gmx.de> | 2020-05-12 14:19:18 +0200 |
---|---|---|
committer | Daniel <kingdread@gmx.de> | 2020-05-12 14:19:18 +0200 |
commit | b2e87338ff60851db8326abf50555bf65b311810 (patch) | |
tree | 9e9b9579985016f10f6cbb1ca70fcbcd26f10982 /src/fexpr/grammar.lalrpop | |
parent | 331dbac270273889111a3cd4bb73d16eeaf5ebde (diff) | |
download | raidgrep-b2e87338ff60851db8326abf50555bf65b311810.tar.gz raidgrep-b2e87338ff60851db8326abf50555bf65b311810.tar.bz2 raidgrep-b2e87338ff60851db8326abf50555bf65b311810.zip |
make regular expressions case-insensitive
Most users probably don't need the capitalization, and character names
always have a predefined capitalization anyway.
Diffstat (limited to 'src/fexpr/grammar.lalrpop')
-rw-r--r-- | src/fexpr/grammar.lalrpop | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/src/fexpr/grammar.lalrpop b/src/fexpr/grammar.lalrpop index 1540aae..6a7a9a0 100644 --- a/src/fexpr/grammar.lalrpop +++ b/src/fexpr/grammar.lalrpop @@ -11,7 +11,7 @@ use std::collections::HashSet; use lalrpop_util::ParseError; use chrono::{DateTime, Local, TimeZone, Utc, Weekday}; -use regex::Regex; +use regex::{Regex, RegexBuilder}; grammar; @@ -85,20 +85,26 @@ PlayerPredicate: Box<dyn filters::player::PlayerFilter> = { } Regex: Regex = { - <l:@L> <s:string> =>? Regex::new(&s[1..s.len() - 1]).map_err(|error| ParseError::User { - error: FError { - location: l, - data: s.to_string(), - kind: error.into(), - } - }), - <l:@L> <s:word> =>? Regex::new(s).map_err(|error| ParseError::User { - error: FError { - location: l, - data: s.to_string(), - kind: error.into(), - } - }), + <l:@L> <s:string> =>? RegexBuilder::new(&s[1..s.len() - 1]) + .case_insensitive(true) + .build() + .map_err(|error| ParseError::User { + error: FError { + location: l, + data: s.to_string(), + kind: error.into(), + } + }), + <l:@L> <s:word> =>? RegexBuilder::new(s) + .case_insensitive(true) + .build() + .map_err(|error| ParseError::User { + error: FError { + location: l, + data: s.to_string(), + kind: error.into(), + } + }), } FightOutcome: FightOutcome = { |