Skip to content

Commit bf4dfe6

Browse files
authored
Merge pull request #40742 from ahoppen/pr/remove-syntax-buildable-python-code
[gyb_syntax_support] Remove Python code specific to SwiftSyntaxBuilder
2 parents f64135a + f3f2370 commit bf4dfe6

File tree

3 files changed

+0
-109
lines changed

3 files changed

+0
-109
lines changed

utils/gyb_syntax_support/__init__.py

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from .StmtNodes import STMT_NODES # noqa: I201
1616
from .Trivia import TRIVIAS # noqa: I201
1717
from .TypeNodes import TYPE_NODES # noqa: I201
18-
from .kinds import syntax_buildable_child_type
1918

2019

2120
# Re-export global constants
@@ -180,42 +179,3 @@ def _digest_trivia(trivia):
180179
_digest_trivia(trivia)
181180

182181
return digest.hexdigest()
183-
184-
185-
def syntax_collection_element_to_collection_mapping():
186-
"""
187-
Generates a lookup table to find syntax collection type by syntax collection
188-
element type.
189-
190-
Example:
191-
{
192-
'SyntaxBuildable': [
193-
'StringLiteralSegments',
194-
'PrecedenceGroupAttributeList',
195-
'AttributeList',
196-
'SpecializeAttributeSpecList',
197-
'SwitchCaseList'
198-
],
199-
'IfConfigClause': [
200-
'IfConfigClauseList'
201-
],
202-
}
203-
"""
204-
collection_map = {}
205-
206-
for node in SYNTAX_NODES:
207-
if node.is_syntax_collection():
208-
syntax_collection_syntax_kind = node.syntax_kind
209-
210-
syntax_child_type = syntax_buildable_child_type(
211-
node.collection_element_type,
212-
node.collection_element,
213-
node.is_token())
214-
215-
if syntax_child_type not in collection_map:
216-
collection_map[syntax_child_type] = []
217-
218-
collection_map[syntax_child_type] \
219-
.append(syntax_collection_syntax_kind)
220-
221-
return collection_map

utils/gyb_syntax_support/kinds.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -38,27 +38,3 @@ def lowercase_first_word(name):
3838
if word_index == 0:
3939
return name
4040
return name[:word_index].lower() + name[word_index:]
41-
42-
43-
def syntax_buildable_child_type(type_name, syntax_kind, is_token,
44-
is_optional=False):
45-
if syntax_kind in SYNTAX_BASE_KINDS:
46-
buildable_type = syntax_kind + 'Buildable'
47-
elif not is_token:
48-
buildable_type = syntax_kind
49-
else:
50-
buildable_type = type_name
51-
52-
if is_optional:
53-
buildable_type += '?'
54-
55-
return buildable_type
56-
57-
58-
def syntax_buildable_default_init_value(child, token):
59-
if child.is_optional:
60-
return " = nil"
61-
elif token and token.text:
62-
return " = TokenSyntax.`%s`" % lowercase_first_word(token.name)
63-
else:
64-
return ""

utils/gyb_syntax_support/protocolsMap.py

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)