logo       

Re: Printing comments with BooPrinterVisitor: msg#00053

lang.boo.devel

Subject: Re: Printing comments with BooPrinterVisitor

Rodrigo B. de Oliveira wrote:
On 9/10/05, Daniel Grunwald <daniel-c/LZLyLxtvmTUrhO6CyE8bNAH6kLmebB@xxxxxxxxxxxxxxxx> wrote:
  
 I want to extend BooPrinterVisitor to print comments for the C# -> Boo
conversion.
 I have a list of comments with line+column number, and the comment text.
 All nodes in the AST carry LexicalInfo representing the location of the
node in the C# document.
 So basically I want to intercept writing ANY node (or at least any
statement) and print all comments up to the line of the statement.
 My problem is: Do I really need to override all On...Statement methods?
 It would be much easier if DepthFirstVisitor.Visit(INode) was virtual.
 
 So should I make DepthFirstVisitor.Visit virtual? Or override all
...Statement methods (with the risk that future statements are forgotten to
be inserted)?
 Or is there any other way?
 
    

Use a DepthFirstTransformer and override OnNode.
  
But I'm not creating my own visitor, I'm extending BooPrinterVisitor which inherits from TextEmitter which inherits from DepthFirstVisitor.

Daniel
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise