home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 January / Chip_2003-01_cd2.bin / convert / eJayMp3Pro / mp3pro_demo.exe / TOKENIZE.PYC (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2000-06-05  |  7.7 KB  |  27 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 1.5)
  3.  
  4. '''Tokenization help for Python programs.
  5.  
  6. This module exports a function called \'tokenize()\' that breaks a stream of
  7. text into Python tokens.  It accepts a readline-like method which is called
  8. repeatedly to get the next line of input (or "" for EOF) and a "token-eater"
  9. function which is called once for each token found.  The latter function is
  10. passed the token type, a string containing the token, the starting and
  11. ending (row, column) coordinates of the token, and the original line.  It is
  12. designed to match the working of the Python tokenizer exactly, except that
  13. it produces COMMENT tokens for comments and gives type OP for all operators.'''
  14. __version__ = 'Ka-Ping Yee, 26 October 1997; patched, GvR 3/30/98'
  15. import string
  16. import re
  17. *
  18. tok_name[COMMENT] = 'COMMENT'
  19. tok_name[NL] = 'NL'
  20. (tokenprog, pseudoprog, single3prog, double3prog) = map(re.compile, (Token, PseudoToken, Single3, Double3))
  21. if __name__ == '__main__':
  22.     if len(sys.argv) > 1:
  23.         tokenize(open(sys.argv[1]).readline)
  24.     else:
  25.         tokenize(sys.stdin.readline)
  26.  
  27.