new require("lib/TokenIterator")(tokens)
Represent token sequence the way it's easy to navigate
Parameters:
Name | Type | Description |
---|---|---|
tokens |
Object[] |
- Source:
A module representing token sequence
- Source:
Members
-
<private, static> leftPosIndexMap :number[]
-
Type:
- number[]
- Source:
-
<private, static> pos :number
-
Type:
- number
- Source:
-
<private, static> rightPosIndexMap :number[]
-
Type:
- number[]
- Source:
Methods
-
<inner> clone() → {module:lib/TokenIterator}
-
Get an independent copy of the iterator
- Source:
Returns:
self -
<inner> current() → {Object}
-
Get the current token
- Source:
Returns:
- Type
- Object
-
<inner> findByLeftPos(lPos) → {TokenIterator}
-
Move to the token corresponding given left in-code position
Parameters:
Name Type Description lPos
number - Source:
Returns:
- Type
- TokenIterator
-
<inner> findByRightPos(rPos) → {TokenIterator}
-
Move to the token corresponding given right in-code position
Parameters:
Name Type Description rPos
number - Source:
Returns:
- Type
- TokenIterator
-
<inner> findGroupCloser(rightBoundaryPos)
-
Group boundaries are not present in the SyntaxTree, find the group closing token (((1))<)>
Parameters:
Name Type Description rightBoundaryPos
number - Source:
-
<inner> findGroupOpener(leftBoundaryPos)
-
Group boundaries are not present in the SyntaxTree, find the group opening token <(>((1)))
Parameters:
Name Type Description leftBoundaryPos
number - Source:
-
<inner> get(offset) → {object}
-
Get token by a given offset
Parameters:
Name Type Description offset
number (can be negative) - Source:
Returns:
- Type
- object
-
<inner> key() → {boolean}
-
Check if the end of the sequence reached
- Source:
Returns:
- Type
- boolean
-
<inner> next()
-
Move to the next element
- Source:
-
<inner> rewind()
-
Rewind the sequence
- Source:
-
<inner> valid() → {boolean}
-
Check if the end of the sequence reached
- Source:
Returns:
- Type
- boolean