Documentation
¶
Index ¶
- func ApplyAnnotationLine(ann *model.Annotation, key, value string)
- func BuildImportMap(f *ast.File, modulePath string) map[string]string
- func CalcBodyHash(path string) (string, error)
- func CalcMaxDepth(f *ast.File) int
- func CallName(call *ast.CallExpr, projImports map[string]string, projFuncs map[string]string, ...) string
- func CollectFuncDecl(gf *model.GoFile, d *ast.FuncDecl)
- func CollectGenDecl(gf *model.GoFile, d *ast.GenDecl)
- func CollectProjectSymbols(files []model.SourceFile) (funcs map[string]string, types map[string]bool)
- func CollectTypeRefs(fd *ast.FuncDecl, projImports map[string]string, projTypes map[string]bool, ...)
- func CollectVarNames(s *ast.ValueSpec) []string
- func DetectControl(path string) string
- func ExtractCalls(path string, modulePath string, projFuncs map[string]string, callerPkg string) ([]string, error)
- func ExtractFuncSource(path string, src []byte) string
- func ExtractFuncSourceCSharp(path string) (string, error)
- func ExtractFuncSourceJava(path string) (string, error)
- func ExtractFuncSourcePython(path string) (string, error)
- func ExtractFuncSourceRust(path string) (string, error)
- func ExtractFuncSourceTypeScript(path string) (string, error)
- func ExtractUses(path string, modulePath string, projTypes map[string]bool) ([]string, error)
- func HasLoopAtDepth1(path string) bool
- func HasSwitchAtDepth1(path string) bool
- func IfElseDepth(s *ast.IfStmt, current int) int
- func IsSkippableLine(line string) bool
- func IsSkippableLineCSharp(line string) bool
- func IsSkippableLineJava(line string) bool
- func IsSkippableLinePython(line string) bool
- func IsSkippableLineRust(line string) bool
- func IsSkippableLineTypeScript(line string) bool
- func NodeDepth(stmt ast.Stmt, current int) int
- func ParseAnnotation(path string) (*model.Annotation, error)
- func ParseCSharpAnnotation(path string) (*model.Annotation, error)
- func ParseCSharpFiles(paths []string) ([]*model.CSharpFile, error)
- func ParseCodebook(path string) (*model.Codebook, error)
- func ParseFuncPairs(value string) map[string]string
- func ParseGoFile(path string) (*model.GoFile, error)
- func ParseJavaAnnotation(path string) (*model.Annotation, error)
- func ParseJavaFiles(paths []string) ([]*model.JavaFile, error)
- func ParsePythonAnnotation(path string) (*model.Annotation, error)
- func ParsePythonFile(path string) (*model.PythonFile, error)
- func ParsePythonFiles(paths []string) ([]*model.PythonFile, error)
- func ParseRustAnnotation(path string) (*model.Annotation, error)
- func ParseRustFiles(paths []string) ([]*model.RustFile, error)
- func ParseTypeScriptAnnotation(path string) (*model.Annotation, error)
- func ParseTypeScriptFile(path string, projectRoot string) (*model.TypeScriptFile, error)
- func ParseTypeScriptFiles(paths []string, projectRoot string) ([]*model.TypeScriptFile, error)
- func ReadModulePath(goModPath string) (string, error)
- func ReceiverTypeName(recv *ast.FieldList) string
- func SortedKeys(m map[string]bool) []string
- func SplitTrim(s string) []string
- func StmtDepth(stmts []ast.Stmt, current int) int
- type CSharpResult
- type JavaResult
- type PyAstResult
- type PyImportJSON
- type PyQ4JSON
- type RustResult
- type TsAstResult
- type TsImportJSON
- type TsQ4JSON
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyAnnotationLine ¶
func ApplyAnnotationLine(ann *model.Annotation, key, value string)
ApplyAnnotationLine applies a parsed //ff: key-value pair to an Annotation.
func BuildImportMap ¶
BuildImportMap builds a map of alias → package name for project-internal imports.
func CalcBodyHash ¶
CalcBodyHash calculates the SHA-256 hash (first 8 hex chars) of the main func's signature and body in a Go source file.
func CalcMaxDepth ¶
CalcMaxDepth calculates the maximum nesting depth across all functions in a file.
func CallName ¶
func CallName(call *ast.CallExpr, projImports map[string]string, projFuncs map[string]string, callerPkg string) string
CallName extracts the qualified function name (pkg.FuncName) from a CallExpr. projImports: alias → package name. projFuncs: funcName → package name. callerPkg is used for same-package calls. Returns empty string for external or built-in calls.
func CollectFuncDecl ¶
CollectFuncDecl extracts func/method/init info from a FuncDecl into GoFile.
func CollectGenDecl ¶
CollectGenDecl extracts type/var info from a GenDecl into GoFile.
func CollectProjectSymbols ¶
func CollectProjectSymbols(files []model.SourceFile) (funcs map[string]string, types map[string]bool)
CollectProjectSymbols collects all func and type names from parsed SourceFiles. Returns two maps: funcs[name]=pkg, types[name]=true.
func CollectTypeRefs ¶
func CollectTypeRefs(fd *ast.FuncDecl, projImports map[string]string, projTypes map[string]bool, seen map[string]bool)
CollectTypeRefs collects project-internal type references from a FuncDecl.
func CollectVarNames ¶
CollectVarNames extracts variable names from a ValueSpec.
func DetectControl ¶
DetectControl detects the control structure of a func. Returns "selection", "iteration", or "sequence".
func ExtractCalls ¶
func ExtractCalls(path string, modulePath string, projFuncs map[string]string, callerPkg string) ([]string, error)
ExtractCalls extracts project-internal function calls as qualified names (pkg.FuncName).
func ExtractFuncSource ¶
ExtractFuncSource extracts the source text of the main func (excluding init) from a Go source file. Returns empty string if no func found.
func ExtractFuncSourceCSharp ¶
ExtractFuncSourceCSharp extracts the full source text (signature + body) of the first function-like node in a C# file, using the same node the parse stage hashes so llmc and parse agree. Returns "" if no function is found.
func ExtractFuncSourceJava ¶
ExtractFuncSourceJava extracts the full source text (signature + body) of the first function-like node in a Java file, using the same node the parse stage hashes so llmc and parse agree. Returns "" if no function is found.
func ExtractFuncSourcePython ¶
ExtractFuncSourcePython extracts the full source of the first def/method from a Python file. Returns empty string if no def found.
func ExtractFuncSourceRust ¶
ExtractFuncSourceRust extracts the full source text (signature + body) of the first function_item in a Rust file, using the same node the parse stage hashes so llmc and parse agree. Returns "" if no function is found.
func ExtractFuncSourceTypeScript ¶
ExtractFuncSourceTypeScript extracts the full source of the first function/method from a TypeScript file. Returns empty string if no function found.
func ExtractUses ¶
ExtractUses extracts project-internal type usages from a Go source file.
func HasLoopAtDepth1 ¶
HasLoopAtDepth1 returns true if the first non-init func has a loop at depth 1.
func HasSwitchAtDepth1 ¶
HasSwitchAtDepth1 returns true if the first non-init func has a switch at depth 1.
func IfElseDepth ¶
IfElseDepth calculates the maximum nesting depth for an if statement, including its else branch.
func IsSkippableLine ¶
IsSkippableLine returns true if the line should be skipped during annotation parsing (empty lines, regular comments, package declarations).
func IsSkippableLineCSharp ¶
IsSkippableLineCSharp returns true if the line should be skipped during C# annotation parsing. Skips empty lines, non-ff comments, and using directives.
func IsSkippableLineJava ¶
IsSkippableLineJava returns true if the line should be skipped during Java annotation parsing. Skips empty lines, non-ff comments, package declarations, and import statements.
func IsSkippableLinePython ¶
IsSkippableLinePython returns true if the line should be skipped during Python annotation parsing. Skips empty lines, shebang, encoding declarations, and non-ff comments.
func IsSkippableLineRust ¶
IsSkippableLineRust returns true if the line should be skipped during Rust annotation parsing. Skips empty lines, doc comments (/// and //!), attributes (#[...] and #![...]), non-ff line comments, and use declarations.
func IsSkippableLineTypeScript ¶
IsSkippableLineTypeScript returns true if the line should be skipped during TypeScript annotation parsing. Skips empty lines and non-ff comments.
func ParseAnnotation ¶
func ParseAnnotation(path string) (*model.Annotation, error)
ParseAnnotation parses //ff: annotations from the top of a Go source file.
func ParseCSharpAnnotation ¶
func ParseCSharpAnnotation(path string) (*model.Annotation, error)
ParseCSharpAnnotation parses //ff: annotations from the top of a C# source file.
func ParseCSharpFiles ¶
func ParseCSharpFiles(paths []string) ([]*model.CSharpFile, error)
ParseCSharpFiles parses multiple C# files in-process via tree-sitter (no subprocess) and returns the resulting CSharpFile slice.
func ParseCodebook ¶
ParseCodebook loads and parses a codebook.yaml file.
func ParseFuncPairs ¶
ParseFuncPairs parses "key1=val1 key2=val2" into a map.
func ParseGoFile ¶
ParseGoFile parses a Go source file and extracts its structure.
func ParseJavaAnnotation ¶
func ParseJavaAnnotation(path string) (*model.Annotation, error)
ParseJavaAnnotation parses //ff: annotations from the top of a Java source file.
func ParseJavaFiles ¶
ParseJavaFiles parses multiple Java files in-process via tree-sitter (no subprocess) and returns the resulting JavaFile slice.
func ParsePythonAnnotation ¶
func ParsePythonAnnotation(path string) (*model.Annotation, error)
ParsePythonAnnotation parses # ff: annotations from the top of a Python source file.
func ParsePythonFile ¶
func ParsePythonFile(path string) (*model.PythonFile, error)
ParsePythonFile parses a single Python file and returns a PythonFile.
func ParsePythonFiles ¶
func ParsePythonFiles(paths []string) ([]*model.PythonFile, error)
ParsePythonFiles parses multiple Python files in batch mode via py_ast.py.
func ParseRustAnnotation ¶
func ParseRustAnnotation(path string) (*model.Annotation, error)
ParseRustAnnotation parses //ff: annotations from the top of a Rust source file. Doc comments (///, //!) and attributes (#[...], #![...]) above the annotation are skipped.
func ParseRustFiles ¶
ParseRustFiles parses multiple Rust files in-process via tree-sitter (no subprocess) and returns the resulting RustFile slice.
func ParseTypeScriptAnnotation ¶
func ParseTypeScriptAnnotation(path string) (*model.Annotation, error)
ParseTypeScriptAnnotation parses //ff: annotations from the top of a TypeScript source file.
func ParseTypeScriptFile ¶
func ParseTypeScriptFile(path string, projectRoot string) (*model.TypeScriptFile, error)
ParseTypeScriptFile parses a single TypeScript file and returns a TypeScriptFile.
func ParseTypeScriptFiles ¶
func ParseTypeScriptFiles(paths []string, projectRoot string) ([]*model.TypeScriptFile, error)
ParseTypeScriptFiles parses multiple TypeScript files in batch mode via ts_ast.js.
func ReadModulePath ¶
ReadModulePath reads the module path from a go.mod file.
func ReceiverTypeName ¶
ReceiverTypeName extracts the type name from a method receiver field list.
func SortedKeys ¶
SortedKeys returns the keys of a map[string]bool as a sorted slice.
Types ¶
type CSharpResult ¶
type CSharpResult struct {
Path string
Module string
Funcs []string
Classes []string
Interfaces []string
Methods []string
Constructors []string
Vars []string
Lines int
MaxDepth int
Control string
HasLoopAtDepth1 bool
HasSwitchAtDepth1 bool
FuncLines map[string]int
Calls []string
Imports []string
BodyHash string
}
CSharpResult is the intermediate extraction result produced by tree-sitter for a single C# source file, before conversion to model.CSharpFile.
type JavaResult ¶
type JavaResult struct {
Path string
Module string
Funcs []string
Classes []string
Interfaces []string
Methods []string
Constructors []string
Vars []string
Lines int
MaxDepth int
Control string
HasLoopAtDepth1 bool
HasSwitchAtDepth1 bool
FuncLines map[string]int
Calls []string
Imports []string
BodyHash string
}
JavaResult is the intermediate extraction result produced by tree-sitter for a single Java source file, before conversion to model.JavaFile.
type PyAstResult ¶
type PyAstResult struct {
Path string `json:"path"`
Functions []string `json:"functions"`
Classes []string `json:"classes"`
Methods []string `json:"methods"`
HasInitMethod bool `json:"has_init_method"`
Vars []string `json:"vars"`
Lines int `json:"lines"`
MaxDepth int `json:"max_depth"`
Control string `json:"control"`
HasLoopAtDepth1 bool `json:"has_loop_at_depth1"`
HasMatchAtD1 bool `json:"has_match_at_depth1"`
FuncLines map[string]int `json:"func_lines"`
Q4Results []PyQ4JSON `json:"q4_results"`
Calls []string `json:"calls"`
Imports []PyImportJSON `json:"imports"`
ModuleImports []PyImportJSON `json:"module_imports"`
BodyHash string `json:"body_hash"`
Error string `json:"error,omitempty"`
}
PyAstResult is the JSON structure output by scripts/py_ast.py.
type PyImportJSON ¶
PyImportJSON is the JSON representation of an import from py_ast.py.
type PyQ4JSON ¶
type PyQ4JSON struct {
FuncName string `json:"func_name"`
StmtType string `json:"stmt_type"`
PureLines int `json:"pure_lines"`
Line int `json:"line"`
}
PyQ4JSON is the JSON representation of a Q4 result from py_ast.py.
type RustResult ¶
type RustResult struct {
Path string
Module string
Funcs []string
Types []string
Methods []string
Vars []string
Lines int
MaxDepth int
Control string
HasLoopAtDepth1 bool
HasSwitchAtDepth1 bool
FuncLines map[string]int
Calls []string
Imports []string
IsTest bool
BodyHash string
}
RustResult is the intermediate extraction result produced by tree-sitter for a single Rust source file, before conversion to model.RustFile.
type TsAstResult ¶
type TsAstResult struct {
Path string `json:"path"`
Functions []string `json:"functions"`
Classes []string `json:"classes"`
Interfaces []string `json:"interfaces"`
TypeAliases []string `json:"type_aliases"`
Methods []string `json:"methods"`
HasConstructor bool `json:"has_constructor"`
Vars []string `json:"vars"`
Lines int `json:"lines"`
MaxDepth int `json:"max_depth"`
Control string `json:"control"`
HasLoopAtDepth1 bool `json:"has_loop_at_depth1"`
HasSwitchAtD1 bool `json:"has_switch_at_depth1"`
FuncLines map[string]int `json:"func_lines"`
Q4Results []TsQ4JSON `json:"q4_results"`
Calls []string `json:"calls"`
Imports []TsImportJSON `json:"imports"`
BodyHash string `json:"body_hash"`
Error string `json:"error,omitempty"`
}
TsAstResult is the JSON structure output by scripts/ts_ast.js.
type TsImportJSON ¶
TsImportJSON is the JSON representation of an import from ts_ast.js.
Source Files
¶
- append_const_var_name.go
- apply_annotation_line.go
- build_csharp_file.go
- build_import_map.go
- build_java_file.go
- build_python_file.go
- build_rust_file.go
- build_typescript_file.go
- calc_body_hash.go
- calc_max_depth.go
- call_name.go
- classify_rust_funcs.go
- collect_calls_from_func.go
- collect_func_decl.go
- collect_gen_decl.go
- collect_project_symbols.go
- collect_type_refs.go
- collect_var_names.go
- contains_loop.go
- contains_switch.go
- csharp_func_lines.go
- csharp_queries.go
- csharp_result.go
- detect_control.go
- detect_control_csharp.go
- detect_control_java.go
- detect_control_rust.go
- detect_from_body.go
- extract_calls.go
- extract_const_fields_csharp.go
- extract_const_fields_java.go
- extract_func_source.go
- extract_func_source_csharp.go
- extract_func_source_java.go
- extract_func_source_python.go
- extract_func_source_rust.go
- extract_func_source_typescript.go
- extract_uses.go
- first_csharp_func_node.go
- first_func_body_stmts.go
- first_java_func_node.go
- first_or_empty.go
- first_rust_func_node.go
- has_loop_at_depth1.go
- has_switch_at_depth1.go
- if_else_depth.go
- is_next_python_top_level.go
- is_next_ts_top_level.go
- is_rust_method_context.go
- is_skippable_line.go
- is_skippable_line_csharp.go
- is_skippable_line_java.go
- is_skippable_line_python.go
- is_skippable_line_rust.go
- is_skippable_line_typescript.go
- is_test_file_rust.go
- is_ts_func_start.go
- java_func_lines.go
- java_queries.go
- java_result.go
- node_depth.go
- parse_annotation.go
- parse_codebook.go
- parse_csharp_annotation.go
- parse_csharp_files.go
- parse_csharp_source.go
- parse_func_pairs.go
- parse_go_file.go
- parse_java_annotation.go
- parse_java_files.go
- parse_java_source.go
- parse_python_annotation.go
- parse_python_file.go
- parse_python_files.go
- parse_rust_annotation.go
- parse_rust_files.go
- parse_rust_source.go
- parse_typescript_annotation.go
- parse_typescript_file.go
- parse_typescript_files.go
- py_ast_result.go
- py_import_json.go
- py_q4_json.go
- query_csharp_names.go
- query_java_names.go
- query_rust_names.go
- read_module_path.go
- receiver_type_name.go
- rust_control_kind.go
- rust_func_lines.go
- rust_queries.go
- rust_result.go
- scan_func_body.go
- scan_to_first_def.go
- scan_to_first_ts_func.go
- scan_ts_func_body.go
- sorted_keys.go
- split_trim.go
- stmt_depth.go
- ts_ast_result.go
- ts_import_json.go
- ts_q4_json.go
- wrap_ts_ast_error.go