summaryrefslogtreecommitdiffstats
path: root/Lib/symbol.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1993-11-11 10:31:23 (GMT)
committerGuido van Rossum <guido@python.org>1993-11-11 10:31:23 (GMT)
commitb31c7f732aea6abf6ce24d3da7fd67b2172acec9 (patch)
treee97a352f4308578604255065063766f303ee788d /Lib/symbol.py
parent52f2c05401ab13eab45a91d39089866f55ef3c9b (diff)
downloadcpython-b31c7f732aea6abf6ce24d3da7fd67b2172acec9.zip
cpython-b31c7f732aea6abf6ce24d3da7fd67b2172acec9.tar.gz
cpython-b31c7f732aea6abf6ce24d3da7fd67b2172acec9.tar.bz2
* test_select.py: (some) tests for built-in select module
* test_grammar.py, testall.out: added test for funny things in string literals * token.py, symbol.py: definitions used with built-in parser module. * tokenize.py: added double-quote recognition
Diffstat (limited to 'Lib/symbol.py')
-rwxr-xr-xLib/symbol.py60
1 files changed, 60 insertions, 0 deletions
diff --git a/Lib/symbol.py b/Lib/symbol.py
new file mode 100755
index 0000000..1422f12
--- /dev/null
+++ b/Lib/symbol.py
@@ -0,0 +1,60 @@
+# Non-terminal symbols of Python grammar (from "graminit.h")
+
+single_input = 256
+file_input = 257
+eval_input = 258
+lambda_input = 259
+funcdef = 260
+parameters = 261
+varargslist = 262
+fpdef = 263
+fplist = 264
+stmt = 265
+simple_stmt = 266
+small_stmt = 267
+expr_stmt = 268
+print_stmt = 269
+del_stmt = 270
+pass_stmt = 271
+flow_stmt = 272
+break_stmt = 273
+continue_stmt = 274
+return_stmt = 275
+raise_stmt = 276
+import_stmt = 277
+global_stmt = 278
+access_stmt = 279
+accesstype = 280
+exec_stmt = 281
+compound_stmt = 282
+if_stmt = 283
+while_stmt = 284
+for_stmt = 285
+try_stmt = 286
+except_clause = 287
+suite = 288
+test = 289
+and_test = 290
+not_test = 291
+comparison = 292
+comp_op = 293
+expr = 294
+xor_expr = 295
+and_expr = 296
+shift_expr = 297
+arith_expr = 298
+term = 299
+factor = 300
+atom = 301
+trailer = 302
+subscript = 303
+exprlist = 304
+testlist = 305
+dictmaker = 306
+classdef = 307
+
+names = dir()
+sym_name = {}
+for name in names:
+ number = eval(name)
+ sym_name[number] = name