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


C# Lexer.ParsePackage方法代码示例

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


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

示例1: Package_NOK03

        public void Package_NOK03()
        {
            const string text = "    package"; // still not finished line

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

              lex.ParsePackage();

              Assert.AreEqual(1, lex.Tokens.Count);
              Assert.AreEqual(4, lex.Tokens[0].Position);
              Assert.AreEqual(7, lex.Tokens[0].Length);
              Assert.AreEqual(CodeType.TopLevelCmd, lex.Tokens[0].CodeType);
              Assert.AreEqual(0, lex.Line);

              Assert.AreEqual(1, lex.Errors.Count);
              Assert.AreEqual(11, lex.Errors[0].Position);
              Assert.AreEqual(1, lex.Errors[0].Length);
              Assert.AreEqual(0, lex.Line);
        }
开发者ID:mreu,项目名称:ProtobufLanguageService,代码行数:19,代码来源:ParsePackageTests.cs

示例2: Package_NOK02

        public void Package_NOK02()
        {
            const string text = "    package Teäst1.kjhkj.jjjj;";

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

              lex.ParsePackage();

              Assert.AreEqual(4, lex.Tokens.Count);
              Assert.AreEqual(4, lex.Tokens[0].Position);
              Assert.AreEqual(7, lex.Tokens[0].Length);
              Assert.AreEqual(CodeType.TopLevelCmd, lex.Tokens[0].CodeType);
              Assert.AreEqual(0, lex.Line);

              Assert.AreEqual(1, lex.Errors.Count);
              Assert.AreEqual(12, lex.Errors[0].Position);
              Assert.AreEqual(6, lex.Errors[0].Length);
              Assert.AreEqual(0, lex.Line);
        }
开发者ID:mreu,项目名称:ProtobufLanguageService,代码行数:19,代码来源:ParsePackageTests.cs

示例3: Package_NOK04

        public void Package_NOK04()
        {
            const string text = "    package dfs"; // still not finished line

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

              lex.ParsePackage();

            Assert.AreEqual(2, lex.Tokens.Count);
              Assert.AreEqual(12, lex.Tokens[1].Position);
              Assert.AreEqual(3, lex.Tokens[1].Length);
              Assert.AreEqual(CodeType.Namespace, lex.Tokens[1].CodeType);
              Assert.AreEqual(0, lex.Line);

              Assert.AreEqual(1, lex.Errors.Count);
              Assert.AreEqual(15, lex.Errors[0].Position);
              Assert.AreEqual(1, lex.Errors[0].Length);
              Assert.AreEqual(0, lex.Line);
        }
开发者ID:mreu,项目名称:ProtobufLanguageService,代码行数:19,代码来源:ParsePackageTests.cs

示例4: Package_OK2

        public void Package_OK2()
        {
            const string text = "    package Test1.Test2.Test3;";

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

              lex.ParsePackage();

              Assert.AreEqual(4, lex.Tokens.Count);
              Assert.AreEqual(4, lex.Tokens[0].Position);
              Assert.AreEqual(7, lex.Tokens[0].Length);
              Assert.AreEqual(CodeType.TopLevelCmd, lex.Tokens[0].CodeType);
              Assert.AreEqual(0, lex.Line);
              Assert.AreEqual(12, lex.Tokens[1].Position);
              Assert.AreEqual(5, lex.Tokens[1].Length);
              Assert.AreEqual(CodeType.Namespace, lex.Tokens[1].CodeType);
              Assert.AreEqual(0, lex.Line);
              Assert.AreEqual(18, lex.Tokens[2].Position);
              Assert.AreEqual(5, lex.Tokens[2].Length);
              Assert.AreEqual(CodeType.Namespace, lex.Tokens[2].CodeType);
              Assert.AreEqual(0, lex.Line);
              Assert.AreEqual(24, lex.Tokens[3].Position);
              Assert.AreEqual(5, lex.Tokens[3].Length);
              Assert.AreEqual(CodeType.Namespace, lex.Tokens[3].CodeType);
              Assert.AreEqual(0, lex.Line);
        }
开发者ID:mreu,项目名称:ProtobufLanguageService,代码行数:26,代码来源:ParsePackageTests.cs

示例5: Package_NOK08

        public void Package_NOK08()
        {
            const string text = "    package dfs.abc;";

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

              lex.ParsePackage();

              Assert.AreEqual(3, lex.Tokens.Count);
              Assert.AreEqual(16, lex.Tokens[2].Position);
              Assert.AreEqual(3, lex.Tokens[2].Length);
              Assert.AreEqual(CodeType.Namespace, lex.Tokens[2].CodeType);
              Assert.AreEqual(0, lex.Line);

              Assert.AreEqual(1, lex.Errors.Count);
              Assert.AreEqual(4, lex.Errors[0].Position);
              Assert.AreEqual(7, lex.Errors[0].Length);
              Assert.AreEqual(0, lex.Line);
        }
开发者ID:mreu,项目名称:ProtobufLanguageService,代码行数:19,代码来源:ParsePackageTests.cs


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