Exemple #1
0
        /// <inheritdoc />
        public ILexer <Bit> Create()
        {
            var bit0TerminalLexer   = terminalLexerFactory.Create("0", StringComparer.Ordinal);
            var bit1TerminalLexer   = terminalLexerFactory.Create("1", StringComparer.Ordinal);
            var bitAlternativeLexer = alternativeLexerFactory.Create(bit0TerminalLexer, bit1TerminalLexer);

            return(new BitLexer(bitAlternativeLexer));
        }
Exemple #2
0
        public ILexer <Sign> Create()
        {
            var plusLexer        = terminalLexerFactory.Create("+", StringComparer.Ordinal);
            var minusLexer       = terminalLexerFactory.Create("-", StringComparer.Ordinal);
            var plusOrMinusLexer = alternativeLexerFactory.Create(plusLexer, minusLexer);

            return(new SignLexer(plusOrMinusLexer));
        }
Exemple #3
0
        /// <inheritdoc />
        public ILexer <ControlCharacter> Create()
        {
            var controlsValueRange = valueRangeLexerFactory.Create('\x00', '\x1F');
            var delete             = terminalLexerFactory.Create("\x7F", StringComparer.Ordinal);
            var controlCharacterAlternativeLexer = alternativeLexerFactory.Create(controlsValueRange, delete);

            return(new ControlCharacterLexer(controlCharacterAlternativeLexer));
        }
Exemple #4
0
        /// <inheritdoc />
        public ILexer <WhiteSpace> Create()
        {
            var sp         = spaceLexerFactory.Create();
            var htab       = horizontalTabLexerFactory.Create();
            var innerLexer = alternativeLexerFactory.Create(sp, htab);

            return(new WhiteSpaceLexer(innerLexer));
        }
        /// <inheritdoc />
        public ILexer <LinearWhiteSpace> Create()
        {
            var endOfLineLexer          = endOfLineLexerFactory.Create();
            var whiteSpaceLexer         = whiteSpaceLexerFactory.Create();
            var foldLexer               = concatenationLexerFactory.Create(endOfLineLexer, whiteSpaceLexer);
            var breakingWhiteSpaceLexer = alternativeLexerFactory.Create(whiteSpaceLexer, foldLexer);
            var innerLexer              = repetitionLexerFactory.Create(breakingWhiteSpaceLexer, 0, int.MaxValue);

            return(new LinearWhiteSpaceLexer(innerLexer));
        }
Exemple #6
0
        /// <inheritdoc />
        public ILexer <Alpha> Create()
        {
            var upperCaseValueRangeLexer   = valueRangeLexerFactory.Create('\x41', '\x5A');
            var lowerCaseValueRangeLexer   = valueRangeLexerFactory.Create('\x61', '\x7A');
            var upperOrLowerCaseAlphaLexer = alternativeLexerFactory.Create(
                upperCaseValueRangeLexer,
                lowerCaseValueRangeLexer);

            return(new AlphaLexer(upperOrLowerCaseAlphaLexer));
        }
Exemple #7
0
        /// <inheritdoc />
        public ILexer <HexadecimalDigit> Create()
        {
            var hexadecimalDigitAlternativeLexer = alternativeLexerFactory.Create(
                digitLexerFactory.Create(),
                terminalLexerFactory.Create("A", StringComparer.OrdinalIgnoreCase),
                terminalLexerFactory.Create("B", StringComparer.OrdinalIgnoreCase),
                terminalLexerFactory.Create("C", StringComparer.OrdinalIgnoreCase),
                terminalLexerFactory.Create("D", StringComparer.OrdinalIgnoreCase),
                terminalLexerFactory.Create("E", StringComparer.OrdinalIgnoreCase),
                terminalLexerFactory.Create("F", StringComparer.OrdinalIgnoreCase));

            return(new HexadecimalDigitLexer(hexadecimalDigitAlternativeLexer));
        }