Swiftpack.co - Package - joehinkle11/SwiftSyntaxStubs

SwiftSyntaxStubs

SwiftSyntaxStubs provides all SwiftSyntax structs found in Apple's SwiftSyntax without needing the underlying parser. It also supports decoding stubs from JSON (for exporting to JSON, see the package SwiftSyntaxStubExporter).

Built binary is ~3MB (exactly 3,032,160 bytes on commit e34c4d2).

Contributing

Don't work directly on the .swift files, but instead work on SwiftSyntaxStubs.swift.gyb and run build-script.py to produce all the Swift.

Swift Versions

Following SwiftSyntax's format...

| Xcode Release | Swift Release Tag | SwiftSyntax Release Tag | gyb_syntax_support Release Tag | SwiftSyntaxStubs Release Tag | |:-------------------:|:-------------------:|:-------------------------:|:-------------------------:|:-------------------------:| | Xcode 12.0 | swift-5.3-RELEASE | 0.50300.0 | swift-5.3-RELEASE | 0.50300.0 | | Xcode 11.4 | swift-5.2-RELEASE | 0.50200.0 | swift-5.2-RELEASE | 0.50200.0 |

Notes

  • SwiftSyntaxStubs relies on a modified version of Apple's GYB (GYB2) which allows a simple GYB file to produce multiple Swift files.
  • The default branch is main, not master
  • SwiftSyntaxStubExporter is separate to keep this base repo as small as possible. The models used here are included in the App Maker App Clip and therefore need to be as tiny as possible.

Related Efforts

I'm making some repos open and free, but I'm working on some closed-sourced projects which directly use this repo. If you're interested in helping me with those efforts, don't hesitate to contact me.

  • EditableSwiftSyntax (private) while this does not directly use this repo, this project is related to my project App Maker and allows SwiftSyntax to be edited easily by a UI client
  • SwiftSyntaxStubExporter extensions for stubs in this repo allowing you to export them to JSON
  • SwiftSyntaxToStubs (private) converts a AST in SwiftSyntax to the stubs found in this repo (SwiftSyntaxStubs)
  • SwiftInterpreter (private) runs through populated stub nodes in this repo (SwiftSyntaxStubs) to interpret the Swift code
  • GYB2 is a simple modifiation of Apple's GYB that allows exporting to multiple Swift files
  • gyb_syntax_support mirrors the gyb_syntax_support found in Apple's Swift source

Sources:

  • https://github.com/apple/swift-syntax
  • https://github.com/apple/swift
  • https://github.com/joehinkle11/gyb_syntax_support
  • http://github.com/joehinkle11/GYB2

Github

link
Stars: 1

Dependencies

Used By

Total: 0