1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-05-28 19:13:38 +02:00
MLEM/MLEM/Formatting/Codes/SimpleEndCode.cs

21 lines
554 B
C#

using System.Text.RegularExpressions;
namespace MLEM.Formatting.Codes {
/// <inheritdoc />
public class SimpleEndCode : Code {
private readonly Regex codeToEnd;
/// <inheritdoc />
public SimpleEndCode(Match match, Regex regex, string codeNameToEnd) : base(match, regex) {
this.codeToEnd = new Regex($@"<{codeNameToEnd}(\W.*)?>");
}
/// <inheritdoc />
public override bool EndsOther(Code other) {
return this.codeToEnd.IsMatch(other.Regex.ToString());
}
}
}