Files
swift-mirror/utils/gyb_syntax_support/AttributeNodes.py
Harlan a5098e6b69 Generate libSyntax API (#10926)
* 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.
2017-07-25 18:19:58 -07:00

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'),
]