MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / validate_float_suffix

Function validate_float_suffix

src/code_actions/extract_constant.rs:135–151  ·  view source on GitHub ↗

Validate the remainder of a float literal after the 'e'/'E'.

(bytes: &[u8])

Source from the content-addressed store, hash-verified

133
134/// Validate the remainder of a float literal after the 'e'/'E'.
135fn validate_float_suffix(bytes: &[u8]) -> bool {
136 if bytes.is_empty() {
137 return false;
138 }
139 let start = if bytes[0] == b'+' || bytes[0] == b'-' {
140 1
141 } else {
142 0
143 };
144 if start >= bytes.len() {
145 return false;
146 }
147 bytes[start..]
148 .iter()
149 .all(|b| b.is_ascii_digit() || *b == b'_')
150 && bytes[start..].iter().any(|b| b.is_ascii_digit())
151}
152
153/// Returns `true` when the text is a concatenated string expression
154/// like `'prefix_' . 'suffix'`. Each segment must be a string literal

Callers 1

is_numeric_literalFunction · 0.85

Calls 3

iterMethod · 0.80
is_emptyMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected