{ "ast": { "items": [ { "use": { "tree": { "path": { "ident": "crate", "tree": { "path": { "ident": "extractor", "tree": { "group": [ { "path": { "ident": "model", "tree": { "path": { "ident": "extract_html", "tree": { "ident": "extract_code_snippets_from_html" } } } } }, { "path": { "ident": "types", "tree": { "group": [ { "ident": "CodeSnippet" }, { "ident": "DocumentSummary" }, { "ident": "ExtractedFile" }, { "ident": "ProcessingFile" }, { "ident": "TestResult" } ] } } } ] } } } } } } }, { "use": { "tree": { "path": { "ident": "dioxus", "tree": { "group": [ { "path": { "ident": "html", "tree": { "ident": "FileEngine" } } }, { "path": { "ident": "prelude", "tree": "*" } } ] } } } } }, { "use": { "tree": { "path": { "ident": "gloo_timers", "tree": { "path": { "ident": "future", "tree": { "ident": "TimeoutFuture" } } } } } } }, { "use": { "tree": { "path": { "ident": "std", "tree": { "group": [ { "path": { "ident": "collections", "tree": { "path": { "ident": "hash_map", "tree": { "ident": "DefaultHasher" } } } } }, { "path": { "ident": "hash", "tree": { "group": [ { "ident": "Hash" }, { "ident": "Hasher" } ] } } }, { "path": { "ident": "sync", "tree": { "ident": "Arc" } } } ] } } } } }, { "fn": { "ident": "extract_code_snippets", "inputs": [ { "typed": { "pat": { "ident": { "ident": "content" } }, "ty": { "reference": { "elem": { "path": { "segments": [ { "ident": "str" } ] } } } } } } ], "output": { "path": { "segments": [ { "arguments": { "angle_bracketed": { "args": [ { "type": { "path": { "segments": [ { "ident": "CodeSnippet" } ] } } } ] } }, "ident": "Vec" } ] } }, "stmts": [ { "let": { "init": { "expr": { "call": { "args": [], "func": { "path": { "segments": [ { "ident": "Vec" }, { "ident": "new" } ] } } } } }, "pat": { "ident": { "ident": "snippets", "mut": true } } } }, { "let": { "init": { "expr": { "method_call": { "args": [], "method": "collect", "receiver": { "method_call": { "args": [], "method": "lines", "receiver": { "path": { "segments": [ { "ident": "content" } ] } } } } } } }, "pat": { "type": { "pat": { "ident": { "ident": "lines" } }, "ty": { "path": { "segments": [ { "arguments": { "angle_bracketed": { "args": [ { "type": { "reference": { "elem": { "path": { "segments": [ { "ident": "str" } ] } } } } } ] } }, "ident": "Vec" } ] } } } } } }, { "let": { "init": { "expr": { "lit": { "bool": false } } }, "pat": { "ident": { "ident": "in_code_block", "mut": true } } } }, { "let": { "init": { "expr": { "call": { "args": [], "func": { "path": { "segments": [ { "ident": "String" }, { "ident": "new" } ] } } } } }, "pat": { "ident": { "ident": "current_language", "mut": true } } } }, { "let": { "init": { "expr": { "call": { "args": [], "func": { "path": { "segments": [ { "ident": "String" }, { "ident": "new" } ] } } } } }, "pat": { "ident": { "ident": "current_content", "mut": true } } } }, { "let": { "init": { "expr": { "lit": { "int": "0" } } }, "pat": { "ident": { "ident": "start_line", "mut": true } } } }, { "expr": [ { "for_loop": { "body": [ { "expr": [ { "if": { "cond": { "method_call": { "args": [ { "lit": { "str": "\"```\"" } } ], "method": "starts_with", "receiver": { "path": { "segments": [ { "ident": "line" } ] } } } }, "else_branch": { "if": { "cond": { "path": { "segments": [ { "ident": "in_code_block" } ] } }, "then_branch": [ { "expr": [ { "if": { "cond": { "unary": { "expr": { "method_call": { "args": [], "method": "is_empty", "receiver": { "path": { "segments": [ { "ident": "current_content" } ] } } } }, "op": "!" } }, "then_branch": [ { "expr": [ { "method_call": { "args": [ { "lit": { "char": "'\\n'" } } ], "method": "push", "receiver": { "path": { "segments": [ { "ident": "current_content" } ] } } } }, true ] } ] } }, false ] }, { "expr": [ { "method_call": { "args": [ { "path": { "segments": [ { "ident": "line" } ] } } ], "method": "push_str", "receiver": { "path": { "segments": [ { "ident": "current_content" } ] } } } }, true ] } ] } }, "then_branch": [ { "expr": [ { "if": { "cond": { "path": { "segments": [ { "ident": "in_code_block" } ] } }, "else_branch": { "block": { "stmts": [ { "expr": [ { "assign": { "left": { "path": { "segments": [ { "ident": "current_language" } ] } }, "right": { "method_call": { "args": [], "method": "to_string", "receiver": { "method_call": { "args": [], "method": "trim", "receiver": { "index": { "expr": { "path": { "segments": [ { "ident": "line" } ] } }, "index": { "range": { "limits": "..", "start": { "lit": { "int": "3" } } } } } } } } } } } }, true ] }, { "expr": [ { "if": { "cond": { "method_call": { "args": [], "method": "is_empty", "receiver": { "path": { "segments": [ { "ident": "current_language" } ] } } } }, "then_branch": [ { "expr": [ { "assign": { "left": { "path": { "segments": [ { "ident": "current_language" } ] } }, "right": { "method_call": { "args": [], "method": "to_string", "receiver": { "lit": { "str": "\"text\"" } } } } } }, true ] } ] } }, false ] }, { "expr": [ { "method_call": { "args": [], "method": "clear", "receiver": { "path": { "segments": [ { "ident": "current_content" } ] } } } }, true ] }, { "expr": [ { "assign": { "left": { "path": { "segments": [ { "ident": "start_line" } ] } }, "right": { "binary": { "left": { "path": { "segments": [ { "ident": "i" } ] } }, "op": "+", "right": { "lit": { "int": "1" } } } } } }, true ] }, { "expr": [ { "assign": { "left": { "path": { "segments": [ { "ident": "in_code_block" } ] } }, "right": { "lit": { "bool": true } } } }, true ] } ] } }, "then_branch": [ { "expr": [ { "if": { "cond": { "unary": { "expr": { "method_call": { "args": [], "method": "is_empty", "receiver": { "method_call": { "args": [], "method": "trim", "receiver": { "path": { "segments": [ { "ident": "current_content" } ] } } } } } }, "op": "!" } }, "then_branch": [ { "let": { "init": { "expr": { "call": { "args": [ { "method_call": { "args": [], "method": "clone", "receiver": { "path": { "segments": [ { "ident": "current_language" } ] } } } }, { "method_call": { "args": [], "method": "clone", "receiver": { "path": { "segments": [ { "ident": "current_content" } ] } } } }, { "path": { "segments": [ { "ident": "start_line" } ] } }, { "path": { "segments": [ { "ident": "i" } ] } } ], "func": { "path": { "segments": [ { "ident": "create_code_snippet" } ] } } } } }, "pat": { "ident": { "ident": "snippet" } } } }, { "expr": [ { "method_call": { "args": [ { "path": { "segments": [ { "ident": "snippet" } ] } } ], "method": "push", "receiver": { "path": { "segments": [ { "ident": "snippets" } ] } } } }, true ] } ] } }, false ] }, { "expr": [ { "method_call": { "args": [], "method": "clear", "receiver": { "path": { "segments": [ { "ident": "current_content" } ] } } } }, true ] }, { "expr": [ { "assign": { "left": { "path": { "segments": [ { "ident": "in_code_block" } ] } }, "right": { "lit": { "bool": false } } } }, true ] } ] } }, false ] } ] } }, false ] } ], "expr": { "method_call": { "args": [], "method": "enumerate", "receiver": { "method_call": { "args": [], "method": "iter", "receiver": { "path": { "segments": [ { "ident": "lines" } ] } } } } } }, "pat": { "tuple": { "elems": [ { "ident": { "ident": "i" } }, { "ident": { "ident": "line" } } ] } } } }, false ] }, { "expr": [ { "if": { "cond": { "binary": { "left": { "path": { "segments": [ { "ident": "in_code_block" } ] } }, "op": "&&", "right": { "unary": { "expr": { "method_call": { "args": [], "method": "is_empty", "receiver": { "method_call": { "args": [], "method": "trim", "receiver": { "path": { "segments": [ { "ident": "current_content" } ] } } } } } }, "op": "!" } } } }, "then_branch": [ { "let": { "init": { "expr": { "call": { "args": [ { "path": { "segments": [ { "ident": "current_language" } ] } }, { "path": { "segments": [ { "ident": "current_content" } ] } }, { "path": { "segments": [ { "ident": "start_line" } ] } }, { "method_call": { "args": [], "method": "len", "receiver": { "path": { "segments": [ { "ident": "lines" } ] } } } } ], "func": { "path": { "segments": [ { "ident": "create_code_snippet" } ] } } } } }, "pat": { "ident": { "ident": "snippet" } } } }, { "expr": [ { "method_call": { "args": [ { "path": { "segments": [ { "ident": "snippet" } ] } } ], "method": "push", "receiver": { "path": { "segments": [ { "ident": "snippets" } ] } } } }, true ] } ] } }, false ] }, { "expr": [ { "path": { "segments": [ { "ident": "snippets" } ] } }, false ] } ], "vis": "pub" } }, { "fn": { "attrs": [ { "meta": { "name_value": { "path": { "segments": [ { "ident": "doc" } ] }, "value": { "lit": { "str": "\" Create a complete CodeSnippet with all fields populated\"" } } } }, "style": "outer" } ], "ident": "create_code_snippet", "inputs": [ { "typed": { "pat": { "ident": { "ident": "language" } }, "ty": { "path": { "segments": [ { "ident": "String" } ] } } } }, { "typed": { "pat": { "ident": { "ident": "content" } }, "ty": { "path": { "segments": [ { "ident": "String" } ] } } } }, { "typed": { "pat": { "ident": { "ident": "line_start" } }, "ty": { "path": { "segments": [ { "ident": "usize" } ] } } } }, { "typed": { "pat": { "ident": { "ident": "line_end" } }, "ty": { "path": { "segments": [ { "ident": "usize" } ] } } } } ], "output": { "path": { "segments": [ { "ident": "CodeSnippet" } ] } }, "stmts": [ { "let": { "init": { "expr": { "call": { "args": [ { "reference": { "expr": { "path": { "segments": [ { "ident": "content" } ] } } } } ], "func": { "path": { "segments": [ { "ident": "generate_content_hash" } ] } } } } }, "pat": { "ident": { "ident": "content_hash" } } } }, { "let": { "init": { "expr": { "call": { "args": [ { "reference": { "expr": { "path": { "segments": [ { "ident": "content" } ] } } } } ], "func": { "path": { "segments": [ { "ident": "estimate_token_count" } ] } } } } }, "pat": { "ident": { "ident": "token_count" } } } }, { "let": { "init": { "expr": { "method_call": { "args": [], "method": "count", "receiver": { "method_call": { "args": [], "method": "lines", "receiver": { "path": { "segments": [ { "ident": "content" } ] } } } } } } }, "pat": { "ident": { "ident": "line_count" } } } }, { "let": { "init": { "expr": { "method_call": { "args": [], "method": "count", "receiver": { "method_call": { "args": [], "method": "chars", "receiver": { "path": { "segments": [ { "ident": "content" } ] } } } } } } }, "pat": { "ident": { "ident": "char_count" } } } }, { "let": { "init": { "expr": { "call": { "args": [ { "call": { "args": [], "func": { "path": { "segments": [ { "ident": "create_default_test_result" } ] } } } } ], "func": { "path": { "segments": [ { "ident": "Some" } ] } } } } }, "pat": { "ident": { "ident": "test_result" } } } }, { "expr": [ { "struct": { "fields": [ { "expr": { "path": { "segments": [ { "ident": "language" } ] } }, "ident": "language" }, { "expr": { "path": { "segments": [ { "ident": "content" } ] } }, "ident": "content" }, { "expr": { "path": { "segments": [ { "ident": "line_start" } ] } }, "ident": "line_start" }, { "expr": { "path": { "segments": [ { "ident": "line_end" } ] } }, "ident": "line_end" }, { "expr": { "path": { "segments": [ { "ident": "content_hash" } ] } }, "ident": "content_hash" }, { "expr": { "path": { "segments": [ { "ident": "token_count" } ] } }, "ident": "token_count" }, { "expr": { "path": { "segments": [ { "ident": "line_count" } ] } }, "ident": "line_count" }, { "expr": { "path": { "segments": [ { "ident": "char_count" } ] } }, "ident": "char_count" }, { "expr": { "path": { "segments": [ { "ident": "test_result" } ] } }, "ident": "test_result" } ], "path": { "segments": [ { "ident": "CodeSnippet" } ] } } }, false ] } ] } }, { "fn": { "attrs": [ { "meta": { "name_value": { "path": { "segments": [ { "ident": "doc" } ] }, "value": { "lit": { "str": "\" Generate a simple hash for content deduplication\"" } } } }, "style": "outer" } ], "ident": "generate_content_hash", "inputs": [ { "typed": { "pat": { "ident": { "ident": "content" } }, "ty": { "reference": { "elem": { "path": { "segments": [ { "ident": "str" } ] } } } } } } ], "output": { "path": { "segments": [ { "ident": "String" } ] } }, "stmts": [ { "let": { "init": { "expr": { "call": { "args": [], "func": { "path": { "segments": [ { "ident": "DefaultHasher" }, { "ident": "new" } ] } } } } }, "pat": { "ident": { "ident": "hasher", "mut": true } } } }, { "expr": [ { "method_call": { "args": [ { "reference": { "expr": { "path": { "segments": [ { "ident": "hasher" } ] } }, "mut": true } } ], "method": "hash", "receiver": { "path": { "segments": [ { "ident": "content" } ] } } } }, true ] }, { "expr": [ { "macro": { "delimiter": "paren", "path": { "segments": [ { "ident": "format" } ] }, "tokens": [ { "lit": "\"{:x}\"" }, { "punct": { "op": ",", "spacing": "alone" } }, { "ident": "hasher" }, { "punct": { "op": ".", "spacing": "alone" } }, { "ident": "finish" }, { "group": { "delimiter": "parenthesis", "stream": [] } } ] } }, false ] } ] } }, { "fn": { "attrs": [ { "meta": { "name_value": { "path": { "segments": [ { "ident": "doc" } ] }, "value": { "lit": { "str": "\" Estimate token count (rough approximation)\"" } } } }, "style": "outer" } ], "ident": "estimate_token_count", "inputs": [ { "typed": { "pat": { "ident": { "ident": "content" } }, "ty": { "reference": { "elem": { "path": { "segments": [ { "ident": "str" } ] } } } } } } ], "output": { "path": { "segments": [ { "ident": "usize" } ] } }, "stmts": [ { "expr": [ { "method_call": { "args": [], "method": "sum", "receiver": { "method_call": { "args": [ { "closure": { "body": { "block": { "stmts": [ { "let": { "init": { "expr": { "method_call": { "args": [], "method": "count", "receiver": { "method_call": { "args": [ { "closure": { "body": { "method_call": { "args": [], "method": "is_ascii_punctuation", "receiver": { "path": { "segments": [ { "ident": "c" } ] } } } }, "inputs": [ { "ident": { "ident": "c" } } ], "output": null } } ], "method": "filter", "receiver": { "method_call": { "args": [], "method": "chars", "receiver": { "path": { "segments": [ { "ident": "word" } ] } } } } } } } } }, "pat": { "ident": { "ident": "punctuation_count" } } } }, { "expr": [ { "binary": { "left": { "lit": { "int": "1" } }, "op": "+", "right": { "path": { "segments": [ { "ident": "punctuation_count" } ] } } } }, false ] } ] } }, "inputs": [ { "ident": { "ident": "word" } } ], "output": null } } ], "method": "map", "receiver": { "method_call": { "args": [], "method": "split_whitespace", "receiver": { "path": { "segments": [ { "ident": "content" } ] } } } } } } } }, false ] } ], "vis": "pub" } }, { "fn": { "attrs": [ { "meta": { "name_value": { "path": { "segments": [ { "ident": "doc" } ] }, "value": { "lit": { "str": "\" Create a default test result\"" } } } }, "style": "outer" } ], "ident": "create_default_test_result", "inputs": [], "output": { "path": { "segments": [ { "ident": "TestResult" } ] } }, "stmts": [ { "expr": [ { "struct": { "fields": [ { "colon_token": true, "expr": { "lit": { "bool": false } }, "ident": "passed" }, { "colon_token": true, "expr": { "path": { "segments": [ { "ident": "None" } ] } }, "ident": "error_message" }, { "colon_token": true, "expr": { "path": { "segments": [ { "ident": "None" } ] } }, "ident": "execution_time" }, { "colon_token": true, "expr": { "path": { "segments": [ { "ident": "None" } ] } }, "ident": "output" } ], "path": { "segments": [ { "ident": "TestResult" } ] } } }, false ] } ] } }, { "fn": { "async": true, "attrs": [ { "meta": { "name_value": { "path": { "segments": [ { "ident": "doc" } ] }, "value": { "lit": { "str": "\" Process files from FileEngine and extract code snippets\"" } } } }, "style": "outer" } ], "ident": "process_file_engine", "inputs": [ { "typed": { "pat": { "ident": { "ident": "file_engine" } }, "ty": { "path": { "segments": [ { "arguments": { "angle_bracketed": { "args": [ { "type": { "trait_object": { "bounds": [ { "trait": { "path": { "segments": [ { "ident": "FileEngine" } ] } } } ], "dyn": true } } } ] } }, "ident": "Arc" } ] } } } }, { "typed": { "pat": { "ident": { "ident": "files", "mut": true } }, "ty": { "path": { "segments": [ { "arguments": { "angle_bracketed": { "args": [ { "type": { "path": { "segments": [ { "arguments": { "angle_bracketed": { "args": [ { "type": { "path": { "segments": [ { "ident": "ExtractedFile" } ] } } } ] } }, "ident": "Vec" } ] } } } ] } }, "ident": "Signal" } ] } } } }, { "typed": { "pat": { "ident": { "ident": "processing_file", "mut": true } }, "ty": { "path": { "segments": [ { "arguments": { "angle_bracketed": { "args": [ { "type": { "path": { "segments": [ { "arguments": { "angle_bracketed": { "args": [ { "type": { "path": { "segments": [ { "ident": "ProcessingFile" } ] } } } ] } }, "ident": "Option" } ] } } } ] } }, "ident": "Signal" } ] } } } } ], "output": null, "stmts": [ { "let": { "init": { "expr": { "method_call": { "args": [], "method": "files", "receiver": { "path": { "segments": [ { "ident": "file_engine" } ] } } } } }, "pat": { "ident": { "ident": "file_names" } } } }, { "expr": [ { "for_loop": { "body": [ { "let": { "init": { "expr": { "call": { "args": [ { "struct": { "fields": [ { "colon_token": true, "expr": { "lit": { "int": "9" } }, "ident": "total_turns" }, { "colon_token": true, "expr": { "lit": { "int": "0" } }, "ident": "total_code_snippets" }, { "colon_token": true, "expr": { "lit": { "int": "0" } }, "ident": "total_tokens" }, { "colon_token": true, "expr": { "method_call": { "args": [], "method": "to_vec", "receiver": { "array": { "elems": [] } } } }, "ident": "languages_found" }, { "colon_token": true, "expr": { "method_call": { "args": [], "method": "to_vec", "receiver": { "array": { "elems": [] } } } }, "ident": "content_hashes" } ], "path": { "segments": [ { "ident": "DocumentSummary" } ] } } } ], "func": { "path": { "segments": [ { "ident": "Some" } ] } } } } }, "pat": { "ident": { "ident": "summary" } } } }, { "expr": [ { "method_call": { "args": [ { "call": { "args": [ { "struct": { "fields": [ { "colon_token": true, "expr": { "method_call": { "args": [], "method": "clone", "receiver": { "path": { "segments": [ { "ident": "file_name" } ] } } } }, "ident": "name" }, { "colon_token": true, "expr": { "lit": { "int": "0" } }, "ident": "progress" }, { "colon_token": true, "expr": { "lit": { "int": "0" } }, "ident": "total_lines" }, { "colon_token": true, "expr": { "call": { "args": [], "func": { "path": { "segments": [ { "ident": "String" }, { "ident": "new" } ] } } } }, "ident": "current_content" }, { "expr": { "path": { "segments": [ { "ident": "summary" } ] } }, "ident": "summary" } ], "path": { "segments": [ { "ident": "ProcessingFile" } ] } } } ], "func": { "path": { "segments": [ { "ident": "Some" } ] } } } } ], "method": "set", "receiver": { "path": { "segments": [ { "ident": "processing_file" } ] } } } }, true ] }, { "expr": [ { "await": { "base": { "call": { "args": [ { "lit": { "int": "50" } } ], "func": { "path": { "segments": [ { "ident": "TimeoutFuture" }, { "ident": "new" } ] } } } } } }, true ] }, { "expr": [ { "if": { "cond": { "let": { "expr": { "await": { "base": { "method_call": { "args": [ { "path": { "segments": [ { "ident": "file_name" } ] } } ], "method": "read_file_to_string", "receiver": { "path": { "segments": [ { "ident": "file_engine" } ] } } } } } }, "pat": { "tuple_struct": { "elems": [ { "ident": { "ident": "content" } } ], "path": { "segments": [ { "ident": "Some" } ] } } } } }, "then_branch": [ { "let": { "init": { "expr": { "method_call": { "args": [], "method": "collect", "receiver": { "method_call": { "args": [], "method": "lines", "receiver": { "path": { "segments": [ { "ident": "content" } ] } } } } } } }, "pat": { "type": { "pat": { "ident": { "ident": "lines" } }, "ty": { "path": { "segments": [ { "arguments": { "angle_bracketed": { "args": [ { "type": { "reference": { "elem": { "path": { "segments": [ { "ident": "str" } ] } } } } } ] } }, "ident": "Vec" } ] } } } } } }, { "let": { "init": { "expr": { "method_call": { "args": [], "method": "len", "receiver": { "path": { "segments": [ { "ident": "lines" } ] } } } } }, "pat": { "ident": { "ident": "total_lines" } } } }, { "expr": [ { "if": { "cond": { "let": { "expr": { "method_call": { "args": [], "method": "as_mut", "receiver": { "method_call": { "args": [], "method": "write", "receiver": { "path": { "segments": [ { "ident": "processing_file" } ] } } } } } }, "pat": { "tuple_struct": { "elems": [ { "ident": { "ident": "pf" } } ], "path": { "segments": [ { "ident": "Some" } ] } } } } }, "then_branch": [ { "expr": [ { "assign": { "left": { "field": { "base": { "path": { "segments": [ { "ident": "pf" } ] } }, "ident": "total_lines" } }, "right": { "path": { "segments": [ { "ident": "total_lines" } ] } } } }, true ] }, { "expr": [ { "assign": { "left": { "field": { "base": { "path": { "segments": [ { "ident": "pf" } ] } }, "ident": "current_content" } }, "right": { "method_call": { "args": [], "method": "clone", "receiver": { "path": { "segments": [ { "ident": "content" } ] } } } } } }, true ] } ] } }, false ] }, { "let": { "init": { "expr": { "method_call": { "args": [ { "lit": { "int": "1" } } ], "method": "max", "receiver": { "paren": { "expr": { "binary": { "left": { "path": { "segments": [ { "ident": "total_lines" } ] } }, "op": "/", "right": { "lit": { "int": "100" } } } } } } } } }, "pat": { "ident": { "ident": "progress_steps" } } } }, { "expr": [ { "for_loop": { "body": [ { "expr": [ { "if": { "cond": { "let": { "expr": { "method_call": { "args": [], "method": "as_mut", "receiver": { "method_call": { "args": [], "method": "write", "receiver": { "path": { "segments": [ { "ident": "processing_file" } ] } } } } } }, "pat": { "tuple_struct": { "elems": [ { "ident": { "ident": "pf" } } ], "path": { "segments": [ { "ident": "Some" } ] } } } } }, "then_branch": [ { "expr": [ { "assign": { "left": { "field": { "base": { "path": { "segments": [ { "ident": "pf" } ] } }, "ident": "progress" } }, "right": { "method_call": { "args": [ { "path": { "segments": [ { "ident": "total_lines" } ] } } ], "method": "min", "receiver": { "path": { "segments": [ { "ident": "i" } ] } } } } } }, true ] } ] } }, false ] }, { "expr": [ { "await": { "base": { "call": { "args": [ { "lit": { "int": "10" } } ], "func": { "path": { "segments": [ { "ident": "TimeoutFuture" }, { "ident": "new" } ] } } } } } }, true ] } ], "expr": { "method_call": { "args": [ { "path": { "segments": [ { "ident": "progress_steps" } ] } } ], "method": "step_by", "receiver": { "paren": { "expr": { "range": { "end": { "path": { "segments": [ { "ident": "total_lines" } ] } }, "limits": "..=", "start": { "lit": { "int": "0" } } } } } } } }, "pat": { "ident": { "ident": "i" } } } }, false ] }, { "let": { "init": { "expr": { "call": { "args": [ { "reference": { "expr": { "path": { "segments": [ { "ident": "content" } ] } } } } ], "func": { "path": { "segments": [ { "ident": "extract_code_snippets" } ] } } } } }, "pat": { "ident": { "ident": "snippets" } } } }, { "let": { "init": { "expr": { "path": { "segments": [ { "ident": "snippets" } ] } } }, "pat": { "ident": { "ident": "all_snippets", "mut": true } } } }, { "expr": [ { "method_call": { "args": [ { "call": { "args": [ { "reference": { "expr": { "path": { "segments": [ { "ident": "content" } ] } } } } ], "func": { "path": { "segments": [ { "ident": "extract_code_snippets_from_html" } ] } } } } ], "method": "extend", "receiver": { "path": { "segments": [ { "ident": "all_snippets" } ] } } } }, true ] }, { "expr": [ { "method_call": { "args": [ { "struct": { "fields": [ { "colon_token": true, "expr": { "method_call": { "args": [], "method": "clone", "receiver": { "path": { "segments": [ { "ident": "file_name" } ] } } } }, "ident": "name" }, { "colon_token": true, "expr": { "path": { "segments": [ { "ident": "all_snippets" } ] } }, "ident": "snippets" }, { "expr": { "path": { "segments": [ { "ident": "total_lines" } ] } }, "ident": "total_lines" } ], "path": { "segments": [ { "ident": "ExtractedFile" } ] } } } ], "method": "push", "receiver": { "method_call": { "args": [], "method": "write", "receiver": { "path": { "segments": [ { "ident": "files" } ] } } } } } }, true ] } ] } }, false ] } ], "expr": { "reference": { "expr": { "path": { "segments": [ { "ident": "file_names" } ] } } } }, "pat": { "ident": { "ident": "file_name" } } } }, false ] }, { "expr": [ { "method_call": { "args": [ { "path": { "segments": [ { "ident": "None" } ] } } ], "method": "set", "receiver": { "path": { "segments": [ { "ident": "processing_file" } ] } } } }, true ] } ], "vis": "pub" } }, { "fn": { "attrs": [ { "meta": { "name_value": { "path": { "segments": [ { "ident": "doc" } ] }, "value": { "lit": { "str": "\" Generate unique identifier for a code snippet\"" } } } }, "style": "outer" } ], "ident": "generate_snippet_id", "inputs": [ { "typed": { "pat": { "ident": { "ident": "file_name" } }, "ty": { "reference": { "elem": { "path": { "segments": [ { "ident": "str" } ] } } } } } }, { "typed": { "pat": { "ident": { "ident": "snippet_idx" } }, "ty": { "path": { "segments": [ { "ident": "usize" } ] } } } } ], "output": { "path": { "segments": [ { "ident": "String" } ] } }, "stmts": [ { "expr": [ { "macro": { "delimiter": "paren", "path": { "segments": [ { "ident": "format" } ] }, "tokens": [ { "lit": "\"{}_{}\"" }, { "punct": { "op": ",", "spacing": "alone" } }, { "ident": "file_name" }, { "punct": { "op": ",", "spacing": "alone" } }, { "ident": "snippet_idx" } ] } }, false ] } ], "vis": "pub" } }, { "fn": { "attrs": [ { "meta": { "name_value": { "path": { "segments": [ { "ident": "doc" } ] }, "value": { "lit": { "str": "\" Validate if content appears to be a markdown file\"" } } } }, "style": "outer" } ], "ident": "is_markdown_file", "inputs": [ { "typed": { "pat": { "ident": { "ident": "file_name" } }, "ty": { "reference": { "elem": { "path": { "segments": [ { "ident": "str" } ] } } } } } } ], "output": { "path": { "segments": [ { "ident": "bool" } ] } }, "stmts": [ { "let": { "init": { "expr": { "method_call": { "args": [], "method": "to_lowercase", "receiver": { "path": { "segments": [ { "ident": "file_name" } ] } } } } }, "pat": { "ident": { "ident": "lower_name" } } } }, { "expr": [ { "binary": { "left": { "binary": { "left": { "method_call": { "args": [ { "lit": { "str": "\".md\"" } } ], "method": "ends_with", "receiver": { "path": { "segments": [ { "ident": "lower_name" } ] } } } }, "op": "||", "right": { "method_call": { "args": [ { "lit": { "str": "\".markdown\"" } } ], "method": "ends_with", "receiver": { "path": { "segments": [ { "ident": "lower_name" } ] } } } } } }, "op": "||", "right": { "method_call": { "args": [ { "lit": { "str": "\".mdown\"" } } ], "method": "ends_with", "receiver": { "path": { "segments": [ { "ident": "lower_name" } ] } } } } } }, false ] } ], "vis": "pub" } }, { "fn": { "attrs": [ { "meta": { "name_value": { "path": { "segments": [ { "ident": "doc" } ] }, "value": { "lit": { "str": "\" Get language-specific file extension for downloaded snippets\"" } } } }, "style": "outer" } ], "ident": "get_file_extension", "inputs": [ { "typed": { "pat": { "ident": { "ident": "language" } }, "ty": { "reference": { "elem": { "path": { "segments": [ { "ident": "str" } ] } } } } } } ], "output": { "reference": { "elem": { "path": { "segments": [ { "ident": "str" } ] } }, "lifetime": "static" } }, "stmts": [ { "expr": [ { "match": { "arms": [ { "body": { "lit": { "str": "\"rs\"" } }, "pat": { "or": { "cases": [ { "lit": { "str": "\"rust\"" } }, { "lit": { "str": "\"rs\"" } } ] } } }, { "body": { "lit": { "str": "\"js\"" } }, "pat": { "or": { "cases": [ { "lit": { "str": "\"javascript\"" } }, { "lit": { "str": "\"js\"" } } ] } } }, { "body": { "lit": { "str": "\"ts\"" } }, "pat": { "or": { "cases": [ { "lit": { "str": "\"typescript\"" } }, { "lit": { "str": "\"ts\"" } } ] } } }, { "body": { "lit": { "str": "\"py\"" } }, "pat": { "or": { "cases": [ { "lit": { "str": "\"python\"" } }, { "lit": { "str": "\"py\"" } } ] } } }, { "body": { "lit": { "str": "\"java\"" } }, "pat": { "lit": { "str": "\"java\"" } } }, { "body": { "lit": { "str": "\"cpp\"" } }, "pat": { "or": { "cases": [ { "lit": { "str": "\"cpp\"" } }, { "lit": { "str": "\"c++\"" } } ] } } }, { "body": { "lit": { "str": "\"c\"" } }, "pat": { "lit": { "str": "\"c\"" } } }, { "body": { "lit": { "str": "\"html\"" } }, "pat": { "lit": { "str": "\"html\"" } } }, { "body": { "lit": { "str": "\"css\"" } }, "pat": { "lit": { "str": "\"css\"" } } }, { "body": { "lit": { "str": "\"json\"" } }, "pat": { "lit": { "str": "\"json\"" } } }, { "body": { "lit": { "str": "\"xml\"" } }, "pat": { "lit": { "str": "\"xml\"" } } }, { "body": { "lit": { "str": "\"yml\"" } }, "pat": { "or": { "cases": [ { "lit": { "str": "\"yaml\"" } }, { "lit": { "str": "\"yml\"" } } ] } } }, { "body": { "lit": { "str": "\"toml\"" } }, "pat": { "lit": { "str": "\"toml\"" } } }, { "body": { "lit": { "str": "\"sql\"" } }, "pat": { "lit": { "str": "\"sql\"" } } }, { "body": { "lit": { "str": "\"sh\"" } }, "pat": { "or": { "cases": [ { "lit": { "str": "\"bash\"" } }, { "lit": { "str": "\"sh\"" } } ] } } }, { "body": { "lit": { "str": "\"ps1\"" } }, "pat": { "or": { "cases": [ { "lit": { "str": "\"powershell\"" } }, { "lit": { "str": "\"ps1\"" } } ] } } }, { "body": { "lit": { "str": "\"txt\"" } }, "pat": { "_": {} } } ], "expr": { "method_call": { "args": [], "method": "as_str", "receiver": { "method_call": { "args": [], "method": "to_lowercase", "receiver": { "path": { "segments": [ { "ident": "language" } ] } } } } } } } }, false ] } ], "vis": "pub" } } ] }, "file_path": "src\\extractor\\model\\extract.rs", "summary": { "emoji_counts_in_strings": {}, "string_literals": [ "\"```\"", "\"text\"", "\" Create a complete CodeSnippet with all fields populated\"", "\" Generate a simple hash for content deduplication\"", "\"{:x}\"", "\" Estimate token count (rough approximation)\"", "\" Create a default test result\"", "\" Process files from FileEngine and extract code snippets\"", "\" Generate unique identifier for a code snippet\"", "\"{}_{}\"", "\" Validate if content appears to be a markdown file\"", "\".md\"", "\".markdown\"", "\".mdown\"", "\" Get language-specific file extension for downloaded snippets\"", "\"rs\"", "\"rust\"", "\"rs\"", "\"js\"", "\"javascript\"", "\"js\"", "\"ts\"", "\"typescript\"", "\"ts\"", "\"py\"", "\"python\"", "\"py\"", "\"java\"", "\"java\"", "\"cpp\"", "\"cpp\"", "\"c++\"", "\"c\"", "\"c\"", "\"html\"", "\"html\"", "\"css\"", "\"css\"", "\"json\"", "\"json\"", "\"xml\"", "\"xml\"", "\"yml\"", "\"yaml\"", "\"yml\"", "\"toml\"", "\"toml\"", "\"sql\"", "\"sql\"", "\"sh\"", "\"bash\"", "\"sh\"", "\"ps1\"", "\"powershell\"", "\"ps1\"", "\"txt\"" ], "top_level_nodes": 1, "total_nodes": 1366, "type_counts": { "_": 1, "angle_bracketed": 8, "args": 88, "arguments": 8, "arms": 1, "array": 2, "assign": 8, "async": 1, "attrs": 8, "await": 3, "base": 6, "binary": 6, "block": 2, "body": 22, "bool": 4, "bounds": 1, "call": 17, "cases": 8, "char": 1, "closure": 2, "colon_token": 15, "cond": 10, "delimiter": 3, "dyn": 1, "elem": 9, "elems": 6, "else_branch": 2, "end": 1, "expr": 110, "field": 3, "fields": 5, "fn": 9, "for_loop": 3, "func": 17, "group": 6, "ident": 328, "if": 10, "index": 2, "init": 23, "inputs": 11, "int": 14, "items": 1, "left": 14, "let": 26, "lifetime": 1, "limits": 2, "lit": 75, "macro": 2, "match": 1, "meta": 8, "method": 63, "method_call": 63, "mut": 10, "name_value": 8, "op": 13, "or": 8, "output": 11, "paren": 2, "pat": 62, "path": 175, "punct": 4, "range": 2, "receiver": 63, "reference": 15, "right": 14, "segments": 160, "spacing": 4, "start": 2, "stmts": 11, "str": 54, "stream": 1, "struct": 5, "style": 8, "then_branch": 10, "tokens": 2, "trait": 1, "trait_object": 1, "tree": 19, "tuple": 1, "tuple_struct": 3, "ty": 16, "type": 10, "typed": 14, "unary": 3, "use": 4, "value": 8, "vis": 6 }, "word_counts": { "_": 1, "a": 5, "all": 1, "and": 1, "appears": 1, "approximation": 1, "bash": 1, "be": 1, "c": 3, "code": 3, "complete": 1, "content": 2, "count": 1, "cpp": 2, "create": 2, "css": 2, "deduplication": 1, "default": 1, "downloaded": 1, "engine": 1, "estimate": 1, "extension": 1, "extract": 1, "fields": 1, "file": 3, "files": 1, "for": 3, "from": 1, "generate": 2, "get": 1, "hash": 1, "html": 2, "identifier": 1, "if": 1, "java": 2, "javascript": 1, "js": 2, "json": 2, "language": 1, "markdown": 2, "md": 1, "mdown": 1, "populated": 1, "powershell": 1, "process": 1, "ps1": 2, "py": 2, "python": 1, "result": 1, "rough": 1, "rs": 2, "rust": 1, "sh": 2, "simple": 1, "snippet": 2, "snippets": 2, "specific": 1, "sql": 2, "test": 1, "text": 1, "to": 1, "token": 1, "toml": 2, "ts": 2, "txt": 1, "typescript": 1, "unique": 1, "validate": 1, "with": 1, "x": 1, "xml": 2, "yaml": 1, "yml": 2 }, "word_emoji_counts": { "⬜": 1, "🌱": 1, "🎟️": 1, "📦": 2 } }, "timestamp": 1751588253 }