| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
* Always set the text attribute.
* Correct the offset attribute for non-ascii sources.
(cherry picked from commit 0cc6b5e559b8303b18fdd56c2befd900fe7b5e35)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
|
|
|
|
| |
(cherry picked from commit 5ec91f78d59d9c39b984f284e00cd04b96ddb5db)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
|
|
|
|
|
|
|
|
| |
(GH-17421)
https://bugs.python.org/issue38673
(cherry picked from commit 109fc2792a490ee5cd8a423e17d415fbdedec5c8)
Co-authored-by: Batuhan Taşkaya <47358913+isidentical@users.noreply.github.com>
|
|
|
|
|
|
| |
Without indendation, seems like strcpy line is parallel to `if` condition.
(cherry picked from commit 69f37bcb28d7cd78255828029f895958b5baf6ff)
Co-authored-by: Hansraj Das <raj.das.136@gmail.com>
|
|
|
|
|
|
|
| |
(GH-14433)
(cherry picked from commit 5b94f3578c662d5f1ee90c0e6b81481d9ec82d89)
Co-authored-by: Anthony Sottile <asottile@umich.edu>
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-13504)
This disallows things like `# type: ignoreé`, which seems wrong.
Also switch to using Py_ISALNUM for the alnum check, for consistency
with other code (and maybe correctness re: locale issues?).
https://bugs.python.org/issue36878
|
|
|
|
|
| |
GH-13238 made extra text after a # type: ignore accepted by the parser.
This finishes the job and actually plumbs the extra text through the
parser and makes it available in the AST.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This makes the parser consistent with the tokenize module (already the case
in `pypy`).
sample
------
```python
x = 5\
```
before
------
```console
$ python3 t.py
$ python3 -mtokenize t.py
t.py:2:0: error: EOF in multi-line statement
```
after
-----
```console
$ ./python t.py
File "t.py", line 3
x = 5\
^
SyntaxError: unexpected EOF while parsing
$ ./python -m tokenize t.py
t.py:2:0: error: EOF in multi-line statement
```
https://bugs.python.org/issue2180
|
|
|
|
|
|
|
| |
In the parser, when using the type_comments=True option, recognize
a TYPE_IGNORE as anything containing `# type: ignore` followed by
a non-alphanumeric character. This is to allow ignores such as
`# type: ignore[E1000]`.
|
|
|
| |
After the removal of pgen, multiple header and function prototypes that lack implementation or are unused are still lying around.
|
|
|
|
|
|
| |
tok_nextc() (12601)
Remove the PyMem_FREE() call added in cb90c89. The buffer will be
freed when PyTokenizer_Free() is called on the tokenizer state.
|
| |
|
|
|
|
|
|
|
| |
This adds a `feature_version` flag to `ast.parse()` (documented) and `compile()` (hidden) that allow tweaking the parser to support older versions of the grammar. In particular if `feature_version` is 5 or 6, the hacks for the `async` and `await` keyword from PEP 492 are reinstated. (For 7 or higher, these are unconditionally treated as keywords, but they are still special tokens rather than `NAME` tokens that the parser driver recognizes.)
https://bugs.python.org/issue35975
|
|
|
|
|
| |
Pgen is the oldest piece of technology in the CPython repository, building it requires various #if[n]def PGEN hacks in other parts of the code and it also depends more and more on CPython internals. This commit removes the old pgen C code and replaces it for a new version implemented in pure Python. This is a modified and adapted version of lib2to3/pgen2 that can generate grammar files compatibles with the current parser.
This commit also eliminates all the #ifdef and code branches related to pgen, simplifying the code and making it more maintainable. The regen-grammar step now uses $(PYTHON_FOR_REGEN) that can be any version of the interpreter, so the new pgen code maintains compatibility with older versions of the interpreter (this also allows regenerating the grammar with the current CI solution that uses Python3.5). The new pgen Python module also makes use of the Grammar/Tokens file that holds the token specification, so is always kept in sync and avoids having to maintain duplicate token definitions.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-10370)
"Include/token.h", "Lib/token.py" (containing now some data moved from
"Lib/tokenize.py") and new files "Parser/token.c" (containing the code
moved from "Parser/tokenizer.c") and "Doc/library/token-list.inc" (included
in "Doc/library/token.rst") are now generated from "Grammar/Tokens" by
"Tools/scripts/generate_token.py". The script overwrites files only if
needed and can be used on the read-only sources tree.
"Lib/symbol.py" is now generated by "Tools/scripts/generate_symbol_py.py"
instead of been executable itself.
Added new make targets "regen-token" and "regen-symbol" which are now
dependencies of "regen-all".
The documentation contains now strings for operators and punctuation tokens.
|
| |
|
|
|
|
|
|
| |
(GH-11015)
Set MemoryError when appropriate, add missing failure checks,
and fix some potential leaks.
|
| |
|
|
|
|
|
|
| |
Fix the following warning on Windows:
parser\tokenizer.c(1297): warning C4244: 'function': conversion from
'__int64' to 'int', possible loss of data.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Remove the following fields from tok_state structure which are now
used unused:
* altwarning: "Issue warning if alternate tabs don't match"
* alterror: "Issue error if alternate tabs don't match"
* alttabsize: "Alternate tab spacing"
Replace alttabsize variable with ALTTABSIZE define.
|
|
|
| |
Per PEP 492, 'async' and 'await' should become proper keywords in 3.7.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* add test to check if were modifying token
* copy list so import tokenize doesnt have side effects on token
* shorten line
* add tokenize tokens to token.h to get them to show up in token
* move ERRORTOKEN back to its previous location, and fix nitpick
* copy comments from token.h automatically
* fix whitespace and make more pythonic
* change to fix comments from @haypo
* update token.rst and Misc/NEWS
* change wording
* some more wording changes
|
|\ |
|
| |
| |
| |
| | |
Patch by Ryan Gonzalez.
|
|/
|
|
|
|
|
| |
Replace:
PyObject_CallObject(callable, NULL)
with:
_PyObject_CallNoArg(callable)
|
|
|
|
| |
with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
|
|\ |
|
| |\ |
|
| | | |
|
|\ \ \
| |/ / |
|
| | | |
|
| | |
| | |
| | |
| | | |
Thanks to Georg Brandl for the patch.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
In the case of an escape character, c is never read. tok_next() is
used to advance the pointer.
CID 1225097
|
|\ \ \
| |/ / |
|
| | | |
|
| | |
| | |
| | |
| | | |
Patch by Oren Milman.
|
|\ \ \
| |/ / |
|
| | | |
|
| | |
| | |
| | |
| | | |
private functions.
|
|\ \ \
| |/ /
| | |
| | | |
macro Py_SETREF.
|
| | |
| | |
| | |
| | | |
macro Py_SETREF.
|
|\ \ \
| |/ /
| | |
| | | |
with a null byte.
|
| |\ \
| | |/
| | |
| | | |
with a null byte.
|
| | |
| | |
| | |
| | | |
with a null byte.
|
| | |
| | |
| | |
| | | |
Documentation is still needed, I'll open an issue for that.
|
|/ / |
|