symbol.py 1.68 KB
Newer Older
Guido van Rossum's avatar
Guido van Rossum committed
1
#! /usr/bin/env python
2 3 4

"""Non-terminal symbols of Python grammar (from "graminit.h")."""

Guido van Rossum's avatar
Guido van Rossum committed
5 6 7 8 9
#  This file is automatically generated; please don't muck it up!
#
#  To update the symbols in this file, 'cd' to the top directory of
#  the python source tree after building the interpreter and run:
#
10
#    python Lib/symbol.py
11

Guido van Rossum's avatar
Guido van Rossum committed
12
#--start constants--
13 14 15
single_input = 256
file_input = 257
eval_input = 258
16 17 18 19 20 21 22 23 24
funcdef = 259
parameters = 260
varargslist = 261
fpdef = 262
fplist = 263
stmt = 264
simple_stmt = 265
small_stmt = 266
expr_stmt = 267
25 26 27 28 29 30 31 32
augassign = 268
print_stmt = 269
del_stmt = 270
pass_stmt = 271
flow_stmt = 272
break_stmt = 273
continue_stmt = 274
return_stmt = 275
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
yield_stmt = 276
raise_stmt = 277
import_stmt = 278
import_as_name = 279
dotted_as_name = 280
dotted_name = 281
global_stmt = 282
exec_stmt = 283
assert_stmt = 284
compound_stmt = 285
if_stmt = 286
while_stmt = 287
for_stmt = 288
try_stmt = 289
except_clause = 290
suite = 291
test = 292
and_test = 293
not_test = 294
comparison = 295
comp_op = 296
expr = 297
xor_expr = 298
and_expr = 299
shift_expr = 300
arith_expr = 301
term = 302
factor = 303
power = 304
atom = 305
listmaker = 306
lambdef = 307
trailer = 308
subscriptlist = 309
subscript = 310
sliceop = 311
exprlist = 312
testlist = 313
71 72 73 74 75 76 77 78
testlist_safe = 314
dictmaker = 315
classdef = 316
arglist = 317
argument = 318
list_iter = 319
list_for = 320
list_if = 321
Guido van Rossum's avatar
Guido van Rossum committed
79
#--end constants--
80 81

sym_name = {}
82 83
for _name, _value in globals().items():
    if type(_value) is type(0):
84
        sym_name[_value] = _name
Guido van Rossum's avatar
Guido van Rossum committed
85 86 87 88 89 90


def main():
    import sys
    import token
    if len(sys.argv) == 1:
91
        sys.argv = sys.argv + ["Include/graminit.h", "Lib/symbol.py"]
Guido van Rossum's avatar
Guido van Rossum committed
92 93 94 95
    token.main()

if __name__ == "__main__":
    main()