Expand description
§DevGen Code Splitter Library
This library provides functionality for splitting source code into manageable chunks and identifying various code entities within those chunks. It’s designed to assist in code analysis, documentation generation, and other tasks that require structured parsing of source code.
§Main Components:
EntityType: Enum representing different types of code entities (e.g., Struct, Function).Entity: Struct containing metadata about a specific code entity.Chunk: Struct representing a section of code containing one or more entities.SplitOptions: Configuration options for controlling how code is split into chunks.Lang: Enum representing supported programming languages (imported fromlangmodule).split: Function for splitting code into chunks (imported fromsplittermodule).
§Usage Example:
use devgen_splitter::{
split,
Lang,
SplitOptions,
};
let source_code = "// Your source code here...";
let options = SplitOptions {
chunk_line_limit: 100,
};
let chunks = split("test.rs", source_code, &options).unwrap();
for chunk in chunks {
println!("Chunk line range: {:?}", chunk.line_range);
for entity in chunk.entities {
println!("Entity: {} ({:?})", entity.name, entity.entity_type);
}
}Structs§
- Chunk
- Represents a chunk of code containing one or more entities.
- Entity
- Represents a code entity with its associated metadata.
- Lang
- Split
Options - Configuration options for the devgen splitter.
Enums§
- Entity
Type - Represents the different types of entities that can be identified in the code.
Functions§
- split
- Splits the given code into chunks based on the provided options.