public void MetaHeader() { var parser = new BVE5CommonParser("BveTs Station List", BVE5FileKind.StationList); var tree = parser.Parse(@"BveTs Station List 1.00 staA, A, 10:00:00, 10:01:00, 20, 10:00:30, 0, 10, 0.3, soundStaA, soundStaADeperture, 0.05, 5 ", "<string>", true); var expected1 = new List<TypeDescriber>{ TypeDescriber.Create(NodeType.Tree, new List<TypeDescriber>{ TypeDescriber.Create(NodeType.Statement, new List<TypeDescriber>{ TypeDescriber.Create(NodeType.Invocation, new List<TypeDescriber>{ TypeDescriber.Create(NodeType.Identifier, null), TypeDescriber.Create(NodeType.Literal, null), //staA TypeDescriber.Create(NodeType.Literal, null), //A TypeDescriber.Create(NodeType.TimeLiteral, null), //10:30:00 TypeDescriber.Create(NodeType.TimeLiteral, null), //10:30:30 TypeDescriber.Create(NodeType.Literal, null), //20 TypeDescriber.Create(NodeType.TimeLiteral, null), //10:30:00 TypeDescriber.Create(NodeType.Literal, null), //0 TypeDescriber.Create(NodeType.Literal, null), //10 TypeDescriber.Create(NodeType.Literal, null), //0.3 TypeDescriber.Create(NodeType.Literal, null), //soundStaA TypeDescriber.Create(NodeType.Literal, null), //soundStaADeperture TypeDescriber.Create(NodeType.Literal, null), //0.05 TypeDescriber.Create(NodeType.Literal, null) //5 }) }) }) }; Assert.IsFalse(parser.HasErrors); Helpers.TestStructualEqual(expected1.GetEnumerator(), tree); }
public void Invalid() { var parser = new BVE5CommonParser("BveTs Station List", BVE5FileKind.StationList); var tree = parser.Parse("bvets steition list 0.01\n", "<invalid header>", true); Assert.IsTrue(parser.HasErrors && parser.Errors.Count() == 1); Assert.IsNull(tree); }
internal BVE5CommonFileCompleter(BVE5FileKind kind) { SemanticInfo = BVE5ResourceManager.CommonFileSemanticInfos[kind.ToString()]; parser = ParserFactory.CreateCommonParser(kind); this.kind = kind; }