Skip to content

Commit

Permalink
Document range and line mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jloleysens committed Oct 7, 2019
1 parent 5152927 commit d2ff6a2
Showing 1 changed file with 29 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,39 @@ export interface Position {
}

export interface Range {
// TODO: document
/**
* The start point of the range.
*/
start: Position;
// TODO: document

/**
* The end point of the range.
*/
end: Position;
}

// TODO: document
/**
* Enumeration of the different states the current position can be in.
*
* Current implementation uses low-level binary operations OR ('|') and AND ('&') to, respectively:
*
* - Create a combination of acceptable states.
* - Extract the states from the acceptable combination.
*
* E.g.
* ```ts
* const acceptableStates = LINE_MODE.REQUEST_START | LINE_MODE.IN_REQUEST; // binary '110'
*
* // Is MULTI_DOC_CUR_DOC_END ('1000') acceptable?
* Boolean(acceptableStates & LINE_MODE.MULTI_DOC_CUR_DOC_END) // false
*
* // Is REQUEST_START ('10') acceptable?
* Boolean(acceptableStates & LINE_MODE.REQUEST_START) // true
* ```
*
* This implementation will probably be changed to something more accessible in future but is documented
* here for reference.
*/
export enum LINE_MODE {
REQUEST_START = 2,
IN_REQUEST = 4,
Expand Down

0 comments on commit d2ff6a2

Please sign in to comment.