dissect.cstruct.expression

Module Contents

Classes

ExpressionTokenizer

Expression

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: 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(cstruct: Expression.__init__.cstruct, expression: str)

Expression parser for calculations in definitions.

binary_operators
unary_operators
precedence_levels
cstruct
expression
tokens
stack = []
queue = []
__repr__() str
precedence(o1: str, o2: str) bool
evaluate_exp() None
is_number(token: str) bool
evaluate(context: dict[str, int] | None = None) int

Evaluates an expression using a Shunting-Yard implementation.