1010
1111from dissect .cstruct .exceptions import ResolveError
1212from dissect .cstruct .expression import Expression
13- from dissect .cstruct .parser import CStyleParser , TokenParser
13+ from dissect .cstruct .parser import CStyleParser
1414from dissect .cstruct .types import (
1515 LEB128 ,
1616 BaseArray ,
@@ -56,7 +56,6 @@ def __init__(self, load: str = "", *, endian: str = "<", pointer: str | None = N
5656 self .endian = endian
5757
5858 self .consts = {}
59- self .lookups = {}
6059 self .includes = []
6160 # fmt: off
6261 self .typedefs = {
@@ -212,7 +211,6 @@ def __copy__(self) -> cstruct:
212211 cs = cstruct (endian = self .endian , pointer = self .pointer .__name__ )
213212 cs ._anonymous_count = self ._anonymous_count
214213 cs .consts = self .consts .copy ()
215- cs .lookups = self .lookups .copy ()
216214 cs .includes = self .includes .copy ()
217215
218216 # Update typedefs to point to the new cstruct instance
@@ -274,11 +272,7 @@ def load(self, definition: str, deftype: int | None = None, **kwargs) -> cstruct
274272 Definitions can be parsed using different parsers. Currently, there's
275273 only one supported parser - DEF_CSTYLE. Parsers can add types and
276274 modify this cstruct instance. Arguments can be passed to parsers
277- using kwargs.
278-
279- The CSTYLE parser was recently replaced with token based parser,
280- instead of a strictly regex based one. The old parser is still available
281- by using DEF_LEGACY.
275+ using ``kwargs``.
282276
283277 Args:
284278 definition: The definition to parse.
@@ -288,9 +282,9 @@ def load(self, definition: str, deftype: int | None = None, **kwargs) -> cstruct
288282 deftype = deftype or cstruct .DEF_CSTYLE
289283
290284 if deftype == cstruct .DEF_CSTYLE :
291- TokenParser (self , ** kwargs ).parse (definition )
292- elif deftype == cstruct .DEF_LEGACY :
293285 CStyleParser (self , ** kwargs ).parse (definition )
286+ else :
287+ raise ValueError (f"Unknown definition type: { deftype } " )
294288
295289 return self
296290
0 commit comments