ml_switcheroo.core.html.parser¶

HTML Parser.

Parses the HTML DSL structure using standard library html.parser. Reconstructs a Python LibCST Module representing the logic described by the visual grid.

Classes¶

GridParser

HTML Parser callback handler.

HtmlParser

Facade for parsing HTML strings into LibCST modules.

Module Contents¶

class ml_switcheroo.core.html.parser.GridParser[source]¶

Bases: html.parser.HTMLParser

HTML Parser callback handler. Extracts high-level model components (Name, Attributes, Operations) from the DOM stream.

in_box = False¶
current_class = ''¶
in_header_txt = False¶
in_code = False¶
model_name = 'Model'¶
attrs: List[Tuple[str, str, str]] = []¶
ops: List[Tuple[str, str]] = []¶
handle_starttag(tag: str, attrs: List[Tuple[str, str | None]]) → None[source]¶
handle_endtag(tag: str) → None[source]¶
handle_data(data: str) → None[source]¶
class ml_switcheroo.core.html.parser.HtmlParser(source: str)[source]¶

Facade for parsing HTML strings into LibCST modules.

source¶
parse() → libcst.Module[source]¶