mirror of
https://github.com/apple/swift.git
synced 2026-06-27 12:25:55 +02:00
68348944e2
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'),
|
|
]
|