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

core: Add support for QmlJs via tree-sitter-qmljs #46

Merged
merged 1 commit into from
Jun 24, 2024
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
[submodule "3rdparty/tree-sitter-cpp"]
path = 3rdparty/tree-sitter-cpp
url = https://github.com/tree-sitter/tree-sitter-cpp
[submodule "3rdparty/tree-sitter-qmljs"]
path = 3rdparty/tree-sitter-qmljs
url = https://github.com/yuja/tree-sitter-qmljs.git
[submodule "3rdparty/mfc-utils"]
path = 3rdparty-kdab/mfc-utils
url = ssh://codereview.kdab.com:29418/kdab/mfc-utils
Expand Down
6 changes: 6 additions & 0 deletions 3RDPARTY.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ C++ grammar for tree-sitter.<br>
[Home page](https://github.com/tree-sitter/tree-sitter-cpp)<br>
[MIT licensed](LICENSES/MIT.txt)

### tree-sitter-qmljs

QML grammar for the tree-sitter parsing library.<br>
[Home page](https://github.com/yuja/tree-sitter-qmljs)<br>
[MIT licensed](LICENSES/MIT.txt)

## Build-time / CI tests 3rdparty

These dependencies are only used during build or other CI purposes like running tests.
Expand Down
12 changes: 12 additions & 0 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,15 @@ target_link_libraries(${PROJECT_NAME} PRIVATE TreeSitter)
# Always build tree-sitter with optimizations enabled. We shouldn't have to
# debug it and it's performance critical.
target_compile_options(${PROJECT_NAME} PRIVATE -O3)

# TreeSitterQmlJs
# ##############################################################################
check_submodule(tree-sitter-qmljs tree-sitter-qmljs)
project(TreeSitterQmlJs LANGUAGES C)

add_library(${PROJECT_NAME} STATIC tree-sitter-qmljs/src/parser.c
tree-sitter-qmljs/src/scanner.c)
target_link_libraries(${PROJECT_NAME} PRIVATE TreeSitter)
# Always build tree-sitter with optimizations enabled. We shouldn't have to
# debug it and it's performance critical.
target_compile_options(${PROJECT_NAME} PRIVATE -O3)
1 change: 1 addition & 0 deletions 3rdparty/tree-sitter-qmljs
Submodule tree-sitter-qmljs added at febf48
10 changes: 8 additions & 2 deletions src/treesitter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ set(PROJECT_SOURCES node.cpp parser.cpp predicates.cpp query.cpp
transformation.cpp tree.cpp)

add_library(${PROJECT_NAME} STATIC ${PROJECT_SOURCES})
target_link_libraries(${PROJECT_NAME} TreeSitter TreeSitterCpp kdalgorithms
knut-utils Qt${QT_VERSION_MAJOR}::Core)
target_link_libraries(
${PROJECT_NAME}
TreeSitter
TreeSitterCpp
TreeSitterQmlJs
kdalgorithms
knut-utils
Qt${QT_VERSION_MAJOR}::Core)
target_include_directories(${PROJECT_NAME}
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/..)
1 change: 1 addition & 0 deletions src/treesitter/languages.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ struct TSLanguage;

extern "C" {
TSLanguage *tree_sitter_cpp();
TSLanguage *tree_sitter_qmljs();
}
Loading