Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Swift Package Manager support #76

Merged
merged 2 commits into from
Feb 25, 2023
Merged

Conversation

nhubbard
Copy link
Contributor

@nhubbard nhubbard commented Feb 24, 2023

This pull request is intended to add Swift Package Manager support so that we can use this package with the wonderful https://github.com/ChimeHQ/SwiftTreeSitter without manually adding another build step to our Swift projects.

As an example, here's how it would be used:

  1. Add this package as a dependency to your Xcode project or Package.swift file.
  2. Use it as follows:
    import SwiftTreeSitter
    import TreeSitterLatex
    
    let language = Language(language: tree_sitter_latex())
    let parser = Parser()
    try parser.setLanguage(language)
    
    let source = "" // Insert LaTeX source code here
    let tree = parser.parse(source)!
    // Use the tree as you see fit!

The work for this PR is based on tree-sitter/tree-sitter-java#113. I've tested it with the included test document and a few LaTeX documents I've written myself and it worked perfectly.

@pfoerster
Copy link
Member

@nhubbard Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants