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


C# Scanner.Scan方法代码示例

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


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

示例1: CanParseSimpleFilename2

 public void CanParseSimpleFilename2()
 {
     var scanner = new Scanner("*.txt");
     AssertToken(TokenKind.Wildcard, "*", scanner.Scan());
     AssertToken(TokenKind.Identifier, ".txt", scanner.Scan());
     AssertToken(TokenKind.EOT, "", scanner.Scan());
 }
开发者ID:kthompson,项目名称:csharp-glob,代码行数:7,代码来源:ScannerTests.cs

示例2: ParseWindowsRoot

 public void ParseWindowsRoot()
 {
     var scanner = new Scanner(@"C:\*.txt");
     AssertToken(TokenKind.WindowsRoot, "C:", scanner.Scan());
     AssertToken(TokenKind.PathSeperator, "\\", scanner.Scan());
     AssertToken(TokenKind.Wildcard, "*", scanner.Scan());
     AssertToken(TokenKind.Identifier, ".txt", scanner.Scan());
     AssertToken(TokenKind.EOT, "", scanner.Scan());
 }
开发者ID:kthompson,项目名称:csharp-glob,代码行数:9,代码来源:ScannerTests.cs

示例3: Scan_Should_Return_Empty_When_Regex_Match_Is_Greater_Than_Zero

 public void Scan_Should_Return_Empty_When_Regex_Match_Is_Greater_Than_Zero()
 {
     var scanner = new Scanner("a b c");
     var match = scanner.Scan("b");
     Assert.Equal(match, "");
     Assert.Equal(scanner.Pos, 0);
 }
开发者ID:StubbleOrg,项目名称:Stubble,代码行数:7,代码来源:ScannerTest.cs

示例4: Scan_Should_Return_Empty_When_Regex_Does_Not_Match

 public void Scan_Should_Return_Empty_When_Regex_Does_Not_Match()
 {
     var scanner = new Scanner("a b c");
     var match = scanner.Scan("z");
     Assert.Equal(match, "");
     Assert.Equal(scanner.Pos, 0);
 }
开发者ID:StubbleOrg,项目名称:Stubble,代码行数:7,代码来源:ScannerTest.cs

示例5: Scan

 public static ScanResult Scan(string expression)
 {
     var scanner = new Scanner();
     scanner.text = expression;
     scanner.Scan();
     return scanner.result;
 }
开发者ID:KirillOsenkov,项目名称:MathParser,代码行数:7,代码来源:Scanner.cs

示例6: It_Should_Match_Whole_String

 public void It_Should_Match_Whole_String()
 {
     var scanner = new Scanner("a b c");
     var match = scanner.Scan("a b c");
     Assert.Equal(match, scanner.Template);
     Assert.True(scanner.EOS);
 }
开发者ID:StubbleOrg,项目名称:Stubble,代码行数:7,代码来源:ScannerTest.cs

示例7: Scan_Should_Match_When_Regex_Starts_At_Zero

 public void Scan_Should_Match_When_Regex_Starts_At_Zero()
 {
     var scanner = new Scanner("a b c");
     var match = scanner.Scan("a");
     Assert.Equal(match, "a");
     Assert.Equal(scanner.Pos, 1);
 }
开发者ID:StubbleOrg,项目名称:Stubble,代码行数:7,代码来源:ScannerTest.cs

示例8: It_scans_literal_text

        public void It_scans_literal_text()
        {
            var scanner = new Scanner();

            var parts = scanner.Scan("foo");

            parts.IsEqualTo(new LiteralText("foo"));
        }
开发者ID:kindohm,项目名称:Nustache,代码行数:8,代码来源:Describe_Scanner.cs

示例9: It_returns_no_parts_for_the_empty_string

        public void It_returns_no_parts_for_the_empty_string()
        {
            var scanner = new Scanner();

            var parts = scanner.Scan("");

            parts.IsEmpty();
        }
开发者ID:kindohm,项目名称:Nustache,代码行数:8,代码来源:Describe_Scanner.cs

示例10: It_skips_comments

        public void It_skips_comments()
        {
            var scanner = new Scanner();

            var parts = scanner.Scan("before{{!foo}}after");

            parts.IsEqualTo(new LiteralText("before"),
                            new LiteralText("after"));
        }
开发者ID:paulcbetts,项目名称:Nustache,代码行数:9,代码来源:Describe_Scanner.cs

示例11: It_scans_template_definitions

        public void It_scans_template_definitions()
        {
            var scanner = new Scanner();

            var parts = scanner.Scan("{{<foo}}inside{{/foo}}");

            parts.IsEqualTo(new TemplateDefinition("foo"),
                            new LiteralText("inside"),
                            new EndSection("foo"));
        }
开发者ID:kindohm,项目名称:Nustache,代码行数:10,代码来源:Describe_Scanner.cs

示例12: Scan_NotStarted_ReturnsFalse

        public void Scan_NotStarted_ReturnsFalse()
        {
            var httpClientHelper = A.Fake<IHttpClientHelper>();
            var scanner = new Scanner(A.Fake<ISettings>(), A.Fake<ILogger>(), httpClientHelper);
            A.CallTo(() => httpClientHelper.MakeHttpRequest(A<string>.Ignored, A<HttpResponseType>.Ignored)).Returns("{\"status\":\"0\"}");

            bool hasStarted = scanner.Scan("");

            Assert.AreEqual(false, hasStarted);
        }
开发者ID:cassiodeveloper,项目名称:ZapPenTester,代码行数:10,代码来源:ScannerTests.cs

示例13: It_scans_variable_references

        public void It_scans_variable_references()
        {
            var scanner = new Scanner();

            var parts = scanner.Scan("before{{foo}}after");

            parts.IsEqualTo(new LiteralText("before"),
                            new VariableReference("foo"),
                            new LiteralText("after"));
        }
开发者ID:kindohm,项目名称:Nustache,代码行数:10,代码来源:Describe_Scanner.cs

示例14: Scan_Finished_ReturnsTrue

        public void Scan_Finished_ReturnsTrue()
        {
            var httpClientHelper = A.Fake<IHttpClientHelper>();
            var scanner = new Scanner(A.Fake<ISettings>(), A.Fake<ILogger>(), httpClientHelper);
            A.CallTo(() => httpClientHelper.MakeHttpRequest(A<string>.Ignored, HttpResponseType.json)).Returns("{\"code\":\"scan_in_progress\"}");

            bool hasStarted = scanner.Scan("");

            Assert.AreEqual(true, hasStarted);
        }
开发者ID:cassiodeveloper,项目名称:ZapPenTester,代码行数:10,代码来源:ScannerTests.cs

示例15: It_scans_sections

        public void It_scans_sections()
        {
            var scanner = new Scanner();

            var parts = scanner.Scan("{{#foo}}inside{{/foo}}");

            parts.IsEqualTo(new Block("foo"),
                            new LiteralText("inside"),
                            new EndSection("foo"));
        }
开发者ID:kindohm,项目名称:Nustache,代码行数:10,代码来源:Describe_Scanner.cs


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