mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 16:15:43 +00:00
ZoneCodeGenerator: Make GroupOptional always add Tag due to consistency (Tags get added when matches succeeds)
This commit is contained in:
parent
7a6df40be5
commit
23f82894b7
@ -50,7 +50,7 @@ namespace ZoneCodeGenerator.Parsing.CommandFile.Tests
|
||||
private static readonly TokenMatcher evaluation = new MatcherGroupAnd(
|
||||
new MatcherGroupOr(
|
||||
new MatcherGroupAnd(
|
||||
new MatcherGroupOptional(new MatcherLiteral("!")).WithTag(TagEvaluationNot),
|
||||
new MatcherGroupOptional(new MatcherLiteral("!").WithTag(TagEvaluationNot)),
|
||||
new MatcherLiteral("("),
|
||||
new MatcherWithTag(TagEvaluation),
|
||||
new MatcherLiteral(")")
|
||||
@ -60,7 +60,7 @@ namespace ZoneCodeGenerator.Parsing.CommandFile.Tests
|
||||
new MatcherGroupOptional(new MatcherGroupAnd(
|
||||
new MatcherWithTag(TagOperationType),
|
||||
new MatcherWithTag(TagEvaluation)
|
||||
)).WithTag(TagEvaluationOperation)
|
||||
).WithTag(TagEvaluationOperation))
|
||||
|
||||
).WithTag(TagEvaluation);
|
||||
|
||||
|
@ -12,9 +12,14 @@
|
||||
protected override TokenMatchingResult PerformTest(MatchingContext context, int tokenOffset)
|
||||
{
|
||||
var result = matcher.Test(context, tokenOffset);
|
||||
result.PrependTag(Tag);
|
||||
|
||||
return !result.Successful ? new TokenMatchingResult(true, 0) : result;
|
||||
if (!result.Successful)
|
||||
{
|
||||
result = new TokenMatchingResult(true, 0);
|
||||
}
|
||||
|
||||
result.PrependTag(Tag);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected override string GetIdentifier()
|
||||
|
Loading…
x
Reference in New Issue
Block a user