-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_isf_parser.rs
More file actions
41 lines (35 loc) · 1.38 KB
/
debug_isf_parser.rs
File metadata and controls
41 lines (35 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
fn main() {
let test_isf = r#"
/*{
"NAME": "Basic Color",
"DESCRIPTION": "Simple color shader",
"INPUTS": [
{"NAME": "brightness", "TYPE": "float", "DEFAULT": 1.0, "MIN": 0.0, "MAX": 2.0}
]
}*/
void main() {
vec2 uv = isf_FragNormCoord;
vec3 color = vec3(uv.x, uv.y, 0.5) * brightness;
gl_FragColor = vec4(color, 1.0);
}
"#;
println!("Original ISF code:");
println!("{}", test_isf);
println!("\n{}", "=".repeat(50));
// Find JSON boundaries
if let Some(json_start) = test_isf.find("/*{") {
println!("Found JSON start at position: {}", json_start);
if let Some(json_end) = test_isf.find("}*/") {
println!("Found JSON end at position: {}", json_end);
let json_str = &test_isf[json_start + 2..json_end];
println!("\nExtracted JSON:");
println!("{}", json_str);
println!("\nJSON length: {}", json_str.len());
// Try to parse
match json_str.parse::<serde_json::Value>() {
Ok(parsed) => println!("\nParsed successfully: {:?}", parsed),
Err(e) => println!("\nParse error: {}", e),
}
}
}
}