private void AddLines(SourceNode sourceNode, Action <LineOfCode> action) { LineOfCode parentLine = null; AddLines(sourceNode, sourceNode.StartString, delegate(LineOfCode line) { action(line); parentLine = line; }); if (sourceNode.Children != null) { foreach (var child in sourceNode.Children) { AddLines(child, delegate(LineOfCode line) { if (parentLine == null) { action(line); } else // note the parent action is not executed here { parentOfLine[line] = parentLine; } }); } } AddLines(sourceNode, sourceNode.EndString, action); }
internal MatchCollection Matches(LineOfCode line) { if (regex == null) { SetRegex(); } return(regex.Matches(line.Text)); }
private void ForEachAttributeOfCodeElementAndAncestors(LineOfCode line, Action <ICompilerAttribute> action) { ForEachAttributeOfCodeElementAndContents(line.CodeElement, action); if (parentOfLine != null) { while (line != null && parentOfLine.TryGetValue(line, out line) && !(line.CodeElement is ITypeDeclaration)) { ForEachAttributeOfCodeElement(line.CodeElement, action); } } }
private void AddLines(SourceNode sn, string text, Action <LineOfCode> action) { string[] ls = text.Split(lineBreaks, StringSplitOptions.RemoveEmptyEntries); foreach (var s in ls) { var line = new LineOfCode { Text = s, CodeElement = sn.ASTElement }; action(line); lines.Add(line); } }