Expand description
Small text utilities shared by the TypeScript and Rust scanners.
Both scanners read source as plain text โ the drift check must work when
ag-ui does not compile and when no TypeScript toolchain is present.
Everything here is therefore delimiter counting with string-literal
awareness, nothing more.
Functionsยง
- apply_
rename_ all - Applies a serde
rename_allrule to an already-snake_case name. - blank_
lifetimes - Replaces the apostrophe that opens a Rust lifetime with a space.
- closing ๐
- The closing delimiter for an opening one.
- find_
top_ level - Byte index of the first
needleinsthat sits outside every delimiter pair and string literal. - match_
delim - Byte index of the delimiter matching the one at
open, orNonewhen the source is unbalanced. - pascal_
to_ screaming_ snake TextMessageStart->TEXT_MESSAGE_START.- push_
trimmed ๐ - read_
ident - Reads the identifier starting at byte index
at, or an empty string. - screaming_
snake_ to_ pascal TEXT_MESSAGE_START->TextMessageStart.- skip_
string ๐ - Consumes an iterator up to and including the closing
quote. - snake_
to_ camel message_id->messageId.- snake_
to_ pascal message_id->MessageId.- split_
top_ level - Splits
sonsepoccurrences that sit outside every delimiter pair and string literal. Empty (whitespace-only) pieces are dropped, so a trailing comma costs nothing. - strip_
comments - Replaces
//and/* */comments with spaces, keeping every newline so byte offsets stay usable for line numbers.