public final class SourceAnchor extends Object
Every IR edge and most IR nodes carry a SourceAnchor so that any analysis result can be traced back to the exact source code position.
| Modifier and Type | Field and Description |
|---|---|
int |
endCol |
int |
endLine |
int |
endOffset |
String |
fileId
Source file identifier (file path or hash).
|
String |
snippet
Source code snippet text (for report display, max 200 characters).
|
int |
startCol |
int |
startLine
Line position (1-based).
|
int |
startOffset
Character offset (0-based).
|
String |
statementKey
Associated statementKey (for alignment with existing DataFlow system).
|
| Constructor and Description |
|---|
SourceAnchor(String fileId,
int startOffset,
int endOffset,
int startLine,
int startCol,
int endLine,
int endCol,
String statementKey,
String snippet) |
| Modifier and Type | Method and Description |
|---|---|
static SourceAnchor |
from(TParseTreeNode astNode)
Construct a SourceAnchor from an AST node's start/end tokens.
|
static SourceAnchor |
fromToken(TSourceToken token)
Construct a SourceAnchor from a single token.
|
String |
toString() |
public final int startOffset
public final int endOffset
public final int startLine
public final int startCol
public final int endLine
public final int endCol
public final String statementKey
public SourceAnchor(String fileId, int startOffset, int endOffset, int startLine, int startCol, int endLine, int endCol, String statementKey, String snippet)
public static SourceAnchor from(TParseTreeNode astNode)
public static SourceAnchor fromToken(TSourceToken token)