summaryrefslogtreecommitdiffstats
path: root/Lib/tokenize.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-33899: Revert tokenize module adding an implicit final NEWLINE (GH-10072)Tal Einat2018-10-241-10/+0
| | | This reverts commit 7829bba.
* [2.7] bpo-33899: Make tokenize module mirror end-of-file is end-of-line ↵Ammar Askar2018-07-061-0/+10
| | | | | | | | | | | behavior (GH-7891) (#8133) Most of the change involves fixing up the test suite, which previously made the assumption that there wouldn't be a new line if the input didn't end in one. Contributed by Ammar Askar. (cherry picked from commit c4ef4896eac86a6759901c8546e26de4695a1389)
* Issue #20387: Backport fix from Python 3.4Jason R. Coombs2015-06-281-0/+17
|
* Issue #9974: When untokenizing, use row info to insert backslash+newline.Terry Jan Reedy2014-02-241-0/+6
| | | | Original patches by A. Kuchling and G. Rees (#12691).
* whitespaceTerry Jan Reedy2014-02-181-1/+1
|
* Issue #8478: Untokenizer.compat now processes first token from iterator input.Terry Jan Reedy2014-02-181-9/+7
| | | | Patch based on lines from Georg Brandl, Eric Snow, and Gareth Rees.
* Untokenize: An logically incorrect assert tested user input validity.Terry Jan Reedy2014-02-171-1/+3
| | | | | | Replace it with correct logic that raises ValueError for bad input. Issues #8478 and #12691 reported the incorrect logic. Add an Untokenize test case and an initial test method.
* #19620: Fix typo in docstring (noticed by Christopher Welborn).Ezio Melotti2013-11-251-1/+1
|
* #16152: fix tokenize to ignore whitespace at the end of the code when no ↵Ezio Melotti2012-11-031-1/+3
| | | | newline is found. Patch by Ned Batchelder.
* Issue #15054: Fix incorrect tokenization of 'b' and 'br' string literals.Meador Inge2012-06-171-5/+5
| | | | Patch by Serhiy Storchaka.
* some cleanupsBenjamin Peterson2009-10-151-10/+10
|
* use floor division and add a test that exercises the tabsize codepathBenjamin Peterson2009-10-151-1/+1
|
* pep8ify if blocksBenjamin Peterson2009-10-151-9/+18
|
* Remove a tuple unpacking in a parameter list to remove a SyntaxWarning raisedBrett Cannon2008-08-021-1/+3
| | | | while running under -3.
* revert 63965 for preformance reasonsBenjamin Peterson2008-06-051-1/+1
|
* use the more idomatic while TrueBenjamin Peterson2008-06-051-1/+1
|
* Issue2495: tokenize.untokenize did not insert space between two consecutive ↵Amaury Forgeot d'Arc2008-03-271-1/+10
| | | | | | | | string literals: "" "" => """", which is invalid code. Will backport
* Added PEP 3127 support to tokenize (with tests); added PEP 3127 to NEWS.Eric Smith2008-03-171-2/+3
|
* Fix #1679: "0x" was taken as a valid integer literal.Georg Brandl2008-01-191-1/+1
| | | | | Fixes the tokenizer, tokenize.py and int() to reject this. Patches by Malte Helmert.
* Added bytes and b'' as aliases for str and ''Christian Heimes2008-01-181-3/+16
|
* Add name to credits (for untokenize).Raymond Hettinger2006-12-021-1/+1
|
* Replace dead code with an assert.Jeremy Hylton2006-08-231-4/+1
| | | | | Now that COMMENT tokens are reliably followed by NL or NEWLINE, there is never a need to add extra newlines in untokenize.
* Bug fixes large and small for tokenize.Jeremy Hylton2006-08-231-31/+79
| | | | | | | | | | | | | | | | | | | | Small: Always generate a NL or NEWLINE token following a COMMENT token. The old code did not generate an NL token if the comment was on a line by itself. Large: The output of untokenize() will now match the input exactly if it is passed the full token sequence. The old, crufty output is still generated if a limited input sequence is provided, where limited means that it does not include position information for tokens. Remaining bug: There is no CONTINUATION token (\) so there is no way for untokenize() to handle such code. Also, expanded the number of doctests in hopes of eventually removing the old-style tests that compare against a golden file. Bug fix candidate for Python 2.5.1. (Sigh.)
* Make tabnanny recognize IndentationErrors raised by tokenize.Georg Brandl2006-08-141-1/+2
| | | | | Add a test to test_inspect to make sure indented source is recognized correctly. (fixes #1224621)
* Insert a safety space after numbers as well as names in untokenize().Guido van Rossum2006-03-301-1/+1
|
* SF bug #1224621: tokenize module does not detect inconsistent dedentsRaymond Hettinger2005-06-211-0/+3
|
* Add untokenize() function to allow full round-trip tokenization.Raymond Hettinger2005-06-101-3/+49
| | | | | | Should significantly enhance the utility of the module by supporting the creation of tools that modify the token stream and writeback the modified result.
* PEP-0318, @decorator-style. In Guido's words:Anthony Baxter2004-08-021-1/+1
| | | | | "@ seems the syntax that everybody can hate equally" Implementation by Mark Russell, from SF #979728.
* Get rid of many apply() calls.Guido van Rossum2003-02-271-3/+3
|
* SF 633560: tokenize.__all__ needs "generate_tokens"Raymond Hettinger2002-11-051-1/+2
|
* Speed up the most egregious "if token in (long tuple)" cases by usingGuido van Rossum2002-08-241-10/+19
| | | | | a dict instead. (Alas, using a Set would be slower instead of faster.)
* Whitespace normalization.Tim Peters2002-05-231-5/+5
|
* Added docstrings excerpted from Python Library Reference.Raymond Hettinger2002-05-151-0/+25
| | | | Closes patch 556161.
* Remove some now-obsolete generator future statements.Tim Peters2002-04-011-2/+0
| | | | | I left the email pkg alone; I'm not sure how Barry would like to handle that.
* Cleanup x so it is not left in moduleNeal Norwitz2002-03-261-0/+1
|
* SF patch #455966: Allow leading 0 in float/imag literals.Tim Peters2001-08-301-2/+2
| | | | Consequences for Jython still unknown (but raised on Jython-Dev).
* Add new tokens // and //=, in support of PEP 238.Guido van Rossum2001-08-081-0/+1
|
* Use string.ascii_letters instead of string.letters (SF bug #226706).Fred Drake2001-07-201-1/+1
|
* Preliminary support for "from __future__ import generators" to enableGuido van Rossum2001-07-151-0/+2
| | | | | | | | the yield statement. I figure we have to have this in before I can release 2.2a1 on Wednesday. Note: test_generators is currently broken, I'm counting on Tim to fix this.
* Turns out Neil didn't intend for *all* of his gen-branch work to getTim Peters2001-06-291-8/+21
| | | | | | | | | | | | | | | | | | | | committed. tokenize.py: I like these changes, and have tested them extensively without even realizing it, so I just updated the docstring and the docs. tabnanny.py: Also liked this, but did a little code fiddling. I should really rewrite this to *exploit* generators, but that's near the bottom of my effort/benefit scale so doubt I'll get to it anytime soon (it would be most useful as a non-trivial example of ideal use of generators; but test_generators.py has already grown plenty of food-for-thought examples). inspect.py: I'm sure Ping intended for this to continue running even under 1.5.2, so I reverted this to the last pre-gen-branch version. The "bugfix" I checked in in-between was actually repairing a bug *introduced* by the conversion to generators, so it's OK that the reverted version doesn't reflect that checkin.
* Merging the gen-branch into the main line, at Guido's direction. Yay!Tim Peters2001-06-181-15/+20
| | | | | Bugfix candidate in inspect.py: it was referencing "self" outside of a method.
* Provide a StopTokenizing exception for conveniently exiting the loop.Ka-Ping Yee2001-03-231-10/+11
|
* Better __credits__.Ka-Ping Yee2001-03-011-1/+2
|
* Add __author__ and __credits__ variables.Ka-Ping Yee2001-03-011-1/+2
|
* final round of __all__ lists (I hope) - skipped urllib2 because Moshe may beSkip Montanaro2001-03-011-1/+5
| | | | giving it a slight facelift
* String method conversion.Eric S. Raymond2001-02-091-1/+1
|
* Add tokenizer support and tests for u'', U"", uR'', Ur"", etc.Ka-Ping Yee2001-01-151-9/+25
|
* Whitespace normalization.Tim Peters2001-01-151-1/+0
|
* Possible fix for Skip's bug 116136 (sre recursion limit hit in tokenize.py).Tim Peters2000-10-071-12/+20
| | | | | | | | | | | tokenize.py has always used naive regexps for matching string literals, and that appears to trigger the sre recursion limit on Skip's platform (he has very long single-line string literals). Replaced all of tokenize.py's string regexps with the "unrolled" forms used in IDLE, where they're known to handle even absurd (multi-megabyte!) string literals without trouble. See Friedl's book for explanation (at heart, the naive regexps create a backtracking choice point for each character in the literal, while the unrolled forms create none).
* Update for augmented assignment, tested & approved by Guido.Thomas Wouters2000-08-241-2/+5
|