public override ILexer <SegmentNonZeroLength> Create()
        {
            var pathCharacterLexer = PathCharacterLexerFactory.Create();
            var innerLexer         = Repetition.Create(pathCharacterLexer, 1, int.MaxValue);

            return(new SegmentNonZeroLengthLexer(innerLexer));
        }
Exemplo n.º 2
0
        public void Initialize()
        {
            var wsp  = Grammar.Rule("WSP");
            var crlf = Grammar.Rule("CRLF");

            InnerLexer = Repetition.Create(Alternation.Create(wsp, Concatenation.Create(crlf, wsp)), 0, int.MaxValue);
        }
Exemplo n.º 3
0
        public override ILexer <IPvFuture> Create()
        {
            // "v"
            var v = Terminal.Create(@"v", StringComparer.OrdinalIgnoreCase);

            // "."
            var dot = Terminal.Create(@".", StringComparer.Ordinal);

            // ":"
            var colon = Terminal.Create(@":", StringComparer.Ordinal);

            // 1*HEXDIG
            var hexadecimalDigitLexer = HexadecimalDigitLexerFactory.Create();
            var r = Repetition.Create(hexadecimalDigitLexer, 1, int.MaxValue);

            // unreserved / sub-delims / ":"
            var unreservedLexer             = UnreservedLexerFactory.Create();
            var subcomponentsDelimiterLexer = SubcomponentsDelimiterLexerFactory.Create();
            var a = Alternation.Create(unreservedLexer, subcomponentsDelimiterLexer, colon);

            // 1*( unreserved / sub-delims / ":" )
            var s = Repetition.Create(a, 1, int.MaxValue);

            // "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
            var innerLexer = Concatenation.Create(v, r, dot, s);

            // IPvFuture
            return(new IPvFutureLexer(innerLexer));
        }
Exemplo n.º 4
0
        public override ILexer <RequiredWhiteSpace> Create()
        {
            var innerLexer = Repetition.Create(
                Alternation.Create(SpaceFactory.Create(), HorizontalTabLexerFactory.Create()),
                1,
                int.MaxValue);

            return(new RequiredWhiteSpaceLexer(innerLexer));
        }
        public override ILexer <ChunkedBody> Create()
        {
            var innerLexer = Concatenation.Create(
                Repetition.Create(ChunkLexerFactory.Create(), 0, int.MaxValue),
                LastChunkLexerFactory.Create(),
                TrailerPartLexerFactory.Create(),
                NewLineLexerFactory.Create());

            return(new ChunkedBodyLexer(innerLexer));
        }
Exemplo n.º 6
0
        public override ILexer <Query> Create()
        {
            var alternationLexer = Alternation.Create(
                PathCharacterLexerFactory.Create(),
                Terminal.Create(@"/", StringComparer.Ordinal),
                Terminal.Create(@"?", StringComparer.Ordinal));
            var fragmentRepetitionLexer = Repetition.Create(alternationLexer, 0, int.MaxValue);

            return(new QueryLexer(fragmentRepetitionLexer));
        }
Exemplo n.º 7
0
        public override ILexer <TrailerPart> Create()
        {
            var innerLexer =
                Repetition.Create(
                    Concatenation.Create(HeaderFieldLexerFactory.Create(), NewLineLexerFactory.Create()),
                    0,
                    int.MaxValue);

            return(new TrailerPartLexer(innerLexer));
        }
        public override ILexer <ObsoleteFold> Create()
        {
            var innerLexer = Concatenation.Create(
                NewLineLexerFactory.Create(),
                Repetition.Create(
                    Alternation.Create(SpaceLexerFactory.Create(), HorizontalTabLexerFactory.Create()),
                    1,
                    int.MaxValue));

            return(new ObsoleteFoldLexer(innerLexer));
        }
Exemplo n.º 9
0
        public override ILexer <FieldValue> Create()
        {
            var innerLexer = Repetition.Create(
                Alternation.Create(
                    FieldContentLexerFactory.Create(),
                    ObsoleteFoldLexerFactory.Create()),
                0,
                int.MaxValue)
            ;

            return(new FieldValueLexer(innerLexer));
        }
Exemplo n.º 10
0
        public override ILexer <LastChunk> Create()
        {
            var innerLexer = Concatenation.Create(
                Repetition.Create(
                    Terminal.Create(@"0", StringComparer.Ordinal),
                    1,
                    int.MaxValue),
                Option.Create(ChunkExtensionLexerFactory.Create()),
                NewLineLexerFactory.Create());

            return(new LastChunkLexer(innerLexer));
        }
Exemplo n.º 11
0
        public override ILexer <AbsolutePath> Create()
        {
            var innerLexer =
                Repetition.Create(
                    Concatenation.Create(
                        Terminal.Create(@"/", StringComparer.Ordinal),
                        Segment.Create()),
                    1,
                    int.MaxValue);

            return(new AbsolutePathLexer(innerLexer));
        }
        public override ILexer <ReasonPhrase> Create()
        {
            var innerLexer = Repetition.Create(
                Alternation.Create(
                    HorizontalTabLexerFactory.Create(),
                    SpaceLexerFactory.Create(),
                    VisibleCharacterLexerFactory.Create(),
                    ObsoleteTextLexerFactory.Create()),
                0,
                int.MaxValue);

            return(new ReasonPhraseLexer(innerLexer));
        }
Exemplo n.º 13
0
        public override ILexer <PathRootless> Create()
        {
            var innerLexer = Concatenation.Create(
                SegmentNonZeroLengthLexerFactory.Create(),
                Repetition.Create(
                    Concatenation.Create(
                        Terminal.Create(@"/", StringComparer.Ordinal),
                        SegmentLexerFactory.Create()),
                    0,
                    int.MaxValue));

            return(new PathRootlessLexer(innerLexer));
        }
        public override ILexer <QuotedString> Create()
        {
            var dquote     = DoubleQuoteLexerFactory.Create();
            var innerLexer = Concatenation.Create(
                dquote,
                Repetition.Create(
                    Alternation.Create(QuotedTextLexerFactory.Create(), QuotedPairLexerFactory.Create()),
                    0,
                    int.MaxValue),
                dquote);

            return(new QuotedStringLexer(innerLexer));
        }
Exemplo n.º 15
0
        public override ILexer <UserInformation> Create()
        {
            var innerLexer = Repetition.Create(
                Alternation.Create(
                    UnreservedLexerFactory.Create(),
                    PercentEncodingLexerFactory.Create(),
                    SubcomponentsDelimiterLexerFactory.Create(),
                    Terminal.Create(@":", StringComparer.Ordinal)),
                0,
                int.MaxValue);

            return(new UserInformationLexer(innerLexer));
        }
Exemplo n.º 16
0
        public override ILexer <RegisteredName> Create()
        {
            var innerLexer =
                Repetition.Create(
                    Alternation.Create(
                        UnreservedLexerFactory.Create(),
                        PercentEncodingLexerFactory.Create(),
                        SubcomponentsDelimiterLexerFactory.Create()),
                    0,
                    int.MaxValue);

            return(new RegisteredNameLexer(innerLexer));
        }
        public override ILexer <PathAbsoluteOrEmpty> Create()
        {
            // "/"
            var a = Terminal.Create(@"/", StringComparer.Ordinal);

            // "/" segment
            var c = Concatenation.Create(a, SegmentLexerFactory.Create());

            // *( "/" segment )
            var innerLexer = Repetition.Create(c, 0, int.MaxValue);

            // path-abempty
            return(new PathAbsoluteOrEmptyLexer(innerLexer));
        }
        public override ILexer <HttpMessage> Create()
        {
            var crlf       = NewLineLexerFactory.Create();
            var innerLexer = Concatenation.Create(
                StartLineLexerFactory.Create(),
                Repetition.Create(
                    Concatenation.Create(HeaderFieldLexerFactory.Create(), crlf),
                    0,
                    int.MaxValue),
                crlf,
                Option.Create(MessageBodyLexerFactory.Create()));

            return(new HttpMessageLexer(innerLexer));
        }
Exemplo n.º 19
0
        public override ILexer <SegmentNonZeroLengthNoColons> Create()
        {
            var alternationLexer = Alternation.Create(
                UnreservedLexerFactory.Create(),
                PercentEncodingLexerFactory.Create(),
                SubcomponentsDelimiterLexerFactory.Create(),
                Terminal.Create(@"@", StringComparer.Ordinal));
            var segmentNonZeroLengthNoColonsRepetitionLexer = Repetition.Create(
                alternationLexer,
                1,
                int.MaxValue);

            return(new SegmentNonZeroLengthNoColonsLexer(segmentNonZeroLengthNoColonsRepetitionLexer));
        }
Exemplo n.º 20
0
        public void Initialize()
        {
            var factor = Grammar.Rule("factor");

            InnerLexer = Concatenation.Create(
                factor,
                Repetition.Create(
                    Concatenation.Create(
                        Alternation.Create(
                            Terminal.Create(@"*", StringComparer.Ordinal),
                            Terminal.Create(@"/", StringComparer.Ordinal)),
                        factor),
                    0,
                    int.MaxValue));
        }
Exemplo n.º 21
0
        public void Initialize()
        {
            var term = Grammar.Rule("term");

            InnerLexer = Concatenation.Create(
                term,
                Repetition.Create(
                    Concatenation.Create(
                        Alternation.Create(
                            Terminal.Create("+", StringComparer.Ordinal),
                            Terminal.Create("-", StringComparer.Ordinal)),
                        term),
                    0,
                    int.MaxValue));
        }
Exemplo n.º 22
0
        public override ILexer <ChunkExtension> Create()
        {
            var innerLexer = Repetition.Create(
                Concatenation.Create(
                    Terminal.Create(@";", StringComparer.Ordinal),
                    ChunkExtensionName.Create(),
                    Option.Create(
                        Concatenation.Create(
                            Terminal.Create(@"=", StringComparer.Ordinal),
                            ChunkExtensionValue.Create()))),
                0,
                int.MaxValue);

            return(new ChunkExtensionLexer(innerLexer));
        }
Exemplo n.º 23
0
        public override ILexer <PathNoScheme> Create()
        {
            // segment-nz-nc *( "/" segment )
            var innerLexer = Concatenation.Create(
                SegmentNonZeroLengthNoColonsLexerFactory.Create(),
                Repetition.Create(
                    Concatenation.Create(
                        Terminal.Create(@"/", StringComparer.Ordinal),
                        SegmentLexerFactory.Create()),
                    0,
                    int.MaxValue));

            // path-noscheme
            return(new PathNoSchemeLexer(innerLexer));
        }
Exemplo n.º 24
0
        public override ILexer <TransferExtension> Create()
        {
            var ows        = OptionalWhiteSpaceLexerFactory.Create();
            var innerLexer = Concatenation.Create(
                TokenLexerFactory.Create(),
                Repetition.Create(
                    Concatenation.Create(
                        ows,
                        Terminal.Create(@";", StringComparer.Ordinal),
                        ows,
                        TransferParameterLexerFactory.Create()),
                    0,
                    int.MaxValue));

            return(new TransferExtensionLexer(innerLexer));
        }
Exemplo n.º 25
0
        public override ILexer <FieldContent> Create()
        {
            var fieldVChar = FieldVisibleCharacterLexerFactory.Create();
            var innerLexer = Concatenation.Create(
                fieldVChar,
                Option.Create(
                    Concatenation.Create(
                        Repetition.Create(
                            Alternation.Create(
                                SpaceLexerFactory.Create(),
                                HorizontalTabLexerFactory.Create()),
                            1,
                            int.MaxValue),
                        fieldVChar)));

            return(new FieldContentLexer(innerLexer));
        }
Exemplo n.º 26
0
        public override ILexer <Comment> Create()
        {
            var selfLexer  = new ProxyLexer <Comment>();
            var innerLexer = Concatenation.Create(
                Terminal.Create(@"(", StringComparer.Ordinal),
                Repetition.Create(
                    Alternation.Create(
                        CommentTextLexerFactory.Create(),
                        QuotedPairLexerFactory.Create(),
                        selfLexer),
                    0,
                    int.MaxValue),
                Terminal.Create(@")", StringComparer.Ordinal));
            var commentLexer = new CommentLexer(innerLexer);

            selfLexer.Initialize(commentLexer);
            return(commentLexer);
        }
Exemplo n.º 27
0
        public override ILexer <PathAbsolute> Create()
        {
            // "/" [ segment-nz *( "/" segment ) ]
            var innerLexer = Concatenation.Create(
                Terminal.Create(@"/", StringComparer.Ordinal),
                Option.Create(
                    Concatenation.Create(
                        SegmentNonZeroLengthLexerFactory.Create(),
                        Repetition.Create(
                            Concatenation.Create(
                                Terminal.Create(@"/", StringComparer.Ordinal),
                                SegmentLexerFactory.Create()),
                            0,
                            int.MaxValue))));

            // path-absolute
            return(new PathAbsoluteLexer(innerLexer));
        }
Exemplo n.º 28
0
        public override ILexer <Scheme> Create()
        {
            var alpha      = AlphaLexerFactory.Create();
            var digit      = DigitLexerFactory.Create();
            var innerLexer = Concatenation.Create(
                alpha,
                Repetition.Create(
                    Alternation.Create(
                        alpha,
                        digit,
                        Terminal.Create(@"+", StringComparer.Ordinal),
                        Terminal.Create(@"-", StringComparer.Ordinal),
                        Terminal.Create(@".", StringComparer.Ordinal)),
                    0,
                    int.MaxValue));

            return(new SchemeLexer(innerLexer));
        }
Exemplo n.º 29
0
        public override ILexer <DecimalOctet> Create()
        {
            // %x30-35
            var a = ValueRange.Create('\x30', '\x35');

            // "25"
            var b = Terminal.Create("25", StringComparer.Ordinal);

            // "25" %x30-35
            var c = Concatenation.Create(b, a);

            // DIGIT

            // %x30-34
            var e = ValueRange.Create('\x30', '\x34');

            // "2"
            var f = Terminal.Create("2", StringComparer.Ordinal);

            // "2" %x30-34 DIGIT
            var digitLexer = DigitLexerFactory.Create();
            var g          = Concatenation.Create(f, e, digitLexer);

            // 2DIGIT
            var h = Repetition.Create(digitLexer, 2, 2);

            // "1"
            var i = Terminal.Create("1", StringComparer.Ordinal);

            // "1" 2DIGIT
            var j = Concatenation.Create(i, h);

            // %x31-39
            var k = ValueRange.Create('\x31', '\x39');

            // %x31-39 DIGIT
            var l = Concatenation.Create(k, digitLexer);

            // "25" %x30-35 / "2" %x30-34 DIGIT / "1" 2DIGIT / %x31-39 DIGIT / DIGIT
            var m = Alternation.Create(c, g, j, l, digitLexer);

            // dec-octet
            return(new DecimalOctetLexer(m));
        }
Exemplo n.º 30
0
        public override ILexer <Rank> Create()
        {
            var decimalPoint = Terminal.Create(@".", StringComparer.Ordinal);
            var zero         = Terminal.Create(@"0", StringComparer.Ordinal);
            var left         = Concatenation.Create(
                zero,
                Option.Create(
                    Concatenation.Create(
                        decimalPoint,
                        Repetition.Create(DigitLexerFactory.Create(), 0, 3))));
            var right =
                Concatenation.Create(
                    Concatenation.Create(
                        Terminal.Create(@"1", StringComparer.Ordinal),
                        Option.Create(
                            Concatenation.Create(decimalPoint, Repetition.Create(zero, 0, 3)))));
            var innerLexer = Alternation.Create(left, right);

            return(new RankLexer(innerLexer));
        }