dissect.cstruct.expression¶
Module Contents¶
Classes¶
Expression parser for calculations in definitions. |
Attributes¶
- dissect.cstruct.expression.HEXBIN_SUFFIX¶
- class dissect.cstruct.expression.ExpressionTokenizer(expression: str)¶
- expression¶
- pos = 0¶
- tokens = []¶
- equal(token: str, expected: str | set[str]) bool¶
- alnum(token: str) bool¶
- alpha(token: str) bool¶
- digit(token: str) bool¶
- hexdigit(token: str) bool¶
- operator(token: str) bool¶
- match(func: collections.abc.Callable[[str], bool] | None = None, expected: str | None = None, consume: bool = True, append: bool = True) bool¶
- consume() None¶
- eol() bool¶
- get_token() str¶
- tokenize() list[str]¶
- class dissect.cstruct.expression.Expression(expression: str)¶
Expression parser for calculations in definitions.
- binary_operators: ClassVar[dict[str, collections.abc.Callable[[int, int], int]]]¶
- unary_operators: ClassVar[dict[str, collections.abc.Callable[[int], int]]]¶
- precedence_levels: ClassVar[dict[str, int]]¶
- expression¶
- tokens = []¶
- stack = []¶
- queue = []¶
- __repr__() str¶
- precedence(o1: str, o2: str) bool¶
- evaluate_exp() None¶
- is_number(token: str) bool¶
- evaluate(cs: dissect.cstruct.cstruct, context: dict[str, int] | None = None) int¶
Evaluates an expression using a Shunting-Yard implementation.