mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This commit starts to support syntax nodes for @ attributes list for declarations. These attributes don't include modifiers like "static" or access keywords. Along with the function change, the commit refactors some existing code to reduce duplication.
22 lines
653 B
Python
22 lines
653 B
Python
from Child import Child
|
|
from Node import Node # noqa: I201
|
|
|
|
ATTRIBUTE_NODES = [
|
|
# token-list -> token token-list?
|
|
Node('TokenList', kind='SyntaxCollection',
|
|
element='Token'),
|
|
|
|
# attribute -> '@' identifier '('? token-list ')'?
|
|
Node('Attribute', kind='Syntax',
|
|
children=[
|
|
Child('AtSignToken', kind='AtSignToken'),
|
|
Child('AttributeName', kind='Token'),
|
|
# FIXME: more structure
|
|
Child('BalancedTokens', kind='TokenList'),
|
|
]),
|
|
|
|
# attribute-list -> attribute attribute-list?
|
|
Node('AttributeList', kind='SyntaxCollection',
|
|
element='Attribute'),
|
|
]
|