yanagiba / swift-ast

A Swift AST parser and visitor that is written in Swift.
Apache License 2.0
355 stars 40 forks source link

Feature request: Parse swiftinterface files #106

Open tjprescott opened 3 years ago

tjprescott commented 3 years ago

🚨New Issue Checklist🚨

Issue Summary

I am using swift-ast to parse Swift source code, and for that, it works great. However, I also need to be able to parse *.swiftinterface files, as that is what I can generate from Objective-C headers. Since I only care about the public interface, this is ideal. However, I can't parse these files with swift-ast because it exits with a DiagnosticStopper error.

I've had to try modifying the swiftinterface files to make them "look" like compilable Swift, for example, by adding empty brackets {} after function declarations. In this way I've been able to hackily use swift-ast for my purposes, but it's much too brittle to be effective.

I tried using SourceKitten directly to examine the structure, which was very promising as it works the same for swift and swiftinterface, but unfortunately it seems to be missing a bunch of stuff that I am currently able to get from swift-ast.

Reproduction Steps

Run swift-ast on any *.swiftinterface file

Expected Result

Code is parsed and I can navigate the tree, albeit with less detail.

Actual Behavior

DiagnosticStopped exit.

ryuichi-assistant commented 2 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by adding a comment.

tjprescott commented 2 years ago

This has not been addressed. I have a private fork where I made this work for my use case,