Skip to main content

find_identifier

Function find_identifier 

Source
pub(crate) fn find_identifier(source: &str, name: &str) -> Option<Range<usize>>
Expand description

Find the first whole-word occurrence of name in source.

“Whole word” means the bytes adjacent to the match are not identifier characters ([A-Za-z0-9_]). Returns the half-open byte range of the match, or None if name does not appear as a standalone token.