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
@@ -10,28 +10,33 @@ extern "C" {
|
|
10
10
|
#include "runtime/lexer.h"
|
11
11
|
#include "runtime/reusable_node.h"
|
12
12
|
#include "runtime/reduce_action.h"
|
13
|
+
#include "runtime/tree.h"
|
14
|
+
|
15
|
+
typedef struct {
|
16
|
+
Tree *token;
|
17
|
+
Tree *last_external_token;
|
18
|
+
uint32_t byte_index;
|
19
|
+
} TokenCache;
|
13
20
|
|
14
21
|
typedef struct {
|
15
22
|
Lexer lexer;
|
16
23
|
Stack *stack;
|
24
|
+
TreePool tree_pool;
|
17
25
|
const TSLanguage *language;
|
18
26
|
ReduceActionSet reduce_actions;
|
19
27
|
Tree *finished_tree;
|
20
|
-
bool is_split;
|
21
|
-
bool print_debugging_graphs;
|
22
28
|
Tree scratch_tree;
|
23
|
-
|
24
|
-
uint32_t cached_token_byte_index;
|
29
|
+
TokenCache token_cache;
|
25
30
|
ReusableNode reusable_node;
|
26
|
-
TreePath tree_path1;
|
27
|
-
TreePath tree_path2;
|
28
31
|
void *external_scanner_payload;
|
29
|
-
|
32
|
+
bool in_ambiguity;
|
33
|
+
bool print_debugging_graphs;
|
34
|
+
unsigned accept_count;
|
30
35
|
} Parser;
|
31
36
|
|
32
37
|
bool parser_init(Parser *);
|
33
38
|
void parser_destroy(Parser *);
|
34
|
-
Tree *parser_parse(Parser *, TSInput, Tree
|
39
|
+
Tree *parser_parse(Parser *, TSInput, Tree *, bool halt_on_error);
|
35
40
|
void parser_set_language(Parser *, const TSLanguage *);
|
36
41
|
|
37
42
|
#ifdef __cplusplus
|
@@ -3,18 +3,23 @@
|
|
3
3
|
|
4
4
|
#include "tree_sitter/runtime.h"
|
5
5
|
|
6
|
+
static inline TSPoint point__new(unsigned row, unsigned column) {
|
7
|
+
TSPoint result = {row, column};
|
8
|
+
return result;
|
9
|
+
}
|
10
|
+
|
6
11
|
static inline TSPoint point_add(TSPoint a, TSPoint b) {
|
7
12
|
if (b.row > 0)
|
8
|
-
return (
|
13
|
+
return point__new(a.row + b.row, b.column);
|
9
14
|
else
|
10
|
-
return (
|
15
|
+
return point__new(a.row, a.column + b.column);
|
11
16
|
}
|
12
17
|
|
13
18
|
static inline TSPoint point_sub(TSPoint a, TSPoint b) {
|
14
19
|
if (a.row > b.row)
|
15
|
-
return (
|
20
|
+
return point__new(a.row - b.row, a.column);
|
16
21
|
else
|
17
|
-
return (
|
22
|
+
return point__new(0, a.column - b.column);
|
18
23
|
}
|
19
24
|
|
20
25
|
static inline bool point_lte(TSPoint a, TSPoint b) {
|
@@ -3,48 +3,44 @@
|
|
3
3
|
typedef struct {
|
4
4
|
Tree *tree;
|
5
5
|
uint32_t byte_index;
|
6
|
-
|
7
|
-
const TSExternalTokenState *preceding_external_token_state;
|
6
|
+
Tree *last_external_token;
|
8
7
|
} ReusableNode;
|
9
8
|
|
10
9
|
static inline ReusableNode reusable_node_new(Tree *tree) {
|
11
|
-
|
12
|
-
|
13
|
-
.byte_index = 0,
|
14
|
-
.has_preceding_external_token = false,
|
15
|
-
.preceding_external_token_state = NULL,
|
16
|
-
};
|
10
|
+
ReusableNode result = {tree, 0, NULL};
|
11
|
+
return result;
|
17
12
|
}
|
18
13
|
|
19
14
|
static inline void reusable_node_pop(ReusableNode *self) {
|
20
15
|
self->byte_index += ts_tree_total_bytes(self->tree);
|
21
16
|
if (self->tree->has_external_tokens) {
|
22
|
-
self->
|
23
|
-
self->preceding_external_token_state = ts_tree_last_external_token_state(self->tree);
|
17
|
+
self->last_external_token = ts_tree_last_external_token(self->tree);
|
24
18
|
}
|
25
19
|
|
26
20
|
while (self->tree) {
|
27
21
|
Tree *parent = self->tree->context.parent;
|
28
22
|
uint32_t next_index = self->tree->context.index + 1;
|
29
|
-
if (parent && parent->
|
30
|
-
self->tree = parent->children[next_index];
|
23
|
+
if (parent && parent->children.size > next_index) {
|
24
|
+
self->tree = parent->children.contents[next_index];
|
31
25
|
return;
|
32
26
|
}
|
33
27
|
self->tree = parent;
|
34
28
|
}
|
35
29
|
}
|
36
30
|
|
37
|
-
static inline
|
38
|
-
|
39
|
-
|
40
|
-
|
31
|
+
static inline ReusableNode reusable_node_after_leaf(const ReusableNode *self) {
|
32
|
+
ReusableNode result = *self;
|
33
|
+
while (result.tree->children.size > 0)
|
34
|
+
result.tree = result.tree->children.contents[0];
|
35
|
+
reusable_node_pop(&result);
|
36
|
+
return result;
|
41
37
|
}
|
42
38
|
|
43
39
|
static inline bool reusable_node_breakdown(ReusableNode *self) {
|
44
|
-
if (self->tree->
|
40
|
+
if (self->tree->children.size == 0) {
|
45
41
|
return false;
|
46
42
|
} else {
|
47
|
-
self->tree = self->tree->children[0];
|
43
|
+
self->tree = self->tree->children.contents[0];
|
48
44
|
return true;
|
49
45
|
}
|
50
46
|
}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
#include "runtime/alloc.h"
|
2
|
+
#include "runtime/language.h"
|
2
3
|
#include "runtime/tree.h"
|
3
4
|
#include "runtime/array.h"
|
4
5
|
#include "runtime/stack.h"
|
@@ -10,14 +11,17 @@
|
|
10
11
|
#define MAX_NODE_POOL_SIZE 50
|
11
12
|
#define MAX_ITERATOR_COUNT 64
|
12
13
|
|
13
|
-
#
|
14
|
+
#ifdef _WIN32
|
15
|
+
#define inline __forceinline
|
16
|
+
#else
|
17
|
+
#define inline static inline __attribute__((always_inline))
|
18
|
+
#endif
|
14
19
|
|
15
20
|
typedef struct StackNode StackNode;
|
16
21
|
|
17
22
|
typedef struct {
|
18
23
|
StackNode *node;
|
19
24
|
Tree *tree;
|
20
|
-
unsigned push_count;
|
21
25
|
bool is_pending;
|
22
26
|
} StackLink;
|
23
27
|
|
@@ -26,32 +30,39 @@ struct StackNode {
|
|
26
30
|
Length position;
|
27
31
|
StackLink links[MAX_LINK_COUNT];
|
28
32
|
short unsigned int link_count;
|
29
|
-
|
33
|
+
uint32_t ref_count;
|
30
34
|
unsigned error_cost;
|
31
|
-
unsigned
|
35
|
+
unsigned node_count;
|
36
|
+
int dynamic_precedence;
|
32
37
|
};
|
33
38
|
|
34
39
|
typedef struct {
|
40
|
+
StackNode *node;
|
35
41
|
TreeArray trees;
|
36
42
|
uint32_t tree_count;
|
37
|
-
StackNode *node;
|
38
43
|
bool is_pending;
|
39
|
-
unsigned push_count;
|
40
44
|
} Iterator;
|
41
45
|
|
42
46
|
typedef struct {
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
} StackPopSession;
|
47
|
+
void *payload;
|
48
|
+
StackIterateCallback callback;
|
49
|
+
} StackIterateSession;
|
47
50
|
|
48
51
|
typedef Array(StackNode *) StackNodeArray;
|
49
52
|
|
53
|
+
typedef enum {
|
54
|
+
StackStatusActive,
|
55
|
+
StackStatusPaused,
|
56
|
+
StackStatusHalted,
|
57
|
+
} StackStatus;
|
58
|
+
|
50
59
|
typedef struct {
|
51
60
|
StackNode *node;
|
52
|
-
|
53
|
-
|
54
|
-
|
61
|
+
Tree *last_external_token;
|
62
|
+
StackSummary *summary;
|
63
|
+
unsigned node_count_at_last_error;
|
64
|
+
TSSymbol lookahead_when_paused;
|
65
|
+
StackStatus status;
|
55
66
|
} StackHead;
|
56
67
|
|
57
68
|
struct Stack {
|
@@ -60,190 +71,221 @@ struct Stack {
|
|
60
71
|
Array(Iterator) iterators;
|
61
72
|
StackNodeArray node_pool;
|
62
73
|
StackNode *base_node;
|
74
|
+
TreePool *tree_pool;
|
75
|
+
};
|
76
|
+
|
77
|
+
typedef unsigned StackAction;
|
78
|
+
enum {
|
79
|
+
StackActionNone,
|
80
|
+
StackActionStop = 1,
|
81
|
+
StackActionPop = 2,
|
63
82
|
};
|
64
83
|
|
84
|
+
typedef StackAction (*StackCallback)(void *, const Iterator *);
|
85
|
+
|
65
86
|
static void stack_node_retain(StackNode *self) {
|
66
87
|
if (!self)
|
67
88
|
return;
|
68
|
-
assert(self->ref_count
|
89
|
+
assert(self->ref_count > 0);
|
69
90
|
self->ref_count++;
|
91
|
+
assert(self->ref_count != 0);
|
70
92
|
}
|
71
93
|
|
72
|
-
static void stack_node_release(StackNode *self, StackNodeArray *pool) {
|
73
|
-
|
74
|
-
return;
|
94
|
+
static void stack_node_release(StackNode *self, StackNodeArray *pool, TreePool *tree_pool) {
|
95
|
+
recur:
|
75
96
|
assert(self->ref_count != 0);
|
76
97
|
self->ref_count--;
|
77
|
-
if (self->ref_count
|
78
|
-
for (int i = 0; i < self->link_count; i++) {
|
79
|
-
if (self->links[i].tree)
|
80
|
-
ts_tree_release(self->links[i].tree);
|
81
|
-
stack_node_release(self->links[i].node, pool);
|
82
|
-
}
|
98
|
+
if (self->ref_count > 0) return;
|
83
99
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
100
|
+
StackNode *first_predecessor = NULL;
|
101
|
+
if (self->link_count > 0) {
|
102
|
+
for (unsigned i = self->link_count - 1; i > 0; i--) {
|
103
|
+
if (self->links[i].tree) ts_tree_release(tree_pool, self->links[i].tree);
|
104
|
+
stack_node_release(self->links[i].node, pool, tree_pool);
|
88
105
|
}
|
106
|
+
if (self->links[0].tree) ts_tree_release(tree_pool, self->links[0].tree);
|
107
|
+
first_predecessor = self->links[0].node;
|
89
108
|
}
|
90
|
-
}
|
91
109
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
.link_count = 0,
|
104
|
-
.links = {},
|
105
|
-
.state = state,
|
106
|
-
.position = position,
|
107
|
-
};
|
110
|
+
if (pool->size < MAX_NODE_POOL_SIZE) {
|
111
|
+
array_push(pool, self);
|
112
|
+
} else {
|
113
|
+
ts_free(self);
|
114
|
+
}
|
115
|
+
|
116
|
+
if (first_predecessor) {
|
117
|
+
self = first_predecessor;
|
118
|
+
goto recur;
|
119
|
+
}
|
120
|
+
}
|
108
121
|
|
109
|
-
|
110
|
-
|
122
|
+
static StackNode *stack_node_new(StackNode *previous_node, Tree *tree, bool is_pending,
|
123
|
+
TSStateId state, StackNodeArray *pool) {
|
124
|
+
StackNode *node = pool->size > 0 ?
|
125
|
+
array_pop(pool) :
|
126
|
+
ts_malloc(sizeof(StackNode));
|
127
|
+
*node = (StackNode){.ref_count = 1, .link_count = 0, .state = state};
|
111
128
|
|
129
|
+
if (previous_node) {
|
112
130
|
node->link_count = 1;
|
113
131
|
node->links[0] = (StackLink){
|
114
|
-
.node =
|
132
|
+
.node = previous_node,
|
133
|
+
.tree = tree,
|
134
|
+
.is_pending = is_pending,
|
115
135
|
};
|
116
136
|
|
117
|
-
node->
|
118
|
-
node->error_cost =
|
137
|
+
node->position = previous_node->position;
|
138
|
+
node->error_cost = previous_node->error_cost;
|
139
|
+
node->dynamic_precedence = previous_node->dynamic_precedence;
|
140
|
+
node->node_count = previous_node->node_count;
|
119
141
|
|
120
142
|
if (tree) {
|
121
|
-
ts_tree_retain(tree);
|
122
143
|
node->error_cost += tree->error_cost;
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
node->error_cost += ERROR_COST_PER_SKIPPED_TREE +
|
127
|
-
ERROR_COST_PER_SKIPPED_CHAR *
|
128
|
-
(tree->padding.chars + tree->size.chars) +
|
129
|
-
ERROR_COST_PER_SKIPPED_LINE *
|
130
|
-
(tree->padding.extent.row + tree->size.extent.row);
|
131
|
-
}
|
132
|
-
}
|
133
|
-
} else {
|
134
|
-
node->error_count++;
|
144
|
+
node->position = length_add(node->position, ts_tree_total_size(tree));
|
145
|
+
node->dynamic_precedence += tree->dynamic_precedence;
|
146
|
+
if (!tree->extra) node->node_count += tree->node_count;
|
135
147
|
}
|
136
148
|
} else {
|
137
|
-
node->
|
149
|
+
node->position = length_zero();
|
138
150
|
node->error_cost = 0;
|
139
151
|
}
|
140
152
|
|
141
153
|
return node;
|
142
154
|
}
|
143
155
|
|
156
|
+
static bool stack__tree_is_equivalent(const Tree *left, const Tree *right) {
|
157
|
+
return
|
158
|
+
left == right ||
|
159
|
+
(left &&
|
160
|
+
right &&
|
161
|
+
left->symbol == right->symbol &&
|
162
|
+
((left->error_cost > 0 && right->error_cost > 0) ||
|
163
|
+
(left->children.size == 0 && right->children.size == 0 &&
|
164
|
+
left->padding.bytes == right->padding.bytes &&
|
165
|
+
left->size.bytes == right->size.bytes &&
|
166
|
+
left->extra == right->extra &&
|
167
|
+
ts_tree_external_token_state_eq(left, right))));
|
168
|
+
}
|
169
|
+
|
144
170
|
static void stack_node_add_link(StackNode *self, StackLink link) {
|
171
|
+
if (link.node == self) return;
|
172
|
+
|
145
173
|
for (int i = 0; i < self->link_count; i++) {
|
146
174
|
StackLink existing_link = self->links[i];
|
147
|
-
if (existing_link.tree
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
if (existing_link.node->state == link.node->state) {
|
153
|
-
for (int j = 0; j < link.node->link_count; j++)
|
175
|
+
if (stack__tree_is_equivalent(existing_link.tree, link.tree)) {
|
176
|
+
if (existing_link.node == link.node) return;
|
177
|
+
if (existing_link.node->state == link.node->state &&
|
178
|
+
existing_link.node->position.bytes == link.node->position.bytes) {
|
179
|
+
for (int j = 0; j < link.node->link_count; j++) {
|
154
180
|
stack_node_add_link(existing_link.node, link.node->links[j]);
|
181
|
+
}
|
155
182
|
return;
|
156
183
|
}
|
157
184
|
}
|
158
185
|
}
|
159
186
|
|
160
|
-
if (self->link_count
|
161
|
-
stack_node_retain(link.node);
|
162
|
-
if (link.tree)
|
163
|
-
ts_tree_retain(link.tree);
|
187
|
+
if (self->link_count == MAX_LINK_COUNT) return;
|
164
188
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
189
|
+
stack_node_retain(link.node);
|
190
|
+
if (link.tree) ts_tree_retain(link.tree);
|
191
|
+
self->links[self->link_count++] = link;
|
192
|
+
|
193
|
+
unsigned node_count = link.node->node_count;
|
194
|
+
if (link.tree) node_count += link.tree->node_count;
|
195
|
+
if (node_count > self->node_count) self->node_count = node_count;
|
196
|
+
}
|
197
|
+
|
198
|
+
static void stack_head_delete(StackHead *self, StackNodeArray *pool, TreePool *tree_pool) {
|
199
|
+
if (self->node) {
|
200
|
+
if (self->last_external_token) {
|
201
|
+
ts_tree_release(tree_pool, self->last_external_token);
|
202
|
+
}
|
203
|
+
if (self->summary) {
|
204
|
+
array_delete(self->summary);
|
205
|
+
ts_free(self->summary);
|
206
|
+
}
|
207
|
+
stack_node_release(self->node, pool, tree_pool);
|
171
208
|
}
|
172
209
|
}
|
173
210
|
|
174
|
-
static StackVersion ts_stack__add_version(Stack *self,
|
175
|
-
|
176
|
-
const TSExternalTokenState *external_token_state) {
|
211
|
+
static StackVersion ts_stack__add_version(Stack *self, StackVersion original_version,
|
212
|
+
StackNode *node) {
|
177
213
|
StackHead head = {
|
178
214
|
.node = node,
|
179
|
-
.
|
180
|
-
.
|
181
|
-
.
|
215
|
+
.node_count_at_last_error = self->heads.contents[original_version].node_count_at_last_error,
|
216
|
+
.last_external_token = self->heads.contents[original_version].last_external_token,
|
217
|
+
.status = StackStatusActive,
|
218
|
+
.lookahead_when_paused = 0,
|
182
219
|
};
|
183
220
|
array_push(&self->heads, head);
|
184
221
|
stack_node_retain(node);
|
222
|
+
if (head.last_external_token) ts_tree_retain(head.last_external_token);
|
185
223
|
return (StackVersion)(self->heads.size - 1);
|
186
224
|
}
|
187
225
|
|
188
|
-
static void ts_stack__add_slice(Stack *self,
|
189
|
-
|
190
|
-
const TSExternalTokenState *external_token_state) {
|
226
|
+
static void ts_stack__add_slice(Stack *self, StackVersion original_version,
|
227
|
+
StackNode *node, TreeArray *trees) {
|
191
228
|
for (uint32_t i = self->slices.size - 1; i + 1 > 0; i--) {
|
192
229
|
StackVersion version = self->slices.contents[i].version;
|
193
230
|
if (self->heads.contents[version].node == node) {
|
194
|
-
StackSlice slice = {
|
231
|
+
StackSlice slice = {*trees, version};
|
195
232
|
array_insert(&self->slices, i + 1, slice);
|
196
233
|
return;
|
197
234
|
}
|
198
235
|
}
|
199
236
|
|
200
|
-
StackVersion version = ts_stack__add_version(self,
|
237
|
+
StackVersion version = ts_stack__add_version(self, original_version, node);
|
201
238
|
StackSlice slice = { *trees, version };
|
202
239
|
array_push(&self->slices, slice);
|
203
240
|
}
|
204
241
|
|
205
|
-
|
206
|
-
|
242
|
+
inline StackSliceArray stack__iter(Stack *self, StackVersion version,
|
243
|
+
StackCallback callback, void *payload,
|
244
|
+
int goal_tree_count) {
|
207
245
|
array_clear(&self->slices);
|
208
246
|
array_clear(&self->iterators);
|
209
247
|
|
210
248
|
StackHead *head = array_get(&self->heads, version);
|
211
|
-
unsigned push_count = head->push_count;
|
212
|
-
const TSExternalTokenState *external_token_state = head->external_token_state;
|
213
249
|
Iterator iterator = {
|
214
250
|
.node = head->node,
|
215
251
|
.trees = array_new(),
|
216
252
|
.tree_count = 0,
|
217
253
|
.is_pending = true,
|
218
|
-
.push_count = 0,
|
219
254
|
};
|
255
|
+
|
256
|
+
bool include_trees = false;
|
257
|
+
if (goal_tree_count >= 0) {
|
258
|
+
include_trees = true;
|
259
|
+
array_reserve(&iterator.trees, goal_tree_count);
|
260
|
+
}
|
261
|
+
|
220
262
|
array_push(&self->iterators, iterator);
|
221
263
|
|
222
264
|
while (self->iterators.size > 0) {
|
223
265
|
for (uint32_t i = 0, size = self->iterators.size; i < size; i++) {
|
224
266
|
Iterator *iterator = &self->iterators.contents[i];
|
225
267
|
StackNode *node = iterator->node;
|
226
|
-
bool is_done = node == self->base_node;
|
227
|
-
|
228
|
-
StackIterateAction action =
|
229
|
-
callback(payload, node->state, &iterator->trees, iterator->tree_count,
|
230
|
-
is_done, iterator->is_pending);
|
231
268
|
|
232
|
-
|
233
|
-
bool
|
269
|
+
StackAction action = callback(payload, iterator);
|
270
|
+
bool should_pop = action & StackActionPop;
|
271
|
+
bool should_stop = action & StackActionStop || node->link_count == 0;
|
234
272
|
|
235
273
|
if (should_pop) {
|
236
274
|
TreeArray trees = iterator->trees;
|
237
275
|
if (!should_stop)
|
238
276
|
ts_tree_array_copy(trees, &trees);
|
239
|
-
|
240
|
-
ts_stack__add_slice(
|
241
|
-
|
277
|
+
ts_tree_array_reverse(&trees);
|
278
|
+
ts_stack__add_slice(
|
279
|
+
self,
|
280
|
+
version,
|
281
|
+
node,
|
282
|
+
&trees
|
283
|
+
);
|
242
284
|
}
|
243
285
|
|
244
286
|
if (should_stop) {
|
245
287
|
if (!should_pop)
|
246
|
-
ts_tree_array_delete(&iterator->trees);
|
288
|
+
ts_tree_array_delete(self->tree_pool, &iterator->trees);
|
247
289
|
array_erase(&self->iterators, i);
|
248
290
|
i--, size--;
|
249
291
|
continue;
|
@@ -258,52 +300,51 @@ INLINE StackPopResult stack__iter(Stack *self, StackVersion version,
|
|
258
300
|
} else {
|
259
301
|
if (self->iterators.size >= MAX_ITERATOR_COUNT) continue;
|
260
302
|
link = node->links[j];
|
261
|
-
|
303
|
+
Iterator current_iterator = self->iterators.contents[i];
|
304
|
+
array_push(&self->iterators, current_iterator);
|
262
305
|
next_iterator = array_back(&self->iterators);
|
263
306
|
ts_tree_array_copy(next_iterator->trees, &next_iterator->trees);
|
264
307
|
}
|
265
308
|
|
266
309
|
next_iterator->node = link.node;
|
267
|
-
next_iterator->push_count += link.push_count;
|
268
310
|
if (link.tree) {
|
311
|
+
if (include_trees) {
|
312
|
+
array_push(&next_iterator->trees, link.tree);
|
313
|
+
ts_tree_retain(link.tree);
|
314
|
+
}
|
315
|
+
|
269
316
|
if (!link.tree->extra) {
|
270
317
|
next_iterator->tree_count++;
|
271
|
-
if (!link.is_pending)
|
318
|
+
if (!link.is_pending) {
|
272
319
|
next_iterator->is_pending = false;
|
320
|
+
}
|
273
321
|
}
|
274
|
-
array_push(&next_iterator->trees, link.tree);
|
275
|
-
ts_tree_retain(link.tree);
|
276
322
|
} else {
|
323
|
+
next_iterator->tree_count++;
|
277
324
|
next_iterator->is_pending = false;
|
278
325
|
}
|
279
326
|
}
|
280
327
|
}
|
281
328
|
}
|
282
329
|
|
283
|
-
return
|
330
|
+
return self->slices;
|
284
331
|
}
|
285
332
|
|
286
|
-
Stack *ts_stack_new() {
|
333
|
+
Stack *ts_stack_new(TreePool *tree_pool) {
|
287
334
|
Stack *self = ts_calloc(1, sizeof(Stack));
|
288
335
|
|
289
336
|
array_init(&self->heads);
|
290
337
|
array_init(&self->slices);
|
291
338
|
array_init(&self->iterators);
|
292
339
|
array_init(&self->node_pool);
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
340
|
+
array_reserve(&self->heads, 4);
|
341
|
+
array_reserve(&self->slices, 4);
|
342
|
+
array_reserve(&self->iterators, 4);
|
343
|
+
array_reserve(&self->node_pool, MAX_NODE_POOL_SIZE);
|
297
344
|
|
298
|
-
self->
|
299
|
-
|
300
|
-
|
301
|
-
array_push(&self->heads, ((StackHead){
|
302
|
-
self->base_node,
|
303
|
-
false,
|
304
|
-
0,
|
305
|
-
NULL
|
306
|
-
}));
|
345
|
+
self->tree_pool = tree_pool;
|
346
|
+
self->base_node = stack_node_new(NULL, NULL, false, 1, &self->node_pool);
|
347
|
+
ts_stack_clear(self);
|
307
348
|
|
308
349
|
return self;
|
309
350
|
}
|
@@ -313,9 +354,10 @@ void ts_stack_delete(Stack *self) {
|
|
313
354
|
array_delete(&self->slices);
|
314
355
|
if (self->iterators.contents)
|
315
356
|
array_delete(&self->iterators);
|
316
|
-
stack_node_release(self->base_node, &self->node_pool);
|
317
|
-
for (uint32_t i = 0; i < self->heads.size; i++)
|
318
|
-
|
357
|
+
stack_node_release(self->base_node, &self->node_pool, self->tree_pool);
|
358
|
+
for (uint32_t i = 0; i < self->heads.size; i++) {
|
359
|
+
stack_head_delete(&self->heads.contents[i], &self->node_pool, self->tree_pool);
|
360
|
+
}
|
319
361
|
array_clear(&self->heads);
|
320
362
|
if (self->node_pool.contents) {
|
321
363
|
for (uint32_t i = 0; i < self->node_pool.size; i++)
|
@@ -330,214 +372,289 @@ uint32_t ts_stack_version_count(const Stack *self) {
|
|
330
372
|
return self->heads.size;
|
331
373
|
}
|
332
374
|
|
333
|
-
TSStateId
|
375
|
+
TSStateId ts_stack_state(const Stack *self, StackVersion version) {
|
334
376
|
return array_get(&self->heads, version)->node->state;
|
335
377
|
}
|
336
378
|
|
337
|
-
Length
|
379
|
+
Length ts_stack_position(const Stack *self, StackVersion version) {
|
338
380
|
return array_get(&self->heads, version)->node->position;
|
339
381
|
}
|
340
382
|
|
341
|
-
|
342
|
-
return array_get(&self->heads, version)->
|
343
|
-
}
|
344
|
-
|
345
|
-
void ts_stack_decrease_push_count(Stack *self, StackVersion version,
|
346
|
-
unsigned decrement) {
|
347
|
-
array_get(&self->heads, version)->push_count -= decrement;
|
383
|
+
Tree *ts_stack_last_external_token(const Stack *self, StackVersion version) {
|
384
|
+
return array_get(&self->heads, version)->last_external_token;
|
348
385
|
}
|
349
386
|
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
array_get(&self->heads, version)->external_token_state = state;
|
387
|
+
void ts_stack_set_last_external_token(Stack *self, StackVersion version, Tree *token) {
|
388
|
+
StackHead *head = array_get(&self->heads, version);
|
389
|
+
if (token) ts_tree_retain(token);
|
390
|
+
if (head->last_external_token) ts_tree_release(self->tree_pool, head->last_external_token);
|
391
|
+
head->last_external_token = token;
|
356
392
|
}
|
357
393
|
|
358
|
-
|
394
|
+
unsigned ts_stack_error_cost(const Stack *self, StackVersion version) {
|
359
395
|
StackHead *head = array_get(&self->heads, version);
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
396
|
+
unsigned result = head->node->error_cost;
|
397
|
+
if (
|
398
|
+
head->status == StackStatusPaused ||
|
399
|
+
(head->node->state == ERROR_STATE && !head->node->links[0].tree)) {
|
400
|
+
result += ERROR_COST_PER_RECOVERY;
|
401
|
+
}
|
402
|
+
return result;
|
365
403
|
}
|
366
404
|
|
367
|
-
unsigned
|
368
|
-
|
369
|
-
|
405
|
+
unsigned ts_stack_node_count_since_error(const Stack *self, StackVersion version) {
|
406
|
+
StackHead *head = array_get(&self->heads, version);
|
407
|
+
if (head->node->node_count < head->node_count_at_last_error) {
|
408
|
+
head->node_count_at_last_error = head->node->node_count;
|
409
|
+
}
|
410
|
+
return head->node->node_count - head->node_count_at_last_error;
|
370
411
|
}
|
371
412
|
|
372
|
-
|
373
|
-
bool is_pending, TSStateId state) {
|
413
|
+
void ts_stack_push(Stack *self, StackVersion version, Tree *tree, bool pending, TSStateId state) {
|
374
414
|
StackHead *head = array_get(&self->heads, version);
|
375
|
-
StackNode *
|
376
|
-
|
377
|
-
if (tree)
|
378
|
-
position = length_add(position, ts_tree_total_size(tree));
|
379
|
-
StackNode *new_node =
|
380
|
-
stack_node_new(node, tree, is_pending, state, position, &self->node_pool);
|
381
|
-
if (!new_node)
|
382
|
-
return false;
|
383
|
-
stack_node_release(node, &self->node_pool);
|
415
|
+
StackNode *new_node = stack_node_new(head->node, tree, pending, state, &self->node_pool);
|
416
|
+
if (!tree) head->node_count_at_last_error = new_node->node_count;
|
384
417
|
head->node = new_node;
|
385
|
-
if (state == ERROR_STATE) {
|
386
|
-
new_node->links[0].push_count = head->push_count;
|
387
|
-
head->push_count = 0;
|
388
|
-
} else
|
389
|
-
head->push_count++;
|
390
|
-
return true;
|
391
418
|
}
|
392
419
|
|
393
|
-
|
394
|
-
|
395
|
-
|
420
|
+
inline StackAction iterate_callback(void *payload, const Iterator *iterator) {
|
421
|
+
StackIterateSession *session = payload;
|
422
|
+
session->callback(
|
423
|
+
session->payload,
|
424
|
+
iterator->node->state,
|
425
|
+
iterator->tree_count
|
426
|
+
);
|
427
|
+
return StackActionNone;
|
396
428
|
}
|
397
429
|
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
430
|
+
void ts_stack_iterate(Stack *self, StackVersion version,
|
431
|
+
StackIterateCallback callback, void *payload) {
|
432
|
+
StackIterateSession session = {payload, callback};
|
433
|
+
stack__iter(self, version, iterate_callback, &session, -1);
|
434
|
+
}
|
402
435
|
|
403
|
-
|
404
|
-
|
405
|
-
|
436
|
+
inline StackAction pop_count_callback(void *payload, const Iterator *iterator) {
|
437
|
+
unsigned *goal_tree_count = payload;
|
438
|
+
if (iterator->tree_count == *goal_tree_count) {
|
439
|
+
return StackActionPop | StackActionStop;
|
440
|
+
} else {
|
441
|
+
return StackActionNone;
|
406
442
|
}
|
443
|
+
}
|
444
|
+
|
445
|
+
StackSliceArray ts_stack_pop_count(Stack *self, StackVersion version, uint32_t count) {
|
446
|
+
return stack__iter(self, version, pop_count_callback, &count, count);
|
447
|
+
}
|
407
448
|
|
408
|
-
|
409
|
-
|
410
|
-
|
449
|
+
inline StackAction pop_pending_callback(void *payload, const Iterator *iterator) {
|
450
|
+
if (iterator->tree_count >= 1) {
|
451
|
+
if (iterator->is_pending) {
|
452
|
+
return StackActionPop | StackActionStop;
|
411
453
|
} else {
|
412
|
-
|
413
|
-
return StackIteratePop | StackIterateStop;
|
454
|
+
return StackActionStop;
|
414
455
|
}
|
456
|
+
} else {
|
457
|
+
return StackActionNone;
|
415
458
|
}
|
416
|
-
return StackIterateNone;
|
417
459
|
}
|
418
460
|
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
StackPopResult pop = stack__iter(self, version, pop_count_callback, &session);
|
425
|
-
if (session.found_error) {
|
426
|
-
if (session.found_valid_path) {
|
427
|
-
StackSlice error_slice = pop.slices.contents[0];
|
428
|
-
ts_tree_array_delete(&error_slice.trees);
|
429
|
-
array_erase(&pop.slices, 0);
|
430
|
-
if (array_front(&pop.slices)->version != error_slice.version) {
|
431
|
-
ts_stack_remove_version(self, error_slice.version);
|
432
|
-
for (StackVersion i = 0; i < pop.slices.size; i++)
|
433
|
-
pop.slices.contents[i].version--;
|
434
|
-
}
|
435
|
-
} else {
|
436
|
-
pop.stopped_at_error = true;
|
437
|
-
}
|
461
|
+
StackSliceArray ts_stack_pop_pending(Stack *self, StackVersion version) {
|
462
|
+
StackSliceArray pop = stack__iter(self, version, pop_pending_callback, NULL, 0);
|
463
|
+
if (pop.size > 0) {
|
464
|
+
ts_stack_renumber_version(self, pop.contents[0].version, version);
|
465
|
+
pop.contents[0].version = version;
|
438
466
|
}
|
439
467
|
return pop;
|
440
468
|
}
|
441
469
|
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
return StackIteratePop | StackIterateStop;
|
470
|
+
inline StackAction pop_error_callback(void *payload, const Iterator *iterator) {
|
471
|
+
if (iterator->trees.size > 0) {
|
472
|
+
bool *found_error = payload;
|
473
|
+
if (!*found_error && iterator->trees.contents[0]->symbol == ts_builtin_sym_error) {
|
474
|
+
*found_error = true;
|
475
|
+
return StackActionPop | StackActionStop;
|
449
476
|
} else {
|
450
|
-
return
|
477
|
+
return StackActionStop;
|
451
478
|
}
|
452
479
|
} else {
|
453
|
-
return
|
480
|
+
return StackActionNone;
|
454
481
|
}
|
455
482
|
}
|
456
483
|
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
484
|
+
TreeArray ts_stack_pop_error(Stack *self, StackVersion version) {
|
485
|
+
StackNode *node = array_get(&self->heads, version)->node;
|
486
|
+
for (unsigned i = 0; i < node->link_count; i++) {
|
487
|
+
if (node->links[i].tree && node->links[i].tree->symbol == ts_builtin_sym_error) {
|
488
|
+
bool found_error = false;
|
489
|
+
StackSliceArray pop = stack__iter(self, version, pop_error_callback, &found_error, 1);
|
490
|
+
if (pop.size > 0) {
|
491
|
+
assert(pop.size == 1);
|
492
|
+
ts_stack_renumber_version(self, pop.contents[0].version, version);
|
493
|
+
return pop.contents[0].trees;
|
494
|
+
}
|
495
|
+
break;
|
496
|
+
}
|
462
497
|
}
|
463
|
-
return
|
498
|
+
return (TreeArray){.size = 0};
|
499
|
+
}
|
500
|
+
|
501
|
+
inline StackAction pop_all_callback(void *payload, const Iterator *iterator) {
|
502
|
+
return iterator->node->link_count == 0 ? StackActionPop : StackActionNone;
|
464
503
|
}
|
465
504
|
|
466
|
-
|
467
|
-
|
468
|
-
bool is_done, bool is_pending) {
|
469
|
-
return is_done ? (StackIteratePop | StackIterateStop) : StackIterateNone;
|
505
|
+
StackSliceArray ts_stack_pop_all(Stack *self, StackVersion version) {
|
506
|
+
return stack__iter(self, version, pop_all_callback, NULL, 0);
|
470
507
|
}
|
471
508
|
|
472
|
-
|
473
|
-
|
509
|
+
typedef struct {
|
510
|
+
StackSummary *summary;
|
511
|
+
unsigned max_depth;
|
512
|
+
} SummarizeStackSession;
|
513
|
+
|
514
|
+
inline StackAction summarize_stack_callback(void *payload, const Iterator *iterator) {
|
515
|
+
SummarizeStackSession *session = payload;
|
516
|
+
TSStateId state = iterator->node->state;
|
517
|
+
unsigned depth = iterator->tree_count;
|
518
|
+
if (depth > session->max_depth) return StackActionStop;
|
519
|
+
for (unsigned i = session->summary->size - 1; i + 1 > 0; i--) {
|
520
|
+
StackSummaryEntry entry = session->summary->contents[i];
|
521
|
+
if (entry.depth < depth) break;
|
522
|
+
if (entry.depth == depth && entry.state == state) return StackActionNone;
|
523
|
+
}
|
524
|
+
array_push(session->summary, ((StackSummaryEntry){
|
525
|
+
.position = iterator->node->position,
|
526
|
+
.depth = depth,
|
527
|
+
.state = state,
|
528
|
+
}));
|
529
|
+
return StackActionNone;
|
530
|
+
}
|
531
|
+
|
532
|
+
void ts_stack_record_summary(Stack *self, StackVersion version, unsigned max_depth) {
|
533
|
+
SummarizeStackSession session = {
|
534
|
+
.summary = ts_malloc(sizeof(StackSummary)),
|
535
|
+
.max_depth = max_depth
|
536
|
+
};
|
537
|
+
array_init(session.summary);
|
538
|
+
stack__iter(self, version, summarize_stack_callback, &session, -1);
|
539
|
+
self->heads.contents[version].summary = session.summary;
|
540
|
+
}
|
541
|
+
|
542
|
+
StackSummary *ts_stack_get_summary(Stack *self, StackVersion version) {
|
543
|
+
return array_get(&self->heads, version)->summary;
|
544
|
+
}
|
545
|
+
|
546
|
+
int ts_stack_dynamic_precedence(Stack *self, StackVersion version) {
|
547
|
+
return array_get(&self->heads, version)->node->dynamic_precedence;
|
474
548
|
}
|
475
549
|
|
476
550
|
void ts_stack_remove_version(Stack *self, StackVersion version) {
|
477
|
-
|
478
|
-
stack_node_release(node, &self->node_pool);
|
551
|
+
stack_head_delete(array_get(&self->heads, version), &self->node_pool, self->tree_pool);
|
479
552
|
array_erase(&self->heads, version);
|
480
553
|
}
|
481
554
|
|
482
555
|
void ts_stack_renumber_version(Stack *self, StackVersion v1, StackVersion v2) {
|
483
556
|
assert(v2 < v1);
|
484
557
|
assert((uint32_t)v1 < self->heads.size);
|
485
|
-
|
486
|
-
|
558
|
+
StackHead *source_head = &self->heads.contents[v1];
|
559
|
+
StackHead *target_head = &self->heads.contents[v2];
|
560
|
+
if (target_head->summary && !source_head->summary) {
|
561
|
+
source_head->summary = target_head->summary;
|
562
|
+
target_head->summary = NULL;
|
563
|
+
}
|
564
|
+
stack_head_delete(target_head, &self->node_pool, self->tree_pool);
|
565
|
+
*target_head = *source_head;
|
487
566
|
array_erase(&self->heads, v1);
|
488
567
|
}
|
489
568
|
|
569
|
+
void ts_stack_swap_versions(Stack *self, StackVersion v1, StackVersion v2) {
|
570
|
+
StackHead temporary_head = self->heads.contents[v1];
|
571
|
+
self->heads.contents[v1] = self->heads.contents[v2];
|
572
|
+
self->heads.contents[v2] = temporary_head;
|
573
|
+
}
|
574
|
+
|
490
575
|
StackVersion ts_stack_copy_version(Stack *self, StackVersion version) {
|
491
576
|
assert(version < self->heads.size);
|
492
577
|
array_push(&self->heads, self->heads.contents[version]);
|
493
|
-
|
578
|
+
StackHead *head = array_back(&self->heads);
|
579
|
+
stack_node_retain(head->node);
|
580
|
+
if (head->last_external_token) ts_tree_retain(head->last_external_token);
|
581
|
+
head->summary = NULL;
|
494
582
|
return self->heads.size - 1;
|
495
583
|
}
|
496
584
|
|
497
|
-
bool ts_stack_merge(Stack *self, StackVersion
|
498
|
-
|
499
|
-
StackHead *
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
new_node->error_cost == node->error_cost &&
|
507
|
-
new_head->external_token_state == head->external_token_state) {
|
508
|
-
for (uint32_t j = 0; j < new_node->link_count; j++)
|
509
|
-
stack_node_add_link(node, new_node->links[j]);
|
510
|
-
if (new_head->push_count > head->push_count)
|
511
|
-
head->push_count = new_head->push_count;
|
512
|
-
ts_stack_remove_version(self, new_version);
|
513
|
-
return true;
|
514
|
-
} else {
|
515
|
-
return false;
|
585
|
+
bool ts_stack_merge(Stack *self, StackVersion version1, StackVersion version2) {
|
586
|
+
if (!ts_stack_can_merge(self, version1, version2)) return false;
|
587
|
+
StackHead *head1 = &self->heads.contents[version1];
|
588
|
+
StackHead *head2 = &self->heads.contents[version2];
|
589
|
+
for (uint32_t i = 0; i < head2->node->link_count; i++) {
|
590
|
+
stack_node_add_link(head1->node, head2->node->links[i]);
|
591
|
+
}
|
592
|
+
if (head1->node->state == ERROR_STATE) {
|
593
|
+
head1->node_count_at_last_error = head1->node->node_count;
|
516
594
|
}
|
595
|
+
ts_stack_remove_version(self, version2);
|
596
|
+
return true;
|
597
|
+
}
|
598
|
+
|
599
|
+
bool ts_stack_can_merge(Stack *self, StackVersion version1, StackVersion version2) {
|
600
|
+
StackHead *head1 = &self->heads.contents[version1];
|
601
|
+
StackHead *head2 = &self->heads.contents[version2];
|
602
|
+
return
|
603
|
+
head1->status == StackStatusActive &&
|
604
|
+
head2->status == StackStatusActive &&
|
605
|
+
head1->node->state == head2->node->state &&
|
606
|
+
head1->node->position.bytes == head2->node->position.bytes &&
|
607
|
+
head1->node->error_cost == head2->node->error_cost &&
|
608
|
+
ts_tree_external_token_state_eq(head1->last_external_token, head2->last_external_token);
|
517
609
|
}
|
518
610
|
|
519
611
|
void ts_stack_halt(Stack *self, StackVersion version) {
|
520
|
-
array_get(&self->heads, version)->
|
612
|
+
array_get(&self->heads, version)->status = StackStatusHalted;
|
613
|
+
}
|
614
|
+
|
615
|
+
void ts_stack_pause(Stack *self, StackVersion version, TSSymbol lookahead) {
|
616
|
+
StackHead *head = array_get(&self->heads, version);
|
617
|
+
head->status = StackStatusPaused;
|
618
|
+
head->lookahead_when_paused = lookahead;
|
619
|
+
head->node_count_at_last_error = head->node->node_count;
|
521
620
|
}
|
522
621
|
|
523
|
-
bool
|
524
|
-
return array_get(&self->heads, version)->
|
622
|
+
bool ts_stack_is_active(const Stack *self, StackVersion version) {
|
623
|
+
return array_get(&self->heads, version)->status == StackStatusActive;
|
624
|
+
}
|
625
|
+
|
626
|
+
bool ts_stack_is_halted(const Stack *self, StackVersion version) {
|
627
|
+
return array_get(&self->heads, version)->status == StackStatusHalted;
|
628
|
+
}
|
629
|
+
|
630
|
+
bool ts_stack_is_paused(const Stack *self, StackVersion version) {
|
631
|
+
return array_get(&self->heads, version)->status == StackStatusPaused;
|
632
|
+
}
|
633
|
+
|
634
|
+
TSSymbol ts_stack_resume(Stack *self, StackVersion version) {
|
635
|
+
StackHead *head = array_get(&self->heads, version);
|
636
|
+
assert(head->status == StackStatusPaused);
|
637
|
+
TSSymbol result = head->lookahead_when_paused;
|
638
|
+
head->status = StackStatusActive;
|
639
|
+
head->lookahead_when_paused = 0;
|
640
|
+
return result;
|
525
641
|
}
|
526
642
|
|
527
643
|
void ts_stack_clear(Stack *self) {
|
528
644
|
stack_node_retain(self->base_node);
|
529
|
-
for (uint32_t i = 0; i < self->heads.size; i++)
|
530
|
-
|
645
|
+
for (uint32_t i = 0; i < self->heads.size; i++) {
|
646
|
+
stack_head_delete(&self->heads.contents[i], &self->node_pool, self->tree_pool);
|
647
|
+
}
|
531
648
|
array_clear(&self->heads);
|
532
649
|
array_push(&self->heads, ((StackHead){
|
533
|
-
self->base_node,
|
534
|
-
|
535
|
-
|
536
|
-
|
650
|
+
.node = self->base_node,
|
651
|
+
.last_external_token = NULL,
|
652
|
+
.status = StackStatusActive,
|
653
|
+
.lookahead_when_paused = 0,
|
537
654
|
}));
|
538
655
|
}
|
539
656
|
|
540
|
-
bool ts_stack_print_dot_graph(Stack *self, const
|
657
|
+
bool ts_stack_print_dot_graph(Stack *self, const TSLanguage *language, FILE *f) {
|
541
658
|
bool was_recording_allocations = ts_toggle_allocation_recording(false);
|
542
659
|
if (!f)
|
543
660
|
f = stderr;
|
@@ -546,28 +663,31 @@ bool ts_stack_print_dot_graph(Stack *self, const char **symbol_names, FILE *f) {
|
|
546
663
|
fprintf(f, "rankdir=\"RL\";\n");
|
547
664
|
fprintf(f, "edge [arrowhead=none]\n");
|
548
665
|
|
549
|
-
Array(StackNode *)visited_nodes = array_new();
|
666
|
+
Array(StackNode *) visited_nodes = array_new();
|
550
667
|
|
551
668
|
array_clear(&self->iterators);
|
552
669
|
for (uint32_t i = 0; i < self->heads.size; i++) {
|
553
670
|
StackHead *head = &self->heads.contents[i];
|
554
|
-
if (head->
|
555
|
-
|
671
|
+
if (head->status == StackStatusHalted) continue;
|
672
|
+
|
556
673
|
fprintf(f, "node_head_%u [shape=none, label=\"\"]\n", i);
|
557
|
-
fprintf(
|
558
|
-
|
559
|
-
|
560
|
-
"
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
674
|
+
fprintf(f, "node_head_%u -> node_%p [", i, head->node);
|
675
|
+
|
676
|
+
if (head->status == StackStatusPaused) {
|
677
|
+
fprintf(f, "color=red ");
|
678
|
+
}
|
679
|
+
fprintf(f,
|
680
|
+
"label=%u, fontcolor=blue, weight=10000, labeltooltip=\"node_count: %u\nerror_cost: %u",
|
681
|
+
i,
|
682
|
+
ts_stack_node_count_since_error(self, i),
|
683
|
+
ts_stack_error_cost(self, i)
|
684
|
+
);
|
685
|
+
|
686
|
+
if (head->last_external_token) {
|
687
|
+
TSExternalTokenState *state = &head->last_external_token->external_token_state;
|
688
|
+
const char *data = ts_external_token_state_data(state);
|
689
|
+
fprintf(f, "\nexternal_token_state:");
|
690
|
+
for (uint32_t j = 0; j < state->length; j++) fprintf(f, " %2X", data[j]);
|
571
691
|
}
|
572
692
|
|
573
693
|
fprintf(f, "\"]\n");
|
@@ -579,8 +699,8 @@ bool ts_stack_print_dot_graph(Stack *self, const char **symbol_names, FILE *f) {
|
|
579
699
|
all_iterators_done = true;
|
580
700
|
|
581
701
|
for (uint32_t i = 0; i < self->iterators.size; i++) {
|
582
|
-
Iterator
|
583
|
-
StackNode *node = iterator
|
702
|
+
Iterator iterator = self->iterators.contents[i];
|
703
|
+
StackNode *node = iterator.node;
|
584
704
|
|
585
705
|
for (uint32_t j = 0; j < visited_nodes.size; j++) {
|
586
706
|
if (visited_nodes.contents[j] == node) {
|
@@ -589,8 +709,7 @@ bool ts_stack_print_dot_graph(Stack *self, const char **symbol_names, FILE *f) {
|
|
589
709
|
}
|
590
710
|
}
|
591
711
|
|
592
|
-
if (!node)
|
593
|
-
continue;
|
712
|
+
if (!node) continue;
|
594
713
|
all_iterators_done = false;
|
595
714
|
|
596
715
|
fprintf(f, "node_%p [", node);
|
@@ -602,10 +721,15 @@ bool ts_stack_print_dot_graph(Stack *self, const char **symbol_names, FILE *f) {
|
|
602
721
|
else
|
603
722
|
fprintf(f, "label=\"%d\"", node->state);
|
604
723
|
|
605
|
-
fprintf(
|
606
|
-
|
607
|
-
|
608
|
-
|
724
|
+
fprintf(
|
725
|
+
f,
|
726
|
+
" tooltip=\"position: %u,%u\nnode_count:%u\nerror_cost: %u\ndynamic_precedence: %d\"];\n",
|
727
|
+
node->position.extent.row,
|
728
|
+
node->position.extent.column,
|
729
|
+
node->node_count,
|
730
|
+
node->error_cost,
|
731
|
+
node->dynamic_precedence
|
732
|
+
);
|
609
733
|
|
610
734
|
for (int j = 0; j < node->link_count; j++) {
|
611
735
|
StackLink link = node->links[j];
|
@@ -616,34 +740,32 @@ bool ts_stack_print_dot_graph(Stack *self, const char **symbol_names, FILE *f) {
|
|
616
740
|
fprintf(f, "fontcolor=gray ");
|
617
741
|
|
618
742
|
if (!link.tree) {
|
619
|
-
fprintf(f, "color=red
|
620
|
-
} else if (link.tree->symbol == ts_builtin_sym_error) {
|
621
|
-
fprintf(f, "label=\"ERROR\"");
|
743
|
+
fprintf(f, "color=red");
|
622
744
|
} else {
|
623
745
|
fprintf(f, "label=\"");
|
624
|
-
if (!link.tree->named)
|
625
|
-
|
626
|
-
const char *name = symbol_names[link.tree->symbol];
|
746
|
+
if (link.tree->visible && !link.tree->named) fprintf(f, "'");
|
747
|
+
const char *name = ts_language_symbol_name(language, link.tree->symbol);
|
627
748
|
for (const char *c = name; *c; c++) {
|
628
|
-
if (*c == '\"' || *c == '\\')
|
629
|
-
fprintf(f, "\\");
|
749
|
+
if (*c == '\"' || *c == '\\') fprintf(f, "\\");
|
630
750
|
fprintf(f, "%c", *c);
|
631
751
|
}
|
632
|
-
if (!link.tree->named)
|
633
|
-
|
634
|
-
fprintf(f, "
|
635
|
-
link.tree->error_cost
|
752
|
+
if (link.tree->visible && !link.tree->named) fprintf(f, "'");
|
753
|
+
fprintf(f, "\"");
|
754
|
+
fprintf(f, "labeltooltip=\"error_cost: %u\ndynamic_precedence: %u\"",
|
755
|
+
link.tree->error_cost,
|
756
|
+
link.tree->dynamic_precedence);
|
636
757
|
}
|
637
758
|
|
638
759
|
fprintf(f, "];\n");
|
639
760
|
|
761
|
+
Iterator *next_iterator;
|
640
762
|
if (j == 0) {
|
641
|
-
|
763
|
+
next_iterator = &self->iterators.contents[i];
|
642
764
|
} else {
|
643
|
-
array_push(&self->iterators,
|
644
|
-
|
645
|
-
next_iterator->node = link.node;
|
765
|
+
array_push(&self->iterators, iterator);
|
766
|
+
next_iterator = array_back(&self->iterators);
|
646
767
|
}
|
768
|
+
next_iterator->node = link.node;
|
647
769
|
}
|
648
770
|
|
649
771
|
array_push(&visited_nodes, node);
|