Expand description
Parser trait, language dispatch, and content hashing.
The Parser trait defines the interface all language parsers implement.
parse_file dispatches to the correct parser based on Language,
and computes the SHA-256 content hash in shared code so individual parsers
do not duplicate that logic.
Traits§
- Parser
- Common trait for all language parsers.
Functions§
- build_
call_ snippet - Convenience wrapper: splits
sourceinto lines and delegates tobuild_call_snippet_from_lines. Use the_from_linesvariant directly when building many snippets from the same file to avoid repeated allocation. - build_
call_ snippet_ from_ lines - Build a context snippet around a call-site from a pre-split line slice.
- collect_
calls_ bfs - Walk the entire syntax tree (BFS) collecting function call nodes.
- content_
hash - Compute the SHA-256 hex digest of the given source content.
- parse_
file - Parse a source file by dispatching to the appropriate language parser.
- read_
and_ parse_ file - Read
abs_pathfrom disk,parse_fileit understored_path, then striplocal_packagesfromdependencies_used. Returns the parsedProjectFilealongside the original source so callers can populate asource_mapfor the detection pipeline.