mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[gyb_syntax_support] Remove Python code specific to SwiftSyntaxBuilder
These functions/definitions have been migrated to the SwiftSyntax repository.
This commit is contained in:
@@ -38,27 +38,3 @@ def lowercase_first_word(name):
|
||||
if word_index == 0:
|
||||
return name
|
||||
return name[:word_index].lower() + name[word_index:]
|
||||
|
||||
|
||||
def syntax_buildable_child_type(type_name, syntax_kind, is_token,
|
||||
is_optional=False):
|
||||
if syntax_kind in SYNTAX_BASE_KINDS:
|
||||
buildable_type = syntax_kind + 'Buildable'
|
||||
elif not is_token:
|
||||
buildable_type = syntax_kind
|
||||
else:
|
||||
buildable_type = type_name
|
||||
|
||||
if is_optional:
|
||||
buildable_type += '?'
|
||||
|
||||
return buildable_type
|
||||
|
||||
|
||||
def syntax_buildable_default_init_value(child, token):
|
||||
if child.is_optional:
|
||||
return " = nil"
|
||||
elif token and token.text:
|
||||
return " = TokenSyntax.`%s`" % lowercase_first_word(token.name)
|
||||
else:
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user