tree-sitter 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +29 -8
- data/Rakefile +19 -4
- data/ext/tree-sitter/Makefile +24 -0
- data/ext/tree-sitter/document.c +149 -0
- data/ext/tree-sitter/document.h +17 -0
- data/ext/tree-sitter/extconf.rb +55 -15
- data/ext/tree-sitter/node.c +300 -0
- data/ext/tree-sitter/node.h +34 -0
- data/ext/tree-sitter/out/document.o +0 -0
- data/ext/tree-sitter/out/get_changed_ranges.o +0 -0
- data/ext/tree-sitter/out/language.o +0 -0
- data/ext/tree-sitter/out/lexer.o +0 -0
- data/ext/tree-sitter/out/libruntime.a +0 -0
- data/ext/tree-sitter/out/node.o +0 -0
- data/ext/tree-sitter/out/parser.o +0 -0
- data/ext/tree-sitter/out/python/parser.c +65600 -0
- data/ext/tree-sitter/out/python/parser.o +0 -0
- data/ext/tree-sitter/out/python/scanner.cc +164 -0
- data/ext/tree-sitter/out/python/scanner.o +0 -0
- data/ext/tree-sitter/out/stack.o +0 -0
- data/ext/tree-sitter/out/string_input.o +0 -0
- data/ext/tree-sitter/out/tree.o +0 -0
- data/ext/tree-sitter/out/utf16.o +0 -0
- data/ext/tree-sitter/out/utf8proc.o +0 -0
- data/ext/tree-sitter/tree-sitter.c +4 -109
- data/ext/tree-sitter/tree-sitter.h +4 -0
- data/ext/tree-sitter/tree-sitter/LICENSE +7 -0
- data/ext/tree-sitter/tree-sitter/README.md +13 -13
- data/ext/tree-sitter/tree-sitter/appveyor.yml +24 -0
- data/ext/tree-sitter/tree-sitter/docs/Gemfile +2 -0
- data/ext/tree-sitter/tree-sitter/docs/Gemfile.lock +239 -0
- data/ext/tree-sitter/tree-sitter/docs/_config.yml +1 -0
- data/ext/tree-sitter/tree-sitter/docs/_layouts/table-of-contents.html +74 -0
- data/ext/tree-sitter/tree-sitter/docs/creating-parsers.md +360 -0
- data/ext/tree-sitter/tree-sitter/docs/css/style.css +13 -0
- data/ext/tree-sitter/tree-sitter/docs/index.md +10 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/PRESUBMIT.py +10 -2
- data/ext/tree-sitter/tree-sitter/externals/gyp/buildbot/aosp_manifest.xml +466 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/buildbot/buildbot_run.py +91 -30
- data/ext/tree-sitter/tree-sitter/externals/gyp/gyp +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/gyptest.py +3 -3
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/MSVSNew.py +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/MSVSSettings.py +11 -5
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/MSVSSettings_test.py +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/MSVSUtil.py +18 -15
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/MSVSVersion.py +53 -20
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/__init__.py +4 -6
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/__init__.pyc +0 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/common.py +69 -2
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/common.pyc +0 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/flock_tool.py +6 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/__init__.pyc +0 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/analyzer.py +569 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/android.py +133 -111
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/cmake.py +3 -3
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/eclipse.py +112 -22
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/gypd.py +3 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/make.py +45 -14
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/make.pyc +0 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/msvs.py +170 -98
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/ninja.py +300 -71
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/ninja_test.py +12 -9
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/xcode.py +46 -12
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/xcode.pyc +0 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/input.py +379 -335
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/input.pyc +0 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/input_test.py +7 -7
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/mac_tool.py +94 -3
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/msvs_emulation.py +131 -40
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/simple_copy.py +46 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/win_tool.py +28 -5
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/xcode_emulation.py +185 -88
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/xcode_emulation.pyc +0 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/xcode_ninja.py +268 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/xcodeproj_file.py +53 -46
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/xcodeproj_file.pyc +0 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-bare/gyptest-bare.py +1 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-depfile/depfile.gyp +25 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-depfile/gyptest-all.py +20 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-depfile/input.txt +1 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-none/gyptest-none.py +1 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/gyptest-all.py +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/gyptest-default.py +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/gyptest-generated-header.py +6 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/src/subdir1/program.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/src/subdir3/generate_main.py +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/additional-targets/gyptest-additional.py +8 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/common.gypi +6 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/gyptest-analyzer.py +356 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/subdir/subdir.gyp +36 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/subdir/subdir2/subdir2.gyp +15 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/subdir2/subdir.gyp +18 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/subdir2/subdir.includes.gypi +9 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/test.gyp +113 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/test2.gyp +25 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/test2.includes.gypi +13 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/test2.includes.includes.gypi +9 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/test2.toplevel_includes.gypi +15 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/test3.gyp +77 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/test4.gyp +80 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/test5.gyp +25 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/32or64.c +13 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/file.in +1 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/gyptest-host-multilib.py +32 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/gyptest-make-functions.py +24 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/gyptest-noalias.py +21 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/gyptest-settings-list.py +24 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/gyptest-settings.py +24 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/gyptest-space-filenames.py +19 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/hello.c +12 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/hello.gyp +15 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/host_32or64.gyp +38 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/make_functions.gyp +31 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/settings-list.gyp +18 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/settings.gyp +18 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/space_filenames.gyp +18 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/writefile.c +18 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/assembly/src/program.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/build-option/gyptest-build.py +11 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/build-option/hello.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/prog1.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/subdir2/prog2.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/subdir2/subdir3/prog3.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/cflags/cflags.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/cflags/gyptest-cflags.py +15 -55
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/compilable/src/program.cpp +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/{compiler.gyp → compiler-exe.gyp} +0 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/compiler-shared-lib.gyp +16 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/gyptest-compiler-env-toolchain.py +78 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/gyptest-compiler-env.py +9 -11
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/gyptest-compiler-global-settings.py +5 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/my_nm.py +8 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/my_readelf.py +8 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/conditions/elseif/elseif.gyp +43 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/conditions/elseif/elseif_bad1.gyp +20 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/conditions/elseif/elseif_bad2.gyp +22 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/conditions/elseif/elseif_bad3.gyp +23 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/conditions/elseif/elseif_conditions.gypi +15 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/conditions/elseif/gyptest_elseif.py +33 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/conditions/elseif/program.cc +10 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/basics/configurations.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/basics/gyptest-configurations.py +6 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/inheritance/configurations.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/inheritance/duplicates.gyp +27 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/inheritance/duplicates.gypd.golden +12 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/inheritance/gyptest-duplicates.py +34 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/inheritance/gyptest-inheritance.py +6 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/target_platform/front.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/x64/configurations.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/gyptest-all.py +3 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/gyptest-default.py +3 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/gyptest-samedir.py +1 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/gyptest-slash.py +1 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/gyptest-updir.py +1 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/cxxflags/cxxflags.cc +4 -4
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/cxxflags/cxxflags.gyp +0 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/cxxflags/gyptest-cxxflags.py +13 -33
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/defines-escaping/defines-escaping.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/defines/defines.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/gyptest-extra-targets.py +2 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/gyptest-lib-only.py +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependency-copy/src/file1.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependency-copy/src/file2.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/empty-target/empty-target.gyp +12 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/empty-target/gyptest-empty-target.py +18 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/errors/dependency_cycle.gyp +23 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/errors/file_cycle0.gyp +17 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/errors/file_cycle1.gyp +13 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/errors/gyptest-errors.py +10 -2
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/exclusion/hello.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/external-cross-compile/src/program.cc +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/actions/subdir1/program.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/gyptest-copies.py +3 -2
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/rules/subdir1/program.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/prog1.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/subdir2/deeper/deeper.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/subdir2/prog2.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/subdir3/prog3.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/gyp-defines/gyptest-multiple-values.py +2 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/hello/hello.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/hello/hello2.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/home_dot_gyp/src/printfoo.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/include_dirs/src/includes.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/include_dirs/src/subdir/subdir_includes.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/intermediate_dir/gyptest-intermediate-dir.py +2 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/TestApp/Images.xcassets/AppIcon.appiconset/Contents.json +58 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/TestApp/Images.xcassets/image.imageset/Contents.json +23 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain.png +0 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain@2x.png +0 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain@3x.png +0 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/test-assets-catalog.gyp +45 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/test-crosscompile.gyp +47 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/test.gyp +0 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/tool_main.cc +7 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ActionExtension/ActionViewController.h +9 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ActionExtension/ActionViewController.m +31 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ActionExtension/Info.plist +42 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ActionExtension/MainInterface.storyboard +63 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ExtensionContainer/AppDelegate.h +12 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ExtensionContainer/AppDelegate.m +19 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ExtensionContainer/Base.lproj/Main.storyboard +25 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ExtensionContainer/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ExtensionContainer/Images.xcassets/LaunchImage.launchimage/Contents.json +51 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ExtensionContainer/Info.plist +32 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ExtensionContainer/ViewController.h +11 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ExtensionContainer/ViewController.m +24 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ExtensionContainer/main.m +13 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/extension.gyp +85 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/gyptest-app-ios-assets-catalog.py +57 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/gyptest-app-ios.py +7 -7
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/gyptest-archs.py +22 -70
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/gyptest-crosscompile.py +34 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/gyptest-extension.py +28 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/gyptest-watch.py +36 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/gyptest-xcode-ninja.py +25 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchApp/Images.xcassets/AppIcon.appiconset/Contents.json +62 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchApp/Images.xcassets/LaunchImage.launchimage/Contents.json +24 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchApp/Info.plist +35 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchApp/Interface.storyboard +15 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchContainer/AppDelegate.h +12 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchContainer/AppDelegate.m +19 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchContainer/Base.lproj/Main.storyboard +25 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchContainer/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchContainer/Images.xcassets/LaunchImage.launchimage/Contents.json +51 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchContainer/Info.plist +32 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchContainer/ViewController.h +11 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchContainer/ViewController.m +24 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchContainer/main.m +13 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchKitExtension/Images.xcassets/MyImage.imageset/Contents.json +20 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchKitExtension/Info.plist +38 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchKitExtension/InterfaceController.h +10 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchKitExtension/InterfaceController.m +25 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchKitExtension/MainInterface.storyboard +63 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/watch.gyp +105 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/lib/TestGyp.py +349 -46
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/lib/TestMac.py +73 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/lib/TestWin.py +101 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/library/gyptest-shared.py +6 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/library/gyptest-static.py +6 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/library/src/program.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/link-dependency/gyptest-link-dependency.py +23 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/link-dependency/main.c +7 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/link-dependency/mymalloc.c +12 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/link-dependency/test.gyp +37 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/link-objects/base.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/TestApp/Images.xcassets/AppIcon.appiconset/Contents.json +58 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/TestApp/Images.xcassets/image.imageset/Contents.json +23 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain.png +0 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain@2x.png +0 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain@3x.png +0 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/test-assets-catalog.gyp +43 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/file_a.cc +8 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/file_a.h +10 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/file_b.cc +8 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/file_b.h +10 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/file_c.cc +11 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/file_d.cc +11 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/test-archs-multiarch.gyp +20 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/test-dependencies.gyp +92 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/test-valid-archs.gyp +28 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/clang-cxx-library/libc++.cc +2 -2
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/clang-cxx-library/libstdc++.cc +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-action-envvars.py +6 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-app-assets-catalog.py +120 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-app-error.py +2 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-app.py +8 -20
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-archs.py +39 -33
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-cflags.py +1 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-clang-cxx-library.py +3 -4
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-global-settings.py +7 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-installname.py +1 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-ldflags-passed-to-libtool.py +1 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-ldflags.py +6 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-libraries.py +6 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-libtool-zero.py +26 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-loadable-module-bundle-product-extension.py +31 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-loadable-module.py +1 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-objc-gc.py +24 -18
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-postbuild-copy-bundle.py +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-postbuild-fail.py +1 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-prefixheader.py +1 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-rpath.py +5 -4
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-strip.py +13 -5
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-swift-library.py +62 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-type-envvars.py +3 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-xcode-env-order.py +2 -6
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-xcode-support-actions.py +25 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/libtool-zero/mylib.c +7 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/{errors/duplicate_basenames.gyp → mac/libtool-zero/test.gyp} +6 -4
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/loadable-module-bundle-product-extension/src.cc +7 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/loadable-module-bundle-product-extension/test.gyp +24 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/swift-library/Info.plist +28 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/swift-library/file.swift +9 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/swift-library/test.gyp +21 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_bundle_executable.sh +1 -2
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_bundle_loadable_module.sh +1 -2
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_bundle_shared_library.sh +1 -2
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_check_sdkroot.sh +47 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_nonbundle_executable.sh +2 -2
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_nonbundle_loadable_module.sh +1 -2
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_nonbundle_none.sh +1 -2
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_nonbundle_shared_library.sh +1 -2
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_nonbundle_static_library.sh +1 -2
- data/ext/tree-sitter/tree-sitter/{out/Release/linker.lock → externals/gyp/test/mac/xcode-support-actions/source.c} +0 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xcode-support-actions/test.gyp +26 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/make/main.cc +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/make/noload/main.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/ar/gyptest-make_global_settings_ar.py +123 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/ar/make_global_settings_ar.gyp +29 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/basics/gyptest-make_global_settings.py +2 -2
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/full-toolchain/bar.cc +1 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/full-toolchain/foo.c +1 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/full-toolchain/gyptest-make_global_settings.py +48 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/full-toolchain/make_global_settings.gyp +22 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/full-toolchain/my_nm.py +8 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/full-toolchain/my_readelf.py +8 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/ld/gyptest-make_global_settings_ld.py +130 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/ld/make_global_settings_ld.gyp +29 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/many-actions/gyptest-many-actions-unsorted.py +1 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/buildevents/gyptest-ninja-warnings.py +2 -2
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/config_attrs/hello.c +2 -2
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/external_builder/hello.cpp +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/filters/gyptest-filters-2010.py +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/list_excluded/hello.cpp +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/multiple_actions_error_handling/action_fail.py +7 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/multiple_actions_error_handling/action_succeed.py +7 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/multiple_actions_error_handling/actions.gyp +40 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/multiple_actions_error_handling/gyptest.py +26 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/props/hello.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/shared_output/hello.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/shared_output/there/there.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/uldi2010/hello.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/multiple-targets/gyptest-all.py +0 -3
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/multiple-targets/gyptest-default.py +0 -3
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/multiple-targets/src/prog1.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/multiple-targets/src/prog2.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/action-rule-hash/gyptest-action-rule-hash.py +32 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/action-rule-hash/subdir/action-rule-hash.gyp +29 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/action-rule-hash/subdir/emit.py +13 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/action_dependencies/gyptest-action-dependencies.py +3 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/chained-dependency/chained.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/chained-dependency/gyptest-chained-dependency.py +4 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/empty-and-non-empty-duplicate-name/gyptest-empty-and-non-empty-duplicate-name.py +23 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/empty-and-non-empty-duplicate-name/subdir/included.gyp +19 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/empty-and-non-empty-duplicate-name/test.gyp +19 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/normalize-paths-win/gyptest-normalize-paths.py +4 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/normalize-paths-win/normalize-paths.gyp +12 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/solibs_avoid_relinking/gyptest-solibs-avoid-relinking.py +5 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/use-console/foo.bar +5 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/use-console/gyptest-use-console.py +29 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/use-console/use-console.gyp +60 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/no-cpp/gyptest-no-cpp.py +1 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/product/hello.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/prune_targets/gyptest-prune-targets.py +3 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-dirname/gyptest-dirname.py +17 -3
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-dirname/src/subdir/a/b/c.gencc +2 -5
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-dirname/src/subdir/foo/bar/baz.gencc +2 -5
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-dirname/src/subdir/input-rule-dirname.gyp +62 -14
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-dirname/src/subdir/main.cc +2 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-dirname/src/subdir/nodir.gencc +8 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-rebuild/src/main.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-use-built-dependencies/gyptest-use-built-dependencies.py +1 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/gyptest-all.py +7 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/gyptest-default.py +7 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/actions.gyp +1 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/special-variables.gyp +0 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir1/program.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir2/both_rule_and_action_input.gyp +50 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir2/program.c +12 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir3/program.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir4/build-asm.gyp +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir4/program.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/gyptest-shared.py +27 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/gyptest-static.py +29 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/src/double-shared.gyp +6 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/src/double-static.gyp +1 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/src/prog1.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/src/prog2.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/src/prog3.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-target-name-different-directory/gyptest-all.py +5 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/sibling/gyptest-all.py +6 -3
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/sibling/gyptest-relocate.py +6 -3
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/sibling/src/prog1/prog1.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/sibling/src/prog2/prog2.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/standalone-static-library/prog.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/gyptest-SYMROOT-all.py +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/gyptest-SYMROOT-default.py +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/src/prog1.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/src/subdir/prog2.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/src/subdir/subdir2/prog3.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/toolsets/main.cc +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/toplevel-dir/gyptest-toplevel-dir.py +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/toplevel-dir/src/sub1/prog1.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/toplevel-dir/src/sub2/prog2.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/gyptest-commands-repeated-multidir.py +23 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/repeated_multidir/dir_1/test_1.gyp +13 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/repeated_multidir/dir_2/test_2.gyp +13 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/repeated_multidir/main.gyp +16 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/repeated_multidir/print_cwd_basename.py +10 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/repeated_multidir/repeated_command_common.gypi +25 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/latelate/src/program.cc +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/command-quote/command-quote.gyp +0 -5
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/command-quote/subdir/and/another/in-subdir.gyp +0 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/calling-convention-cdecl.def +6 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/calling-convention-fastcall.def +6 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/calling-convention-stdcall.def +6 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/calling-convention-vectorcall.def +6 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/calling-convention.cc +6 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/calling-convention.gyp +66 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/enable-enhanced-instruction-set.cc +28 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/enable-enhanced-instruction-set.gyp +68 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/floating-point-model-fast.cc +19 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/floating-point-model-precise.cc +19 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/floating-point-model-strict.cc +19 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/floating-point-model.gyp +43 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/enable-winrt/dllmain.cc +30 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/enable-winrt/enable-winrt.gyp +39 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/generator-output-different-drive/prog.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-calling-convention.py +22 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-enable-enhanced-instruction-set.py +44 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-floating-point-model.py +22 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-base-address.py +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-enable-winrt.py +35 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-pdb-no-output.py +25 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-pdb-output.py +0 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-profile.py +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-restat-importlib.py +6 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-safeseh.py +40 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-shard.py +3 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-macro-targetext.py +26 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-macro-targetfilename.py +32 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-macro-targetpath.py +30 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-midl-excluded.py +22 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-midl-includedirs.py +21 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-midl-rules.py +4 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-ml-safeseh.py +22 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-system-include.py +21 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-excluded/bad.idl +6 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-excluded/copy-file.py +11 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-excluded/idl-excluded.gyp +58 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-excluded/program.cc +7 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-includedirs/hello.cc +7 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-includedirs/idl-includedirs.gyp +26 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-includedirs/subdir/bar.idl +13 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-includedirs/subdir/foo.idl +14 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-rules/Window.idl +9 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-rules/basic-idl.gyp +67 -42
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-rules/idl_compiler.py +17 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/large-pdb/main.cc +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/pdb-output.gyp +13 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/safeseh.gyp +47 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/safeseh_hello.cc +11 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/safeseh_zero.asm +10 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/update_pgd.py +3 -3
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/ml-safeseh/a.asm +10 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/ml-safeseh/hello.cc +11 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/ml-safeseh/ml-safeseh.gyp +24 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/precompiled/hello.c +1 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/shard/hello.cc +7 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/shard/shard.gyp +11 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/shard/shard_ref.gyp +41 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/system-include/bar/header.h +0 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/system-include/common/commonheader.h +0 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/system-include/foo/header.h +0 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/system-include/main.cc +4 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/system-include/test.gyp +26 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/vs-macros/containing-gyp.gyp +0 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/vs-macros/input-output-macros.gyp +0 -1
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/vs-macros/targetext.gyp +59 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/vs-macros/targetfilename.gyp +59 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/vs-macros/targetpath.gyp +59 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/win-tool/copies_readonly_files.gyp +29 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/win-tool/gyptest-win-tool-handles-readonly-files.py +55 -0
- data/ext/tree-sitter/tree-sitter/externals/gyp/tools/emacs/gyp.el +36 -13
- data/ext/tree-sitter/tree-sitter/externals/gyp/tools/pretty_sln.py +4 -3
- data/ext/tree-sitter/tree-sitter/externals/utf8proc/CMakeLists.txt +4 -2
- data/ext/tree-sitter/tree-sitter/externals/utf8proc/MANIFEST +3 -3
- data/ext/tree-sitter/tree-sitter/externals/utf8proc/Makefile +11 -6
- data/ext/tree-sitter/tree-sitter/externals/utf8proc/NEWS.md +69 -0
- data/ext/tree-sitter/tree-sitter/externals/utf8proc/README.md +4 -2
- data/ext/tree-sitter/tree-sitter/externals/utf8proc/bench/bench.c +2 -2
- data/ext/tree-sitter/tree-sitter/externals/utf8proc/data/Makefile +12 -9
- data/ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb +125 -42
- data/ext/tree-sitter/tree-sitter/externals/utf8proc/test/custom.c +27 -0
- data/ext/tree-sitter/tree-sitter/externals/utf8proc/test/iterate.c +8 -2
- data/ext/tree-sitter/tree-sitter/externals/utf8proc/test/printproperty.c +5 -7
- data/ext/tree-sitter/tree-sitter/externals/utf8proc/utf8proc.c +209 -98
- data/ext/tree-sitter/tree-sitter/externals/utf8proc/utf8proc.h +126 -28
- data/ext/tree-sitter/tree-sitter/externals/utf8proc/utf8proc_data.c +12976 -15342
- data/ext/tree-sitter/tree-sitter/include/tree_sitter/compiler.h +2 -0
- data/ext/tree-sitter/tree-sitter/include/tree_sitter/parser.h +73 -74
- data/ext/tree-sitter/tree-sitter/include/tree_sitter/runtime.h +29 -20
- data/ext/tree-sitter/tree-sitter/project.gyp +13 -24
- data/ext/tree-sitter/tree-sitter/script/benchmark +76 -0
- data/ext/tree-sitter/tree-sitter/script/build-fuzzers +66 -0
- data/ext/tree-sitter/tree-sitter/script/ci +2 -1
- data/ext/tree-sitter/tree-sitter/script/configure.cmd +3 -0
- data/ext/tree-sitter/tree-sitter/script/fetch-fixtures +13 -9
- data/ext/tree-sitter/tree-sitter/script/fetch-fixtures.cmd +26 -0
- data/ext/tree-sitter/tree-sitter/script/reproduce +1 -0
- data/ext/tree-sitter/tree-sitter/script/run-fuzzer +57 -0
- data/ext/tree-sitter/tree-sitter/script/test +47 -8
- data/ext/tree-sitter/tree-sitter/script/test.cmd +2 -0
- data/ext/tree-sitter/tree-sitter/script/trim-whitespace +1 -1
- data/ext/tree-sitter/tree-sitter/script/util/scan-build.sh +24 -0
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lex_item.cc +60 -41
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lex_item.h +6 -7
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lex_item_transitions.cc +108 -101
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lex_item_transitions.h +1 -4
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lex_table_builder.cc +537 -0
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lex_table_builder.h +57 -0
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lookahead_set.cc +93 -19
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lookahead_set.h +90 -5
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/parse_item.cc +77 -29
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/parse_item.h +4 -9
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/parse_item_set_builder.cc +229 -94
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/parse_item_set_builder.h +9 -3
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/parse_table_builder.cc +893 -0
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/parse_table_builder.h +38 -0
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/rule_can_be_blank.cc +34 -35
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/rule_can_be_blank.h +1 -1
- data/ext/tree-sitter/tree-sitter/src/compiler/compile.cc +23 -40
- data/ext/tree-sitter/tree-sitter/src/compiler/compile_error.h +6 -0
- data/ext/tree-sitter/tree-sitter/src/compiler/generate_code/c_code.cc +301 -124
- data/ext/tree-sitter/tree-sitter/src/compiler/generate_code/c_code.h +12 -4
- data/ext/tree-sitter/tree-sitter/{doc → src/compiler}/grammar-schema.json +34 -42
- data/ext/tree-sitter/tree-sitter/src/compiler/grammar.h +24 -5
- data/ext/tree-sitter/tree-sitter/src/compiler/lex_table.cc +2 -31
- data/ext/tree-sitter/tree-sitter/src/compiler/lex_table.h +6 -30
- data/ext/tree-sitter/tree-sitter/src/compiler/lexical_grammar.h +15 -3
- data/ext/tree-sitter/tree-sitter/src/compiler/parse_grammar.cc +143 -105
- data/ext/tree-sitter/tree-sitter/src/compiler/parse_grammar.h +2 -1
- data/ext/tree-sitter/tree-sitter/src/compiler/parse_table.cc +71 -174
- data/ext/tree-sitter/tree-sitter/src/compiler/parse_table.h +23 -41
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/expand_repeats.cc +67 -34
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/expand_repeats.h +0 -2
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/expand_tokens.cc +53 -61
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/expand_tokens.h +9 -3
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/extract_choices.cc +37 -43
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/extract_choices.h +1 -1
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/extract_tokens.cc +248 -125
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/extract_tokens.h +3 -2
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/flatten_grammar.cc +114 -70
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/flatten_grammar.h +2 -2
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/initial_syntax_grammar.h +4 -3
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/intern_symbols.cc +113 -50
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/intern_symbols.h +2 -2
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/interned_grammar.h +7 -6
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/normalize_rules.cc +5 -3
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/parse_regex.cc +95 -76
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/parse_regex.h +1 -1
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/prepare_grammar.cc +9 -7
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/prepare_grammar.h +2 -5
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/token_description.cc +59 -45
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/token_description.h +1 -1
- data/ext/tree-sitter/tree-sitter/src/compiler/rule.cc +284 -6
- data/ext/tree-sitter/tree-sitter/src/compiler/rule.h +124 -25
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/blank.h +5 -14
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/character_set.cc +35 -84
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/character_set.h +19 -26
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/choice.cc +3 -69
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/choice.h +6 -13
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/metadata.cc +128 -71
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/metadata.h +48 -17
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/named_symbol.h +6 -12
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/pattern.h +6 -12
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/repeat.cc +5 -34
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/repeat.h +7 -13
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/seq.cc +6 -47
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/seq.h +8 -14
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/string.h +6 -12
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/symbol.h +53 -32
- data/ext/tree-sitter/tree-sitter/src/compiler/syntax_grammar.cc +24 -22
- data/ext/tree-sitter/tree-sitter/src/compiler/syntax_grammar.h +36 -21
- data/ext/tree-sitter/tree-sitter/src/compiler/util/make_visitor.h +31 -0
- data/ext/tree-sitter/tree-sitter/src/runtime/alloc.h +1 -1
- data/ext/tree-sitter/tree-sitter/src/runtime/array.h +25 -36
- data/ext/tree-sitter/tree-sitter/src/runtime/document.c +61 -34
- data/ext/tree-sitter/tree-sitter/src/runtime/document.h +3 -0
- data/ext/tree-sitter/tree-sitter/src/runtime/error_costs.h +5 -19
- data/ext/tree-sitter/tree-sitter/src/runtime/get_changed_ranges.c +355 -0
- data/ext/tree-sitter/tree-sitter/src/runtime/get_changed_ranges.h +20 -0
- data/ext/tree-sitter/tree-sitter/src/runtime/language.c +33 -31
- data/ext/tree-sitter/tree-sitter/src/runtime/language.h +27 -3
- data/ext/tree-sitter/tree-sitter/src/runtime/length.h +5 -21
- data/ext/tree-sitter/tree-sitter/src/runtime/lexer.c +61 -17
- data/ext/tree-sitter/tree-sitter/src/runtime/lexer.h +4 -5
- data/ext/tree-sitter/tree-sitter/src/runtime/node.c +93 -89
- data/ext/tree-sitter/tree-sitter/src/runtime/node.h +1 -1
- data/ext/tree-sitter/tree-sitter/src/runtime/parser.c +850 -743
- data/ext/tree-sitter/tree-sitter/src/runtime/parser.h +13 -8
- data/ext/tree-sitter/tree-sitter/src/runtime/point.h +9 -4
- data/ext/tree-sitter/tree-sitter/src/runtime/reduce_action.h +2 -0
- data/ext/tree-sitter/tree-sitter/src/runtime/reusable_node.h +14 -18
- data/ext/tree-sitter/tree-sitter/src/runtime/stack.c +424 -302
- data/ext/tree-sitter/tree-sitter/src/runtime/stack.h +75 -72
- data/ext/tree-sitter/tree-sitter/src/runtime/string_input.c +4 -10
- data/ext/tree-sitter/tree-sitter/src/runtime/tree.c +401 -252
- data/ext/tree-sitter/tree-sitter/src/runtime/tree.h +71 -57
- data/ext/tree-sitter/tree-sitter/src/runtime/utf16.c +5 -0
- data/ext/tree-sitter/tree-sitter/test/benchmarks.cc +122 -0
- data/ext/tree-sitter/tree-sitter/{spec/compiler/build_tables/lex_item_spec.cc → test/compiler/build_tables/lex_item_test.cc} +141 -143
- data/ext/tree-sitter/tree-sitter/test/compiler/build_tables/parse_item_set_builder_test.cc +134 -0
- data/ext/tree-sitter/tree-sitter/{spec/compiler/build_tables/rule_can_be_blank_spec.cc → test/compiler/build_tables/rule_can_be_blank_test.cc} +16 -19
- data/ext/tree-sitter/tree-sitter/test/compiler/prepare_grammar/expand_repeats_test.cc +170 -0
- data/ext/tree-sitter/tree-sitter/test/compiler/prepare_grammar/expand_tokens_test.cc +89 -0
- data/ext/tree-sitter/tree-sitter/test/compiler/prepare_grammar/extract_choices_test.cc +77 -0
- data/ext/tree-sitter/tree-sitter/test/compiler/prepare_grammar/extract_tokens_test.cc +459 -0
- data/ext/tree-sitter/tree-sitter/test/compiler/prepare_grammar/flatten_grammar_test.cc +130 -0
- data/ext/tree-sitter/tree-sitter/test/compiler/prepare_grammar/intern_symbols_test.cc +101 -0
- data/ext/tree-sitter/tree-sitter/test/compiler/prepare_grammar/parse_regex_test.cc +334 -0
- data/ext/tree-sitter/tree-sitter/{spec/compiler/rules/character_set_spec.cc → test/compiler/rules/character_set_test.cc} +15 -27
- data/ext/tree-sitter/tree-sitter/test/compiler/rules/rule_test.cc +90 -0
- data/ext/tree-sitter/tree-sitter/{spec/compiler/util/string_helpers_spec.cc → test/compiler/util/string_helpers_test.cc} +1 -1
- data/ext/tree-sitter/tree-sitter/test/fixtures/error_corpus/c_errors.txt +166 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/error_corpus/javascript_errors.txt +179 -0
- data/ext/tree-sitter/tree-sitter/{spec → test}/fixtures/error_corpus/json_errors.txt +10 -7
- data/ext/tree-sitter/tree-sitter/{spec → test}/fixtures/error_corpus/python_errors.txt +0 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/aliased_inlined_rules/corpus.txt +13 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/aliased_inlined_rules/grammar.json +59 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/aliased_inlined_rules/readme.md +1 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/aliased_rules/corpus.txt +18 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/aliased_rules/grammar.json +71 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/aliased_unit_reductions/corpus.txt +12 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/aliased_unit_reductions/grammar.json +70 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/aliased_unit_reductions/readme.md +5 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/anonymous_tokens_with_escaped_chars/corpus.txt +32 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/anonymous_tokens_with_escaped_chars/grammar.json +14 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/anonymous_tokens_with_escaped_chars/readme.md +1 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/associativity_left/corpus.txt +8 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/associativity_left/grammar.json +31 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/associativity_missing/expected_error.txt +13 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/associativity_missing/grammar.json +27 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/associativity_right/corpus.txt +8 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/associativity_right/grammar.json +31 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/conflict_in_repeat_rule/expected_error.txt +14 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/conflict_in_repeat_rule/grammar.json +76 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/conflict_in_repeat_rule/readme.md +1 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/conflict_in_repeat_rule_after_external_token/expected_error.txt +14 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/conflict_in_repeat_rule_after_external_token/grammar.json +82 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/conflict_in_repeat_rule_after_external_token/readme.md +1 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/conflicting_precedence/expected_error.txt +15 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/conflicting_precedence/grammar.json +58 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/dynamic_precedence/corpus.txt +25 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/dynamic_precedence/grammar.json +73 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/dynamic_precedence/readme.md +1 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/epsilon_rules/expected_error.txt +4 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/epsilon_rules/grammar.json +15 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_and_internal_anonymous_tokens/corpus.txt +41 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_and_internal_anonymous_tokens/grammar.json +35 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_and_internal_anonymous_tokens/readme.md +1 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_and_internal_anonymous_tokens/scanner.c +36 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_and_internal_tokens/corpus.txt +41 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_and_internal_tokens/grammar.json +36 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_and_internal_tokens/readme.md +1 -0
- data/ext/tree-sitter/tree-sitter/{spec/fixtures/external_scanners/shared_external_tokens.c → test/fixtures/test_grammars/external_and_internal_tokens/scanner.c} +21 -14
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_extra_tokens/corpus.txt +10 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_extra_tokens/grammar.json +25 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_extra_tokens/scanner.c +49 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_tokens/corpus.txt +22 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_tokens/grammar.json +57 -0
- data/ext/tree-sitter/tree-sitter/{spec/fixtures/external_scanners/percent_strings.c → test/fixtures/test_grammars/external_tokens/scanner.c} +19 -17
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/inline_rules/corpus.txt +20 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/inline_rules/grammar.json +76 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/inlined_aliased_rules/corpus.txt +18 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/inlined_aliased_rules/grammar.json +75 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/inlined_aliased_rules/readme.md +1 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/inverted_external_token/corpus.txt +32 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/inverted_external_token/grammar.json +55 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/inverted_external_token/readme.md +1 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/inverted_external_token/scanner.c +48 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/invisible_start_rule/expected_error.txt +1 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/invisible_start_rule/grammar.json +23 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/lexical_conflicts_due_to_state_merging/corpus.txt +33 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/lexical_conflicts_due_to_state_merging/grammar.json +65 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/lexical_conflicts_due_to_state_merging/readme.md +20 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/nested_inlined_rules/corpus.txt +12 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/nested_inlined_rules/grammar.json +54 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/nested_inlined_rules/readme.md +1 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/partially_resolved_conflict/expected_error.txt +14 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/partially_resolved_conflict/grammar.json +58 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/partially_resolved_conflict/readme.txt +1 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/precedence_on_single_child_missing/expected_error.txt +15 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/precedence_on_single_child_missing/grammar.json +63 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/precedence_on_single_child_missing/readme.md +15 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/precedence_on_single_child_negative/corpus.txt +12 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/precedence_on_single_child_negative/grammar.json +63 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/precedence_on_single_child_negative/readme.md +1 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/precedence_on_single_child_positive/corpus.txt +13 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/precedence_on_single_child_positive/grammar.json +63 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/precedence_on_single_child_positive/readme.md +1 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/precedence_on_subsequence/corpus.txt +24 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/precedence_on_subsequence/grammar.json +135 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/readme.md +3 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/readme_grammar/corpus.txt +13 -0
- data/{test/tree-sitter/fixtures/arithmetic → ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/readme_grammar}/grammar.json +3 -3
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/start_rule_is_blank/corpus.txt +7 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/start_rule_is_blank/grammar.json +6 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/start_rule_is_token/corpus.txt +6 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/start_rule_is_token/grammar.json +6 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/unused_rules/corpus.txt +9 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/unused_rules/grammar.json +73 -0
- data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/unused_rules/readme.md +1 -0
- data/ext/tree-sitter/tree-sitter/test/fuzz/README.md +43 -0
- data/ext/tree-sitter/tree-sitter/test/fuzz/fuzzer.cc +27 -0
- data/ext/tree-sitter/tree-sitter/test/fuzz/gen-dict.py +31 -0
- data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/dedent.h +0 -0
- data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/encoding_helpers.cc +9 -3
- data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/encoding_helpers.h +0 -0
- data/ext/tree-sitter/tree-sitter/test/helpers/file_helpers.cc +100 -0
- data/ext/tree-sitter/tree-sitter/test/helpers/file_helpers.h +15 -0
- data/ext/tree-sitter/tree-sitter/test/helpers/load_language.cc +239 -0
- data/ext/tree-sitter/tree-sitter/test/helpers/load_language.h +14 -0
- data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/point_helpers.cc +2 -5
- data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/point_helpers.h +0 -0
- data/ext/tree-sitter/tree-sitter/test/helpers/random_helpers.cc +59 -0
- data/ext/tree-sitter/tree-sitter/test/helpers/random_helpers.h +14 -0
- data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/read_test_entries.cc +38 -38
- data/ext/tree-sitter/tree-sitter/test/helpers/read_test_entries.h +22 -0
- data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/record_alloc.cc +7 -13
- data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/record_alloc.h +2 -2
- data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/scope_sequence.cc +0 -0
- data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/scope_sequence.h +0 -0
- data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/spy_input.cc +39 -15
- data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/spy_input.h +4 -4
- data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/spy_logger.cc +0 -0
- data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/spy_logger.h +0 -0
- data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/stderr_logger.cc +0 -0
- data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/stderr_logger.h +0 -0
- data/ext/tree-sitter/tree-sitter/test/helpers/stream_methods.cc +224 -0
- data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/stream_methods.h +32 -15
- data/ext/tree-sitter/tree-sitter/test/helpers/tree_helpers.cc +99 -0
- data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/tree_helpers.h +3 -1
- data/ext/tree-sitter/tree-sitter/test/integration/fuzzing-examples.cc +67 -0
- data/ext/tree-sitter/tree-sitter/test/integration/real_grammars.cc +142 -0
- data/ext/tree-sitter/tree-sitter/test/integration/test_grammars.cc +79 -0
- data/ext/tree-sitter/tree-sitter/{spec/runtime/document_spec.cc → test/runtime/document_test.cc} +150 -32
- data/ext/tree-sitter/tree-sitter/test/runtime/language_test.cc +55 -0
- data/ext/tree-sitter/tree-sitter/{spec/runtime/node_spec.cc → test/runtime/node_test.cc} +222 -127
- data/ext/tree-sitter/tree-sitter/{spec/runtime/parser_spec.cc → test/runtime/parser_test.cc} +126 -85
- data/ext/tree-sitter/tree-sitter/{spec/runtime/stack_spec.cc → test/runtime/stack_test.cc} +201 -164
- data/ext/tree-sitter/tree-sitter/test/runtime/tree_test.cc +475 -0
- data/ext/tree-sitter/tree-sitter/{spec/spec_helper.h → test/test_helper.h} +3 -3
- data/ext/tree-sitter/tree-sitter/{spec/specs.cc → test/tests.cc} +4 -3
- data/ext/tree-sitter/tree-sitter/tests.gyp +77 -23
- data/lib/tree-sitter.rb +4 -0
- data/lib/tree-sitter/node.rb +27 -0
- data/lib/tree-sitter/version.rb +3 -1
- data/test/test_helper.rb +4 -0
- data/test/tree-sitter/fixtures/parsers/python/parser.c +65600 -0
- data/test/tree-sitter/fixtures/parsers/python/scanner.cc +164 -0
- data/test/tree-sitter/test_basic.rb +2 -0
- data/test/tree-sitter/test_document.rb +101 -1
- data/test/tree-sitter/test_node.rb +73 -0
- data/tree-sitter.gemspec +4 -2
- metadata +445 -217
- data/ext/tree-sitter/tree-sitter/Makefile +0 -360
- data/ext/tree-sitter/tree-sitter/compiler.target.mk +0 -238
- data/ext/tree-sitter/tree-sitter/externals/gyp/pylintrc +0 -307
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/gyptest-fail-shared.py +0 -18
- data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/gyptest-fail-static.py +0 -18
- data/ext/tree-sitter/tree-sitter/gyp-mac-tool +0 -511
- data/ext/tree-sitter/tree-sitter/out/Release/libcompiler.a +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/libruntime.a +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/externals/json-parser/json.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/externals/utf8proc/utf8proc.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/build_lex_table.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/build_parse_table.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/build_tables.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/lex_conflict_manager.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/lex_item.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/lex_item_transitions.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/lookahead_set.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/parse_item.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/parse_item_set_builder.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/recovery_tokens.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/rule_can_be_blank.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/compile.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/generate_code/c_code.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/lex_table.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/parse_grammar.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/parse_table.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/precedence_range.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/expand_repeats.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/expand_tokens.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/extract_choices.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/extract_tokens.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/flatten_grammar.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/intern_symbols.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/is_token.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/normalize_rules.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/parse_regex.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/prepare_grammar.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/token_description.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rule.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/blank.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/built_in_symbols.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/character_range.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/character_set.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/choice.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/metadata.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/named_symbol.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/pattern.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/repeat.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/rules.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/seq.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/string.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/symbol.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/visitor.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/syntax_grammar.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/util/string_helpers.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/variable.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/externals/utf8proc/utf8proc.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/document.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/error_costs.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/language.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/lexer.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/node.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/parser.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/stack.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/string_input.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/tree.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/utf16.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/build_tables/distinctive_tokens_spec.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/build_tables/lex_conflict_manager_spec.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/build_tables/lex_item_spec.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/build_tables/parse_item_set_builder_spec.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/build_tables/rule_can_be_blank_spec.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/prepare_grammar/expand_repeats_spec.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/prepare_grammar/expand_tokens_spec.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/prepare_grammar/extract_choices_spec.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/prepare_grammar/extract_tokens_spec.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/prepare_grammar/flatten_grammar_spec.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/prepare_grammar/intern_symbols_spec.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/prepare_grammar/parse_regex_spec.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/rules/character_set_spec.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/rules/choice_spec.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/rules/repeat_spec.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/util/string_helpers_spec.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/encoding_helpers.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/load_language.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/point_helpers.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/random_helpers.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/read_test_entries.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/record_alloc.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/rule_helpers.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/scope_sequence.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/spy_input.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/spy_logger.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/stderr_logger.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/stream_methods.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/tree_helpers.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/integration/compile_grammar_spec.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/integration/corpus_specs.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/runtime/document_spec.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/runtime/node_spec.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/runtime/parser_spec.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/runtime/stack_spec.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/runtime/tree_spec.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/specs.o +0 -0
- data/ext/tree-sitter/tree-sitter/out/Release/tests +0 -0
- data/ext/tree-sitter/tree-sitter/project.Makefile +0 -6
- data/ext/tree-sitter/tree-sitter/runtime.target.mk +0 -174
- data/ext/tree-sitter/tree-sitter/spec/compiler/build_tables/distinctive_tokens_spec.cc +0 -34
- data/ext/tree-sitter/tree-sitter/spec/compiler/build_tables/lex_conflict_manager_spec.cc +0 -88
- data/ext/tree-sitter/tree-sitter/spec/compiler/build_tables/parse_item_set_builder_spec.cc +0 -133
- data/ext/tree-sitter/tree-sitter/spec/compiler/prepare_grammar/expand_repeats_spec.cc +0 -152
- data/ext/tree-sitter/tree-sitter/spec/compiler/prepare_grammar/expand_tokens_spec.cc +0 -109
- data/ext/tree-sitter/tree-sitter/spec/compiler/prepare_grammar/extract_choices_spec.cc +0 -106
- data/ext/tree-sitter/tree-sitter/spec/compiler/prepare_grammar/extract_tokens_spec.cc +0 -251
- data/ext/tree-sitter/tree-sitter/spec/compiler/prepare_grammar/flatten_grammar_spec.cc +0 -89
- data/ext/tree-sitter/tree-sitter/spec/compiler/prepare_grammar/intern_symbols_spec.cc +0 -89
- data/ext/tree-sitter/tree-sitter/spec/compiler/prepare_grammar/parse_regex_spec.cc +0 -245
- data/ext/tree-sitter/tree-sitter/spec/compiler/rules/choice_spec.cc +0 -53
- data/ext/tree-sitter/tree-sitter/spec/compiler/rules/repeat_spec.cc +0 -22
- data/ext/tree-sitter/tree-sitter/spec/fixtures/error_corpus/c_errors.txt +0 -130
- data/ext/tree-sitter/tree-sitter/spec/fixtures/error_corpus/javascript_errors.txt +0 -157
- data/ext/tree-sitter/tree-sitter/spec/fixtures/external_scanners/extra_external_tokens.c +0 -42
- data/ext/tree-sitter/tree-sitter/spec/helpers/equals_pointer.h +0 -37
- data/ext/tree-sitter/tree-sitter/spec/helpers/load_language.cc +0 -206
- data/ext/tree-sitter/tree-sitter/spec/helpers/load_language.h +0 -12
- data/ext/tree-sitter/tree-sitter/spec/helpers/random_helpers.cc +0 -35
- data/ext/tree-sitter/tree-sitter/spec/helpers/random_helpers.h +0 -8
- data/ext/tree-sitter/tree-sitter/spec/helpers/read_test_entries.h +0 -15
- data/ext/tree-sitter/tree-sitter/spec/helpers/rule_helpers.cc +0 -55
- data/ext/tree-sitter/tree-sitter/spec/helpers/rule_helpers.h +0 -21
- data/ext/tree-sitter/tree-sitter/spec/helpers/stream_methods.cc +0 -140
- data/ext/tree-sitter/tree-sitter/spec/helpers/tree_helpers.cc +0 -50
- data/ext/tree-sitter/tree-sitter/spec/integration/compile_grammar_spec.cc +0 -847
- data/ext/tree-sitter/tree-sitter/spec/integration/corpus_specs.cc +0 -185
- data/ext/tree-sitter/tree-sitter/spec/runtime/tree_spec.cc +0 -439
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/build_lex_table.cc +0 -195
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/build_lex_table.h +0 -18
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/build_parse_table.cc +0 -604
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/build_parse_table.h +0 -22
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/build_tables.cc +0 -27
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/build_tables.h +0 -24
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/conflict_type.h +0 -16
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lex_conflict_manager.cc +0 -55
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lex_conflict_manager.h +0 -31
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/recovery_tokens.cc +0 -89
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/recovery_tokens.h +0 -19
- data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/remove_duplicate_states.h +0 -65
- data/ext/tree-sitter/tree-sitter/src/compiler/compile.h +0 -16
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/is_token.cc +0 -30
- data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/is_token.h +0 -14
- data/ext/tree-sitter/tree-sitter/src/compiler/rules.h +0 -28
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/blank.cc +0 -36
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/built_in_symbols.cc +0 -19
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/built_in_symbols.h +0 -16
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/character_range.cc +0 -36
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/character_range.h +0 -25
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/named_symbol.cc +0 -35
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/pattern.cc +0 -36
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/rules.cc +0 -108
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/string.cc +0 -35
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/symbol.cc +0 -82
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/visitor.cc +0 -44
- data/ext/tree-sitter/tree-sitter/src/compiler/rules/visitor.h +0 -234
- data/ext/tree-sitter/tree-sitter/src/compiler/variable.cc +0 -11
- data/ext/tree-sitter/tree-sitter/src/compiler/variable.h +0 -27
- data/ext/tree-sitter/tree-sitter/src/runtime/error_costs.c +0 -28
- data/ext/tree-sitter/tree-sitter/src/runtime/tree_path.h +0 -217
- data/ext/tree-sitter/tree-sitter/tests.Makefile +0 -6
- data/ext/tree-sitter/tree-sitter/tests.target.mk +0 -176
- data/test/tree-sitter/fixtures/ruby/grammar.json +0 -4803
- data/test/tree-sitter/test_grammar.rb +0 -34
@@ -12,116 +12,119 @@ extern "C" {
|
|
12
12
|
|
13
13
|
typedef struct Stack Stack;
|
14
14
|
|
15
|
-
typedef unsigned
|
16
|
-
|
15
|
+
typedef unsigned StackVersion;
|
17
16
|
#define STACK_VERSION_NONE ((StackVersion)-1)
|
18
17
|
|
19
18
|
typedef struct {
|
20
19
|
TreeArray trees;
|
21
20
|
StackVersion version;
|
22
21
|
} StackSlice;
|
23
|
-
|
24
22
|
typedef Array(StackSlice) StackSliceArray;
|
25
23
|
|
26
24
|
typedef struct {
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
typedef unsigned int StackIterateAction;
|
38
|
-
|
39
|
-
typedef StackIterateAction (*StackIterateCallback)(void *, TSStateId state,
|
40
|
-
TreeArray *trees,
|
41
|
-
uint32_t tree_count,
|
42
|
-
bool is_done,
|
43
|
-
bool is_pending);
|
44
|
-
|
45
|
-
/*
|
46
|
-
* Create a parse stack.
|
47
|
-
*/
|
48
|
-
Stack *ts_stack_new();
|
49
|
-
|
50
|
-
/*
|
51
|
-
* Release any resources reserved by a parse stack.
|
52
|
-
*/
|
25
|
+
Length position;
|
26
|
+
unsigned depth;
|
27
|
+
TSStateId state;
|
28
|
+
} StackSummaryEntry;
|
29
|
+
typedef Array(StackSummaryEntry) StackSummary;
|
30
|
+
|
31
|
+
// Create a stack.
|
32
|
+
Stack *ts_stack_new(TreePool *);
|
33
|
+
|
34
|
+
// Release the memory reserved for a given stack.
|
53
35
|
void ts_stack_delete(Stack *);
|
54
36
|
|
55
|
-
|
56
|
-
* Get the stack's current number of versions.
|
57
|
-
*/
|
37
|
+
// Get the stack's current number of versions.
|
58
38
|
uint32_t ts_stack_version_count(const Stack *);
|
59
39
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
*/
|
64
|
-
TSStateId ts_stack_top_state(const Stack *, StackVersion);
|
40
|
+
// Get the state at the top of the given version of the stack. If the stack is
|
41
|
+
// empty, this returns the initial state, 0.
|
42
|
+
TSStateId ts_stack_state(const Stack *, StackVersion);
|
65
43
|
|
66
|
-
|
44
|
+
// Get the last external token associated with a given version of the stack.
|
45
|
+
Tree *ts_stack_last_external_token(const Stack *, StackVersion);
|
67
46
|
|
68
|
-
|
47
|
+
// Set the last external token associated with a given version of the stack.
|
48
|
+
void ts_stack_set_last_external_token(Stack *, StackVersion, Tree *);
|
69
49
|
|
70
|
-
|
50
|
+
// Get the position of the given version of the stack within the document.
|
51
|
+
Length ts_stack_position(const Stack *, StackVersion);
|
71
52
|
|
72
|
-
|
53
|
+
// Push a tree and state onto the given version of the stack.
|
54
|
+
//
|
55
|
+
// This transfers ownership of the tree to the Stack. Callers that
|
56
|
+
// need to retain ownership of the tree for their own purposes should
|
57
|
+
// first retain the tree.
|
58
|
+
void ts_stack_push(Stack *, StackVersion, Tree *, bool, TSStateId);
|
73
59
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
60
|
+
// Pop the given number of entries from the given version of the stack. This
|
61
|
+
// operation can increase the number of stack versions by revealing multiple
|
62
|
+
// versions which had previously been merged. It returns an array that
|
63
|
+
// specifies the index of each revealed version and the trees that were
|
64
|
+
// removed from that version.
|
65
|
+
StackSliceArray ts_stack_pop_count(Stack *, StackVersion, uint32_t count);
|
79
66
|
|
80
|
-
|
81
|
-
|
82
|
-
* the version to merge with an existing version.
|
83
|
-
*/
|
84
|
-
bool ts_stack_push(Stack *, StackVersion, Tree *, bool, TSStateId);
|
67
|
+
// Remove an error at the top of the given version of the stack.
|
68
|
+
TreeArray ts_stack_pop_error(Stack *, StackVersion);
|
85
69
|
|
86
|
-
|
87
|
-
|
88
|
-
* operation can increase the number of stack versions by revealing multiple
|
89
|
-
* versions which had previously been merged. It returns a struct that
|
90
|
-
* indicates the index of each revealed version and the trees removed from that
|
91
|
-
* version.
|
92
|
-
*/
|
93
|
-
StackPopResult ts_stack_pop_count(Stack *, StackVersion, uint32_t count);
|
70
|
+
// Remove any pending trees from the top of the given version of the stack.
|
71
|
+
StackSliceArray ts_stack_pop_pending(Stack *, StackVersion);
|
94
72
|
|
95
|
-
|
96
|
-
|
73
|
+
// Remove any all trees from the given version of the stack.
|
74
|
+
StackSliceArray ts_stack_pop_all(Stack *, StackVersion);
|
97
75
|
|
98
|
-
|
76
|
+
// Get the maximum number of tree nodes reachable from this version of the stack
|
77
|
+
// since the last error was detected.
|
78
|
+
unsigned ts_stack_node_count_since_error(const Stack *, StackVersion);
|
99
79
|
|
100
|
-
|
80
|
+
int ts_stack_dynamic_precedence(Stack *, StackVersion);
|
101
81
|
|
102
|
-
|
82
|
+
// Compute a summary of all the parse states near the top of the given
|
83
|
+
// version of the stack and store the summary for later retrieval.
|
84
|
+
void ts_stack_record_summary(Stack *, StackVersion, unsigned max_depth);
|
103
85
|
|
86
|
+
// Retrieve a summary of all the parse states near the top of the
|
87
|
+
// given version of the stack.
|
88
|
+
StackSummary *ts_stack_get_summary(Stack *, StackVersion);
|
89
|
+
|
90
|
+
// Get the total cost of all errors on the given version of the stack.
|
91
|
+
unsigned ts_stack_error_cost(const Stack *, StackVersion version);
|
92
|
+
|
93
|
+
// Determine whether the given two stack versions can be merged.
|
104
94
|
bool ts_stack_merge(Stack *, StackVersion, StackVersion);
|
105
95
|
|
96
|
+
// Merge the given two stack versions if possible, returning true
|
97
|
+
// if they were successfully merged and false otherwise.
|
98
|
+
bool ts_stack_can_merge(Stack *, StackVersion, StackVersion);
|
99
|
+
|
100
|
+
TSSymbol ts_stack_resume(Stack *, StackVersion);
|
101
|
+
|
102
|
+
void ts_stack_pause(Stack *, StackVersion, TSSymbol);
|
103
|
+
|
106
104
|
void ts_stack_halt(Stack *, StackVersion);
|
107
105
|
|
108
|
-
bool
|
106
|
+
bool ts_stack_is_active(const Stack *, StackVersion);
|
107
|
+
|
108
|
+
bool ts_stack_is_paused(const Stack *, StackVersion);
|
109
|
+
|
110
|
+
bool ts_stack_is_halted(const Stack *, StackVersion);
|
109
111
|
|
110
112
|
void ts_stack_renumber_version(Stack *, StackVersion, StackVersion);
|
111
113
|
|
114
|
+
void ts_stack_swap_versions(Stack *, StackVersion, StackVersion);
|
115
|
+
|
112
116
|
StackVersion ts_stack_copy_version(Stack *, StackVersion);
|
113
117
|
|
114
|
-
|
115
|
-
* Remove the given version from the stack.
|
116
|
-
*/
|
118
|
+
// Remove the given version from the stack.
|
117
119
|
void ts_stack_remove_version(Stack *, StackVersion);
|
118
120
|
|
119
|
-
/*
|
120
|
-
* Remove all entries from the stack.
|
121
|
-
*/
|
122
121
|
void ts_stack_clear(Stack *);
|
123
122
|
|
124
|
-
bool ts_stack_print_dot_graph(Stack *, const
|
123
|
+
bool ts_stack_print_dot_graph(Stack *, const TSLanguage *, FILE *);
|
124
|
+
|
125
|
+
typedef void (*StackIterateCallback)(void *, TSStateId, uint32_t);
|
126
|
+
|
127
|
+
void ts_stack_iterate(Stack *, StackVersion, StackIterateCallback, void *);
|
125
128
|
|
126
129
|
#ifdef __cplusplus
|
127
130
|
}
|
@@ -8,7 +8,7 @@ typedef struct {
|
|
8
8
|
uint32_t length;
|
9
9
|
} TSStringInput;
|
10
10
|
|
11
|
-
const char *
|
11
|
+
static const char *ts_string_input__read(void *payload, uint32_t *bytes_read) {
|
12
12
|
TSStringInput *input = (TSStringInput *)payload;
|
13
13
|
if (input->position >= input->length) {
|
14
14
|
*bytes_read = 0;
|
@@ -20,7 +20,7 @@ const char *ts_string_input_read(void *payload, uint32_t *bytes_read) {
|
|
20
20
|
return input->string + previous_position;
|
21
21
|
}
|
22
22
|
|
23
|
-
int
|
23
|
+
static int ts_string_input__seek(void *payload, uint32_t byte, TSPoint _) {
|
24
24
|
TSStringInput *input = (TSStringInput *)payload;
|
25
25
|
input->position = byte;
|
26
26
|
return (byte < input->length);
|
@@ -32,19 +32,13 @@ TSInput ts_string_input_make(const char *string) {
|
|
32
32
|
|
33
33
|
TSInput ts_string_input_make_with_length(const char *string, uint32_t length) {
|
34
34
|
TSStringInput *input = ts_malloc(sizeof(TSStringInput));
|
35
|
-
if (!input)
|
36
|
-
goto error;
|
37
|
-
|
38
35
|
input->string = string;
|
39
36
|
input->position = 0;
|
40
37
|
input->length = length;
|
41
38
|
return (TSInput){
|
42
39
|
.payload = input,
|
43
|
-
.read =
|
44
|
-
.seek =
|
40
|
+
.read = ts_string_input__read,
|
41
|
+
.seek = ts_string_input__seek,
|
45
42
|
.encoding = TSInputEncodingUTF8,
|
46
43
|
};
|
47
|
-
|
48
|
-
error:
|
49
|
-
return (TSInput){ NULL, NULL, NULL, TSInputEncodingUTF8 };
|
50
44
|
}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
#include <assert.h>
|
2
|
+
#include <ctype.h>
|
2
3
|
#include <limits.h>
|
3
4
|
#include <stdbool.h>
|
4
5
|
#include <string.h>
|
@@ -6,30 +7,45 @@
|
|
6
7
|
#include "runtime/alloc.h"
|
7
8
|
#include "runtime/tree.h"
|
8
9
|
#include "runtime/length.h"
|
10
|
+
#include "runtime/language.h"
|
9
11
|
#include "runtime/error_costs.h"
|
10
12
|
|
11
13
|
TSStateId TS_TREE_STATE_NONE = USHRT_MAX;
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
};
|
30
|
-
return result;
|
15
|
+
// ExternalTokenState
|
16
|
+
|
17
|
+
void ts_external_token_state_init(TSExternalTokenState *self, const char *content, unsigned length) {
|
18
|
+
self->length = length;
|
19
|
+
if (length > sizeof(self->short_data)) {
|
20
|
+
self->long_data = ts_malloc(length);
|
21
|
+
memcpy(self->long_data, content, length);
|
22
|
+
} else {
|
23
|
+
memcpy(self->short_data, content, length);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
void ts_external_token_state_delete(TSExternalTokenState *self) {
|
28
|
+
if (self->length > sizeof(self->short_data)) {
|
29
|
+
ts_free(self->long_data);
|
30
|
+
}
|
31
31
|
}
|
32
32
|
|
33
|
+
const char *ts_external_token_state_data(const TSExternalTokenState *self) {
|
34
|
+
if (self->length > sizeof(self->short_data)) {
|
35
|
+
return self->long_data;
|
36
|
+
} else {
|
37
|
+
return self->short_data;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
bool ts_external_token_state_eq(const TSExternalTokenState *a, const TSExternalTokenState *b) {
|
42
|
+
return a == b ||
|
43
|
+
(a->length == b->length &&
|
44
|
+
memcmp(ts_external_token_state_data(a), ts_external_token_state_data(b), a->length) == 0);
|
45
|
+
}
|
46
|
+
|
47
|
+
// TreeArray
|
48
|
+
|
33
49
|
bool ts_tree_array_copy(TreeArray self, TreeArray *dest) {
|
34
50
|
Tree **contents = NULL;
|
35
51
|
if (self.capacity > 0) {
|
@@ -45,43 +61,11 @@ bool ts_tree_array_copy(TreeArray self, TreeArray *dest) {
|
|
45
61
|
return true;
|
46
62
|
}
|
47
63
|
|
48
|
-
void ts_tree_array_delete(TreeArray *self) {
|
49
|
-
for (uint32_t i = 0; i < self->size; i++)
|
50
|
-
ts_tree_release(self->contents[i]);
|
51
|
-
array_delete(self);
|
52
|
-
}
|
53
|
-
|
54
|
-
uint32_t ts_tree_array_essential_count(const TreeArray *self) {
|
55
|
-
uint32_t result = 0;
|
64
|
+
void ts_tree_array_delete(TreePool *pool, TreeArray *self) {
|
56
65
|
for (uint32_t i = 0; i < self->size; i++) {
|
57
|
-
|
58
|
-
if (!tree->extra && tree->symbol != ts_builtin_sym_error)
|
59
|
-
result++;
|
60
|
-
}
|
61
|
-
return result;
|
62
|
-
}
|
63
|
-
|
64
|
-
TreeArray ts_tree_array_remove_last_n(TreeArray *self, uint32_t remove_count) {
|
65
|
-
TreeArray result = array_new();
|
66
|
-
if (self->size == 0 || remove_count == 0) return result;
|
67
|
-
|
68
|
-
uint32_t count = 0;
|
69
|
-
uint32_t split_index = self->size - 1;
|
70
|
-
for (; split_index + 1 > 0; split_index--) {
|
71
|
-
Tree *tree = self->contents[split_index];
|
72
|
-
if (!tree->extra) {
|
73
|
-
count++;
|
74
|
-
if (count == remove_count) break;
|
75
|
-
}
|
76
|
-
}
|
77
|
-
|
78
|
-
array_grow(&result, self->size - split_index);
|
79
|
-
for (uint32_t i = split_index; i < self->size; i++) {
|
80
|
-
array_push(&result, self->contents[i]);
|
66
|
+
ts_tree_release(pool, self->contents[i]);
|
81
67
|
}
|
82
|
-
|
83
|
-
self->size = split_index;
|
84
|
-
return result;
|
68
|
+
array_delete(self);
|
85
69
|
}
|
86
70
|
|
87
71
|
TreeArray ts_tree_array_remove_trailing_extras(TreeArray *self) {
|
@@ -95,162 +79,331 @@ TreeArray ts_tree_array_remove_trailing_extras(TreeArray *self) {
|
|
95
79
|
}
|
96
80
|
|
97
81
|
self->size = i + 1;
|
98
|
-
|
82
|
+
ts_tree_array_reverse(&result);
|
99
83
|
return result;
|
100
84
|
}
|
101
85
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
86
|
+
void ts_tree_array_reverse(TreeArray *self) {
|
87
|
+
for (uint32_t i = 0, limit = self->size / 2; i < limit; i++) {
|
88
|
+
size_t reverse_index = self->size - 1 - i;
|
89
|
+
Tree *swap = self->contents[i];
|
90
|
+
self->contents[i] = self->contents[reverse_index];
|
91
|
+
self->contents[reverse_index] = swap;
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
// TreePool
|
96
|
+
|
97
|
+
static const uint32_t MAX_TREE_POOL_SIZE = 1024;
|
98
|
+
|
99
|
+
void ts_tree_pool_init(TreePool *self) {
|
100
|
+
array_init(&self->free_trees);
|
101
|
+
array_init(&self->tree_stack);
|
102
|
+
}
|
103
|
+
|
104
|
+
void ts_tree_pool_delete(TreePool *self) {
|
105
|
+
if (self->free_trees.contents) {
|
106
|
+
for (unsigned i = 0; i < self->free_trees.size; i++) {
|
107
|
+
ts_free(self->free_trees.contents[i]);
|
108
|
+
}
|
109
|
+
array_delete(&self->free_trees);
|
110
|
+
}
|
111
|
+
if (self->tree_stack.contents) array_delete(&self->tree_stack);
|
112
|
+
}
|
113
|
+
|
114
|
+
Tree *ts_tree_pool_allocate(TreePool *self) {
|
115
|
+
if (self->free_trees.size > 0) {
|
116
|
+
return array_pop(&self->free_trees);
|
117
|
+
} else {
|
118
|
+
return ts_malloc(sizeof(Tree));
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
void ts_tree_pool_free(TreePool *self, Tree *tree) {
|
123
|
+
if (self->free_trees.size < MAX_TREE_POOL_SIZE) {
|
124
|
+
array_push(&self->free_trees, tree);
|
125
|
+
} else {
|
126
|
+
ts_free(tree);
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
130
|
+
// Tree
|
131
|
+
|
132
|
+
Tree *ts_tree_make_leaf(TreePool *pool, TSSymbol symbol, Length padding, Length size, const TSLanguage *language) {
|
133
|
+
TSSymbolMetadata metadata = ts_language_symbol_metadata(language, symbol);
|
134
|
+
Tree *result = ts_tree_pool_allocate(pool);
|
135
|
+
*result = (Tree){
|
136
|
+
.ref_count = 1,
|
137
|
+
.symbol = symbol,
|
138
|
+
.size = size,
|
139
|
+
.visible_child_count = 0,
|
140
|
+
.named_child_count = 0,
|
141
|
+
.alias_sequence_id = 0,
|
142
|
+
.padding = padding,
|
143
|
+
.visible = metadata.visible,
|
144
|
+
.named = metadata.named,
|
145
|
+
.node_count = 1,
|
146
|
+
.has_changes = false,
|
147
|
+
.first_leaf = {
|
148
|
+
.symbol = symbol,
|
149
|
+
.lex_mode = {0, 0},
|
150
|
+
},
|
151
|
+
.has_external_tokens = false,
|
152
|
+
};
|
153
|
+
return result;
|
154
|
+
}
|
155
|
+
|
156
|
+
Tree *ts_tree_make_error(TreePool *pool, Length size, Length padding, int32_t lookahead_char,
|
157
|
+
const TSLanguage *language) {
|
158
|
+
Tree *result = ts_tree_make_leaf(pool, ts_builtin_sym_error, padding, size, language);
|
107
159
|
result->fragile_left = true;
|
108
160
|
result->fragile_right = true;
|
109
161
|
result->lookahead_char = lookahead_char;
|
110
162
|
return result;
|
111
163
|
}
|
112
164
|
|
113
|
-
Tree *ts_tree_make_copy(Tree *self) {
|
114
|
-
Tree *result =
|
165
|
+
Tree *ts_tree_make_copy(TreePool *pool, Tree *self) {
|
166
|
+
Tree *result = ts_tree_pool_allocate(pool);
|
115
167
|
*result = *self;
|
116
168
|
result->ref_count = 1;
|
117
169
|
return result;
|
118
170
|
}
|
119
171
|
|
120
|
-
void
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
172
|
+
static void ts_tree__compress(Tree *self, unsigned count, const TSLanguage *language) {
|
173
|
+
Tree *tree = self;
|
174
|
+
for (unsigned i = 0; i < count; i++) {
|
175
|
+
if (tree->ref_count > 1 || tree->children.size != 2) break;
|
176
|
+
|
177
|
+
Tree *child = tree->children.contents[0];
|
178
|
+
if (
|
179
|
+
child->ref_count > 1 ||
|
180
|
+
child->children.size != 2 ||
|
181
|
+
child->symbol != tree->symbol
|
182
|
+
) break;
|
183
|
+
|
184
|
+
Tree *grandchild = child->children.contents[0];
|
185
|
+
if (
|
186
|
+
grandchild->ref_count > 1 ||
|
187
|
+
grandchild->children.size != 2 ||
|
188
|
+
grandchild->symbol != tree->symbol
|
189
|
+
) break;
|
190
|
+
|
191
|
+
tree->children.contents[0] = grandchild;
|
192
|
+
grandchild->context.parent = tree;
|
193
|
+
grandchild->context.index = -1;
|
194
|
+
|
195
|
+
child->children.contents[0] = grandchild->children.contents[1];
|
196
|
+
child->children.contents[0]->context.parent = child;
|
197
|
+
child->children.contents[0]->context.index = -1;
|
198
|
+
|
199
|
+
grandchild->children.contents[1] = child;
|
200
|
+
grandchild->children.contents[1]->context.parent = grandchild;
|
201
|
+
grandchild->children.contents[1]->context.index = -1;
|
202
|
+
|
203
|
+
tree = grandchild;
|
204
|
+
}
|
205
|
+
|
206
|
+
while (tree != self) {
|
207
|
+
tree = tree->context.parent;
|
208
|
+
Tree *child = tree->children.contents[0];
|
209
|
+
Tree *grandchild = child->children.contents[1];
|
210
|
+
ts_tree_set_children(grandchild, &grandchild->children, language);
|
211
|
+
ts_tree_set_children(child, &child->children, language);
|
212
|
+
ts_tree_set_children(tree, &tree->children, language);
|
213
|
+
}
|
214
|
+
}
|
215
|
+
|
216
|
+
void ts_tree__balance(Tree *self, const TSLanguage *language) {
|
217
|
+
if (self->children.contents[0]->repeat_depth > self->children.contents[1]->repeat_depth) {
|
218
|
+
unsigned n = self->children.contents[0]->repeat_depth - self->children.contents[1]->repeat_depth;
|
219
|
+
for (unsigned i = n / 2; i > 0; i /= 2) {
|
220
|
+
ts_tree__compress(self, i, language);
|
221
|
+
n -= i;
|
222
|
+
}
|
223
|
+
}
|
224
|
+
}
|
225
|
+
|
226
|
+
void ts_tree_assign_parents(Tree *self, TreePool *pool, const TSLanguage *language) {
|
227
|
+
self->context.parent = NULL;
|
228
|
+
array_clear(&pool->tree_stack);
|
229
|
+
array_push(&pool->tree_stack, self);
|
230
|
+
while (pool->tree_stack.size > 0) {
|
231
|
+
Tree *tree = array_pop(&pool->tree_stack);
|
232
|
+
|
233
|
+
if (tree->repeat_depth > 0) {
|
234
|
+
ts_tree__balance(tree, language);
|
235
|
+
}
|
236
|
+
|
125
237
|
Length offset = length_zero();
|
126
|
-
|
127
|
-
|
128
|
-
|
238
|
+
const TSSymbol *alias_sequence = ts_language_alias_sequence(language, tree->alias_sequence_id);
|
239
|
+
uint32_t non_extra_index = 0;
|
240
|
+
bool earlier_child_was_changed = false;
|
241
|
+
for (uint32_t i = 0; i < tree->children.size; i++) {
|
242
|
+
Tree *child = tree->children.contents[i];
|
243
|
+
if (earlier_child_was_changed || child->context.parent != tree || child->context.index != i) {
|
244
|
+
earlier_child_was_changed = true;
|
129
245
|
child->context.parent = tree;
|
130
246
|
child->context.index = i;
|
131
247
|
child->context.offset = offset;
|
132
|
-
|
248
|
+
if (!child->extra && alias_sequence && alias_sequence[non_extra_index] != 0) {
|
249
|
+
TSSymbolMetadata metadata = ts_language_symbol_metadata(language, alias_sequence[non_extra_index]);
|
250
|
+
child->context.alias_symbol = alias_sequence[non_extra_index];
|
251
|
+
child->context.alias_is_named = metadata.named;
|
252
|
+
} else {
|
253
|
+
child->context.alias_symbol = 0;
|
254
|
+
child->context.alias_is_named = false;
|
255
|
+
}
|
256
|
+
array_push(&pool->tree_stack, child);
|
133
257
|
}
|
134
258
|
offset = length_add(offset, ts_tree_total_size(child));
|
259
|
+
if (!child->extra) non_extra_index++;
|
135
260
|
}
|
136
261
|
}
|
137
262
|
}
|
138
263
|
|
264
|
+
void ts_tree_set_children(Tree *self, TreeArray *children, const TSLanguage *language) {
|
265
|
+
if (self->children.size > 0 && children->contents != self->children.contents) {
|
266
|
+
array_delete(&self->children);
|
267
|
+
}
|
139
268
|
|
140
|
-
|
141
|
-
if (self->child_count > 0)
|
142
|
-
ts_free(self->children);
|
143
|
-
|
144
|
-
self->children = children;
|
145
|
-
self->child_count = child_count;
|
269
|
+
self->children = *children;
|
146
270
|
self->named_child_count = 0;
|
147
271
|
self->visible_child_count = 0;
|
148
272
|
self->error_cost = 0;
|
273
|
+
self->repeat_depth = 0;
|
274
|
+
self->node_count = 1;
|
149
275
|
self->has_external_tokens = false;
|
150
|
-
self->
|
276
|
+
self->dynamic_precedence = 0;
|
277
|
+
|
278
|
+
uint32_t non_extra_index = 0;
|
279
|
+
const TSSymbol *alias_sequence = ts_language_alias_sequence(language, self->alias_sequence_id);
|
151
280
|
|
152
|
-
for (uint32_t i = 0; i <
|
153
|
-
Tree *child = children[i];
|
281
|
+
for (uint32_t i = 0; i < self->children.size; i++) {
|
282
|
+
Tree *child = self->children.contents[i];
|
154
283
|
|
155
284
|
if (i == 0) {
|
156
285
|
self->padding = child->padding;
|
157
286
|
self->size = child->size;
|
287
|
+
self->bytes_scanned = child->bytes_scanned;
|
158
288
|
} else {
|
289
|
+
uint32_t bytes_scanned = ts_tree_total_bytes(self) + child->bytes_scanned;
|
290
|
+
if (bytes_scanned > self->bytes_scanned) self->bytes_scanned = bytes_scanned;
|
159
291
|
self->size = length_add(self->size, ts_tree_total_size(child));
|
160
292
|
}
|
161
293
|
|
162
|
-
|
294
|
+
if (child->symbol != ts_builtin_sym_error_repeat) {
|
295
|
+
self->error_cost += child->error_cost;
|
296
|
+
}
|
297
|
+
self->dynamic_precedence += child->dynamic_precedence;
|
298
|
+
self->node_count += child->node_count;
|
163
299
|
|
164
|
-
if (child->
|
300
|
+
if (alias_sequence && alias_sequence[non_extra_index] != 0 && !child->extra) {
|
165
301
|
self->visible_child_count++;
|
166
|
-
if (
|
302
|
+
if (ts_language_symbol_metadata(language, alias_sequence[non_extra_index]).named) {
|
167
303
|
self->named_child_count++;
|
168
|
-
|
304
|
+
}
|
305
|
+
} else if (child->visible) {
|
306
|
+
self->visible_child_count++;
|
307
|
+
if (child->named) self->named_child_count++;
|
308
|
+
} else if (child->children.size > 0) {
|
169
309
|
self->visible_child_count += child->visible_child_count;
|
170
310
|
self->named_child_count += child->named_child_count;
|
171
311
|
}
|
172
312
|
|
173
313
|
if (child->has_external_tokens) self->has_external_tokens = true;
|
174
|
-
if (child->has_external_token_state) self->has_external_token_state = true;
|
175
314
|
|
176
315
|
if (child->symbol == ts_builtin_sym_error) {
|
177
316
|
self->fragile_left = self->fragile_right = true;
|
178
317
|
self->parse_state = TS_TREE_STATE_NONE;
|
179
318
|
}
|
319
|
+
|
320
|
+
if (!child->extra) non_extra_index++;
|
180
321
|
}
|
181
322
|
|
182
|
-
if (self->symbol == ts_builtin_sym_error) {
|
183
|
-
self->error_cost +=
|
323
|
+
if (self->symbol == ts_builtin_sym_error || self->symbol == ts_builtin_sym_error_repeat) {
|
324
|
+
self->error_cost += ERROR_COST_PER_RECOVERY +
|
325
|
+
ERROR_COST_PER_SKIPPED_CHAR * self->size.bytes +
|
184
326
|
ERROR_COST_PER_SKIPPED_LINE * self->size.extent.row;
|
185
|
-
for (uint32_t i = 0; i <
|
186
|
-
|
327
|
+
for (uint32_t i = 0; i < self->children.size; i++) {
|
328
|
+
Tree *child = self->children.contents[i];
|
329
|
+
if (child->extra) continue;
|
330
|
+
if (child->symbol == ts_builtin_sym_error && child->children.size == 0) continue;
|
331
|
+
if (child->visible) {
|
187
332
|
self->error_cost += ERROR_COST_PER_SKIPPED_TREE;
|
333
|
+
} else {
|
334
|
+
self->error_cost += ERROR_COST_PER_SKIPPED_TREE * child->visible_child_count;
|
335
|
+
}
|
336
|
+
}
|
188
337
|
}
|
189
338
|
|
190
|
-
if (
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
if (
|
195
|
-
|
339
|
+
if (self->children.size > 0) {
|
340
|
+
Tree *first_child = self->children.contents[0];
|
341
|
+
Tree *last_child = self->children.contents[self->children.size - 1];
|
342
|
+
self->first_leaf = first_child->first_leaf;
|
343
|
+
if (first_child->fragile_left) self->fragile_left = true;
|
344
|
+
if (last_child->fragile_right) self->fragile_right = true;
|
345
|
+
if (
|
346
|
+
self->children.size == 2 &&
|
347
|
+
!self->visible && !self->named &&
|
348
|
+
first_child->symbol == self->symbol &&
|
349
|
+
last_child->symbol == self->symbol
|
350
|
+
) {
|
351
|
+
if (first_child->repeat_depth > last_child->repeat_depth) {
|
352
|
+
self->repeat_depth = first_child->repeat_depth + 1;
|
353
|
+
} else {
|
354
|
+
self->repeat_depth = last_child->repeat_depth + 1;
|
355
|
+
}
|
356
|
+
}
|
196
357
|
}
|
197
358
|
}
|
198
359
|
|
199
|
-
Tree *ts_tree_make_node(TSSymbol symbol,
|
200
|
-
|
201
|
-
Tree *result =
|
202
|
-
|
203
|
-
|
360
|
+
Tree *ts_tree_make_node(TreePool *pool, TSSymbol symbol, TreeArray *children,
|
361
|
+
unsigned alias_sequence_id, const TSLanguage *language) {
|
362
|
+
Tree *result = ts_tree_make_leaf(pool, symbol, length_zero(), length_zero(), language);
|
363
|
+
result->alias_sequence_id = alias_sequence_id;
|
364
|
+
if (symbol == ts_builtin_sym_error || symbol == ts_builtin_sym_error_repeat) {
|
365
|
+
result->fragile_left = true;
|
366
|
+
result->fragile_right = true;
|
367
|
+
}
|
368
|
+
ts_tree_set_children(result, children, language);
|
204
369
|
return result;
|
205
370
|
}
|
206
371
|
|
207
|
-
Tree *ts_tree_make_error_node(TreeArray *children) {
|
208
|
-
|
209
|
-
|
210
|
-
if (child->symbol == ts_builtin_sym_error && child->child_count > 0) {
|
211
|
-
array_splice(children, i, 1, child->child_count, child->children);
|
212
|
-
i += child->child_count - 1;
|
213
|
-
for (uint32_t j = 0; j < child->child_count; j++)
|
214
|
-
ts_tree_retain(child->children[j]);
|
215
|
-
ts_tree_release(child);
|
216
|
-
}
|
217
|
-
}
|
218
|
-
|
219
|
-
Tree *result = ts_tree_make_node(
|
220
|
-
ts_builtin_sym_error, children->size, children->contents,
|
221
|
-
(TSSymbolMetadata){.extra = false, .visible = true, .named = true });
|
372
|
+
Tree *ts_tree_make_error_node(TreePool *pool, TreeArray *children, const TSLanguage *language) {
|
373
|
+
return ts_tree_make_node(pool, ts_builtin_sym_error, children, 0, language);
|
374
|
+
}
|
222
375
|
|
223
|
-
|
224
|
-
result
|
376
|
+
Tree *ts_tree_make_missing_leaf(TreePool *pool, TSSymbol symbol, const TSLanguage *language) {
|
377
|
+
Tree *result = ts_tree_make_leaf(pool, symbol, length_zero(), length_zero(), language);
|
378
|
+
result->is_missing = true;
|
379
|
+
result->error_cost = ERROR_COST_PER_MISSING_TREE + ERROR_COST_PER_RECOVERY;
|
225
380
|
return result;
|
226
381
|
}
|
227
382
|
|
228
383
|
void ts_tree_retain(Tree *self) {
|
229
384
|
assert(self->ref_count > 0);
|
230
385
|
self->ref_count++;
|
386
|
+
assert(self->ref_count != 0);
|
231
387
|
}
|
232
388
|
|
233
|
-
void ts_tree_release(Tree *self) {
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
goto recur;
|
389
|
+
void ts_tree_release(TreePool *pool, Tree *self) {
|
390
|
+
array_clear(&pool->tree_stack);
|
391
|
+
array_push(&pool->tree_stack, self);
|
392
|
+
while (pool->tree_stack.size > 0) {
|
393
|
+
Tree *tree = array_pop(&pool->tree_stack);
|
394
|
+
assert(tree->ref_count > 0);
|
395
|
+
tree->ref_count--;
|
396
|
+
if (tree->ref_count == 0) {
|
397
|
+
if (tree->children.size > 0) {
|
398
|
+
for (uint32_t i = 0; i < tree->children.size; i++) {
|
399
|
+
array_push(&pool->tree_stack, tree->children.contents[i]);
|
400
|
+
}
|
401
|
+
array_delete(&tree->children);
|
402
|
+
} else if (tree->has_external_tokens) {
|
403
|
+
ts_external_token_state_delete(&tree->external_token_state);
|
404
|
+
}
|
405
|
+
ts_tree_pool_free(pool, tree);
|
251
406
|
}
|
252
|
-
|
253
|
-
ts_free(self);
|
254
407
|
}
|
255
408
|
}
|
256
409
|
|
@@ -275,43 +428,25 @@ uint32_t ts_tree_end_column(const Tree *self) {
|
|
275
428
|
|
276
429
|
bool ts_tree_eq(const Tree *self, const Tree *other) {
|
277
430
|
if (self) {
|
278
|
-
if (!other)
|
279
|
-
return false;
|
431
|
+
if (!other) return false;
|
280
432
|
} else {
|
281
433
|
return !other;
|
282
434
|
}
|
283
435
|
|
284
|
-
if (self->symbol != other->symbol)
|
285
|
-
return false;
|
286
|
-
if (self->visible != other->visible)
|
287
|
-
return false;
|
288
|
-
if (self->named != other->named)
|
289
|
-
return false;
|
290
|
-
if (self->symbol == ts_builtin_sym_error)
|
291
|
-
return self->lookahead_char == other->lookahead_char;
|
292
|
-
if (self->child_count != other->child_count)
|
293
|
-
return false;
|
294
|
-
if (self->visible_child_count != other->visible_child_count)
|
295
|
-
return false;
|
296
|
-
if (self->named_child_count != other->named_child_count)
|
297
|
-
return false;
|
298
|
-
for (uint32_t i = 0; i < self->child_count; i++)
|
299
|
-
if (!ts_tree_eq(self->children[i], other->children[i]))
|
300
|
-
return false;
|
301
|
-
return true;
|
302
|
-
}
|
303
|
-
|
304
|
-
bool ts_tree_tokens_eq(const Tree *self, const Tree *other) {
|
305
|
-
if (self->child_count > 0 || other->child_count > 0) return false;
|
306
436
|
if (self->symbol != other->symbol) return false;
|
437
|
+
if (self->visible != other->visible) return false;
|
438
|
+
if (self->named != other->named) return false;
|
307
439
|
if (self->padding.bytes != other->padding.bytes) return false;
|
308
440
|
if (self->size.bytes != other->size.bytes) return false;
|
309
|
-
if (self->
|
310
|
-
if (self->
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
441
|
+
if (self->symbol == ts_builtin_sym_error) return self->lookahead_char == other->lookahead_char;
|
442
|
+
if (self->children.size != other->children.size) return false;
|
443
|
+
if (self->visible_child_count != other->visible_child_count) return false;
|
444
|
+
if (self->named_child_count != other->named_child_count) return false;
|
445
|
+
|
446
|
+
for (uint32_t i = 0; i < self->children.size; i++) {
|
447
|
+
if (!ts_tree_eq(self->children.contents[i], other->children.contents[i])) {
|
448
|
+
return false;
|
449
|
+
}
|
315
450
|
}
|
316
451
|
return true;
|
317
452
|
}
|
@@ -321,13 +456,13 @@ int ts_tree_compare(const Tree *left, const Tree *right) {
|
|
321
456
|
return -1;
|
322
457
|
if (right->symbol < left->symbol)
|
323
458
|
return 1;
|
324
|
-
if (left->
|
459
|
+
if (left->children.size < right->children.size)
|
325
460
|
return -1;
|
326
|
-
if (right->
|
461
|
+
if (right->children.size < left->children.size)
|
327
462
|
return 1;
|
328
|
-
for (uint32_t i = 0; i < left->
|
329
|
-
Tree *left_child = left->children[i];
|
330
|
-
Tree *right_child = right->children[i];
|
463
|
+
for (uint32_t i = 0; i < left->children.size; i++) {
|
464
|
+
Tree *left_child = left->children.contents[i];
|
465
|
+
Tree *right_child = right->children.contents[i];
|
331
466
|
switch (ts_tree_compare(left_child, right_child)) {
|
332
467
|
case -1:
|
333
468
|
return -1;
|
@@ -340,10 +475,28 @@ int ts_tree_compare(const Tree *left, const Tree *right) {
|
|
340
475
|
return 0;
|
341
476
|
}
|
342
477
|
|
343
|
-
static inline long
|
478
|
+
static inline long min_byte(long a, long b) {
|
344
479
|
return a <= b ? a : b;
|
345
480
|
}
|
346
481
|
|
482
|
+
bool ts_tree_invalidate_lookahead(Tree *self, uint32_t edit_byte_offset) {
|
483
|
+
if (edit_byte_offset >= self->bytes_scanned) return false;
|
484
|
+
self->has_changes = true;
|
485
|
+
if (self->children.size > 0) {
|
486
|
+
uint32_t child_start_byte = 0;
|
487
|
+
for (uint32_t i = 0; i < self->children.size; i++) {
|
488
|
+
Tree *child = self->children.contents[i];
|
489
|
+
if (child_start_byte > edit_byte_offset) break;
|
490
|
+
ts_tree_invalidate_lookahead(child, edit_byte_offset - child_start_byte);
|
491
|
+
child_start_byte += ts_tree_total_bytes(child);
|
492
|
+
}
|
493
|
+
}
|
494
|
+
return true;
|
495
|
+
}
|
496
|
+
|
497
|
+
static inline TSPoint ts_tree_total_extent(const Tree *self) {
|
498
|
+
return point_add(self->padding.extent, self->size.extent);
|
499
|
+
}
|
347
500
|
|
348
501
|
void ts_tree_edit(Tree *self, const TSInputEdit *edit) {
|
349
502
|
uint32_t old_end_byte = edit->start_byte + edit->bytes_removed;
|
@@ -356,14 +509,12 @@ void ts_tree_edit(Tree *self, const TSInputEdit *edit) {
|
|
356
509
|
self->has_changes = true;
|
357
510
|
|
358
511
|
if (edit->start_byte < self->padding.bytes) {
|
359
|
-
length_set_unknown_chars(&self->padding);
|
360
512
|
if (self->padding.bytes >= old_end_byte) {
|
361
513
|
uint32_t trailing_padding_bytes = self->padding.bytes - old_end_byte;
|
362
514
|
TSPoint trailing_padding_extent = point_sub(self->padding.extent, old_end_point);
|
363
515
|
self->padding.bytes = new_end_byte + trailing_padding_bytes;
|
364
516
|
self->padding.extent = point_add(new_end_point, trailing_padding_extent);
|
365
517
|
} else {
|
366
|
-
length_set_unknown_chars(&self->size);
|
367
518
|
uint32_t removed_content_bytes = old_end_byte - self->padding.bytes;
|
368
519
|
TSPoint removed_content_extent = point_sub(old_end_point, self->padding.extent);
|
369
520
|
self->size.bytes = self->size.bytes - removed_content_bytes;
|
@@ -372,11 +523,9 @@ void ts_tree_edit(Tree *self, const TSInputEdit *edit) {
|
|
372
523
|
self->padding.extent = new_end_point;
|
373
524
|
}
|
374
525
|
} else if (edit->start_byte == self->padding.bytes && edit->bytes_removed == 0) {
|
375
|
-
length_set_unknown_chars(&self->padding);
|
376
526
|
self->padding.bytes = self->padding.bytes + edit->bytes_added;
|
377
527
|
self->padding.extent = point_add(self->padding.extent, edit->extent_added);
|
378
528
|
} else {
|
379
|
-
length_set_unknown_chars(&self->size);
|
380
529
|
uint32_t trailing_content_bytes = ts_tree_total_bytes(self) - old_end_byte;
|
381
530
|
TSPoint trailing_content_extent = point_sub(ts_tree_total_extent(self), old_end_point);
|
382
531
|
self->size.bytes = new_end_byte + trailing_content_bytes - self->padding.bytes;
|
@@ -387,37 +536,35 @@ void ts_tree_edit(Tree *self, const TSInputEdit *edit) {
|
|
387
536
|
long remaining_bytes_to_delete = 0;
|
388
537
|
TSPoint remaining_extent_to_delete = {0, 0};
|
389
538
|
Length child_left, child_right = length_zero();
|
390
|
-
for (uint32_t i = 0; i < self->
|
391
|
-
Tree *child = self->children[i];
|
539
|
+
for (uint32_t i = 0; i < self->children.size; i++) {
|
540
|
+
Tree *child = self->children.contents[i];
|
392
541
|
child_left = child_right;
|
542
|
+
child_right = length_add(child_left, ts_tree_total_size(child));
|
393
543
|
|
394
|
-
if (!found_first_child) {
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
.extent_removed = edit->extent_removed,
|
405
|
-
};
|
406
|
-
|
407
|
-
if (old_end_byte > child_right.bytes) {
|
408
|
-
child_edit.bytes_removed = child_right.bytes - edit->start_byte;
|
409
|
-
child_edit.extent_removed = point_sub(child_right.extent, edit->start_point);
|
410
|
-
remaining_bytes_to_delete = old_end_byte - child_right.bytes;
|
411
|
-
remaining_extent_to_delete = point_sub(old_end_point, child_right.extent);
|
412
|
-
}
|
544
|
+
if (!found_first_child && child_right.bytes >= edit->start_byte) {
|
545
|
+
found_first_child = true;
|
546
|
+
TSInputEdit child_edit = {
|
547
|
+
.start_byte = edit->start_byte - child_left.bytes,
|
548
|
+
.bytes_added = edit->bytes_added,
|
549
|
+
.bytes_removed = edit->bytes_removed,
|
550
|
+
.start_point = point_sub(edit->start_point, child_left.extent),
|
551
|
+
.extent_added = edit->extent_added,
|
552
|
+
.extent_removed = edit->extent_removed,
|
553
|
+
};
|
413
554
|
|
414
|
-
|
555
|
+
if (old_end_byte > child_right.bytes) {
|
556
|
+
child_edit.bytes_removed = child_right.bytes - edit->start_byte;
|
557
|
+
child_edit.extent_removed = point_sub(child_right.extent, edit->start_point);
|
558
|
+
remaining_bytes_to_delete = old_end_byte - child_right.bytes;
|
559
|
+
remaining_extent_to_delete = point_sub(old_end_point, child_right.extent);
|
415
560
|
}
|
561
|
+
|
562
|
+
ts_tree_edit(child, &child_edit);
|
416
563
|
} else if (remaining_bytes_to_delete > 0) {
|
417
564
|
TSInputEdit child_edit = {
|
418
565
|
.start_byte = 0,
|
419
566
|
.bytes_added = 0,
|
420
|
-
.bytes_removed =
|
567
|
+
.bytes_removed = min_byte(remaining_bytes_to_delete, ts_tree_total_bytes(child)),
|
421
568
|
.start_point = {0, 0},
|
422
569
|
.extent_added = {0, 0},
|
423
570
|
.extent_removed = point_min(remaining_extent_to_delete, ts_tree_total_size(child).extent),
|
@@ -425,6 +572,8 @@ void ts_tree_edit(Tree *self, const TSInputEdit *edit) {
|
|
425
572
|
remaining_bytes_to_delete -= child_edit.bytes_removed;
|
426
573
|
remaining_extent_to_delete = point_sub(remaining_extent_to_delete, child_edit.extent_removed);
|
427
574
|
ts_tree_edit(child, &child_edit);
|
575
|
+
} else {
|
576
|
+
ts_tree_invalidate_lookahead(child, edit->start_byte - child_left.bytes);
|
428
577
|
}
|
429
578
|
|
430
579
|
child_right = length_add(child_left, ts_tree_total_size(child));
|
@@ -432,79 +581,81 @@ void ts_tree_edit(Tree *self, const TSInputEdit *edit) {
|
|
432
581
|
}
|
433
582
|
}
|
434
583
|
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
584
|
+
Tree *ts_tree_last_external_token(Tree *tree) {
|
585
|
+
if (!tree->has_external_tokens) return NULL;
|
586
|
+
while (tree->children.size > 0) {
|
587
|
+
for (uint32_t i = tree->children.size - 1; i + 1 > 0; i--) {
|
588
|
+
Tree *child = tree->children.contents[i];
|
589
|
+
if (child->has_external_tokens) {
|
440
590
|
tree = child;
|
441
591
|
break;
|
442
|
-
} else if (child->has_external_tokens) {
|
443
|
-
return NULL;
|
444
592
|
}
|
445
593
|
}
|
446
594
|
}
|
447
|
-
return
|
595
|
+
return tree;
|
448
596
|
}
|
449
597
|
|
450
598
|
static size_t ts_tree__write_char_to_string(char *s, size_t n, int32_t c) {
|
451
599
|
if (c == 0)
|
452
600
|
return snprintf(s, n, "EOF");
|
601
|
+
if (c == -1)
|
602
|
+
return snprintf(s, n, "INVALID");
|
453
603
|
else if (c == '\n')
|
454
604
|
return snprintf(s, n, "'\\n'");
|
455
605
|
else if (c == '\t')
|
456
606
|
return snprintf(s, n, "'\\t'");
|
457
607
|
else if (c == '\r')
|
458
608
|
return snprintf(s, n, "'\\r'");
|
459
|
-
else if (c < 128)
|
609
|
+
else if (0 < c && c < 128 && isprint(c))
|
460
610
|
return snprintf(s, n, "'%c'", c);
|
461
611
|
else
|
462
612
|
return snprintf(s, n, "%d", c);
|
463
613
|
}
|
464
614
|
|
465
|
-
static size_t ts_tree__write_to_string(const Tree *self,
|
466
|
-
|
467
|
-
size_t limit, bool is_root,
|
615
|
+
static size_t ts_tree__write_to_string(const Tree *self, const TSLanguage *language,
|
616
|
+
char *string, size_t limit, bool is_root,
|
468
617
|
bool include_all) {
|
469
|
-
if (!self)
|
470
|
-
return snprintf(string, limit, "(NULL)");
|
618
|
+
if (!self) return snprintf(string, limit, "(NULL)");
|
471
619
|
|
472
620
|
char *cursor = string;
|
473
621
|
char **writer = (limit > 0) ? &cursor : &string;
|
474
|
-
bool visible =
|
475
|
-
|
476
|
-
|
622
|
+
bool visible =
|
623
|
+
include_all ||
|
624
|
+
is_root ||
|
625
|
+
self->is_missing ||
|
626
|
+
(self->visible && self->named) ||
|
627
|
+
self->context.alias_is_named;
|
628
|
+
|
629
|
+
if (visible && !is_root) {
|
477
630
|
cursor += snprintf(*writer, limit, " ");
|
631
|
+
}
|
478
632
|
|
479
633
|
if (visible) {
|
480
|
-
if (self->symbol == ts_builtin_sym_error && self->
|
481
|
-
self->size.chars > 0) {
|
634
|
+
if (self->symbol == ts_builtin_sym_error && self->children.size == 0 && self->size.bytes > 0) {
|
482
635
|
cursor += snprintf(*writer, limit, "(UNEXPECTED ");
|
483
|
-
cursor +=
|
484
|
-
|
636
|
+
cursor += ts_tree__write_char_to_string(*writer, limit, self->lookahead_char);
|
637
|
+
} else if (self->is_missing) {
|
638
|
+
cursor += snprintf(*writer, limit, "(MISSING");
|
485
639
|
} else {
|
486
|
-
|
487
|
-
|
640
|
+
TSSymbol symbol = self->context.alias_symbol ? self->context.alias_symbol : self->symbol;
|
641
|
+
const char *symbol_name = ts_language_symbol_name(language, symbol);
|
642
|
+
cursor += snprintf(*writer, limit, "(%s", symbol_name);
|
488
643
|
}
|
489
644
|
}
|
490
645
|
|
491
|
-
for (uint32_t i = 0; i < self->
|
492
|
-
Tree *child = self->children[i];
|
493
|
-
cursor += ts_tree__write_to_string(child, language, *writer, limit, false,
|
494
|
-
include_all);
|
646
|
+
for (uint32_t i = 0; i < self->children.size; i++) {
|
647
|
+
Tree *child = self->children.contents[i];
|
648
|
+
cursor += ts_tree__write_to_string(child, language, *writer, limit, false, include_all);
|
495
649
|
}
|
496
650
|
|
497
|
-
if (visible)
|
498
|
-
cursor += snprintf(*writer, limit, ")");
|
651
|
+
if (visible) cursor += snprintf(*writer, limit, ")");
|
499
652
|
|
500
653
|
return cursor - string;
|
501
654
|
}
|
502
655
|
|
503
|
-
char *ts_tree_string(const Tree *self, const TSLanguage *language,
|
504
|
-
|
505
|
-
|
506
|
-
size_t size =
|
507
|
-
ts_tree__write_to_string(self, language, SCRATCH, 0, true, include_all) + 1;
|
656
|
+
char *ts_tree_string(const Tree *self, const TSLanguage *language, bool include_all) {
|
657
|
+
char scratch_string[1];
|
658
|
+
size_t size = ts_tree__write_to_string(self, language, scratch_string, 0, true, include_all) + 1;
|
508
659
|
char *result = ts_malloc(size * sizeof(char));
|
509
660
|
ts_tree__write_to_string(self, language, result, size, true, include_all);
|
510
661
|
return result;
|
@@ -512,40 +663,38 @@ char *ts_tree_string(const Tree *self, const TSLanguage *language,
|
|
512
663
|
|
513
664
|
void ts_tree__print_dot_graph(const Tree *self, uint32_t byte_offset,
|
514
665
|
const TSLanguage *language, FILE *f) {
|
515
|
-
|
516
|
-
|
666
|
+
TSSymbol symbol = self->context.alias_symbol ? self->context.alias_symbol : self->symbol;
|
667
|
+
fprintf(f, "tree_%p [label=\"%s\"", self, ts_language_symbol_name(language, symbol));
|
517
668
|
|
518
|
-
if (self->
|
669
|
+
if (self->children.size == 0)
|
519
670
|
fprintf(f, ", shape=plaintext");
|
520
671
|
if (self->extra)
|
521
672
|
fprintf(f, ", fontcolor=gray");
|
522
673
|
|
523
|
-
fprintf(f, ", tooltip=\"
|
524
|
-
byte_offset, byte_offset + ts_tree_total_bytes(self), self->parse_state,
|
525
|
-
self->error_cost);
|
526
|
-
for (uint32_t i = 0; i < self->
|
527
|
-
const Tree *child = self->children[i];
|
674
|
+
fprintf(f, ", tooltip=\"address:%p\nrange:%u - %u\nstate:%d\nerror-cost:%u\nrepeat-depth:%u\"]\n",
|
675
|
+
self, byte_offset, byte_offset + ts_tree_total_bytes(self), self->parse_state,
|
676
|
+
self->error_cost, self->repeat_depth);
|
677
|
+
for (uint32_t i = 0; i < self->children.size; i++) {
|
678
|
+
const Tree *child = self->children.contents[i];
|
528
679
|
ts_tree__print_dot_graph(child, byte_offset, language, f);
|
529
680
|
fprintf(f, "tree_%p -> tree_%p [tooltip=%u]\n", self, child, i);
|
530
681
|
byte_offset += ts_tree_total_bytes(child);
|
531
682
|
}
|
532
683
|
}
|
533
684
|
|
534
|
-
void ts_tree_print_dot_graph(const Tree *self, const TSLanguage *language,
|
535
|
-
FILE *f) {
|
685
|
+
void ts_tree_print_dot_graph(const Tree *self, const TSLanguage *language, FILE *f) {
|
536
686
|
fprintf(f, "digraph tree {\n");
|
537
687
|
fprintf(f, "edge [arrowhead=none]\n");
|
538
688
|
ts_tree__print_dot_graph(self, 0, language, f);
|
539
689
|
fprintf(f, "}\n");
|
540
690
|
}
|
541
691
|
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
}
|
692
|
+
static const TSExternalTokenState empty_state = {.length = 0, .short_data = {0}};
|
693
|
+
|
694
|
+
bool ts_tree_external_token_state_eq(const Tree *self, const Tree *other) {
|
695
|
+
const TSExternalTokenState *state1 = &empty_state;
|
696
|
+
const TSExternalTokenState *state2 = &empty_state;
|
697
|
+
if (self && self->has_external_tokens) state1 = &self->external_token_state;
|
698
|
+
if (other && other->has_external_tokens) state2 = &other->external_token_state;
|
699
|
+
return ts_external_token_state_eq(state1, state2);
|
551
700
|
}
|