public void ProcessBlockStart(CurlyBlock curlyBlock, StringBuilder sb) { var info = curlyBlock.Info; if (info.Method != default) { if (curlyBlock.FindNearestClassOrStruct() == default) { } sb.Insert(0, $"VNLogger.Log($\"Method { info.Method } of class {curlyBlock.FindNearestClassOrStruct().Info.Class} (line №{curlyBlock.StartIndex})\");"); } else if (info.PropertyGet != default) { if (curlyBlock.FindNearestClassOrStruct() == default) { } sb.Insert(0, $"VNLogger.Log($\"Property getter { curlyBlock.FindNearestProperty() } of class {curlyBlock.FindNearestClassOrStruct().Info.Class} (line №{curlyBlock.StartIndex})\");"); } else if (info.PropertySet != default) { sb.Insert(0, $"VNLogger.Log($\"Property setter { curlyBlock.FindNearestProperty() } of class {curlyBlock.FindNearestClassOrStruct().Info.Class} (line №{curlyBlock.StartIndex})\");"); } }
private static (int index, int line) parseBlockRecursively(string text, int i, int l, CurlyBlock result) { var info = parseCurlyBlockParameters(text, i - 2); result.Info = info; var debugLastLettersCount = 36; for (; i < text.Length; i++) { var letter = text[i]; var debugLastLetters = text.Substring(Mathf.Max(0, i - debugLastLettersCount), Mathf.Min(debugLastLettersCount, i + 1)); if (i > 19945) { } switch (letter) { case '"': if (i > 21900) { } (i, l) = parseString(text, i, l); break; case '\n': l++; break; case '/': if (text[i + 1] == '/') { (i, l) = parseSingleLineComment(text, i, l); } else if (text[i + 1] == '*') { (i, l) = parseMultiLineComment(text, i, l); } break; case '{': if (i > 22163) { } var newCurlyBlock = new CurlyBlock(i, l, result); result.AppendChildBlock(newCurlyBlock); (i, l) = parseBlockRecursively(text, i + 1, l, newCurlyBlock); break; case '}': result.EndIndex = i; return(i, l); case ';': if (result.Info.PropertyGet != default || result.Info.PropertySet != default || result.FindNearestMethod() != default) //У пропертей если и есть команды то только в сеттерах и геттерах, а остальные команды только в методах { result.AppendCommand(i, l); } break; default: break; } } result.EndIndex = text.Length - 1; return(-1, -1); }
public void ProcessBlockStart(CurlyBlock curlyBlock, StringBuilder sb) { sb.Insert(0, $"#Block {curlyBlock}: Line {curlyBlock.LineIndex} Start#"); }
public void ProcessCommand(CurlyBlock curlyBlock, StringBuilder sb, int lineIndex) { sb.Insert(0, $"#Command of Block {curlyBlock}: Line {lineIndex}#"); }
public void ProcessBlockEnd(CurlyBlock curlyBlock, StringBuilder sb) { }
public void ProcessCommand(CurlyBlock curlyBlock, StringBuilder sb, int lineIndex) { //sb.Insert(0, $"VNLogger.Log($\"Command of class {curlyBlock.FindNearestClass().Info.Class} (line №{curlyBlock.StartIndex})\");"); sb.Insert(0, $"VNLogger.Log({lineIndex});"); }