OILS / opy / compiler2 / consts.py View on Github | oilshell.org

32 lines, 23 significant
1# operation flags
2OP_ASSIGN = 'OP_ASSIGN'
3OP_DELETE = 'OP_DELETE'
4OP_APPLY = 'OP_APPLY'
5
6SC_LOCAL = 1
7SC_GLOBAL_IMPLICIT = 2
8SC_GLOBAL_EXPLICIT = 3
9SC_FREE = 4
10SC_CELL = 5
11SC_UNKNOWN = 6
12
13# NOTE: These really should be an ASDL enum types so we get proper names.
14# Although we will also need reflection to iterate over them.
15VALUE_TO_NAME = {}
16
17def _const(name, val):
18 VALUE_TO_NAME[val] = name
19 globals()[name] = val
20
21
22_const('CO_OPTIMIZED', 0x0001)
23_const('CO_NEWLOCALS', 0x0002)
24_const('CO_VARARGS', 0x0004)
25_const('CO_VARKEYWORDS', 0x0008)
26_const('CO_NESTED', 0x0010)
27_const('CO_GENERATOR', 0x0020)
28_const('CO_FUTURE_DIVISION', 0x2000)
29_const('CO_FUTURE_ABSIMPORT', 0x4000)
30_const('CO_FUTURE_WITH_STATEMENT', 0x8000)
31# The only FUTURE that's relevant to us. Everything else is the default.
32_const('CO_FUTURE_PRINT_FUNCTION', 0x10000)