parsers.base
Abstract base parser for all language parsers.
Contents
Classes
class
class BaseParser(ABC)
Abstract base class for language-specific code parsers.
Methods
def
def __init__(self, exclude_private: bool = False)
Initialize an object with the exclude private attribute.
Args:
exclude_private: A boolean flag to exclude private attributes from the object.
def
@abstractmethod
def parse_file(self, filepath: str | Path) -> ModuleDoc | None
Parse a single source file and return a ModuleDoc, or None on failure.
def
def parse_directory(self, directory: str | Path, exclude_dirs: list[str] | None = None) -> ProjectDoc
Parse all matching files in a directory tree and return a ProjectDoc.
def
def _should_include(self, name: str) -> bool
Check if a name should be included based on privacy settings.
class
class MultiParser
Delegates parsing to the correct language parser based on file extension.
Scans all supported file types in a single directory pass.
Methods
def
def __init__(self, exclude_private: bool = False)
Initializes a new instance of the class.
Args:
exclude_private: A boolean flag indicating whether to exclude private attributes from the instance. Defaults to False.
Returns:
None
Raises:
TypeError: If exclude_private is not a boolean value.
def
def parse_directory(self, directory: str | Path, exclude_dirs: list[str] | None = None) -> ProjectDoc
Parse all supported source files in a directory tree.
def
def find_all_source_files(self, directory: str | Path, exclude_dirs: set[str] | None = None) -> list[Path]
Find all supported source files in a directory tree.