blark.transform.transform

blark.transform.transform(source_code: str, tree: Tree, comments: list[Token] | None = None, line_map: dict[int, int] | None = None, filename: Path | None = None) SourceCode[source]

Transform a lark.Tree into dataclasses.

Parameters:
source_codestr

The plain source code.

treelark.Tree

The parse tree from lark.

commentslist[lark.Token], optional

A list of pre-processed comments.

line_mapdict[int, int], optional

A map of lines from source_code to file lines.

filenamepathlib.Path, optional

The file associated with the source code.

Returns:
SourceCode