Пример #1
0
 private void ParseSymbol(ICollection<CodeLexem> res, ref SourcePart text)
 {
     int index = text.IndexOfAny(XmlSymbol);
     if (index != 0)
         return;
     
     res.Add(new CodeLexem(LexemType.Symbol, text.Substring(0, 1)));
     text = text.Substring(1);
 }
Пример #2
0
        private void ParseSymbol(ICollection <CodeLexem> res, ref SourcePart text)
        {
            int index = text.IndexOfAny(XmlSymbol);

            if (index != 0)
            {
                return;
            }

            res.Add(new CodeLexem(LexemType.Symbol, text.Substring(0, 1)));
            text = text.Substring(1);
        }
Пример #3
0
 private void ParseXmlKeyWord(ICollection<CodeLexem> res, ref SourcePart text, LexemType type)
 {
     var index = text.IndexOfAny(XmlEndOfTerm);
     if (index <= 0)
         return;
     
     var delimiterIndex = text.IndexOf(XmlNamespaceDelimeter);
     if (delimiterIndex > 0 && delimiterIndex < index)
     {
         res.Add(new CodeLexem(type, CutString(ref text, delimiterIndex)));
         res.Add(new CodeLexem(LexemType.Symbol, CutString(ref text, 1)));
         res.Add(new CodeLexem(type, CutString(ref text, index - delimiterIndex - 1)));
         return;
     }
     res.Add(new CodeLexem(type, CutString(ref text, index)));
 }
Пример #4
0
        private void ParseXmlKeyWord(ICollection <CodeLexem> res, ref SourcePart text, LexemType type)
        {
            var index = text.IndexOfAny(XmlEndOfTerm);

            if (index <= 0)
            {
                return;
            }

            var delimiterIndex = text.IndexOf(XmlNamespaceDelimeter);

            if (delimiterIndex > 0 && delimiterIndex < index)
            {
                res.Add(new CodeLexem(type, CutString(ref text, delimiterIndex)));
                res.Add(new CodeLexem(LexemType.Symbol, CutString(ref text, 1)));
                res.Add(new CodeLexem(type, CutString(ref text, index - delimiterIndex - 1)));
                return;
            }
            res.Add(new CodeLexem(type, CutString(ref text, index)));
        }
Пример #5
0
 private void TryExtractValue(List<CodeLexem> res, ref SourcePart text)
 {
     if (text[0] == '{')
     {
         res.Add(new CodeLexem(LexemType.Symbol, CutString(ref text, 1)));
     }
     else if (text[0] == '[')
     {
         res.Add(new CodeLexem(LexemType.Symbol, CutString(ref text, 1)));
     }
     else if (text[0] == '"')
     {
         res.Add(new CodeLexem(LexemType.Quotes, CutString(ref text, 1)));
         var end = text.IndexOf('"');
         res.Add(new CodeLexem(LexemType.Value, CutString(ref text, end)));
         res.Add(new CodeLexem(LexemType.Quotes, CutString(ref text, 1)));
     }
     else
     {
         var end = text.IndexOfAny(new[] { ',', '}' });
         res.Add(new CodeLexem(LexemType.Value, CutString(ref text, end)));
         res.Add(new CodeLexem(LexemType.Symbol, CutString(ref text, 1)));
     }
 }
Пример #6
0
 private void TryExtractValue(List <CodeLexem> res, ref SourcePart text)
 {
     if (text[0] == '{')
     {
         res.Add(new CodeLexem(LexemType.Symbol, CutString(ref text, 1)));
     }
     else if (text[0] == '[')
     {
         res.Add(new CodeLexem(LexemType.Symbol, CutString(ref text, 1)));
     }
     else if (text[0] == '"')
     {
         res.Add(new CodeLexem(LexemType.Quotes, CutString(ref text, 1)));
         var end = text.IndexOf('"');
         res.Add(new CodeLexem(LexemType.Value, CutString(ref text, end)));
         res.Add(new CodeLexem(LexemType.Quotes, CutString(ref text, 1)));
     }
     else
     {
         var end = text.IndexOfAny(new[] { ',', '}' });
         res.Add(new CodeLexem(LexemType.Value, CutString(ref text, end)));
         res.Add(new CodeLexem(LexemType.Symbol, CutString(ref text, 1)));
     }
 }