summaryrefslogtreecommitdiff
path: root/python/binaryview.py
diff options
context:
space:
mode:
authorJordan Wiens <jordan@psifertex.com>2019-06-17 19:32:43 -0400
committerJordan Wiens <jordan@psifertex.com>2019-06-17 19:32:43 -0400
commit6ca3df465034dac90fea2fb50ca3cb418e98e0a0 (patch)
tree94ec07b252ae05574b52d99a4f1a8620772c9561 /python/binaryview.py
parentde3add71f81a45a587deb470519e0dc8c2acffcc (diff)
improve parse_expression API documentation
Diffstat (limited to 'python/binaryview.py')
-rw-r--r--python/binaryview.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index 9692689c..01139176 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -4498,26 +4498,26 @@ class BinaryView(object):
def parse_expression(self, expression, here=0):
"""
- Evaluates an string expression to an integer value.
+ Evaluates a string expression to an integer value.
The parser uses the following rules:
- symbols are defined by the lexer as `[A-Za-z0-9_:<>][A-Za-z0-9_:$\\-<>]+` or anything enclosed in either single or
- double quotes
+ double quotes
- Numbers are defaulted to hexadecimal thus `_printf + 10` is equivalent to `printf + 0x10` If decimal numbers required use the decimal prefix.
- - Since numbers and symbols can be ambiguous its recommended that you prefix your numbers with the following:
- - 0x - Hexadecimal
- - 0n - Decimal
- - 0 - Octal
+ - Since numbers and symbols can be ambiguous its recommended that you prefix your numbers with the following
+ - `0x` - Hexadecimal
+ - `0n` - Decimal
+ - `0` - Octal
- In the case of an ambiguous number/symbol (one with no prefix) for instance `12345` we will first attempt
to look up the string as a symbol, if a symbol is found its address is used, otherwise we attempt to convert
it to a hexadecimal number.
- - The following operations are valid: +, -, *, /, %, (), &, |, ^, ~
- - In addition to the above operators there are _il-style_ dereference operators
- - [<expression>] - read the _current address size_ at <expression>
- - [<expression>].b - read the byte at <expression>
- - [<expression>].w - read the word (2 bytes) at <expression>
- - [<expression>].d - read the dword (4 bytes) at <expression>
- - [<expression>].q - read the quadword (8 bytes) at <expression>
+ - The following operations are valid: `+, -, *, /, %, (), &, |, ^, ~`
+ - In addition to the above operators there are dereference operators similar to BNIL style IL
+ - [<expression>] - read the _current address size_ at <expression>
+ - [<expression>].b - read the byte at <expression>
+ - [<expression>].w - read the word (2 bytes) at <expression>
+ - [<expression>].d - read the dword (4 bytes) at <expression>
+ - [<expression>].q - read the quadword (8 bytes) at <expression>
- The `$here` keyword can be used in calculations and is defined as the `here` parameter
:param string expression: Arithmetic expression to be evaluated