コード例 #1
0
        public void ParsePosition()
        {
            var simpleParser     = new GenericParserHelper <SimpleConceptInfo>("abc");
            var tokenReader      = TestTokenReader("simple abc def", 1);
            SimpleConceptInfo ci = (SimpleConceptInfo)simpleParser.Parse(tokenReader, new Stack <IConceptInfo>()).Value;

            Assert.AreEqual("def", ci.Name);
            TestUtility.AssertContains(tokenReader.ReportPosition(), "column 15,");
        }
コード例 #2
0
        public void ParseEnclosed()
        {
            var enclosedParser = new GenericParserHelper <EnclosedConceptInfo>("enclosed");

            Stack <IConceptInfo> stack = new Stack <IConceptInfo>();

            stack.Push(new SimpleConceptInfo {
                Name = "a"
            });

            var tokenReader        = TestTokenReader("simple a { enclosed b; }", 3);
            EnclosedConceptInfo ci = (EnclosedConceptInfo)enclosedParser.Parse(tokenReader, stack).Value;

            Assert.AreEqual("a", ci.Parent.Name);
            Assert.AreEqual("b", ci.Name);
            TestUtility.AssertContains(tokenReader.ReportPosition(), "before: \";");
        }