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

feature: tree-sitter like traverse API #2

Open
wants to merge 18 commits into
base: feature/tree-sitter-if
Choose a base branch
from

Conversation

lemonadern
Copy link
Collaborator

@lemonadern lemonadern commented Dec 11, 2024

Summary

Comment on lines +303 to +307
let node = parse(&src).unwrap();
let (node, range_map) = get_ts_tree_and_range_map(&src, &node);
let mut cursor = as_tree_sitter_cursor(src, &node, range_map);

visit(&mut cursor, 0, &src);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

利用側はこのような感じになっています。

  1. get_ts_tree_and_range_map 関数で変換後の木とrange_mapを生成
  2. 変換後の木に対する参照としてCursorを初期化

@lemonadern lemonadern marked this pull request as ready for review December 20, 2024 09:38
@lemonadern lemonadern requested a review from tanzaku December 20, 2024 09:41
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.

1 participant