mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-05-10 06:24:57 +00:00
ZoneCodeGenerator: Fix operationType tokens not being sorted by length so shorter tokens can be matched before longer ones
This commit is contained in:
parent
8d4e4c0025
commit
31b279c1e6
@ -330,7 +330,7 @@ set count GfxPixelShaderLoadDef::program programSize;
|
|||||||
// MaterialShaderArgument
|
// MaterialShaderArgument
|
||||||
use MaterialShaderArgument;
|
use MaterialShaderArgument;
|
||||||
//set condition u::literalConst type == MTL_ARG_LITERAL_VERTEX_CONST || type == MTL_ARG_LITERAL_PIXEL_CONST;
|
//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 reusable u::literalConst;
|
||||||
set count u::literalConst 1;
|
set count u::literalConst 1;
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ namespace ZoneCodeGenerator.Parsing.CommandFile.Tests
|
|||||||
// operationType ::= + | - | * | / | << | >> | ...
|
// operationType ::= + | - | * | / | << | >> | ...
|
||||||
private static readonly TokenMatcher operationType = new MatcherGroupOr(
|
private static readonly TokenMatcher operationType = new MatcherGroupOr(
|
||||||
OperationType.Types
|
OperationType.Types
|
||||||
|
.OrderByDescending(type => type.Syntax.Length)
|
||||||
.Select(type => new MatcherLiteral(type.Syntax.ToCharArray().Select(c => c.ToString()).ToArray()).WithName(TokenOperationType))
|
.Select(type => new MatcherLiteral(type.Syntax.ToCharArray().Select(c => c.ToString()).ToArray()).WithName(TokenOperationType))
|
||||||
.Cast<TokenMatcher>().ToArray()
|
.Cast<TokenMatcher>().ToArray()
|
||||||
).WithTag(TagOperationType);
|
).WithTag(TagOperationType);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user