示例#1
0
        private Token GetNextToken(string input, int inputIndex)
        {
            var currSymbol = input[inputIndex];

            return(TokenReaders.ContainsKey(currSymbol)
                ? TokenReaders[currSymbol].Read(input, inputIndex)
                : AbstractReader.Read(input, inputIndex, CurrMdSymbols));
        }
示例#2
0
        public Token Read(string input, int inputIndex)
        {
            var headerLevel = GetHeaderLevel(input, inputIndex);
            var headerToken = AbstractReader.Read(input, inputIndex + headerLevel, '\n');

            headerToken.Tag      = TokenType.Header;
            headerToken.TagLevel = headerLevel;
            return(headerToken);
        }
示例#3
0
        public Token Read(string input, int inputIndex)
        {
            if (CheckFullSymbol(input, inputIndex))
            {
                var token = AbstractReader.Read(input, inputIndex + 3, '\n');
                token.Tag = TokenType.Horizontal;
                return(token);
            }

            return(AbstractReader.Read(input, inputIndex, MarkdownSymbols.AllSymbols));
        }
        public Token GetTokenWithoutTags(string input, int inputIndex, char stopSymbol, int stopSymbolQuant)
        {
            var refund = "";

            for (var quantApended = 0; quantApended < stopSymbolQuant; quantApended++)
            {
                refund += stopSymbol;
            }
            var startToken = AbstractReader.Read(input, inputIndex + stopSymbolQuant, MarkdownSymbols.Emphasis);

            return(new Token(refund + startToken.Text, inputIndex));
        }
示例#5
0
        public Token Read(string input, int inputIndex)
        {
            var startIndex = inputIndex;

            if (inputIndex + 1 <= input.Length - 1 &&
                input[inputIndex + 1] == MarkdownSymbols.Quote)
            {
                inputIndex = GetTagIndexWithTrueEnviron(input, inputIndex + 2, CheckQuotesEnviron);
                if (inputIndex != -1)
                {
                    var token = new Token(input.Substring(startIndex + 2, inputIndex - startIndex - 2), startIndex + 2);
                    token.Tag = TokenType.Quotes;
                    return(token);
                }
            }
            return(AbstractReader.Read(input, startIndex + 1, MarkdownSymbols.AllSymbols));
        }
示例#6
0
        private void button1_Click(object sender, EventArgs e)
        {
            IEncryption    encryption   = null;
            ISecurityRole  securityRole = null;
            AbstractReader reader       = null;

            if (checkBox1.Checked)
            {
                encryption = new ReverseEncryption();
            }

            if (checkBox2.Checked)
            {
                securityRole = new ClassicSecurityRole();
            }

            reader = GetReaderByIndex(comboBox1.SelectedIndex, encryption, securityRole, textBox3.Text, textBox4.Text);

            textBox2.Text = reader.Read(textBox1.Text);
        }
示例#7
0
        public void Parse_CorrectToken(string input, string tokenText, char stopSymbol)
        {
            var resToken = AbstractReader.Read(input, 0, stopSymbol);

            resToken.Text.Should().Be(tokenText);
        }