Import code from previous AssetBuilder version

This commit is contained in:
Jan
2019-09-24 10:45:09 +02:00
parent 5609557516
commit 0d8432d4f7
919 changed files with 154412 additions and 26 deletions

View File

@ -0,0 +1,41 @@
using ZoneCodeGenerator.Parsing.Matching;
namespace ZoneCodeGeneratorTests.Parsing.Matching.Matchers
{
class TestMatcher : TokenMatcher
{
private readonly int tokenCount;
private readonly string tokenName;
public bool Successful { get; set; }
public int TestTokenOffset { get; private set; }
public bool WasTested { get; private set; }
public TestMatcher(bool successful, int tokenCount, string tokenName = "")
{
Successful = successful;
this.tokenCount = tokenCount;
this.tokenName = tokenName;
TestTokenOffset = 0;
WasTested = false;
}
protected override string GetIdentifier()
{
return "TestMatcher";
}
protected override TokenMatchingResult PerformTest(MatchingContext context, int tokenOffset)
{
var result = new TokenMatchingResult(Successful, Successful ? tokenCount : 0);
if(!string.IsNullOrEmpty(tokenName))
result.AddNamedMatch(tokenName, "test");
TestTokenOffset = tokenOffset;
WasTested = true;
return result;
}
}
}