| java.lang.Object com.sun.tools.javac.util.Position
Position | public class Position (Code) | | A class that defines source code positions as simple character
offsets from the beginning of the file. The first character
is at position 0.
Support is also provided for (line,column) coordinates, but tab
expansion is optional and no Unicode excape translation is considered.
The first character is at location (1,1).
This is NOT part of any API supported by Sun Microsystems. If
you write code that depends on this, you do so at your own risk.
This code and its internal interfaces are subject to change or
deletion without notice.
|
Inner Class :static class LineMapImpl implements LineMap | |
Inner Class :public static class LineTabMapImpl extends LineMapImpl | |
Method Summary | |
public static int | encodePosition(int line, int col) | public static LineMap | makeLineMap(char[] src, int max, boolean expandTabs) A two-way map between line/column numbers and positions,
derived from a scan done at creation time. |
FIRSTCOLUMN | final public static int FIRSTCOLUMN(Code) | | |
FIRSTLINE | final public static int FIRSTLINE(Code) | | |
FIRSTPOS | final public static int FIRSTPOS(Code) | | |
LINESHIFT | final public static int LINESHIFT(Code) | | |
MAXCOLUMN | final public static int MAXCOLUMN(Code) | | |
MAXLINE | final public static int MAXLINE(Code) | | |
MAXPOS | final public static int MAXPOS(Code) | | |
NOPOS | final public static int NOPOS(Code) | | |
encodePosition | public static int encodePosition(int line, int col)(Code) | | Encode line and column numbers in an integer as:
line-number << LINESHIFT + column-number
Position.NOPOS represents an undefined position. Parameters: line - number of line (first is 1) Parameters: col - number of character on line (first is 1) an encoded position or Position.NOPOS if the line or column number is too big to represent in the encoded format throws: IllegalArgumentException - if line or col is less than 1 |
makeLineMap | public static LineMap makeLineMap(char[] src, int max, boolean expandTabs)(Code) | | A two-way map between line/column numbers and positions,
derived from a scan done at creation time. Tab expansion is
optionally supported via a character map. Text content
is not retained.
Notes: The first character position FIRSTPOS is at
(FIRSTLINE,FIRSTCOLUMN). No account is taken of Unicode escapes.
Parameters: src - Source characters Parameters: max - Number of characters to read Parameters: expandTabs - If true, expand tabs when calculating columns |
|
|