diff --git a/ParadoxSaveParser.Lib/SearchExpression.cs b/ParadoxSaveParser.Lib/SearchExpression.cs index afa4b46..1acd038 100644 --- a/ParadoxSaveParser.Lib/SearchExpression.cs +++ b/ParadoxSaveParser.Lib/SearchExpression.cs @@ -88,7 +88,9 @@ public static class SearchExpressionCompiler remaining = query.Slice(partBeforePointLength + 1); if (part is "*") return new AnyMatchExpression(remaining.IsEmpty ? null : Compile(remaining)); - + if (part is "~") + return new NoMatchExpression(); + for (int j = 0; j < part.Length; j++) if (CharEqualsAndNotEscaped('*', part, j)) throw new NotImplementedException("pattern matching other than '*' is not implemented yet"); @@ -112,6 +114,15 @@ public static class SearchExpressionCompiler } } + private record NoMatchExpression : ISearchExpression + { + public bool DoesMatch(SearchArgs args, out ISearchExpression? nextSearchExpression) + { + nextSearchExpression = null; + return false; + } + } + private record MultipleMatchExpression(List subExprs) : ISearchExpression { public bool DoesMatch(SearchArgs args, out ISearchExpression? nextSearchExpression)