private int FindEndQuoteForValue(SourcePart text) { if (text == null || text.Length < 2) { return(-1); } var start = 1; var end = -1; var length = text.Length; var indexMatch = false; while (!indexMatch && start > 0 && start < length) { end = text.Substring(start, length - start).IndexOf("\"") + start; if (end == -1) { return(-1); } indexMatch = text.Substring(end - 1, 1).IndexOf("\\") == -1; start = end + 1; } return(indexMatch ? end : -1); }
protected string CutString(ref SourcePart text, int count) { if (count == 0) return string.Empty; previousSimbol = text[count - 1]; var result = text.Substring(0, count); text = text.Substring(count); return result; }
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); }
protected string CutString(ref SourcePart text, int count) { if (count == 0) { return(string.Empty); } previousSimbol = text[count - 1]; var result = text.Substring(0, count); text = text.Substring(count); return(result); }
protected void TryExtractTo(List <CodeLexem> res, ref SourcePart text, string lex, LexemType type, string except = null) { var index = text.IndexOf(lex); if (except != null) { while (index >= 0 && text.Substring(0, index + 1).EndsWith(except)) { index = text.IndexOf(lex, index + 1); } } if (index < 0) { return; } LineBreaks(res, ref text, index + lex.Length, type); }
private int FindEndQuoteForValue(SourcePart text) { if (text == null || text.Length < 2) return -1; var start = 1; var end = -1; var length = text.Length; var indexMatch = false; while (!indexMatch && start > 0 && start < length) { end = text.Substring(start, length - start).IndexOf("\"") + start; if (end == -1) return -1; indexMatch = text.Substring(end - 1, 1).IndexOf("\\") == -1; start = end + 1; } return indexMatch ? end : -1; }
private void ParseSymbol(ICollection<CodeLexem> res, ref SourcePart text) { var index = text.IndexOfAny(JsonSymbol); if (index != 0) return; res.Add(new CodeLexem(LexemType.Symbol, text.Substring(0, 1))); text = text.Substring(1); }
protected void TryExtractTo(List<CodeLexem> res, ref SourcePart text, string lex, LexemType type, string except = null) { var index = text.IndexOf(lex); if (except != null) { while (index >= 0 && text.Substring(0, index + 1).EndsWith(except)) { index = text.IndexOf(lex, index + 1); } } if (index < 0) return; LineBreaks(res, ref text, index + lex.Length, type); }