1 | #!/usr/bin/env python
|
2 | """
|
3 | Test for generator expressions.
|
4 | """
|
5 |
|
6 | def MakeLookup(p):
|
7 | #return dict([(pat, tok) for _, pat, tok in p])
|
8 | # Something is broken about how we compile this...
|
9 | # Difference in compilation is SETUP_LOOP. So CPython handle this fine,
|
10 | # but bytern doesn't.
|
11 | return dict((pat, tok) for _, pat, tok in p)
|
12 |
|
13 | # This should be an error but isn't. Looks like it's not compiled
|
14 | # correctly.
|
15 | #return list(i for (i, j) in p)
|
16 |
|
17 | fake_pairs = [
|
18 | (False, '-a', 0),
|
19 | (False, '-b', 1),
|
20 | (False, '-c', 2),
|
21 | #(False, '-d', 3),
|
22 | #(False, '-e', 4),
|
23 | #(False, '-f', 5),
|
24 | ]
|
25 | #lookup = MakeLookup(id_kind.ID_SPEC.LexerPairs(Kind.BoolUnary))
|
26 | lookup = MakeLookup(fake_pairs)
|
27 | print('LOOKUP ***************', len(lookup))
|
28 | print(lookup)
|