コード例 #1
0
 public void ReadSuccess(string input)
 {
     var valueRangeLexerFactory = new ValueRangeLexerFactory();
     var digitLexerFactory = new DigitLexerFactory(valueRangeLexerFactory);
     var terminalLexerFactory = new TerminalLexerFactory();
     var alternativeLexerFactory = new AlternativeLexerFactory();
     var factory = new HexadecimalDigitLexerFactory(digitLexerFactory, terminalLexerFactory, alternativeLexerFactory);
     var lexer = factory.Create();
     using (var scanner = new TextScanner(new StringTextSource(input)))
     {
         var result = lexer.Read(scanner);
         Assert.NotNull(result);
         Assert.True(result.Success);
         Assert.NotNull(result.Element);
         Assert.Equal(input, result.Element.Text);
     }
 }
コード例 #2
0
        public void ReadSuccess(string input)
        {
            var valueRangeLexerFactory  = new ValueRangeLexerFactory();
            var digitLexerFactory       = new DigitLexerFactory(valueRangeLexerFactory);
            var terminalLexerFactory    = new TerminalLexerFactory();
            var alternativeLexerFactory = new AlternativeLexerFactory();
            var factory = new HexadecimalDigitLexerFactory(digitLexerFactory, terminalLexerFactory, alternativeLexerFactory);
            var lexer   = factory.Create();

            using (var scanner = new TextScanner(new StringTextSource(input)))
            {
                var result = lexer.Read(scanner);
                Assert.NotNull(result);
                Assert.True(result.Success);
                Assert.NotNull(result.Element);
                Assert.Equal(input, result.Element.Text);
            }
        }