:py:mod:`dissect.cstruct.parser` ================================ .. py:module:: dissect.cstruct.parser Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: dissect.cstruct.parser.Parser dissect.cstruct.parser.TokenParser dissect.cstruct.parser.CStyleParser dissect.cstruct.parser.Token dissect.cstruct.parser.TokenCollection dissect.cstruct.parser.TokenConsumer .. py:class:: Parser(cs: dissect.cstruct.cstruct) Base class for definition parsers. :param cs: An instance of cstruct. .. py:method:: parse(data: str) -> None :abstractmethod: This function should parse definitions to cstruct types. :param data: Data to parse definitions from, usually a string. .. py:class:: TokenParser(cs: dissect.cstruct.cstruct, compiled: bool = True, align: bool = False) Bases: :py:obj:`Parser` :param cs: An instance of cstruct. :param compiled: Whether structs should be compiled or not. .. py:method:: parse(data: str) -> None This function should parse definitions to cstruct types. :param data: Data to parse definitions from, usually a string. .. py:class:: CStyleParser(cs: dissect.cstruct.cstruct, compiled: bool = True) Bases: :py:obj:`Parser` Definition parser for C-like structure syntax. :param cs: An instance of cstruct :param compiled: Whether structs should be compiled or not. .. py:method:: parse(data: str) -> None This function should parse definitions to cstruct types. :param data: Data to parse definitions from, usually a string. .. py:class:: Token(token: str, value: str, match: re.Match) .. py:attribute:: __slots__ :value: ('token', 'value', 'match') .. py:method:: __eq__(other) Return self==value. .. py:method:: __ne__(other) Return self!=value. .. py:method:: __repr__() Return repr(self). .. py:class:: TokenCollection .. py:method:: __getattr__(attr: str) .. py:method:: add(regex: str, name: str) -> None .. py:class:: TokenConsumer(tokens: List[Token]) .. py:property:: next :type: Token .. py:method:: __contains__(token) -> bool .. py:method:: __len__() -> int .. py:method:: __repr__() -> str Return repr(self). .. py:method:: consume() -> Token .. py:method:: reset_flags() -> None .. py:method:: eol() -> None