org.grothoff
Class LineNumberInfo

java.lang.Object
  extended byorg.grothoff.LineNumberInfo

public class LineNumberInfo
extends java.lang.Object

Obtain line number information for any JTB node. Note that "any" really means any -- we use reflection to overcome the problem that we do not know the full name of the AST root (in particular, there maybe multiple AST hierarchies in the project with multiple root "Node" classes). Essentially, pass a JTB node to the static "get" method and (if it is a JTB node and there is source corresponding to it), a LineNumberInfo object with the scope of the subtree is returned. Otherwise null. Minimal example: void semanticError(String message, Node n) { throw new Error(message + " at " + LineNumberInfo.get(n)); }


Field Summary
 int colEnd
           
 int colStart
           
 int lineEnd
           
 int lineStart
           
 
Method Summary
static LineNumberInfo get(java.lang.Object o)
          Compute line number information for the given JTB node.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

lineStart

public final int lineStart

lineEnd

public final int lineEnd

colStart

public final int colStart

colEnd

public final int colEnd
Method Detail

toString

public java.lang.String toString()

get

public static LineNumberInfo get(java.lang.Object o)
Compute line number information for the given JTB node.

Parameters:
o - any JTB node (the type should be node, but since this code handles any JTB AST we cannot hardwire the type ("Node" -- but which package?)
Returns: