Mikhail Golubev
81afd74ed9
PY-31442 Started working on format parts of fragments
2018-10-01 12:46:41 +03:00
Mikhail Golubev
c13a63958d
PY-31442 Parse simplest possible f-strings together with other expressions
...
- no nested f-strings
- no formatting parts after colon
- no illegal escapes detection
- no quote mismatch detection
2018-10-01 12:46:41 +03:00
Semyon Proshev
96e41895d3
Deprecate Python 2.5 language level. Remove its usages.
2017-12-13 19:44:28 +03:00
Dmitry Trofimov
79ffc852b7
Move test data for unified parsing to separate folder
2017-10-09 21:23:29 +02:00
Dmitry Trofimov
210bf9b175
Unify stubs for all Python language levels (PY-26392)
...
The cause of the problem was the difference in parsing for different
language levels.
This commit improves error recovery and adds support for stubs for
syntax elements unavailable in older Python versions.
Cases that are covered are necessary for stubs generation
for Python 3.6 standard library. They are discovered by automatic
validation executed by stubs generator in StubsGenerator.kt.
Those are the cases that were fixed:
* A stub for single star argument in Py2 was absent
* Type annotations in Py2 were absent
* Print with end argument in Py2 broke parser
* Exec function as argument in Py2 broke parser
* Async keyword after decorator broke parser
All the cases are listed as test cases in PyUnifiedStubsTest
P.S. It is possible though that more cases will be revealed in future.
2017-10-09 21:23:29 +02:00
Mikhail Golubev
9c3aa66ca4
PY-17017 Comments with greater indent are still included inside suite
2017-10-02 15:20:24 +03:00
Mikhail Golubev
98cc3d928c
PY-17017 Properly add DEDENT tokens after a series of trailing comments
2017-10-02 15:20:24 +03:00
Dmitry Trofimov
d4c895fbec
Fix test data
2017-09-11 19:38:27 +03:00
Mikhail Golubev
8fe04bedbe
PY-24389 Allow trailing comma in all parameter lists starting from Python 3.6
...
Previously it was prohibited in signatures containing varargs and
single stars (delimiting normal and keyword-only parameters).
2017-08-04 14:49:01 +03:00
Andrey Vlasovskikh
91a45bf7ed
Restored None, False, True as non-keywords (reserved words) in PY2 (PY-23305, PY-23364)
...
Typeshed doesn't contain the definitions for them in __builtins__.pyi
so we have to provide types and detect the builtin status for these
words as a special case.
2017-04-17 21:17:35 +03:00
Andrey Vlasovskikh
b3eeba17f6
False, True, None made keywords for Python 2 due to typeshed's __builtins__.pyi
2017-02-02 01:24:11 +03:00
Semyon Proshev
2174c9b258
PY-20682 Fixed: await something() as function argument is not recognized by syntax analyzer
...
Copy `async` flag in ParsingScope.withSuite
2016-12-02 13:54:24 +03:00
Semyon Proshev
cee9fd7789
PY-20770 Fixed: Support Python 3.6 asynchronous generators and comprehensions
...
Add tests for parsing await inside comprehensions
2016-09-30 18:06:20 +03:00
Semyon Proshev
e23de0ceb6
PY-20770 Fixed: Support Python 3.6 asynchronous generators and comprehensions
...
Check for "for" or "async for" while parsing generators, list, dict and set literals
Highlight "async" as keyword in generators, list, dict and set literals
2016-09-30 18:05:19 +03:00
Mikhail Golubev
b16311ef60
PY-18972 Initial support of f-string literals
...
Namely, Python lexer, compatibility inspection and unsupported
features annotator are aware of them now.
2016-09-16 08:16:26 +03:00
Mikhail Golubev
3266460142
PY-20744 Parse PEP-526 variable annotations
...
Annotation is preserved at the level of assignment nodes similar to
where CPython keeps them in its AST (in special "augassign" nodes).
For type annotations in form "x: int" without variable initialization
special statement PyTypeDefinitionStatement was introduced.
2016-09-16 08:16:26 +03:00
Semyon Proshev
61b92120d7
Assignment to await expressions is forbidden now
2016-07-08 13:47:38 +03:00
Semyon Proshev
673bc32291
PY-19036 Fixed: Using await in a non-asynchronous nested function not marked as a syntax error
...
Don't inherit async flag in ParsingScope, pass async flag to function parsing
2016-04-18 14:07:04 +03:00
Andrey Vlasovskikh
30c936a46d
Fixed warnings for star unpacking in set literals
2015-09-14 15:22:58 +03:00
Andrey Vlasovskikh
045532ee74
Allow PEP 448 **expr syntax in dict literals
2015-09-14 13:48:16 +03:00
Andrey Vlasovskikh
caf85e8e71
Fixed parsing decorated async functions and 'await' expressions inside them (PY-16094)
2015-09-08 17:44:21 +03:00
Andrey Vlasovskikh
c855959143
Parse and highlight the 'await' keyword (PY-16094)
2015-09-08 14:21:52 +03:00
Andrey Vlasovskikh
d616d70c50
Parse and highlight the 'async' keyword (PY-16094)
...
We had to switch to stack-based parsing contexts in order to be able
to use context-sensitive token filtering for 'async'.
Also this commit fixes the highlighting annotator issue with blinking
names of the functions and blinking 'async'.
2015-09-06 20:04:50 +03:00
Mikhail Golubev
6794f3299c
PY-15653 Do not consume open parenthesis after missing identifier in class and function headers
2015-04-21 15:14:25 +03:00
Mikhail Golubev
8f30a5836a
PY-15469 Delimiter "->" in Python is parsed as single token
...
Thanks to that, pressing enter no longer inserts backslash in the
middle of "->" sequence (and such corrupted code is properly
highlighted now on).
2015-04-08 16:28:54 +03:00
Andrey Vlasovskikh
e7db2ff39c
Parsing of '@' and '@=' operators (PY-15390)
...
We have to introduce a new lexeme '@=' and re-define '@' to become a
binary operator as well as the prefix of the decorator.
2015-03-24 17:40:42 +03:00
Mikhail Golubev
186f1fe5af
PY-14408 PythonIndentingProcessor includes tabs inside PsiWhitespace elements
...
Also I partially reverted previous fix in PyBlock#isWhitespaceLineBreaks,
because current approach is more general and that workaround is no longer
needed (multiple whitespaces are collapsed into single element as in other
languages).
2015-01-28 13:11:03 +03:00
Andrey Vlasovskikh
ae1e6ca3e7
Better error recovery for lines with single 'class' or 'def' keywords and normal functions defined below
2014-02-26 19:29:15 +04:00
Andrey Vlasovskikh
a39c3b7998
Better error recovery for blocks with missing ':' and non-empty bodies
2014-02-26 18:18:15 +04:00
Andrey Vlasovskikh
09bd5b323a
Fixed error recovery after empty blocks with no indent
2014-02-26 16:26:12 +04:00
Ilya.Kazakevich
2f65c96783
Python function parsing fixed: any function has statement list now
2014-02-06 19:41:01 +04:00
Ekaterina Tuzova
4e914225b4
fixed PY-11340 Invalid case for can't assign to literal inspection
2014-01-23 17:53:05 +04:00
Ekaterina Tuzova
18db741b06
fixed PY-11476 No error given for mismatched accolade and squarebracket
2013-11-25 19:39:35 +04:00
Dmitry Jemerov
c6bc240104
correctly attach leading comment to statement list (PY-1909)
2013-11-12 16:12:10 +01:00
Dmitry Jemerov
aa885ea720
report missing identifier after 'as' (PY-9853)
2013-11-06 19:17:42 +01:00
Dmitry Jemerov
52efcb58c5
only allow single expression after 'in'; tweak error recovery when waiting for colon (PY-9561)
2013-11-06 19:17:41 +01:00
Dmitry Jemerov
664ee85163
improve parser recovery if keyword is used as function or class name (PY-8319)
2013-11-05 19:37:49 +01:00
Dmitry Jemerov
5d6bac5b12
improve parser recovery if keyword is used as named parameter (PY-8318)
2013-11-05 19:37:49 +01:00
Dmitry Jemerov
f52709b867
tweak decorator parsing so that following line comment is outside the text range of PyDecorator (PY-5912)
2013-11-05 19:37:47 +01:00
Dmitry Jemerov
56b50d1dff
report parsing error if no expression was found after * (PY-10177 part 1)
2013-10-31 21:00:19 +01:00
Ekaterina Tuzova
ec5f16c8e0
fixed PY-11058 False positive Statement expected, found statement break
2013-10-11 17:05:05 +04:00
Ekaterina Tuzova
0792f733cc
updated test data for parsing
2013-02-22 12:22:38 +04:00
Ekaterina Tuzova
60d0628886
fixed PY-8948 Not closed quote in subscription breaks parsing for the whole file
2013-02-21 18:44:46 +04:00
Andrey Vlasovskikh
377662303c
Fixed parsing ellipsis as an expression in Python 3 (PY-8257)
...
In Python 3 ellipsis can appear anywhere, not only in sequence slicings. The parser
now always passes ellipsis, it's incorrect use is detected at the unsupported features
annotator or compatibility inspection levels.
2013-02-18 16:08:33 +04:00
Dmitry Jemerov
38ed156b15
report missing expression in subscription (PY-8652)
2013-01-30 18:52:59 +01:00
Andrey Vlasovskikh
8e4270e44a
Fixed parsing ellipsis in slice lists (PY-8606)
2013-01-28 20:49:48 +04:00
Dmitry Jemerov
f51943380f
parse ellipsis only in the context where it can actually be used (PY-7763)
2012-12-13 22:03:08 +01:00
Dmitry Jemerov
59d5c27308
don't parse compound statements after semicolon at top level of file (PY-7660)
2012-12-13 22:03:07 +01:00
Andrey Vlasovskikh
1d3a7823d3
Fixed parsing error in StatementParsing.parseSimpleStatement (EA-30244)
2012-09-03 19:39:05 +04:00
Dmitry Jemerov
59bd0dd4d5
fix parsing of generator in argument list to actually match Python grammaer (PY-6926)
2012-08-07 12:46:11 +02:00