22 lines
703 B
C#
22 lines
703 B
C#
namespace ParadoxSaveParser.Lib;
|
|
|
|
/// <summary>"(a|b)" — matches if any alternative does.</summary>
|
|
internal sealed class MultipleMatchExpression(List<ISearchExpression> subExprs) : ISearchExpression
|
|
{
|
|
public bool DoesMatch(MatchCandidate candidate, out ISearchExpression? nextSearchExpression)
|
|
{
|
|
// the first matching alternative wins
|
|
foreach (var e in subExprs)
|
|
if (e.DoesMatch(candidate, out nextSearchExpression))
|
|
return true;
|
|
|
|
nextSearchExpression = null;
|
|
return false;
|
|
}
|
|
|
|
public void ReEncode(Encoding encoding)
|
|
{
|
|
foreach (var e in subExprs)
|
|
e.ReEncode(encoding);
|
|
}
|
|
} |