当前位置: 首页>>代码示例>>C#>>正文


C# Lexer.ParseMessageField方法代码示例

本文整理汇总了C#中Lexer.Lexer.ParseMessageField方法的典型用法代码示例。如果您正苦于以下问题:C# Lexer.ParseMessageField方法的具体用法?C# Lexer.ParseMessageField怎么用?C# Lexer.ParseMessageField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Lexer.Lexer的用法示例。


在下文中一共展示了Lexer.ParseMessageField方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MessageField_NOK05

        public void MessageField_NOK05()
        {
            const string text = "  option"; // statement not finished

            var lex = new Lexer(text) { Matches = Helper.SplitText(text) };

            Assert.IsFalse(lex.ParseMessageField());

            Assert.AreEqual(0, lex.Tokens.Count);
            Assert.AreEqual(1, lex.Errors.Count);
            Assert.AreEqual(1, lex.Index);
        }
开发者ID:mreu,项目名称:ProtobufLanguageService,代码行数:12,代码来源:ParseMessageFieldTest.cs

示例2: MessageField_NOK02

        public void MessageField_NOK02()
        {
            const string text = "  optional string test1 ;"; // = + number is missing

            var lex = new Lexer(text) { Matches = Helper.SplitText(text) };

            Assert.IsFalse(lex.ParseMessageField());

            Assert.AreEqual(3, lex.Tokens.Count);
            Assert.AreEqual(1, lex.Errors.Count);
            Assert.AreEqual(3, lex.Index);
        }
开发者ID:mreu,项目名称:ProtobufLanguageService,代码行数:12,代码来源:ParseMessageFieldTest.cs

示例3: MessageField_NOK06

        public void MessageField_NOK06()
        {
            const string text = "  optional test1 = ;"; // statement incomplete

            var lex = new Lexer(text) { Matches = Helper.SplitText(text) };

            Assert.IsFalse(lex.ParseMessageField());

            Assert.AreEqual(2, lex.Tokens.Count);
            Assert.AreEqual(1, lex.Errors.Count);
            Assert.AreEqual(2, lex.Index);
        }
开发者ID:mreu,项目名称:ProtobufLanguageService,代码行数:12,代码来源:ParseMessageFieldTest.cs

示例4: MessageField_OK06

        public void MessageField_OK06()
        {
            const string text = "  msg1.msg2.msg3 test1 = 1;\r\naaa";

            var lex = new Lexer(text) { Matches = Helper.SplitText(text), Proto3 = true };

            Assert.IsTrue(lex.ParseMessageField());

            Assert.AreEqual(5, lex.Tokens.Count);
            Assert.AreEqual(0, lex.Errors.Count);
            Assert.AreEqual(10, lex.Index);
        }
开发者ID:mreu,项目名称:ProtobufLanguageService,代码行数:12,代码来源:ParseMessageFieldTest.cs

示例5: MessageField_OK03

        public void MessageField_OK03()
        {
            const string text = "  optional string test1 = 1;\r\naaa";

            var lex = new Lexer(text) { Matches = Helper.SplitText(text) };

            Assert.IsTrue(lex.ParseMessageField());

            Assert.AreEqual(4, lex.Tokens.Count);
            Assert.AreEqual(0, lex.Errors.Count);
            Assert.AreEqual(7, lex.Index);
        }
开发者ID:mreu,项目名称:ProtobufLanguageService,代码行数:12,代码来源:ParseMessageFieldTest.cs

示例6: MessageField_OK02

        public void MessageField_OK02()
        {
            const string text = "  optional string test1 = 1 [default=\"Farz\"];";

            var lex = new Lexer(text) { Matches = Helper.SplitText(text) };

            Assert.IsTrue(lex.ParseMessageField());

            Assert.AreEqual(6, lex.Tokens.Count);
            Assert.AreEqual(0, lex.Errors.Count);
            Assert.AreEqual(13, lex.Index);
        }
开发者ID:mreu,项目名称:ProtobufLanguageService,代码行数:12,代码来源:ParseMessageFieldTest.cs

示例7: MessageField_NOK21

        public void MessageField_NOK21()
        {
            const string text = "  .\r\n";

            var lex = new Lexer(text) { Matches = Helper.SplitText(text), Proto3 = true };

            Assert.IsFalse(lex.ParseMessageField());

            Assert.AreEqual(0, lex.Tokens.Count);
            Assert.AreEqual(1, lex.Errors.Count);
            Assert.AreEqual(2, lex.Index);
        }
开发者ID:mreu,项目名称:ProtobufLanguageService,代码行数:12,代码来源:ParseMessageFieldTest.cs

示例8: MessageField_NOK16

        public void MessageField_NOK16()
        {
            const string text = "  optional msg1.msg2.msg3 test1 = 1";

            var lex = new Lexer(text) { Matches = Helper.SplitText(text), Proto3 = true };

            Assert.IsFalse(lex.ParseMessageField());

            Assert.AreEqual(0, lex.Tokens.Count);
            Assert.AreEqual(1, lex.Errors.Count);
            Assert.AreEqual(1, lex.Index);
        }
开发者ID:mreu,项目名称:ProtobufLanguageService,代码行数:12,代码来源:ParseMessageFieldTest.cs

示例9: MessageField_NOK15

        public void MessageField_NOK15()
        {
            const string text = "  optional string";

            var lex = new Lexer(text) { Matches = Helper.SplitText(text) };

            Assert.IsFalse(lex.ParseMessageField());

            Assert.AreEqual(2, lex.Tokens.Count);
            Assert.AreEqual(1, lex.Errors.Count);
            Assert.AreEqual(2, lex.Index);
        }
开发者ID:mreu,项目名称:ProtobufLanguageService,代码行数:12,代码来源:ParseMessageFieldTest.cs


注:本文中的Lexer.Lexer.ParseMessageField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。