Greg647465374's picture
shorten the files
41c095f
{
"ast": {
"items": [
{
"use": {
"tree": {
"path": {
"ident": "crate",
"tree": {
"path": {
"ident": "extractor",
"tree": {
"path": {
"ident": "model",
"tree": {
"path": {
"ident": "extract",
"tree": {
"ident": "estimate_token_count"
}
}
}
}
}
}
}
}
}
}
},
{
"use": {
"tree": {
"path": {
"ident": "markdown",
"tree": {
"group": [
{
"ident": "to_mdast"
},
{
"ident": "ParseOptions"
}
]
}
}
}
}
},
{
"use": {
"tree": {
"path": {
"ident": "regex",
"tree": {
"ident": "Regex"
}
}
}
}
},
{
"use": {
"tree": {
"path": {
"ident": "crate",
"tree": {
"path": {
"ident": "extractor",
"tree": {
"path": {
"ident": "model",
"tree": {
"path": {
"ident": "content_hash",
"tree": {
"ident": "create_content_hash"
}
}
}
}
}
}
}
}
}
}
},
{
"use": {
"tree": {
"path": {
"ident": "crate",
"tree": {
"path": {
"ident": "extractor",
"tree": {
"group": [
{
"path": {
"ident": "model",
"tree": {
"path": {
"ident": "walk_ast",
"tree": {
"ident": "walk_ast"
}
}
}
}
},
{
"path": {
"ident": "types",
"tree": {
"ident": "CodeSnippet"
}
}
}
]
}
}
}
}
}
}
},
{
"fn": {
"attrs": [
{
"meta": {
"name_value": {
"path": {
"segments": [
{
"ident": "doc"
}
]
},
"value": {
"lit": {
"str": "\" Extracts code snippets from markdown AST using the markdown crate. \""
}
}
}
},
"style": "outer"
},
{
"meta": {
"name_value": {
"path": {
"segments": [
{
"ident": "doc"
}
]
},
"value": {
"lit": {
"str": "\" Extracts code snippets from text using regex patterns.\""
}
}
}
},
"style": "outer"
}
],
"ident": "extract_code_snippets_old",
"inputs": [
{
"typed": {
"pat": {
"ident": {
"ident": "text"
}
},
"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": {
"call": {
"args": [],
"func": {
"path": {
"segments": [
{
"ident": "Vec"
},
{
"ident": "new"
}
]
}
}
}
}
},
"pat": {
"ident": {
"ident": "excluded_ranges"
}
}
}
},
{
"let": {
"init": {
"expr": {
"method_call": {
"args": [],
"method": "unwrap",
"receiver": {
"call": {
"args": [
{
"lit": {
"str": "\"```(\\\\w+)?\\\\s*\\\\n(.*?)\\\\n```\""
}
}
],
"func": {
"path": {
"segments": [
{
"ident": "Regex"
},
{
"ident": "new"
}
]
}
}
}
}
}
}
},
"pat": {
"ident": {
"ident": "code_block_re"
}
}
}
},
{
"expr": [
{
"for_loop": {
"body": [
{
"let": {
"init": {
"expr": {
"method_call": {
"args": [],
"method": "unwrap",
"receiver": {
"method_call": {
"args": [
{
"lit": {
"int": "0"
}
}
],
"method": "get",
"receiver": {
"path": {
"segments": [
{
"ident": "cap"
}
]
}
}
}
}
}
}
},
"pat": {
"ident": {
"ident": "full_match"
}
}
}
},
{
"let": {
"init": {
"expr": {
"method_call": {
"args": [],
"method": "to_string",
"receiver": {
"method_call": {
"args": [
{
"lit": {
"str": "\"text\""
}
}
],
"method": "unwrap_or",
"receiver": {
"method_call": {
"args": [
{
"closure": {
"body": {
"method_call": {
"args": [],
"method": "as_str",
"receiver": {
"path": {
"segments": [
{
"ident": "m"
}
]
}
}
}
},
"inputs": [
{
"ident": {
"ident": "m"
}
}
],
"output": null
}
}
],
"method": "map",
"receiver": {
"method_call": {
"args": [
{
"lit": {
"int": "1"
}
}
],
"method": "get",
"receiver": {
"path": {
"segments": [
{
"ident": "cap"
}
]
}
}
}
}
}
}
}
}
}
}
},
"pat": {
"ident": {
"ident": "language"
}
}
}
},
{
"let": {
"init": {
"expr": {
"method_call": {
"args": [],
"method": "trim",
"receiver": {
"method_call": {
"args": [],
"method": "as_str",
"receiver": {
"method_call": {
"args": [],
"method": "unwrap",
"receiver": {
"method_call": {
"args": [
{
"lit": {
"int": "2"
}
}
],
"method": "get",
"receiver": {
"path": {
"segments": [
{
"ident": "cap"
}
]
}
}
}
}
}
}
}
}
}
}
},
"pat": {
"ident": {
"ident": "content"
}
}
}
},
{
"expr": [
{
"if": {
"cond": {
"unary": {
"expr": {
"method_call": {
"args": [],
"method": "is_empty",
"receiver": {
"path": {
"segments": [
{
"ident": "content"
}
]
}
}
}
},
"op": "!"
}
},
"then_branch": [
{
"let": {
"init": {
"expr": {
"call": {
"args": [
{
"path": {
"segments": [
{
"ident": "content"
}
]
}
}
],
"func": {
"path": {
"segments": [
{
"ident": "create_content_hash"
}
]
}
}
}
}
},
"pat": {
"ident": {
"ident": "content_hash"
}
}
}
},
{
"let": {
"init": {
"expr": {
"call": {
"args": [
{
"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"
}
}
}
},
{
"expr": [
{
"method_call": {
"args": [
{
"struct": {
"fields": [
{
"colon_token": true,
"expr": {
"method_call": {
"args": [],
"method": "to_string",
"receiver": {
"path": {
"segments": [
{
"ident": "content"
}
]
}
}
}
},
"ident": "content"
},
{
"expr": {
"path": {
"segments": [
{
"ident": "content_hash"
}
]
}
},
"ident": "content_hash"
},
{
"expr": {
"path": {
"segments": [
{
"ident": "language"
}
]
}
},
"ident": "language"
},
{
"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"
},
{
"colon_token": true,
"expr": {
"path": {
"segments": [
{
"ident": "None"
}
]
}
},
"ident": "test_result"
},
{
"colon_token": true,
"expr": {
"macro": {
"delimiter": "paren",
"path": {
"segments": [
{
"ident": "todo"
}
]
},
"tokens": []
}
},
"ident": "line_start"
},
{
"colon_token": true,
"expr": {
"macro": {
"delimiter": "paren",
"path": {
"segments": [
{
"ident": "todo"
}
]
},
"tokens": []
}
},
"ident": "line_end"
}
],
"path": {
"segments": [
{
"ident": "CodeSnippet"
}
]
}
}
}
],
"method": "push",
"receiver": {
"path": {
"segments": [
{
"ident": "snippets"
}
]
}
}
}
},
true
]
},
{
"expr": [
{
"method_call": {
"args": [
{
"range": {
"end": {
"method_call": {
"args": [],
"method": "end",
"receiver": {
"path": {
"segments": [
{
"ident": "full_match"
}
]
}
}
}
},
"limits": "..",
"start": {
"method_call": {
"args": [],
"method": "start",
"receiver": {
"path": {
"segments": [
{
"ident": "full_match"
}
]
}
}
}
}
}
}
],
"method": "push",
"receiver": {
"path": {
"segments": [
{
"ident": "excluded_ranges"
}
]
}
}
}
},
true
]
}
]
}
},
false
]
}
],
"expr": {
"method_call": {
"args": [
{
"path": {
"segments": [
{
"ident": "text"
}
]
}
}
],
"method": "captures_iter",
"receiver": {
"path": {
"segments": [
{
"ident": "code_block_re"
}
]
}
}
}
},
"pat": {
"ident": {
"ident": "cap"
}
}
}
},
false
]
},
{
"let": {
"init": {
"expr": {
"method_call": {
"args": [],
"method": "unwrap",
"receiver": {
"call": {
"args": [
{
"lit": {
"str": "\"`([^`]+)`\""
}
}
],
"func": {
"path": {
"segments": [
{
"ident": "Regex"
},
{
"ident": "new"
}
]
}
}
}
}
}
}
},
"pat": {
"ident": {
"ident": "inline_code_re"
}
}
}
},
{
"expr": [
{
"for_loop": {
"body": [
{
"let": {
"init": {
"expr": {
"method_call": {
"args": [],
"method": "unwrap",
"receiver": {
"method_call": {
"args": [
{
"lit": {
"int": "0"
}
}
],
"method": "get",
"receiver": {
"path": {
"segments": [
{
"ident": "cap"
}
]
}
}
}
}
}
}
},
"pat": {
"ident": {
"ident": "full_match"
}
}
}
},
{
"let": {
"init": {
"expr": {
"method_call": {
"args": [],
"method": "as_str",
"receiver": {
"method_call": {
"args": [],
"method": "unwrap",
"receiver": {
"method_call": {
"args": [
{
"lit": {
"int": "1"
}
}
],
"method": "get",
"receiver": {
"path": {
"segments": [
{
"ident": "cap"
}
]
}
}
}
}
}
}
}
}
},
"pat": {
"ident": {
"ident": "content"
}
}
}
},
{
"expr": [
{
"if": {
"cond": {
"method_call": {
"args": [
{
"closure": {
"body": {
"method_call": {
"args": [
{
"reference": {
"expr": {
"method_call": {
"args": [],
"method": "start",
"receiver": {
"path": {
"segments": [
{
"ident": "full_match"
}
]
}
}
}
}
}
}
],
"method": "contains",
"receiver": {
"path": {
"segments": [
{
"ident": "range"
}
]
}
}
}
},
"inputs": [
{
"ident": {
"ident": "range"
}
}
],
"output": null
}
}
],
"method": "any",
"receiver": {
"method_call": {
"args": [],
"method": "iter",
"receiver": {
"path": {
"segments": [
{
"ident": "excluded_ranges"
}
]
}
}
}
}
}
},
"then_branch": [
{
"expr": [
{
"continue": {}
},
true
]
}
]
}
},
false
]
},
{
"expr": [
{
"if": {
"cond": {
"binary": {
"left": {
"method_call": {
"args": [],
"method": "len",
"receiver": {
"path": {
"segments": [
{
"ident": "content"
}
]
}
}
}
},
"op": ">",
"right": {
"lit": {
"int": "10"
}
}
}
},
"then_branch": [
{
"let": {
"init": {
"expr": {
"call": {
"args": [
{
"path": {
"segments": [
{
"ident": "content"
}
]
}
}
],
"func": {
"path": {
"segments": [
{
"ident": "create_content_hash"
}
]
}
}
}
}
},
"pat": {
"ident": {
"ident": "content_hash"
}
}
}
},
{
"let": {
"init": {
"expr": {
"call": {
"args": [
{
"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"
}
}
}
},
{
"expr": [
{
"method_call": {
"args": [
{
"struct": {
"fields": [
{
"colon_token": true,
"expr": {
"method_call": {
"args": [],
"method": "to_string",
"receiver": {
"path": {
"segments": [
{
"ident": "content"
}
]
}
}
}
},
"ident": "content"
},
{
"expr": {
"path": {
"segments": [
{
"ident": "content_hash"
}
]
}
},
"ident": "content_hash"
},
{
"colon_token": true,
"expr": {
"method_call": {
"args": [],
"method": "to_string",
"receiver": {
"lit": {
"str": "\"inline\""
}
}
}
},
"ident": "language"
},
{
"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"
},
{
"colon_token": true,
"expr": {
"path": {
"segments": [
{
"ident": "None"
}
]
}
},
"ident": "test_result"
},
{
"colon_token": true,
"expr": {
"lit": {
"int": "0"
}
},
"ident": "line_end"
},
{
"colon_token": true,
"expr": {
"lit": {
"int": "0"
}
},
"ident": "line_start"
}
],
"path": {
"segments": [
{
"ident": "CodeSnippet"
}
]
}
}
}
],
"method": "push",
"receiver": {
"path": {
"segments": [
{
"ident": "snippets"
}
]
}
}
}
},
true
]
}
]
}
},
false
]
}
],
"expr": {
"method_call": {
"args": [
{
"path": {
"segments": [
{
"ident": "text"
}
]
}
}
],
"method": "captures_iter",
"receiver": {
"path": {
"segments": [
{
"ident": "inline_code_re"
}
]
}
}
}
},
"pat": {
"ident": {
"ident": "cap"
}
}
}
},
false
]
},
{
"expr": [
{
"path": {
"segments": [
{
"ident": "snippets"
}
]
}
},
false
]
}
],
"vis": "pub"
}
},
{
"fn": {
"attrs": [
{
"meta": {
"name_value": {
"path": {
"segments": [
{
"ident": "doc"
}
]
},
"value": {
"lit": {
"str": "\" Extracts code snippets from text using regex patterns.\""
}
}
}
},
"style": "outer"
}
],
"ident": "extract_code_snippets2",
"inputs": [
{
"typed": {
"pat": {
"ident": {
"ident": "text"
}
},
"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": "unwrap",
"receiver": {
"call": {
"args": [
{
"lit": {
"str": "\"```(\\\\w+)?\\\\s*\\\\n(.*?)\\\\n```\""
}
}
],
"func": {
"path": {
"segments": [
{
"ident": "Regex"
},
{
"ident": "new"
}
]
}
}
}
}
}
}
},
"pat": {
"ident": {
"ident": "code_block_re"
}
}
}
},
{
"expr": [
{
"for_loop": {
"body": [
{
"let": {
"init": {
"expr": {
"method_call": {
"args": [],
"method": "to_string",
"receiver": {
"method_call": {
"args": [
{
"lit": {
"str": "\"text\""
}
}
],
"method": "unwrap_or",
"receiver": {
"method_call": {
"args": [
{
"closure": {
"body": {
"method_call": {
"args": [],
"method": "as_str",
"receiver": {
"path": {
"segments": [
{
"ident": "m"
}
]
}
}
}
},
"inputs": [
{
"ident": {
"ident": "m"
}
}
],
"output": null
}
}
],
"method": "map",
"receiver": {
"method_call": {
"args": [
{
"lit": {
"int": "1"
}
}
],
"method": "get",
"receiver": {
"path": {
"segments": [
{
"ident": "cap"
}
]
}
}
}
}
}
}
}
}
}
}
},
"pat": {
"ident": {
"ident": "language"
}
}
}
},
{
"let": {
"init": {
"expr": {
"method_call": {
"args": [],
"method": "trim",
"receiver": {
"method_call": {
"args": [],
"method": "as_str",
"receiver": {
"method_call": {
"args": [],
"method": "unwrap",
"receiver": {
"method_call": {
"args": [
{
"lit": {
"int": "2"
}
}
],
"method": "get",
"receiver": {
"path": {
"segments": [
{
"ident": "cap"
}
]
}
}
}
}
}
}
}
}
}
}
},
"pat": {
"ident": {
"ident": "content"
}
}
}
},
{
"expr": [
{
"if": {
"cond": {
"unary": {
"expr": {
"method_call": {
"args": [],
"method": "is_empty",
"receiver": {
"path": {
"segments": [
{
"ident": "content"
}
]
}
}
}
},
"op": "!"
}
},
"then_branch": [
{
"let": {
"init": {
"expr": {
"call": {
"args": [
{
"path": {
"segments": [
{
"ident": "content"
}
]
}
}
],
"func": {
"path": {
"segments": [
{
"ident": "create_content_hash"
}
]
}
}
}
}
},
"pat": {
"ident": {
"ident": "content_hash"
}
}
}
},
{
"let": {
"init": {
"expr": {
"call": {
"args": [
{
"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"
}
}
}
},
{
"expr": [
{
"method_call": {
"args": [
{
"struct": {
"fields": [
{
"colon_token": true,
"expr": {
"method_call": {
"args": [],
"method": "to_string",
"receiver": {
"path": {
"segments": [
{
"ident": "content"
}
]
}
}
}
},
"ident": "content"
},
{
"expr": {
"path": {
"segments": [
{
"ident": "content_hash"
}
]
}
},
"ident": "content_hash"
},
{
"expr": {
"path": {
"segments": [
{
"ident": "language"
}
]
}
},
"ident": "language"
},
{
"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"
},
{
"colon_token": true,
"expr": {
"path": {
"segments": [
{
"ident": "None"
}
]
}
},
"ident": "test_result"
},
{
"colon_token": true,
"expr": {
"lit": {
"int": "0"
}
},
"ident": "line_start"
},
{
"colon_token": true,
"expr": {
"lit": {
"int": "0"
}
},
"ident": "line_end"
}
],
"path": {
"segments": [
{
"ident": "CodeSnippet"
}
]
}
}
}
],
"method": "push",
"receiver": {
"path": {
"segments": [
{
"ident": "snippets"
}
]
}
}
}
},
true
]
}
]
}
},
false
]
}
],
"expr": {
"method_call": {
"args": [
{
"path": {
"segments": [
{
"ident": "text"
}
]
}
}
],
"method": "captures_iter",
"receiver": {
"path": {
"segments": [
{
"ident": "code_block_re"
}
]
}
}
}
},
"pat": {
"ident": {
"ident": "cap"
}
}
}
},
false
]
},
{
"let": {
"init": {
"expr": {
"method_call": {
"args": [],
"method": "unwrap",
"receiver": {
"call": {
"args": [
{
"lit": {
"str": "\"`([^`]+)`\""
}
}
],
"func": {
"path": {
"segments": [
{
"ident": "Regex"
},
{
"ident": "new"
}
]
}
}
}
}
}
}
},
"pat": {
"ident": {
"ident": "inline_code_re"
}
}
}
},
{
"expr": [
{
"for_loop": {
"body": [
{
"let": {
"init": {
"expr": {
"method_call": {
"args": [],
"method": "as_str",
"receiver": {
"method_call": {
"args": [],
"method": "unwrap",
"receiver": {
"method_call": {
"args": [
{
"lit": {
"int": "1"
}
}
],
"method": "get",
"receiver": {
"path": {
"segments": [
{
"ident": "cap"
}
]
}
}
}
}
}
}
}
}
},
"pat": {
"ident": {
"ident": "content"
}
}
}
},
{
"expr": [
{
"if": {
"cond": {
"binary": {
"left": {
"method_call": {
"args": [],
"method": "len",
"receiver": {
"path": {
"segments": [
{
"ident": "content"
}
]
}
}
}
},
"op": ">",
"right": {
"lit": {
"int": "10"
}
}
}
},
"then_branch": [
{
"let": {
"init": {
"expr": {
"call": {
"args": [
{
"path": {
"segments": [
{
"ident": "content"
}
]
}
}
],
"func": {
"path": {
"segments": [
{
"ident": "create_content_hash"
}
]
}
}
}
}
},
"pat": {
"ident": {
"ident": "content_hash"
}
}
}
},
{
"let": {
"init": {
"expr": {
"call": {
"args": [
{
"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": {
"lit": {
"int": "0"
}
}
},
"pat": {
"ident": {
"ident": "char_count"
}
}
}
},
{
"expr": [
{
"method_call": {
"args": [
{
"struct": {
"fields": [
{
"colon_token": true,
"expr": {
"method_call": {
"args": [],
"method": "to_string",
"receiver": {
"path": {
"segments": [
{
"ident": "content"
}
]
}
}
}
},
"ident": "content"
},
{
"expr": {
"path": {
"segments": [
{
"ident": "content_hash"
}
]
}
},
"ident": "content_hash"
},
{
"colon_token": true,
"expr": {
"method_call": {
"args": [],
"method": "to_string",
"receiver": {
"lit": {
"str": "\"inline\""
}
}
}
},
"ident": "language"
},
{
"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"
},
{
"colon_token": true,
"expr": {
"path": {
"segments": [
{
"ident": "None"
}
]
}
},
"ident": "test_result"
},
{
"colon_token": true,
"expr": {
"lit": {
"int": "0"
}
},
"ident": "line_start"
},
{
"colon_token": true,
"expr": {
"lit": {
"int": "0"
}
},
"ident": "line_end"
}
],
"path": {
"segments": [
{
"ident": "CodeSnippet"
}
]
}
}
}
],
"method": "push",
"receiver": {
"path": {
"segments": [
{
"ident": "snippets"
}
]
}
}
}
},
true
]
}
]
}
},
false
]
}
],
"expr": {
"method_call": {
"args": [
{
"path": {
"segments": [
{
"ident": "text"
}
]
}
}
],
"method": "captures_iter",
"receiver": {
"path": {
"segments": [
{
"ident": "inline_code_re"
}
]
}
}
}
},
"pat": {
"ident": {
"ident": "cap"
}
}
}
},
false
]
},
{
"expr": [
{
"path": {
"segments": [
{
"ident": "snippets"
}
]
}
},
false
]
}
],
"vis": "pub"
}
},
{
"fn": {
"ident": "extract_code_snippets",
"inputs": [
{
"typed": {
"pat": {
"ident": {
"ident": "text"
}
},
"ty": {
"reference": {
"elem": {
"path": {
"segments": [
{
"ident": "str"
}
]
}
}
}
}
}
}
],
"output": {
"path": {
"segments": [
{
"arguments": {
"angle_bracketed": {
"args": [
{
"type": {
"path": {
"segments": [
{
"arguments": {
"angle_bracketed": {
"args": [
{
"type": {
"path": {
"segments": [
{
"ident": "CodeSnippet"
}
]
}
}
}
]
}
},
"ident": "Vec"
}
]
}
}
},
{
"type": {
"path": {
"segments": [
{
"ident": "markdown"
},
{
"ident": "message"
},
{
"ident": "Message"
}
]
}
}
}
]
}
},
"ident": "Result"
}
]
}
},
"stmts": [
{
"let": {
"init": {
"expr": {
"call": {
"args": [],
"func": {
"path": {
"segments": [
{
"ident": "Vec"
},
{
"ident": "new"
}
]
}
}
}
}
},
"pat": {
"ident": {
"ident": "snippets",
"mut": true
}
}
}
},
{
"let": {
"init": {
"expr": {
"try": {
"expr": {
"call": {
"args": [
{
"path": {
"segments": [
{
"ident": "text"
}
]
}
},
{
"reference": {
"expr": {
"call": {
"args": [],
"func": {
"path": {
"segments": [
{
"ident": "ParseOptions"
},
{
"ident": "default"
}
]
}
}
}
}
}
}
],
"func": {
"path": {
"segments": [
{
"ident": "to_mdast"
}
]
}
}
}
}
}
}
},
"pat": {
"ident": {
"ident": "ast"
}
}
}
},
{
"expr": [
{
"call": {
"args": [
{
"reference": {
"expr": {
"path": {
"segments": [
{
"ident": "ast"
}
]
}
}
}
},
{
"reference": {
"expr": {
"path": {
"segments": [
{
"ident": "snippets"
}
]
}
},
"mut": true
}
}
],
"func": {
"path": {
"segments": [
{
"ident": "walk_ast"
}
]
}
}
}
},
true
]
},
{
"expr": [
{
"call": {
"args": [
{
"path": {
"segments": [
{
"ident": "snippets"
}
]
}
}
],
"func": {
"path": {
"segments": [
{
"ident": "Ok"
}
]
}
}
}
},
false
]
}
],
"vis": "pub"
}
}
]
},
"file_path": "src\\extractor\\model\\snippets.rs",
"summary": {
"emoji_counts_in_strings": {},
"string_literals": [
"\" Extracts code snippets from markdown AST using the markdown crate. \"",
"\" Extracts code snippets from text using regex patterns.\"",
"\"```(\\\\w+)?\\\\s*\\\\n(.*?)\\\\n```\"",
"\"text\"",
"\"`([^`]+)`\"",
"\"inline\"",
"\" Extracts code snippets from text using regex patterns.\"",
"\"```(\\\\w+)?\\\\s*\\\\n(.*?)\\\\n```\"",
"\"text\"",
"\"`([^`]+)`\"",
"\"inline\""
],
"top_level_nodes": 1,
"total_nodes": 985,
"type_counts": {
"angle_bracketed": 4,
"args": 95,
"arguments": 4,
"attrs": 2,
"binary": 2,
"body": 7,
"call": 20,
"closure": 3,
"colon_token": 18,
"cond": 5,
"continue": 1,
"delimiter": 2,
"elem": 3,
"end": 1,
"expr": 99,
"fields": 4,
"fn": 3,
"for_loop": 4,
"func": 20,
"group": 2,
"ident": 277,
"if": 5,
"init": 33,
"inputs": 6,
"int": 17,
"items": 1,
"left": 2,
"let": 33,
"limits": 1,
"lit": 28,
"macro": 2,
"meta": 3,
"method": 71,
"method_call": 71,
"mut": 4,
"name_value": 3,
"op": 4,
"output": 6,
"pat": 40,
"path": 134,
"range": 1,
"receiver": 71,
"reference": 7,
"right": 2,
"segments": 119,
"start": 1,
"stmts": 3,
"str": 11,
"struct": 4,
"style": 3,
"then_branch": 5,
"tokens": 2,
"tree": 20,
"try": 1,
"ty": 3,
"type": 5,
"typed": 3,
"unary": 2,
"use": 5,
"value": 3,
"vis": 3
},
"word_counts": {
"ast": 1,
"code": 3,
"crate": 1,
"extracts": 3,
"from": 3,
"inline": 2,
"markdown": 2,
"n": 4,
"patterns": 2,
"regex": 2,
"s": 2,
"snippets": 3,
"text": 4,
"the": 1,
"using": 3,
"w": 2
},
"word_emoji_counts": {
"⏱️": 2,
"🚚": 1
}
},
"timestamp": 1751588223
}