{"id":16273520,"url":"https://github.com/jimhester/rtreesitter","last_synced_at":"2025-03-20T00:30:50.535Z","repository":{"id":42481580,"uuid":"314585524","full_name":"jimhester/rtreesitter","owner":"jimhester","description":"R bindings to the Tree-sitter parsing library","archived":false,"fork":false,"pushed_at":"2022-04-03T22:29:57.000Z","size":621,"stargazers_count":6,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-06-11T18:20:13.584Z","etag":null,"topics":["r","tree-sitter"],"latest_commit_sha":null,"homepage":"https://jimhester.github.io/rtreesitter/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jimhester.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-20T14:57:59.000Z","updated_at":"2024-06-11T18:20:13.585Z","dependencies_parsed_at":"2022-09-03T08:50:47.159Z","dependency_job_id":null,"html_url":"https://github.com/jimhester/rtreesitter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimhester%2Frtreesitter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimhester%2Frtreesitter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimhester%2Frtreesitter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimhester%2Frtreesitter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jimhester","download_url":"https://codeload.github.com/jimhester/rtreesitter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219866013,"owners_count":16555916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["r","tree-sitter"],"created_at":"2024-10-10T18:24:34.917Z","updated_at":"2024-10-10T18:24:35.442Z","avatar_url":"https://github.com/jimhester.png","language":"Rust","readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# rtreesitter\n\n\u003c!-- badges: start --\u003e\n[![Codecov test coverage](https://codecov.io/gh/jimhester/rtreesitter/branch/main/graph/badge.svg)](https://codecov.io/gh/jimhester/rtreesitter?branch=main)\n[![R-CMD-check](https://github.com/jimhester/rtreesitter/workflows/R-CMD-check/badge.svg)](https://github.com/jimhester/rtreesitter/actions)\n\u003c!-- badges: end --\u003e\n\nrtreesitter provides R bindings to the [tree-sitter](https://tree-sitter.github.io/tree-sitter/) parsing library.\n\n## Installation\n\nYou can install the development version from [GitHub](https://github.com/) with:\n\n``` r\n# install.packages(\"remotes\")\nremotes::install_github(\"jimhester/rtreesitter\")\n```\n\n## Usage\n\n```bash\nmkdir vendor\ncd vendor\ngit clone https://github.com/jimhester/tree-sitter-r\ngit clone https://github.com/tree-sitter/tree-sitter-python\ngit clone https://github.com/tree-sitter/tree-sitter-javascript\ngit clone https://github.com/tree-sitter/tree-sitter-go\n```\n\n```{r}\nlibrary(rtreesitter)\n\n\nlib_dir \u003c- file.path(tempdir(), \"rtreesitter\")\nlib \u003c- file.path(lib_dir, \"languages.so\")\n\nrepos \u003c- c(\n  \"tree-sitter/tree-sitter-python\",\n  \"tree-sitter/tree-sitter-javascript\",\n  \"jimhester/tree-sitter-r\"\n)\nfor (repo in repos) {\n  processx::run(\"git\", c(\"clone\", \"--depth=1\", sprintf(\"https://github.com/%s\", repo), file.path(lib_dir, basename(repo))))\n}\n\nbuild_library(lib, file.path(lib_dir, basename(repos)))\n\np_r \u003c- rts_parser$new(\"tree_sitter_R\")\np_r$parse(\"x \u003c- function(x) 1\")\n\np_py \u003c- rts_parser$new(\"tree_sitter_python\")\np_py$parse(\"\ndef foo():\n    if bar:\n       baz()\n\")\n\np_js \u003c- rts_parser$new(\"tree_sitter_javascript\")\np_js$parse('\n    let name = \"world\";\n    alert(\"hello \" + name);')\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimhester%2Frtreesitter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjimhester%2Frtreesitter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimhester%2Frtreesitter/lists"}