Skip to content

Instantly share code, notes, and snippets.

@LucianoPAlmeida
Created April 15, 2019 03:12
Show Gist options
  • Save LucianoPAlmeida/d7d46f24607f4ba639c5d1e8eec66c22 to your computer and use it in GitHub Desktop.
Save LucianoPAlmeida/d7d46f24607f4ba639c5d1e8eec66c22 to your computer and use it in GitHub Desktop.
Syntax Rewriter
import SwiftSyntax
class CatRewriter: SyntaxRewriter {
override func visit(_ token: TokenSyntax) -> Syntax {
guard case .stringLiteral = token.tokenKind else { return token }
return token.withKind(.stringLiteral("\"🐱\""))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment