File tree Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ public final class IncrementalParseReusedNodeCollector:
4343 }
4444}
4545
46+ /// Record the affect range for potential re-used nodes. When edits intersect the affect range, the node is not able to be re-used.
47+ ///
48+ /// This is also a trigger to enable parser to parse incrementally.
4649public final class IncrementalParseNodeAffectRangeCollector {
4750 fileprivate var nodeAffectRange : [ RawSyntax . ID : Int ] = [ : ]
4851
Original file line number Diff line number Diff line change @@ -32,10 +32,12 @@ extension Lexer {
3232 /// usually less than 0.1% of the memory allocated by the syntax arena.
3333 var lexerStateAllocator = BumpPtrAllocator ( slabSize: 256 )
3434
35+ /// Compute the offset of the end of next token
3536 var offsetToNextTokenEnd : Int {
3637 self . getOffsetToStart ( self . nextToken) + self . nextToken. byteLength
3738 }
3839
40+ /// See doc comments in ``LookaheadTracker``
3941 var lookaheadTracker : UnsafeMutablePointer < LookaheadTracker >
4042
4143 fileprivate init ( sourceBufferStart: Lexer . Cursor , cursor: Lexer . Cursor ) {
@@ -61,10 +63,12 @@ extension Lexer {
6163 return self . nextToken
6264 }
6365
66+ /// Get the offset of `token` to `sourceBufferStart`.
6467 func getOffsetToStart( _ token: Lexer . Lexeme ) -> Int {
6568 return self . sourceBufferStart. distance ( to: token. cursor)
6669 }
6770
71+ /// Advance the the cursor by `offset` and reset `currentToken`
6872 mutating func advance( by offset: Int , currentToken: inout Lexer . Lexeme ) {
6973 self . cursor = currentToken. cursor
7074 self . cursor. position = self . cursor. position. advanced ( by: offset)
Original file line number Diff line number Diff line change @@ -682,7 +682,7 @@ extension Parser {
682682 }
683683}
684684
685- /// Record the furthest offset to `sourceBufferStart` that is reached by ``Parser.Lookahead `` or ``Parser.peek() `` in ``Lexer. LexemeSequence``
685+ /// Record the furthest offset to `sourceBufferStart` that is reached by ``Parser.Peek() `` or ``Lookahead `` in ``Lexer/ LexemeSequence``
686686public struct LookaheadTracker {
687687 private var _furthestOffset : Int
688688
You can’t perform that action at this time.
0 commit comments