jfun.parsec
public class DefaultPositionMap extends Object implements PositionMap, Serializable
This class internally keeps a cache of the positions of all the line break characters scanned so far, therefore repeated position lookup can be done in amortized log(n) time.
Constructor Summary | |
---|---|
DefaultPositionMap(CharSequence src, int lno, int cno, char line_break)
Create a DefaultPositionMap object. | |
DefaultPositionMap(CharSequence src, int lno, int cno)
Create a DefaultPositionMap object. |
Method Summary | |
---|---|
Pos | getPos(int n) |
Parameters: src the source. lno the starting line number. cno the starting column number. line_break the line break character.
Parameters: src the source. lno the starting line number. cno the starting column number.