aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel <kingdread@gmx.de>2020-05-12 14:19:18 +0200
committerDaniel <kingdread@gmx.de>2020-05-12 14:19:18 +0200
commitb2e87338ff60851db8326abf50555bf65b311810 (patch)
tree9e9b9579985016f10f6cbb1ca70fcbcd26f10982 /src
parent331dbac270273889111a3cd4bb73d16eeaf5ebde (diff)
downloadraidgrep-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')
-rw-r--r--src/fexpr/grammar.lalrpop36
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 = {