mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
* Generate libSyntax API This patch removes the hand-rolled libSyntax API and replaces it with an API that's entirely automatically generated. This means the API is guaranteed to be internally stylistically and functionally consistent.
25 lines
811 B
Python
25 lines
811 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('Identifier', kind='IdentifierToken'),
|
|
Child('LeftParen', kind='LeftParenToken',
|
|
is_optional=True),
|
|
Child('BalancedTokens', kind='TokenList'),
|
|
Child('RightParen', kind='RightParenToken',
|
|
is_optional=True),
|
|
]),
|
|
|
|
# attribute-list -> attribute attribute-list?
|
|
Node('AttributeList', kind='SyntaxCollection',
|
|
element='Attribute'),
|
|
]
|