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