owned this note changed 6 years ago
Published Linked with GitHub

Making your own tools using SwiftSyntax - Yusuke Kita

所有議程請見議程表

歡迎來到 https://hackmd.io/@iPlayground/2019 共筆

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

點擊本頁上方的 開始用 Markdown 一起寫筆記!
手機版請點選上方 按鈕展開議程列表。

請從這裡開始

YouTube

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Slide

What's SwiftSyntax for?

SwiftSyntax功能如format, search constant
(A parsing tool)

  • Code Modifier
  • Code Analyzer

SwiftSyntax把swift code轉成(emit)樹狀

swift -frontend emit-syntax
  • Swift AST Explorer

Recap

SwiftSyntax is a parsing tool
emits syntax tree
allows to inspect and transform source code

Install

可以透過 SPM 安裝,建議指定特定 Tag,例如:

  • swift-5.0.3-RELEASE
.package(url: "https://github.com/apple/swift-syntax.git",
      .exact("<#Specify Release tag#>")),

interfaces

syntaxParser
SourceFileSyntax
Syntax
TonkenSyntax

Resource

tags:iPlayground2019
Select a repo