dissect.cstruct.parser

Module Contents

Classes

Parser

Base class for definition parsers.

TokenParser

param cs:

An instance of cstruct.

CStyleParser

Definition parser for C-like structure syntax.

Token

TokenCollection

TokenConsumer

class dissect.cstruct.parser.Parser(cs: dissect.cstruct.cstruct)

Base class for definition parsers.

Parameters:

cs – An instance of cstruct.

abstract parse(data: str) None

This function should parse definitions to cstruct types.

Parameters:

data – Data to parse definitions from, usually a string.

class dissect.cstruct.parser.TokenParser(cs: dissect.cstruct.cstruct, compiled: bool = True, align: bool = False)

Bases: Parser

Parameters:
  • cs – An instance of cstruct.

  • compiled – Whether structs should be compiled or not.

parse(data: str) None

This function should parse definitions to cstruct types.

Parameters:

data – Data to parse definitions from, usually a string.

class dissect.cstruct.parser.CStyleParser(cs: dissect.cstruct.cstruct, compiled: bool = True)

Bases: Parser

Definition parser for C-like structure syntax.

Parameters:
  • cs – An instance of cstruct

  • compiled – Whether structs should be compiled or not.

parse(data: str) None

This function should parse definitions to cstruct types.

Parameters:

data – Data to parse definitions from, usually a string.

class dissect.cstruct.parser.Token(token: str, value: str, match: re.Match)
__slots__ = ('token', 'value', 'match')
__eq__(other)

Return self==value.

__ne__(other)

Return self!=value.

__repr__()

Return repr(self).

class dissect.cstruct.parser.TokenCollection
__getattr__(attr: str)
add(regex: str, name: str) None
class dissect.cstruct.parser.TokenConsumer(tokens: List[Token])
property next: Token
__contains__(token) bool
__len__() int
__repr__() str

Return repr(self).

consume() Token
reset_flags() None
eol() None