From 3d30915308b1bf2a80b4568e33f7bc5464c424fd Mon Sep 17 00:00:00 2001 From: Jan Date: Thu, 31 Oct 2019 15:41:35 +0100 Subject: [PATCH] ZoneCodeGenerator: Remove align statement. Alignments will be defined via types created by a typedef that have a __declspec(align(X)) part --- src/ZoneCode/Game/T6/T6_Commands.txt | 1 - .../CommandFile/Impl/CommandParserState.cs | 1 - .../Parsing/CommandFile/Tests/TestAlign.cs | 35 ------------- .../CommandFile/Tests/TestAlignTest.cs | 52 ------------------- 4 files changed, 89 deletions(-) delete mode 100644 src/ZoneCodeGenerator/Parsing/CommandFile/Tests/TestAlign.cs delete mode 100644 test/ZoneCodeGeneratorTests/Parsing/CommandFile/Tests/TestAlignTest.cs diff --git a/src/ZoneCode/Game/T6/T6_Commands.txt b/src/ZoneCode/Game/T6/T6_Commands.txt index 116f0074..ea487a89 100644 --- a/src/ZoneCode/Game/T6/T6_Commands.txt +++ b/src/ZoneCode/Game/T6/T6_Commands.txt @@ -195,7 +195,6 @@ set count verts0 vertCount; set count vb0 0; set count vertList vertListCount; set count triIndices triCount; -set align triIndices 16; set count indexBuffer 0; reorder: vertInfo diff --git a/src/ZoneCodeGenerator/Parsing/CommandFile/Impl/CommandParserState.cs b/src/ZoneCodeGenerator/Parsing/CommandFile/Impl/CommandParserState.cs index 4b9ec688..b0af95ab 100644 --- a/src/ZoneCodeGenerator/Parsing/CommandFile/Impl/CommandParserState.cs +++ b/src/ZoneCodeGenerator/Parsing/CommandFile/Impl/CommandParserState.cs @@ -11,7 +11,6 @@ namespace ZoneCodeGenerator.Parsing.CommandFile.Impl class CommandParserState : ICommandParserState { private static readonly ITokenTest[] tests = { - new TestAlign(), new TestAsset(), new TestBlock(), new TestCondition(), diff --git a/src/ZoneCodeGenerator/Parsing/CommandFile/Tests/TestAlign.cs b/src/ZoneCodeGenerator/Parsing/CommandFile/Tests/TestAlign.cs deleted file mode 100644 index 6851dd34..00000000 --- a/src/ZoneCodeGenerator/Parsing/CommandFile/Tests/TestAlign.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using ZoneCodeGenerator.Parsing.Matching; -using ZoneCodeGenerator.Parsing.Matching.Matchers; -using ZoneCodeGenerator.Parsing.Testing; - -namespace ZoneCodeGenerator.Parsing.CommandFile.Tests -{ - class TestAlign : AbstractTokenTest - { - private const string MemberTypeNameToken = "name"; - private const string AlignValueToken = "align"; - - private static readonly TokenMatcher[] matchers = { - new MatcherLiteral("set"), - new MatcherLiteral("align"), - new MatcherTypename().WithName(MemberTypeNameToken), - new MatcherNumber().WithName(AlignValueToken), - new MatcherLiteral(";") - }; - - public TestAlign() : base(matchers) - { - - } - - protected override void ProcessMatch(ICommandParserState state) - { - - } - } -} diff --git a/test/ZoneCodeGeneratorTests/Parsing/CommandFile/Tests/TestAlignTest.cs b/test/ZoneCodeGeneratorTests/Parsing/CommandFile/Tests/TestAlignTest.cs deleted file mode 100644 index 146a8ba3..00000000 --- a/test/ZoneCodeGeneratorTests/Parsing/CommandFile/Tests/TestAlignTest.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Moq; -using ZoneCodeGenerator.Parsing; -using ZoneCodeGenerator.Parsing.CommandFile; -using ZoneCodeGenerator.Parsing.CommandFile.Tests; -using ZoneCodeGenerator.Parsing.Testing; - -namespace ZoneCodeGeneratorTests.Parsing.CommandFile.Tests -{ - [TestClass] - public class TestAlignTest - { - private Mock parserStateMock; - - private Mock lexerMock; - private int tokenOffset; - private List tokens; - - [TestInitialize] - public void Setup() - { - parserStateMock = new Mock(); - - tokenOffset = 0; - tokens = new List(); - lexerMock = new Mock(); - - lexerMock.Setup(lexer => lexer.PeekToken(It.IsAny())) - .Returns((int index) => tokens.ElementAtOrDefault(index + tokenOffset)); - lexerMock.Setup(lexer => lexer.NextToken()) - .Returns(() => tokens.ElementAtOrDefault(tokenOffset++)); - lexerMock.Setup(lexer => lexer.SkipTokens(It.IsAny())) - .Callback((int count) => tokenOffset += count); - } - - [TestMethod] - public void EnsureAcceptsSimpleAlignStatement() - { - tokens.AddRange(new List - { - "set", "align", "test", ":", ":", "type", "16", ";" - }); - - var test = new TestAlign(); - - Assert.AreEqual(TokenTestResult.Match, test.PerformTest(parserStateMock.Object, lexerMock.Object)); - Assert.AreEqual(8, test.ConsumedTokenCount); - } - } -}