MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / compute_token_changes

Function compute_token_changes

atomic-core/src/diff/semantic/diff_impl.rs:274–287  ·  view source on GitHub ↗

Compute token-level changes between two lines. This is the core of the token-level diff - it compares the tokens of two lines and produces a sequence of token changes.

(
    before: &SemanticLine<'a>,
    after: &SemanticLine<'a>,
    config: &WordDiffConfig,
)

Source from the content-addressed store, hash-verified

272/// This is the core of the token-level diff - it compares the tokens
273/// of two lines and produces a sequence of token changes.
274pub(super) fn compute_token_changes<'a>(
275 before: &SemanticLine<'a>,
276 after: &SemanticLine<'a>,
277 config: &WordDiffConfig,
278) -> Vec<TokenChange<'a>> {
279 // Use word diff to find token-level changes
280 let word_result = word_diff_with_config(
281 before.content_without_newline(),
282 after.content_without_newline(),
283 config,
284 );
285
286 convert_word_diff_to_token_changes(&word_result, before, after)
287}
288
289/// Convert word diff operations to token changes.
290pub(super) fn convert_word_diff_to_token_changes<'a>(

Calls 3

word_diff_with_configFunction · 0.85