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

feat!: capsules & query API #246

Merged
merged 7 commits into from
Aug 22, 2024
Merged

feat!: capsules & query API #246

merged 7 commits into from
Aug 22, 2024

Conversation

ObserverOfTime
Copy link
Member

@ObserverOfTime ObserverOfTime commented May 25, 2024

Breaking changes are marked with !.

Additions:

  • Node.child_containing_descendant(descendant)
  • Tree.language (getter)
  • Query.pattern_count (getter)
  • Query.capture_count (getter)
  • Query.match_limit (getter)
  • Query.did_exceed_match_limit (getter)
  • Query.set_match_limit(match_limit): returns self
  • Query.set_max_start_depth(max_start_depth): returns self
  • Query.set_byte_range(byte_range): returns self
  • Query.set_point_range(point_range): returns self
  • Query.disable_pattern(index): returns self
  • Query.disable_capture(capture): returns self
  • Query.pattern_settings(index)
  • Query.pattern_assertions(index)
  • Query.start_byte_for_pattern(index)
  • Query.end_byte_for_pattern(index)
  • Query.is_pattern_rooted(index)
  • Query.is_pattern_non_local(index)
  • Query.is_pattern_guaranteed_at_step(offset)
  • QueryError (exception class)
  • QueryPredicate (typing protocol)

Removals:

  • Parser.set_language(language)
  • Parser.set_included_ranges(ranges)
  • Parser.set_timeout_micros(timeout)
  • Node.sexp()
  • Tree.text()
  • TreeCursor.goto_first_child_for_point(row, column)
  • LookaheadIterator.reset(language, state)

Changes:

  • Language() accepts a capsule as an argument.
  • Parser.parse(...) no longer accepts a keep_text argument.
  • Query.captures(...) !
    • Range arguments were removed (use set_* instead).
    • Added an argument for custom query predicates.
    • Return type was changed to dict[str, list[Node]].
  • Query.matches(...) !
    • Range arguments were removed (use set_* instead).
    • Added an argument for custom query predicates.
    • Return type was changed to list[tuple[int, dict[str, list[Node]]]].
  • TreeCursor.goto_first_child_for_byte(byte) returns int | None.
  • TreeCursor.goto_first_child_for_point(point) returns int | None.

@ObserverOfTime ObserverOfTime merged commit c70d44f into master Aug 22, 2024
12 checks passed
@ObserverOfTime ObserverOfTime deleted the 0.23 branch August 22, 2024 06:07
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