xtc.tree
Class Relocator

java.lang.Object
  extended by xtc.tree.Visitor
      extended by xtc.tree.Relocator

public class Relocator
extends Visitor

Visitor to relocate an abstract syntax tree. This visitor strips all line markers from the abstract syntax tree, while also updating all nodes with locations to reflect the source location relative to the last line marker.

Version:
$Revision: 1.1 $
Author:
Robert Grimm

Field Summary
protected  int baseLine
          The line of the last line marker.
protected  java.lang.String markedFile
          The currently marked file.
protected  int markedLine
          The currently marked line.
 
Constructor Summary
Relocator()
          Create a new relocator.
 
Method Summary
protected  void relocate(Node n)
          Relocate the specified node.
 Annotation visit(Annotation a)
          Process the specified annotation.
 Node visit(LineMarker m)
          Process the specified line marker.
 Node visit(Node n)
          Process the specified node.
 
Methods inherited from class xtc.tree.Visitor
dispatch, equals, hashCode, iterate, map, mapInPlace, unableToVisit
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

markedFile

protected java.lang.String markedFile
The currently marked file.


markedLine

protected int markedLine
The currently marked line.


baseLine

protected int baseLine
The line of the last line marker.

Constructor Detail

Relocator

public Relocator()
Create a new relocator.

Method Detail

relocate

protected void relocate(Node n)
Relocate the specified node.

Parameters:
n - The node.

visit

public Node visit(Node n)
Process the specified node.


visit

public Annotation visit(Annotation a)
Process the specified annotation.

Overrides:
visit in class Visitor
Parameters:
a - The annotation.
Returns:
The result of applying this visitor on the referenced node.

visit

public Node visit(LineMarker m)
Process the specified line marker.



Copyright © 2012. All Rights Reserved.