(code: &str)
| 1842 | } |
| 1843 | |
| 1844 | fn strip_string_literals(code: &str) -> String { |
| 1845 | let mut result = String::with_capacity(code.len()); |
| 1846 | let mut quote: Option<char> = None; |
| 1847 | let mut escaped = false; |
| 1848 | |
| 1849 | for ch in code.chars() { |
| 1850 | match quote { |
| 1851 | None => { |
| 1852 | if ch == '"' || ch == '\'' { |
| 1853 | quote = Some(ch); |
| 1854 | } |
| 1855 | result.push(ch); |
| 1856 | } |
| 1857 | Some(active_quote) => { |
| 1858 | if escaped { |
| 1859 | escaped = false; |
| 1860 | result.push(' '); |
| 1861 | } else if ch == '\\' { |
| 1862 | escaped = true; |
| 1863 | result.push(' '); |
| 1864 | } else if ch == active_quote { |
| 1865 | quote = None; |
| 1866 | result.push(ch); |
| 1867 | } else { |
| 1868 | result.push(' '); |
| 1869 | } |
| 1870 | } |
| 1871 | } |
| 1872 | } |
| 1873 | |
| 1874 | result |
| 1875 | } |
| 1876 | |
| 1877 | fn regex_has_include() -> &'static Regex { |
| 1878 | static VALUE: OnceLock<Regex> = OnceLock::new(); |
no test coverage detected