Skip to content

Commit

Permalink
Extend documentation of ParserState
Browse files Browse the repository at this point in the history
  • Loading branch information
robinst committed Jul 28, 2015
1 parent 80e22b3 commit ea9a22e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public class DocumentParser implements ParserState {
private CharSequence line;

/**
* current index (offset) in input line
* current index (offset) in input line (0-based)
*/
private int index = 0;

/**
* current column of input line (tab causes column to go to next 4-space tab stop)
* current column of input line (tab causes column to go to next 4-space tab stop) (0-based)
*/
private int column = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,26 @@ public interface ParserState {
CharSequence getLine();

/**
* @return the current index within the line
* @return the current index within the line (0-based)
*/
int getIndex();

/**
* @return the index of the next non-space character starting from {@link #getIndex()} (may be the same)
* @return the index of the next non-space character starting from {@link #getIndex()} (may be the same) (0-based)
*/
int getNextNonSpaceIndex();

/**
* @return the current column within the line
* The column is the position within the line after tab characters have been processed as 4-space tab stops.
* If the line doesn't contain any tabs, it's the same as the {@link #getIndex()}. If the line starts with a tab,
* followed by text, then the column for the first character of the text is 4 (the index is 1).
*
* @return the current column within the line (0-based)
*/
int getColumn();

/**
* @return the indentation (either by spaces or tab stop of 4), starting from {@link #getColumn()}
* @return the indentation in columns (either by spaces or tab stop of 4), starting from {@link #getColumn()}
*/
int getIndent();

Expand Down

0 comments on commit ea9a22e

Please sign in to comment.