blob: 5ac3be06e8c08f23a1ca104e80a25ff4e8ae723d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
from __future__ import print_function
from builtins import range
import string
import random
from miasm2.expression.expression_helper import ExprRandom
print("Simple expression generator\n")
depth = 8
seed = 0
random.seed(seed)
print("- An ID:")
print(ExprRandom.identifier())
print("- A number:")
print(ExprRandom.number())
print("- 3 expressions (without cleaning expression cache):")
for i in range(3):
print("\t%s\n" % ExprRandom.get(depth=depth, clean=False))
class ExprRandom_NoPerfect_NoReuse_UppercaseIdent(ExprRandom):
"""ExprRandom extension with:
- perfect tree disabled
- element reuse disabled
- identifiers uppercased
"""
perfect_tree = False
reuse_element = False
identifier_charset = string.ascii_uppercase
print("- 3 expressions with a custom generator:")
for i in range(3):
print("\t%s\n" % ExprRandom_NoPerfect_NoReuse_UppercaseIdent.get(depth=depth))
|