MCPcopy Create free account
hub / github.com/PerroEngine/Perro / strip_comment

Function strip_comment

perro_source/core/perro_animation/src/panim/syntax.rs:39–48  ·  view source on GitHub ↗
(line: &str)

Source from the content-addressed store, hash-verified

37}
38
39fn strip_comment(line: &str) -> &str {
40 // Comment markers inside quoted strings (e.g. `"res://path"`) are content.
41 let bytes = line.as_bytes();
42 let mut in_string = false;
43 let mut i = 0;
44 while i < bytes.len() {
45 match bytes[i] {
46 b'"' => in_string = !in_string,
47 b'\\' if in_string => i += 1,
48 b'/' if !in_string && bytes.get(i + 1) == Some(&b'/') => return &line[..i],
49 b'#' if !in_string => return &line[..i],
50 _ => {}
51 }

Callers 5

parseMethod · 0.85
parse_animation_blockMethod · 0.85
parse_objects_blockMethod · 0.85
parse_frame_blockMethod · 0.85
parse_object_blockMethod · 0.85

Calls 3

findMethod · 0.80
lenMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected