Yes, Intellipad doesn't show comments in the output graph. But yes, the API does support this through the ISourceInfo interface. For example, I added this piece to the Node class in the MWindow sample:
public IEnumerable<String> Comments {get; set;} <br/> <br/> void ISourceInfo.SetSourceInfo(SourceContext sourceContext)
{
ISourceLocation loc = sourceContext.SourceLocation;
SourceLocation.CopySourceLocation(loc, this as ISourceInfo);
List<ParseToken> interleaveList = sourceContext.GetInterleave("Comment");
if (interleaveList != null)
{
var currentComments = Comments ?? Enumerable.Empty<string>();
var comments = new List<string>();
foreach (ParseToken token in interleaveList)
{
string comment = loc.ToString() + ", \"" + token.Text + "\"";
if (!currentComments.Contains(comment))
{
comments.Add(comment);
Console.WriteLine(comment);
}
}
comments.AddRange(currentComments);
if (comments.Count > 0)
Comments = comments;
}
}
SourceContext.GetInterleave gets you into the interleave stream, and you get the location info as well. In this code, the comments are added as a collection on that node object.
Note that t he location info that comes through here is the location info in the output graph, not the input file.
I also noted with this particular implementation that at the Node level here, the only comments that came there were those contained within an element of the input code that corresponded to a node. I didn't get comments that I placed at the top or the bottom of the input. I suspect that this is due to where ISourceInfo is actually being implemented, but I don't have the cycles at the moment to investigate more deeply.
Does that give you more to go on?
.Kraig