Skip to content

feat: add java bindings #182

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ObserverOfTime
Copy link
Member

@ObserverOfTime ObserverOfTime commented Jun 24, 2024

These bindings are not (yet?) included in the template.
The pom.xml includes the required metadata and plugin for publishing to Maven Central via the new Central Portal.
The bindings can be added to the template after the generate command supports metadata options.

SymbolLookup.libraryLookup(library, arena).or(SymbolLookup.loaderLookup());

/** Get the tree-sitter {@code Language} for this grammar */
public static MemorySegment language() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to have two variants?

  • TreeSitterJava.language()
  • TreeSitterJava.language(SymbolLookup)

The former could then simply delegate to the latter, and use your existing logic here with System.mapLibraryName(...).

It can be useful if users can provide the SymbolLookup themselves:

  • It allows them to control where the library is loaded from, e.g. they can use a temp file
  • They can unload the library by calling Arena#close (see SymbolLookup#libraryLookup documentation)
    On Linux that might not matter that much, but on Windows you cannot delete the library file while it is still loaded which prevents clean-up of a temporarily extracted library file

This comment was marked as resolved.

This comment was marked as resolved.

This comment was marked as resolved.

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