Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions .github/workflows/copilot-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@ name: Copilot Review

on:
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: read
pull-requests: write
types: [opened, ready_for_review]

jobs:
copilot-review:
request-copilot-review:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Copilot Code Review
uses: github/copilot-code-review-action@v1
- name: Request Copilot Review
uses: actions/github-script@v7
with:
model: gpt-4o
script: |
await github.rest.pulls.requestReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
reviewers: ['copilot']
});
20 changes: 19 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ include(FetchContent)
FetchContent_Declare(
tree-sitter
GIT_REPOSITORY https://github.com/tree-sitter/tree-sitter.git
GIT_TAG v0.24.6
GIT_TAG v0.26.3
)
FetchContent_GetProperties(tree-sitter)
if(NOT tree-sitter_POPULATED)
Expand Down Expand Up @@ -116,6 +116,16 @@ if(NOT tree-sitter-kotlin_POPULATED)
FetchContent_Populate(tree-sitter-kotlin)
endif()

FetchContent_Declare(
tree-sitter-typescript
GIT_REPOSITORY https://github.com/tree-sitter/tree-sitter-typescript.git
GIT_TAG v0.23.2
)
FetchContent_GetProperties(tree-sitter-typescript)
if(NOT tree-sitter-typescript_POPULATED)
FetchContent_Populate(tree-sitter-typescript)
endif()

# Build tree-sitter as a static library
add_library(tree-sitter-lib STATIC
${tree-sitter_SOURCE_DIR}/lib/src/lib.c
Expand All @@ -137,6 +147,11 @@ add_library(tree-sitter-grammars STATIC
${tree-sitter-javascript_SOURCE_DIR}/src/scanner.c
${tree-sitter-kotlin_SOURCE_DIR}/src/parser.c
${tree-sitter-kotlin_SOURCE_DIR}/src/scanner.c
${tree-sitter-typescript_SOURCE_DIR}/typescript/src/parser.c
${tree-sitter-typescript_SOURCE_DIR}/typescript/src/scanner.c
${tree-sitter-typescript_SOURCE_DIR}/tsx/src/parser.c
${tree-sitter-typescript_SOURCE_DIR}/tsx/src/scanner.c
${CMAKE_SOURCE_DIR}/grammars/tree-sitter-qore/src/parser.c
)
target_include_directories(tree-sitter-grammars PUBLIC
${tree-sitter_SOURCE_DIR}/lib/include
Expand All @@ -146,6 +161,9 @@ target_include_directories(tree-sitter-grammars PUBLIC
${tree-sitter-yaml_SOURCE_DIR}/src
${tree-sitter-javascript_SOURCE_DIR}/src
${tree-sitter-kotlin_SOURCE_DIR}/src
${tree-sitter-typescript_SOURCE_DIR}/typescript/src
${tree-sitter-typescript_SOURCE_DIR}/tsx/src
${CMAKE_SOURCE_DIR}/grammars/tree-sitter-qore/src
)

set(QPP_SRC
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ This module provides bindings to the [tree-sitter](https://tree-sitter.github.io
- YAML
- JavaScript
- Kotlin
- TypeScript
- TSX
- Qore

## Features

Expand Down Expand Up @@ -42,12 +45,18 @@ make install
```qore
%requires treesitter

# Parse Python code
TreeSitterParser parser("python");
TreeSitterTree tree = parser.parse("def hello(): pass");
TreeSitterNode root = tree.getRootNode();

printf("Root type: %s\n", root.getType());
printf("S-expression: %s\n", root.toSexp());

# Parse Qore code
TreeSitterParser qoreParser("qore");
TreeSitterTree qoreTree = qoreParser.parse("class Test { constructor() {} }");
printf("Qore root: %s\n", qoreTree.getRootNode().getType());
```

## Classes
Expand Down
Loading