Ejemplo n.º 1
0
        public TokenMd GetToken(string text, int index, out int finalIndex)
        {
            helper = new ParseHelper();
            mark   = new StrongMark();
            var builder = new StringBuilder();

            finalIndex = index;

            builder = helper.AppendMarkSymbols(builder, text, finalIndex, out finalIndex, mark.DefiningSymbol);

            while (!helper.IsSymbols(finalIndex, text, Environment.NewLine))
            {
                if (helper.IsSymbols(finalIndex, text, mark.AllSymbols.Last()))
                {
                    builder = helper.AppendMarkSymbols(builder, text, finalIndex, out finalIndex, mark.AllSymbols.Last());
                    return(GetResultToken(builder.ToString()));
                }

                if (finalIndex >= text.Length)
                {
                    return(new TokenMd(builder.ToString(), new EmptyMark()));
                }

                builder.Append(text[finalIndex]);
                finalIndex++;
            }

            return(GetResultToken(builder.ToString()));
        }
Ejemplo n.º 2
0
        public TokenMd GetToken(string text, int index, out int finalIndex)
        {
            helper = new ParseHelper();
            mark   = new HeadMark();
            var builder = new StringBuilder();

            finalIndex = index;

            builder = helper.AppendMarkSymbols(builder, text, finalIndex, out finalIndex, mark.DefiningSymbol);

            while (!helper.IsSymbols(finalIndex, text, Environment.NewLine))
            {
                if (finalIndex >= text.Length || helper.IsSymbols(finalIndex, text, mark.AllSymbols.Last()))
                {
                    return(new TokenMd(builder.ToString(), mark));
                }
                builder = helper.AppendSymbol(builder, text, finalIndex, out finalIndex);
            }

            return(new TokenMd(builder.ToString(), mark));
        }