mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
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.
93 lines
3.3 KiB
Plaintext
93 lines
3.3 KiB
Plaintext
PyFile:VariableAnnotations.py
|
|
PyClass: C
|
|
PsiElement(Py:CLASS_KEYWORD)('class')
|
|
PsiWhiteSpace(' ')
|
|
PsiElement(Py:IDENTIFIER)('C')
|
|
PyArgumentList
|
|
<empty list>
|
|
PsiElement(Py:COLON)(':')
|
|
PsiWhiteSpace('\n ')
|
|
PyStatementList
|
|
PyTypeDeclarationStatement
|
|
PyTargetExpression: x
|
|
PsiElement(Py:IDENTIFIER)('x')
|
|
PyAnnotation
|
|
PsiElement(Py:COLON)(':')
|
|
PsiWhiteSpace(' ')
|
|
PyReferenceExpression: int
|
|
PsiElement(Py:IDENTIFIER)('int')
|
|
PsiWhiteSpace('\n ')
|
|
PyAssignmentStatement
|
|
PyTargetExpression: y
|
|
PsiElement(Py:IDENTIFIER)('y')
|
|
PyAnnotation
|
|
PsiElement(Py:COLON)(':')
|
|
PsiWhiteSpace(' ')
|
|
PyNoneLiteralExpression
|
|
PsiElement(Py:NONE_KEYWORD)('None')
|
|
PsiWhiteSpace(' ')
|
|
PsiElement(Py:EQ)('=')
|
|
PsiWhiteSpace(' ')
|
|
PyNumericLiteralExpression
|
|
PsiElement(Py:INTEGER_LITERAL)('42')
|
|
PsiWhiteSpace('\n\n ')
|
|
PyFunction('m')
|
|
PsiElement(Py:DEF_KEYWORD)('def')
|
|
PsiWhiteSpace(' ')
|
|
PsiElement(Py:IDENTIFIER)('m')
|
|
PyParameterList
|
|
PsiElement(Py:LPAR)('(')
|
|
PyNamedParameter('self')
|
|
PsiElement(Py:IDENTIFIER)('self')
|
|
PsiElement(Py:COMMA)(',')
|
|
PsiWhiteSpace(' ')
|
|
PyNamedParameter('d')
|
|
PsiElement(Py:IDENTIFIER)('d')
|
|
PsiElement(Py:RPAR)(')')
|
|
PsiElement(Py:COLON)(':')
|
|
PsiWhiteSpace('\n ')
|
|
PyStatementList
|
|
PyTypeDeclarationStatement
|
|
PyTargetExpression: x
|
|
PsiElement(Py:IDENTIFIER)('x')
|
|
PyAnnotation
|
|
PsiElement(Py:COLON)(':')
|
|
PsiWhiteSpace(' ')
|
|
PySubscriptionExpression
|
|
PyReferenceExpression: List
|
|
PsiElement(Py:IDENTIFIER)('List')
|
|
PsiElement(Py:LBRACKET)('[')
|
|
PyReferenceExpression: bool
|
|
PsiElement(Py:IDENTIFIER)('bool')
|
|
PsiElement(Py:RBRACKET)(']')
|
|
PsiWhiteSpace('\n ')
|
|
PyTypeDeclarationStatement
|
|
PySubscriptionExpression
|
|
PyReferenceExpression: d
|
|
PsiElement(Py:IDENTIFIER)('d')
|
|
PsiElement(Py:LBRACKET)('[')
|
|
PyStringLiteralExpression: foo
|
|
PsiElement(Py:SINGLE_QUOTED_STRING)(''foo'')
|
|
PsiElement(Py:RBRACKET)(']')
|
|
PyAnnotation
|
|
PsiElement(Py:COLON)(':')
|
|
PsiWhiteSpace(' ')
|
|
PyReferenceExpression: str
|
|
PsiElement(Py:IDENTIFIER)('str')
|
|
PsiWhiteSpace('\n ')
|
|
PyTypeDeclarationStatement
|
|
PyParenthesizedExpression
|
|
PsiElement(Py:LPAR)('(')
|
|
PySubscriptionExpression
|
|
PyReferenceExpression: d
|
|
PsiElement(Py:IDENTIFIER)('d')
|
|
PsiElement(Py:LBRACKET)('[')
|
|
PyStringLiteralExpression: bar
|
|
PsiElement(Py:SINGLE_QUOTED_STRING)(''bar'')
|
|
PsiElement(Py:RBRACKET)(']')
|
|
PsiElement(Py:RPAR)(')')
|
|
PyAnnotation
|
|
PsiElement(Py:COLON)(':')
|
|
PsiWhiteSpace(' ')
|
|
PyReferenceExpression: float
|
|
PsiElement(Py:IDENTIFIER)('float') |