mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-19 15:52:53 +00:00
ZoneCodeGenerator: Remove unused condition matchers in count test
This commit is contained in:
parent
0ee689532b
commit
f13eac7436
@ -11,12 +11,11 @@ namespace ZoneCodeGenerator.Parsing.CommandFile.Tests
|
|||||||
class TestCount : AbstractTokenTest<ICommandParserState>
|
class TestCount : AbstractTokenTest<ICommandParserState>
|
||||||
{
|
{
|
||||||
private const string TypeNameToken = "typeName";
|
private const string TypeNameToken = "typeName";
|
||||||
private const string ConditionStatementTag = "conditionStatement";
|
private const string CalculationStatementTag = "calculationStatement";
|
||||||
private const string ConditionChainTag = "conditionChain";
|
|
||||||
private const string ConditionChainLinkTag = "conditionChainLink";
|
|
||||||
private const string OperationTag = "operation";
|
private const string OperationTag = "operation";
|
||||||
private const string OperandTag = "operand";
|
private const string OperandTag = "operand";
|
||||||
|
|
||||||
|
// operand ::= <typename> <array>* | <number>
|
||||||
private static readonly TokenMatcher operand = new MatcherGroupOr(
|
private static readonly TokenMatcher operand = new MatcherGroupOr(
|
||||||
new MatcherGroupAnd(
|
new MatcherGroupAnd(
|
||||||
new MatcherTypename(),
|
new MatcherTypename(),
|
||||||
@ -25,6 +24,7 @@ namespace ZoneCodeGenerator.Parsing.CommandFile.Tests
|
|||||||
new MatcherNumber()
|
new MatcherNumber()
|
||||||
).WithTag(OperandTag);
|
).WithTag(OperandTag);
|
||||||
|
|
||||||
|
// operation ::= + | - | * | / | << | >>
|
||||||
private static readonly TokenMatcher operation = new MatcherGroupOr(
|
private static readonly TokenMatcher operation = new MatcherGroupOr(
|
||||||
new MatcherLiteral("+"),
|
new MatcherLiteral("+"),
|
||||||
new MatcherLiteral("-"),
|
new MatcherLiteral("-"),
|
||||||
@ -34,54 +34,41 @@ namespace ZoneCodeGenerator.Parsing.CommandFile.Tests
|
|||||||
new MatcherGroupAnd(new MatcherLiteral(">"), new MatcherLiteral(">"))
|
new MatcherGroupAnd(new MatcherLiteral(">"), new MatcherLiteral(">"))
|
||||||
).WithTag(OperationTag);
|
).WithTag(OperationTag);
|
||||||
|
|
||||||
private static readonly TokenMatcher conditionStatement = new MatcherGroupOr(
|
// calculationStatement ::= ( <calculationStatement> ) | <operand> [<operation> <calculationStatement>]
|
||||||
|
private static readonly TokenMatcher calculationStatement = new MatcherGroupOr(
|
||||||
new MatcherGroupAnd(
|
new MatcherGroupAnd(
|
||||||
new MatcherLiteral("("),
|
new MatcherLiteral("("),
|
||||||
new MatcherWithTag(ConditionStatementTag),
|
new MatcherWithTag(CalculationStatementTag),
|
||||||
new MatcherLiteral(")")
|
new MatcherLiteral(")")
|
||||||
),
|
),
|
||||||
new MatcherGroupAnd(
|
new MatcherGroupAnd(
|
||||||
new MatcherWithTag(OperandTag),
|
new MatcherWithTag(OperandTag),
|
||||||
new MatcherGroupOptional(new MatcherGroupAnd(
|
new MatcherGroupOptional(new MatcherGroupAnd(
|
||||||
new MatcherWithTag(OperationTag),
|
new MatcherWithTag(OperationTag),
|
||||||
new MatcherWithTag(OperandTag)
|
new MatcherWithTag(CalculationStatementTag)
|
||||||
))
|
))
|
||||||
)
|
)
|
||||||
).WithTag(ConditionStatementTag);
|
).WithTag(CalculationStatementTag);
|
||||||
|
|
||||||
private static readonly TokenMatcher conditionChainLink = new MatcherGroupOr(
|
// set count <typename> <calculationStatement>;
|
||||||
new MatcherGroupAnd(new MatcherLiteral("|"), new MatcherLiteral("|")),
|
private static readonly TokenMatcher[] matchers =
|
||||||
new MatcherGroupAnd(new MatcherLiteral("&"), new MatcherLiteral("&"))
|
{
|
||||||
).WithTag(ConditionChainLinkTag);
|
|
||||||
|
|
||||||
private static readonly TokenMatcher conditionChain = new MatcherGroupAnd(
|
|
||||||
new MatcherWithTag(ConditionStatementTag),
|
|
||||||
new MatcherGroupLoop(MatcherGroupLoop.LoopMode.ZeroOneMultiple, new MatcherGroupAnd(
|
|
||||||
new MatcherWithTag(ConditionChainLinkTag),
|
|
||||||
new MatcherWithTag(ConditionStatementTag)
|
|
||||||
))
|
|
||||||
).WithTag(ConditionChainTag);
|
|
||||||
|
|
||||||
private static readonly TokenMatcher[] matchers = {
|
|
||||||
new MatcherLiteral("set"),
|
new MatcherLiteral("set"),
|
||||||
new MatcherLiteral("count"),
|
new MatcherLiteral("count"),
|
||||||
new MatcherTypename().WithName(TypeNameToken),
|
new MatcherTypename().WithName(TypeNameToken),
|
||||||
new MatcherWithTag(ConditionChainTag),
|
new MatcherWithTag(CalculationStatementTag),
|
||||||
new MatcherLiteral(";")
|
new MatcherLiteral(";")
|
||||||
};
|
};
|
||||||
|
|
||||||
public TestCount() : base(matchers)
|
public TestCount() : base(matchers)
|
||||||
{
|
{
|
||||||
AddTaggedMatcher(conditionStatement);
|
|
||||||
AddTaggedMatcher(conditionChain);
|
|
||||||
AddTaggedMatcher(conditionChainLink);
|
|
||||||
AddTaggedMatcher(operation);
|
|
||||||
AddTaggedMatcher(operand);
|
AddTaggedMatcher(operand);
|
||||||
|
AddTaggedMatcher(operation);
|
||||||
|
AddTaggedMatcher(calculationStatement);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ProcessMatch(ICommandParserState state)
|
protected override void ProcessMatch(ICommandParserState state)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user