From 31b279c1e6f89ce87c9e5c7d06d423e8208e9aab Mon Sep 17 00:00:00 2001 From: Jan Date: Tue, 19 Nov 2019 12:55:04 +0100 Subject: [PATCH] ZoneCodeGenerator: Fix operationType tokens not being sorted by length so shorter tokens can be matched before longer ones --- src/ZoneCode/Game/T6/T6_Commands.txt | 2 +- .../Parsing/CommandFile/Tests/TestWithEvaluation.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ZoneCode/Game/T6/T6_Commands.txt b/src/ZoneCode/Game/T6/T6_Commands.txt index dd6b95c1..e19258fc 100644 --- a/src/ZoneCode/Game/T6/T6_Commands.txt +++ b/src/ZoneCode/Game/T6/T6_Commands.txt @@ -330,7 +330,7 @@ set count GfxPixelShaderLoadDef::program programSize; // MaterialShaderArgument use MaterialShaderArgument; //set condition u::literalConst type == MTL_ARG_LITERAL_VERTEX_CONST || type == MTL_ARG_LITERAL_PIXEL_CONST; -//set condition u::literalConst type == 1 || type == 7; +set condition u::literalConst type == 1 || type == 7; set reusable u::literalConst; set count u::literalConst 1; diff --git a/src/ZoneCodeGenerator/Parsing/CommandFile/Tests/TestWithEvaluation.cs b/src/ZoneCodeGenerator/Parsing/CommandFile/Tests/TestWithEvaluation.cs index 3a9c6994..89f14b27 100644 --- a/src/ZoneCodeGenerator/Parsing/CommandFile/Tests/TestWithEvaluation.cs +++ b/src/ZoneCodeGenerator/Parsing/CommandFile/Tests/TestWithEvaluation.cs @@ -44,6 +44,7 @@ namespace ZoneCodeGenerator.Parsing.CommandFile.Tests // operationType ::= + | - | * | / | << | >> | ... private static readonly TokenMatcher operationType = new MatcherGroupOr( OperationType.Types + .OrderByDescending(type => type.Syntax.Length) .Select(type => new MatcherLiteral(type.Syntax.ToCharArray().Select(c => c.ToString()).ToArray()).WithName(TokenOperationType)) .Cast().ToArray() ).WithTag(TagOperationType);