Skip to content

Commit a04e1a5

Browse files
authored
[Feature:Autograding] tree-sitter c-api (#2)
* Initial C-API * Update readme * Initial class implementation * Add function call counting * Refactor header * Add c counting * Fix function counting * Fix requested changes * Update source sh scripts * Add cpp shell static checks * Add function counting * File glob handling and format * Update cmakelists * Fix function changes * Update actions * Remove test.yml * Initial diagnostics * Refactor diagnostics * Add nlohmann json * Fix shell-check * Format json output * Add fixes * Add identifier counting * Add c++ * Update counting * Add tests for executable * Update test.yml * check * Fix file name * Switch user * Change to sudo * FIx format * Spaces for tabs
1 parent 046c660 commit a04e1a5

46 files changed

Lines changed: 667 additions & 10891 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.json

Lines changed: 0 additions & 59 deletions
This file was deleted.

.gitattributes

100644100755
File mode changed.

.github/PULL_REQUEST_TEMPLATE.md

100644100755
File mode changed.

.github/workflows/pr_title.yml

100644100755
File mode changed.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Static analysis
2+
on: [push]
3+
4+
jobs:
5+
cppcheck:
6+
name: Cppcheck
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: install cpp-check
11+
run: sudo apt-get install -y cppcheck
12+
- name: run cpp-check
13+
run: cppcheck src/
14+
15+
shellcheck:
16+
name: Shellcheck
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: install shellcheck
21+
run: sudo apt-get install -y shellcheck
22+
- name: run shell-check
23+
run: shellcheck *.sh -e SC1090
24+

.github/workflows/test.yml

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,15 @@
11
name: Test
2-
3-
on: ['push', 'pull_request']
2+
on: [push]
43

54
jobs:
6-
build:
5+
test:
6+
name: Test
77
runs-on: ubuntu-latest
8-
9-
strategy:
10-
matrix:
11-
# Disable 17.x for now, see https://github.com/tree-sitter/node-tree-sitter/issues/102
12-
node-version: [16.x]
13-
148
steps:
15-
- uses: actions/checkout@v2
16-
17-
- uses: actions/setup-node@v2
18-
with:
19-
node-version: ${{ matrix.node-version }}
20-
cache: npm
21-
22-
- run: npm install
23-
24-
- run: npm run lint
25-
26-
- run: npm run build
27-
28-
- run: npm run test
29-
30-
- uses: codecov/codecov-action@v2
9+
- uses: actions/checkout@v2
10+
- name: Change permission
11+
run: chmod +x install_analysistoolsts.sh
12+
- name: Build executable
13+
run: sudo ./install_analysistoolsts.sh local
14+
- name: run tests
15+
run: python testRunner.py

.gitignore

100644100755
Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,2 @@
1-
node_modules/
2-
.DS_Store
3-
4-
# build artifacts
5-
dist/
6-
7-
# test artifacts
8-
.nyc_output/
9-
coverage/
1+
include/
2+
build/

.husky/pre-commit

Lines changed: 0 additions & 5 deletions
This file was deleted.

.prettierrc.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
cmake_minimum_required(VERSION 3.16.3)
2+
3+
project(analysis_tools_ts)
4+
5+
set(JSONCODE include/json/include/)
6+
7+
if(JSONDIR)
8+
set(JSONCODE ${JSONDIR})
9+
endif()
10+
11+
add_library(tree-sitter-python include/tree-sitter-python/src/parser.c
12+
include/tree-sitter-python/src/scanner.cc)
13+
14+
add_library(tree-sitter-cpp include/tree-sitter-cpp/src/parser.c
15+
include/tree-sitter-cpp/src/scanner.cc)
16+
17+
add_library(tree-sitter-c include/tree-sitter-c/src/parser.c)
18+
19+
link_libraries(tree-sitter-python tree-sitter-c tree-sitter-cpp
20+
${PROJECT_SOURCE_DIR}/include/tree-sitter/libtree-sitter.a)
21+
22+
add_executable(submitty_count_ts src/count.cpp src/parser.cpp src/utils.cpp)
23+
24+
add_executable(submitty_diagnostics_ts src/diagnostics.cpp src/parser.cpp
25+
src/utils.cpp)
26+
27+
include_directories(include/tree-sitter/lib/include)
28+
29+
target_include_directories(submitty_diagnostics_ts PUBLIC ${JSONCODE})

0 commit comments

Comments
 (0)