You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.0 KiB

Merged revisions 56020-56124 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/p3yk ................ r56037 | georg.brandl | 2007-06-19 05:33:20 -0700 (Tue, 19 Jun 2007) | 2 lines Patch #1739659: don't slice dict.keys() in pydoc. ................ r56060 | martin.v.loewis | 2007-06-21 13:00:02 -0700 (Thu, 21 Jun 2007) | 2 lines Regenerate to add True, False, None. ................ r56069 | neal.norwitz | 2007-06-21 22:31:56 -0700 (Thu, 21 Jun 2007) | 1 line Get the doctest working again after adding None, True, and False as kewyords. ................ r56070 | neal.norwitz | 2007-06-21 23:25:33 -0700 (Thu, 21 Jun 2007) | 1 line Add space to error message. ................ r56071 | neal.norwitz | 2007-06-21 23:40:04 -0700 (Thu, 21 Jun 2007) | 6 lines Get pybench working, primarily * Use print function * Stop using string module * Use sorted instead of assuming dict methods return lists * Convert range result to a list ................ r56089 | collin.winter | 2007-06-26 10:31:48 -0700 (Tue, 26 Jun 2007) | 1 line Fix AttributeError in distutils/dir_util.py. ................ r56124 | guido.van.rossum | 2007-06-29 18:04:31 -0700 (Fri, 29 Jun 2007) | 30 lines Merged revisions 56014-56123 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r56019 | lars.gustaebel | 2007-06-18 04:42:11 -0700 (Mon, 18 Jun 2007) | 2 lines Added exclude keyword argument to the TarFile.add() method. ........ r56023 | lars.gustaebel | 2007-06-18 13:05:55 -0700 (Mon, 18 Jun 2007) | 3 lines Added missing \versionchanged tag for the new exclude parameter. ........ r56038 | georg.brandl | 2007-06-19 05:36:00 -0700 (Tue, 19 Jun 2007) | 2 lines Bug #1737864: allow empty message in logging format routines. ........ r56040 | georg.brandl | 2007-06-19 05:38:20 -0700 (Tue, 19 Jun 2007) | 2 lines Bug #1739115: make shutil.rmtree docs clear wrt. file deletion. ........ r56084 | georg.brandl | 2007-06-25 08:21:23 -0700 (Mon, 25 Jun 2007) | 2 lines Bug #1742901: document None behavior of shlex.split. ........ r56091 | georg.brandl | 2007-06-27 07:09:56 -0700 (Wed, 27 Jun 2007) | 2 lines Fix a variable name in winreg docs. ........ ................
19 years ago
20 years ago
20 years ago
  1. #! /usr/bin/env python3
  2. """Keywords (from "graminit.c")
  3. This file is automatically generated; please don't muck it up!
  4. To update the symbols in this file, 'cd' to the top directory of
  5. the python source tree after building the interpreter and run:
  6. python Lib/keyword.py
  7. """
  8. __all__ = ["iskeyword", "kwlist"]
  9. kwlist = [
  10. #--start keywords--
  11. 'False',
  12. 'None',
  13. 'True',
  14. 'and',
  15. 'as',
  16. 'assert',
  17. 'break',
  18. 'class',
  19. 'continue',
  20. 'def',
  21. 'del',
  22. 'elif',
  23. 'else',
  24. 'except',
  25. 'finally',
  26. 'for',
  27. 'from',
  28. 'global',
  29. 'if',
  30. 'import',
  31. 'in',
  32. 'is',
  33. 'lambda',
  34. 'nonlocal',
  35. 'not',
  36. 'or',
  37. 'pass',
  38. 'raise',
  39. 'return',
  40. 'try',
  41. 'while',
  42. 'with',
  43. 'yield',
  44. #--end keywords--
  45. ]
  46. iskeyword = frozenset(kwlist).__contains__
  47. def main():
  48. import sys, re
  49. args = sys.argv[1:]
  50. iptfile = args and args[0] or "Python/graminit.c"
  51. if len(args) > 1: optfile = args[1]
  52. else: optfile = "Lib/keyword.py"
  53. # scan the source file for keywords
  54. with open(iptfile) as fp:
  55. strprog = re.compile('"([^"]+)"')
  56. lines = []
  57. for line in fp:
  58. if '{1, "' in line:
  59. match = strprog.search(line)
  60. if match:
  61. lines.append(" '" + match.group(1) + "',\n")
  62. lines.sort()
  63. # load the output skeleton from the target
  64. with open(optfile) as fp:
  65. format = fp.readlines()
  66. # insert the lines of keywords
  67. try:
  68. start = format.index("#--start keywords--\n") + 1
  69. end = format.index("#--end keywords--\n")
  70. format[start:end] = lines
  71. except ValueError:
  72. sys.stderr.write("target does not contain format markers\n")
  73. sys.exit(1)
  74. # write the output file
  75. fp = open(optfile, 'w')
  76. fp.write(''.join(format))
  77. fp.close()
  78. if __name__ == "__main__":
  79. main()