Class: Ibex::Runtime::CST::Relexer
- Inherits:
-
Object
- Object
- Ibex::Runtime::CST::Relexer
- Defined in:
- lib/ibex/runtime/cst/incremental/relexer.rb
Overview
Sound Stage-A comparison: scan from the beginning and reuse only exact token/state/boundary matches, then recognize a shifted suffix boundary.
Class Method Summary collapse
Class Method Details
.reconcile(previous, current, edits) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/ibex/runtime/cst/incremental/relexer.rb', line 36 def self.reconcile(previous, current, edits) normalized = TextEdit.normalize(edits) return RelexResult.new(memo: current, reused_count: 0, scanned_count: 0, resynchronized_at: nil) if normalized.empty? damage, delta, resync_boundary = edit_window(normalized) old_by_offset = offset_index(previous) tokens = current.tokens.dup reused, scanned, resynchronized_at = reuse_tokens( previous, current, tokens, old_by_offset, damage, delta, resync_boundary ) memo = TokenMemo.new(tokens: tokens, offsets: current.offsets, states: current.states) RelexResult.new( memo: memo, reused_count: reused, scanned_count: scanned, resynchronized_at: resynchronized_at ) end |