initial commit

This commit is contained in:
2024-03-25 23:16:07 +01:00
commit 8f31c35bc9
62 changed files with 1348332 additions and 0 deletions

5
script/file_sizes.txt Normal file
View File

@@ -0,0 +1,5 @@
src/grammar.json 0.2MB 11156
src/node-types.json 0.1MB 7916
src/parser.c 41.8MB 1311934
src/scanner.c 0.0MB 37
total 42.2MB 1331043

View File

@@ -0,0 +1,3 @@
examples/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Serialization/SerializationErrorHandlingTests.cs
examples/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/TestFixtureBase.cs
examples/Newtonsoft.Json/Src/Newtonsoft.Json/JsonReader.cs

45
script/parse-examples Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/bash
set -eu
cd "$(dirname "$0")/.."
function clone_repo {
owner=$1
name=$2
sha=$3
path=examples/$name
if [ ! -d "$path" ]; then
echo "Cloning $owner/$name"
git clone "https://github.com/$owner/$name" "$path"
fi
pushd "$path" > /dev/null
actual_sha=$(git rev-parse HEAD)
if [ "$actual_sha" != "$sha" ]; then
echo "Updating $owner/$name to $sha"
git fetch
git reset --hard $sha
fi
popd > /dev/null
}
clone_repo JamesNK Newtonsoft.Json 7c3d7f8da7e35dde8fa74188b0decff70f8f10e3
clone_repo nunit nunit ad49f27294bd0f2677d8699756c6ccb10df600f8
clone_repo OrchardCMS orchard 0a82721968232b07354edcaac63a9ccea02220c6
known_failures="$(cat script/known_failures.txt)"
tree-sitter parse -q \
'examples/**/*.cs' \
$(for failure in $known_failures; do echo "!${failure}"; done)
example_count=$(find examples -name '*.cs' | wc -l)
failure_count=$(wc -w <<< "$known_failures")
success_count=$(( $example_count - $failure_count ))
success_percent=$(bc -l <<< "100*${success_count}/${example_count}")
printf \
"Successfully parsed %d of %d example files (%.1f%%)\n" \
$success_count $example_count $success_percent

3
script/update-file-sizes Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
wc -l -m src/*.* | awk '{printf("%-20s\t%0.1fMB\t%10s\n", $3, $2/1048576, $1)}' > script/file_sizes.txt

7
script/update-known-failures Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
set -eu
find examples -name '*.cs' -print0 | \
xargs -0 -n 1000 tree-sitter parse -q | \
tee >(cut -d' ' -f1 | sort > script/known-failures.txt)