mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-09-27 08:51:04 +02:00
20 lines
554 B
C#
20 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());
|
|
}
|
|
|
|
}
|
|
}
|