svg_path_editor.path_parser =========================== .. py:module:: svg_path_editor.path_parser Classes ------- .. autoapisummary:: svg_path_editor.path_parser.PathParser Module Contents --------------- .. py:class:: PathParser Low-level SVG path string parser. This class understands the SVG path mini-language (M/L/H/V/Z/C/S/Q/T/A) and converts a path string into a list of token lists ``[command, arg1, arg2, ...]`` without interpreting coordinates. .. py:method:: components(cmd_type, path, cursor) :staticmethod: Parse a run of components for a single command type. Starting at ``cursor``, this consumes as many valid components of ``cmd_type`` as possible (including implicit repeats of the command) and returns the new cursor position together with the parsed components. :param cmd_type: Single-letter SVG path command (e.g. ``"M"``, ``"l"``). :param path: Full SVG path string being parsed. :param cursor: Current index in ``path`` to start parsing from. :return: A tuple ``(new_cursor, components)`` where ``components`` is a list of ``[command, arg1, arg2, ...]`` token lists. :raises ValueError: If the path is malformed at or after ``cursor``. .. py:method:: parse(path) :staticmethod: Parse an SVG path data string into a list of token lists. Each element in the returned list is of the form ``[command, arg1, arg2, ...]``, where all items are strings and no semantic interpretation (e.g. absolute vs. relative coordinates) is performed here. :param path: Raw SVG path data string (the value of a ``d`` attribute). :return: A list of command components as token lists. :raises ValueError: If the path is syntactically malformed.