mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Syntax] Swift libSyntax API (#11320)
* Create Swift libSyntax API This patch is an initial implementation of the Swift libSyntax API. It aims to provide all features of the C++ API but exposed to Swift. It currently resides in SwiftExperimental and will likely exist in a molten state for a while. * Only build SwiftSyntax on macOS
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from __future__ import print_function
|
||||
import sys # noqa: I201
|
||||
from kinds import SYNTAX_BASE_KINDS, kind_to_type
|
||||
from kinds import SYNTAX_BASE_KINDS, kind_to_type, lowercase_first_word
|
||||
|
||||
|
||||
def error(msg):
|
||||
@@ -19,6 +19,7 @@ class Node(object):
|
||||
def __init__(self, name, kind=None, children=None,
|
||||
element=None, element_name=None):
|
||||
self.syntax_kind = name
|
||||
self.swift_syntax_kind = lowercase_first_word(name)
|
||||
self.name = kind_to_type(self.syntax_kind)
|
||||
|
||||
self.children = children or []
|
||||
|
||||
Reference in New Issue
Block a user