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

Function tokenize

atomic-core/src/merge/three_way.rs:83–88  ·  view source on GitHub ↗

Tokenize a byte slice into owned [`MergeToken`]s. Uses the project's code-aware [`Tokenizer`] so that operators, strings, numbers, and comments are recognised as single tokens.

(content: &[u8])

Source from the content-addressed store, hash-verified

81/// Uses the project's code-aware [`Tokenizer`] so that operators,
82/// strings, numbers, and comments are recognised as single tokens.
83pub fn tokenize(content: &[u8]) -> Vec<MergeToken> {
84 Tokenizer::tokenize_all(content)
85 .into_iter()
86 .map(|t| MergeToken::new(t.content()))
87 .collect()
88}
89
90/// Perform a three-way merge of token sequences.
91///

Calls 2

into_iterMethod · 0.45
contentMethod · 0.45