MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / is_js_line_terminator

Function is_js_line_terminator

codegraph-kernel/src/docstring.rs:71–73  ·  view source on GitHub ↗

JS multiline `^` anchors after \n, \r, U+2028, U+2029; the regex crate's `(?m)^` anchors after `\n` only. On CRLF content the JS engine finds a line start after the `\r`, so a greedy leading `\s*` (the block-continuation rule) consumes the `\n` and leaves the bare `\r` in the docstring — byte-parity on CRLF checkouts (every Windows autocrlf clone) depends on reproducing exactly that.

(ch: char)

Source from the content-addressed store, hash-verified

69/// byte-parity on CRLF checkouts (every Windows autocrlf clone) depends on
70/// reproducing exactly that.
71fn is_js_line_terminator(ch: char) -> bool {
72 matches!(ch, '\n' | '\r' | '\u{2028}' | '\u{2029}')
73}
74
75/// JS-semantics `str.replace(/^<pat>/gm, "")`: try the \A-anchored `pat` at
76/// position 0 and after every JS line terminator, left to right, resuming

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected