ruby_tree_sitter 0.20.8.2-x86_64-linux → 0.20.8.3-x86_64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/ext/tree_sitter/extconf.rb +0 -42
 - data/ext/tree_sitter/repo.rb +121 -0
 - data/lib/tree_sitter/node.rb +20 -3
 - data/lib/tree_sitter/version.rb +1 -1
 - data/test/tree_sitter/node_test.rb +56 -0
 - data/tree_sitter.gemspec +1 -1
 - metadata +3 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b3fcd4ccccb2f350cc4ce4bb0d29c8551a47c5f683d78c97e4654a630a8c1ffb
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8c07e7a2e6b943b234f69f426f41d194c31f44f612cb4b18ce23453ee8971259
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: df6d2bd96e63e2a4113301fc3f03e9f96bc610ee9f295043eebdb21b9afdb5dd9e199e014c2d26b4ce4b47262f7f12d1e39b3e83468dfa51334200b302d58db1
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 91b3014b446c489597ec8b029f7ebc6e7f9b6e7fb5e2e2fafb8ba2e091dcd6961770f5086b12c2725dfad7560ec05b7f4dcb186ac88e3443d0f3e7c1412ba4af
         
     | 
    
        data/ext/tree_sitter/extconf.rb
    CHANGED
    
    | 
         @@ -53,48 +53,6 @@ dir_include, dir_lib = 
     | 
|
| 
       53 
53 
     | 
    
         
             
                repo.include_and_lib_dirs
         
     | 
| 
       54 
54 
     | 
    
         
             
              end
         
     | 
| 
       55 
55 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
            # TREESITTER_SPEC = Bundler.load_gemspec('../../../../tree_sitter.gemspec')
         
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
            # # def version = TREESITTER_SPEC.version.gsub(/\A(\d+\.\d+\.\d+)(\.\d+)?\z/, '\1')
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
            # def version = '0.20.8'
         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
            # LINUX_PLATFORM_REGEX = /linux/
         
     | 
| 
       63 
     | 
    
         
            -
            # DARWIN_PLATFORM_REGEX = /darwin/
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
            # def platform = RUBY_PLATFORM
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
            # def darwin?
         
     | 
| 
       68 
     | 
    
         
            -
            #   !!(platform =~ DARWIN_PLATFORM_REGEX)
         
     | 
| 
       69 
     | 
    
         
            -
            # end
         
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
            # def dll_ext
         
     | 
| 
       72 
     | 
    
         
            -
            #   darwin? ? 'dylib' : 'so'
         
     | 
| 
       73 
     | 
    
         
            -
            # end
         
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
            # def staging_path
         
     | 
| 
       76 
     | 
    
         
            -
            #   '../../stage/lib/tree_sitter'
         
     | 
| 
       77 
     | 
    
         
            -
            # end
         
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
            # def downloaded_dll_path
         
     | 
| 
       80 
     | 
    
         
            -
            #   "tree-sitter-#{version}"
         
     | 
| 
       81 
     | 
    
         
            -
            # end
         
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
            # def add_tree_sitter_dll_to_gem
         
     | 
| 
       84 
     | 
    
         
            -
            #   puts ">>>>>>>>>>>>> #{`pwd`}"
         
     | 
| 
       85 
     | 
    
         
            -
            #   path = "#{downloaded_dll_path}/libtree-sitter*.#{dll_ext}"
         
     | 
| 
       86 
     | 
    
         
            -
            #   files =
         
     | 
| 
       87 
     | 
    
         
            -
            #     Dir.glob(path)
         
     | 
| 
       88 
     | 
    
         
            -
            #        .map { |f| Pathname(f) }
         
     | 
| 
       89 
     | 
    
         
            -
            #        .filter { |f| !f.symlink? && f.file? }
         
     | 
| 
       90 
     | 
    
         
            -
            #   dll = files.first
         
     | 
| 
       91 
     | 
    
         
            -
            #   dst = Pathname(staging_path) / "libtree-sitter.#{dll_ext}"
         
     | 
| 
       92 
     | 
    
         
            -
            #   FileUtils.cp(dll, dst)
         
     | 
| 
       93 
     | 
    
         
            -
            #   TREESITTER_SPEC.files << dst
         
     | 
| 
       94 
     | 
    
         
            -
            # end
         
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
            # add_tree_sitter_dll_to_gem
         
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
       98 
56 
     | 
    
         
             
            # ################################## #
         
     | 
| 
       99 
57 
     | 
    
         
             
            #          Generate Makefile         #
         
     | 
| 
       100 
58 
     | 
    
         
             
            # ################################## #
         
     | 
| 
         @@ -0,0 +1,121 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require_relative '../../lib/tree_sitter/version'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module TreeSitter
         
     | 
| 
      
 6 
     | 
    
         
            +
              # Fetches tree-sitter sources.
         
     | 
| 
      
 7 
     | 
    
         
            +
              class Repo
         
     | 
| 
      
 8 
     | 
    
         
            +
                attr_reader :exe, :src, :url, :version
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                def initialize
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @version = TREESITTER_VERSION
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  # `tree-sitter-@version` is the name produced by tagged releases of sources
         
     | 
| 
      
 14 
     | 
    
         
            +
                  # by git, so we use it everywhere, including when cloning from git.
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @src = Pathname.pwd / "tree-sitter-#{@version}"
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                  @url = {
         
     | 
| 
      
 18 
     | 
    
         
            +
                    git: 'https://github.com/tree-sitter/tree-sitter',
         
     | 
| 
      
 19 
     | 
    
         
            +
                    tar: "https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v#{@version}.tar.gz",
         
     | 
| 
      
 20 
     | 
    
         
            +
                    zip: "https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v#{@version}.zip"
         
     | 
| 
      
 21 
     | 
    
         
            +
                  }
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  @exe = {}
         
     | 
| 
      
 24 
     | 
    
         
            +
                  %i[curl git tar wget zip].each do |cmd|
         
     | 
| 
      
 25 
     | 
    
         
            +
                    @exe[cmd] = find_executable(cmd.to_s)
         
     | 
| 
      
 26 
     | 
    
         
            +
                  end
         
     | 
| 
      
 27 
     | 
    
         
            +
                end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                def compile
         
     | 
| 
      
 30 
     | 
    
         
            +
                  # We need to clean because the same folder is used over and over
         
     | 
| 
      
 31 
     | 
    
         
            +
                  # by rake-compiler-dock
         
     | 
| 
      
 32 
     | 
    
         
            +
                  sh "cd #{src} && make clean && make"
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                def exe?(name)
         
     | 
| 
      
 36 
     | 
    
         
            +
                  @exe[name]
         
     | 
| 
      
 37 
     | 
    
         
            +
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                def extract?
         
     | 
| 
      
 40 
     | 
    
         
            +
                  !exe.filter { |k, v| %i[tar zip].include?(k) && v }.empty?
         
     | 
| 
      
 41 
     | 
    
         
            +
                end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                def download
         
     | 
| 
      
 44 
     | 
    
         
            +
                  # TODO: should we force re-download? Maybe with a flag?
         
     | 
| 
      
 45 
     | 
    
         
            +
                  return true if Dir.exist? src
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                  res = false
         
     | 
| 
      
 48 
     | 
    
         
            +
                  %w[git curl wget].each do |cmd|
         
     | 
| 
      
 49 
     | 
    
         
            +
                    res =
         
     | 
| 
      
 50 
     | 
    
         
            +
                      if find_executable(cmd)
         
     | 
| 
      
 51 
     | 
    
         
            +
                        send("sources_from_#{cmd}")
         
     | 
| 
      
 52 
     | 
    
         
            +
                      else
         
     | 
| 
      
 53 
     | 
    
         
            +
                        false
         
     | 
| 
      
 54 
     | 
    
         
            +
                      end
         
     | 
| 
      
 55 
     | 
    
         
            +
                    break if res
         
     | 
| 
      
 56 
     | 
    
         
            +
                  end
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
                  res
         
     | 
| 
      
 59 
     | 
    
         
            +
                end
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                def include_and_lib_dirs
         
     | 
| 
      
 62 
     | 
    
         
            +
                  [[src / 'lib' / 'include'], [src.to_s]]
         
     | 
| 
      
 63 
     | 
    
         
            +
                end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                def keep_static_lib
         
     | 
| 
      
 66 
     | 
    
         
            +
                  src
         
     | 
| 
      
 67 
     | 
    
         
            +
                    .children
         
     | 
| 
      
 68 
     | 
    
         
            +
                    .filter { |f| /\.(dylib|so)/ =~ f.basename.to_s }
         
     | 
| 
      
 69 
     | 
    
         
            +
                    .each(&:unlink)
         
     | 
| 
      
 70 
     | 
    
         
            +
                end
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
                def sh(cmd)
         
     | 
| 
      
 73 
     | 
    
         
            +
                  return if system(cmd)
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
                  abort <<~MSG
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                    Failed to run: #{cmd}
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
                    exiting …
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
                  MSG
         
     | 
| 
      
 82 
     | 
    
         
            +
                end
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
                def sources_from_curl
         
     | 
| 
      
 85 
     | 
    
         
            +
                  return false if !exe?(:curl) || !extract?
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
                  if exe?(:tar)
         
     | 
| 
      
 88 
     | 
    
         
            +
                    sh "curl -L #{url[:tar]} -o tree-sitter-v#{version}.tar.gz"
         
     | 
| 
      
 89 
     | 
    
         
            +
                    sh "tar -xf tree-sitter-v#{version}.tar.gz"
         
     | 
| 
      
 90 
     | 
    
         
            +
                  elsif exe?(:zip)
         
     | 
| 
      
 91 
     | 
    
         
            +
                    sh "curl -L #{url[:zip]} -o tree-sitter-v#{version}.zip"
         
     | 
| 
      
 92 
     | 
    
         
            +
                    sh "unzip -q tree-sitter-v#{version}.zip"
         
     | 
| 
      
 93 
     | 
    
         
            +
                  end
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
                  true
         
     | 
| 
      
 96 
     | 
    
         
            +
                end
         
     | 
| 
      
 97 
     | 
    
         
            +
             
     | 
| 
      
 98 
     | 
    
         
            +
                def sources_from_git
         
     | 
| 
      
 99 
     | 
    
         
            +
                  return false if !exe?(:git)
         
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
                  sh "git clone #{url[:git]} #{src}"
         
     | 
| 
      
 102 
     | 
    
         
            +
                  sh "cd #{src} && git checkout tags/v#{version}"
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
                  true
         
     | 
| 
      
 105 
     | 
    
         
            +
                end
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
                def sources_from_wget
         
     | 
| 
      
 108 
     | 
    
         
            +
                  return false if !exe?(:wget) || !extract?
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
                  if exe?(:tar)
         
     | 
| 
      
 111 
     | 
    
         
            +
                    sh "wget #{url[:tar]} -O tree-sitter-v#{version}.tar.gz"
         
     | 
| 
      
 112 
     | 
    
         
            +
                    sh "tar -xf tree-sitter-v#{version}.tar.gz"
         
     | 
| 
      
 113 
     | 
    
         
            +
                  elsif exe?(:zip)
         
     | 
| 
      
 114 
     | 
    
         
            +
                    sh "wget #{url[:zip]} -O tree-sitter-v#{version}.zip"
         
     | 
| 
      
 115 
     | 
    
         
            +
                    sh "unzip -q tree-sitter-v#{version}.zip"
         
     | 
| 
      
 116 
     | 
    
         
            +
                  end
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
      
 118 
     | 
    
         
            +
                  true
         
     | 
| 
      
 119 
     | 
    
         
            +
                end
         
     | 
| 
      
 120 
     | 
    
         
            +
              end
         
     | 
| 
      
 121 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/tree_sitter/node.rb
    CHANGED
    
    | 
         @@ -142,7 +142,12 @@ module TreeSitter 
     | 
|
| 
       142 
142 
     | 
    
         
             
                # uses         named_child                   | field_name_for_child
         
     | 
| 
       143 
143 
     | 
    
         
             
                #              child_by_field_name           |   via each_node
         
     | 
| 
       144 
144 
     | 
    
         
             
                #              ------------------------------+----------------------
         
     | 
| 
       145 
     | 
    
         
            -
                 
     | 
| 
      
 145 
     | 
    
         
            +
                # @param all [Boolean] If `true`, return an array of nodes for all the
         
     | 
| 
      
 146 
     | 
    
         
            +
                # demanded keys, putting `nil` for missing ones.  If `false`, return the
         
     | 
| 
      
 147 
     | 
    
         
            +
                # same array after calling `compact`. Defaults to `false`.
         
     | 
| 
      
 148 
     | 
    
         
            +
                #
         
     | 
| 
      
 149 
     | 
    
         
            +
                # See {#fetch_all}.
         
     | 
| 
      
 150 
     | 
    
         
            +
                def fetch(*keys, all: false, **_kwargs)
         
     | 
| 
       146 
151 
     | 
    
         
             
                  dict = {}
         
     | 
| 
       147 
152 
     | 
    
         
             
                  keys.each.with_index do |k, i|
         
     | 
| 
       148 
153 
     | 
    
         
             
                    dict[k.to_s] = i
         
     | 
| 
         @@ -151,13 +156,25 @@ module TreeSitter 
     | 
|
| 
       151 
156 
     | 
    
         
             
                  res = {}
         
     | 
| 
       152 
157 
     | 
    
         
             
                  each_field do |f, c|
         
     | 
| 
       153 
158 
     | 
    
         
             
                    if dict.key?(f)
         
     | 
| 
       154 
     | 
    
         
            -
                      res[ 
     | 
| 
      
 159 
     | 
    
         
            +
                      res[f] = c
         
     | 
| 
       155 
160 
     | 
    
         
             
                      dict.delete(f)
         
     | 
| 
       156 
161 
     | 
    
         
             
                    end
         
     | 
| 
       157 
162 
     | 
    
         
             
                    break if dict.empty?
         
     | 
| 
       158 
163 
     | 
    
         
             
                  end
         
     | 
| 
       159 
164 
     | 
    
         | 
| 
       160 
     | 
    
         
            -
                  res. 
     | 
| 
      
 165 
     | 
    
         
            +
                  res = keys.uniq.map { |k| res[k.to_s] }
         
     | 
| 
      
 166 
     | 
    
         
            +
                  res = res.compact if !all
         
     | 
| 
      
 167 
     | 
    
         
            +
                  res
         
     | 
| 
      
 168 
     | 
    
         
            +
                end
         
     | 
| 
      
 169 
     | 
    
         
            +
             
     | 
| 
      
 170 
     | 
    
         
            +
                # Access all named children of a node, returning `nil` for missing ones.
         
     | 
| 
      
 171 
     | 
    
         
            +
                #
         
     | 
| 
      
 172 
     | 
    
         
            +
                # Equivalent to `fetch(…, all: true)`.
         
     | 
| 
      
 173 
     | 
    
         
            +
                #
         
     | 
| 
      
 174 
     | 
    
         
            +
                # See {#fetch}.
         
     | 
| 
      
 175 
     | 
    
         
            +
                def fetch_all(*keys, **kwargs)
         
     | 
| 
      
 176 
     | 
    
         
            +
                  kwargs[:all] = true
         
     | 
| 
      
 177 
     | 
    
         
            +
                  fetch(*keys, **kwargs)
         
     | 
| 
       161 
178 
     | 
    
         
             
                end
         
     | 
| 
       162 
179 
     | 
    
         
             
              end
         
     | 
| 
       163 
180 
     | 
    
         
             
            end
         
     | 
    
        data/lib/tree_sitter/version.rb
    CHANGED
    
    
| 
         @@ -352,4 +352,60 @@ describe 'fetch' do 
     | 
|
| 
       352 
352 
     | 
    
         
             
                assert_equal 1, m.length
         
     | 
| 
       353 
353 
     | 
    
         
             
                assert_equal method, m.first
         
     | 
| 
       354 
354 
     | 
    
         
             
              end
         
     | 
| 
      
 355 
     | 
    
         
            +
             
     | 
| 
      
 356 
     | 
    
         
            +
              it 'should return an empty array when asked for non-existent fields' do
         
     | 
| 
      
 357 
     | 
    
         
            +
                b = @child.fetch(:a)
         
     | 
| 
      
 358 
     | 
    
         
            +
                assert_empty b
         
     | 
| 
      
 359 
     | 
    
         
            +
             
     | 
| 
      
 360 
     | 
    
         
            +
                b = @child.fetch(:b, :focus)
         
     | 
| 
      
 361 
     | 
    
         
            +
                assert_empty b
         
     | 
| 
      
 362 
     | 
    
         
            +
              end
         
     | 
| 
      
 363 
     | 
    
         
            +
             
     | 
| 
      
 364 
     | 
    
         
            +
              it 'should return an array of `nil` values when asked for non-existent fields with `all: true`' do
         
     | 
| 
      
 365 
     | 
    
         
            +
                b = @child.fetch(:d, all: true)
         
     | 
| 
      
 366 
     | 
    
         
            +
                refute_empty b
         
     | 
| 
      
 367 
     | 
    
         
            +
                assert b.all?(&:nil?)
         
     | 
| 
      
 368 
     | 
    
         
            +
             
     | 
| 
      
 369 
     | 
    
         
            +
                b = @child.fetch(:e, :f, all: true)
         
     | 
| 
      
 370 
     | 
    
         
            +
                refute_empty b
         
     | 
| 
      
 371 
     | 
    
         
            +
                assert b.all?(&:nil?)
         
     | 
| 
      
 372 
     | 
    
         
            +
              end
         
     | 
| 
      
 373 
     | 
    
         
            +
             
     | 
| 
      
 374 
     | 
    
         
            +
              it 'should return values, even if `nil`, for all keys when `all: true`' do
         
     | 
| 
      
 375 
     | 
    
         
            +
                method = @child.child(0)
         
     | 
| 
      
 376 
     | 
    
         
            +
                arguments = @child.child(1)
         
     | 
| 
      
 377 
     | 
    
         
            +
             
     | 
| 
      
 378 
     | 
    
         
            +
                m, a, f = @child.fetch(:method, :arguments, :fake, all: true)
         
     | 
| 
      
 379 
     | 
    
         
            +
             
     | 
| 
      
 380 
     | 
    
         
            +
                assert_equal method, m
         
     | 
| 
      
 381 
     | 
    
         
            +
                assert_equal arguments, a
         
     | 
| 
      
 382 
     | 
    
         
            +
                assert_nil f
         
     | 
| 
      
 383 
     | 
    
         
            +
              end
         
     | 
| 
      
 384 
     | 
    
         
            +
            end
         
     | 
| 
      
 385 
     | 
    
         
            +
             
     | 
| 
      
 386 
     | 
    
         
            +
            describe 'fetch_all' do
         
     | 
| 
      
 387 
     | 
    
         
            +
              before do
         
     | 
| 
      
 388 
     | 
    
         
            +
                @child = root.child(0).child(4)
         
     | 
| 
      
 389 
     | 
    
         
            +
              end
         
     | 
| 
      
 390 
     | 
    
         
            +
             
     | 
| 
      
 391 
     | 
    
         
            +
              it 'should return an array of `nil` values when asked for non-existent fields' do
         
     | 
| 
      
 392 
     | 
    
         
            +
                b = @child.fetch_all(:d)
         
     | 
| 
      
 393 
     | 
    
         
            +
                refute_empty b
         
     | 
| 
      
 394 
     | 
    
         
            +
                assert b.all?(&:nil?)
         
     | 
| 
      
 395 
     | 
    
         
            +
             
     | 
| 
      
 396 
     | 
    
         
            +
                b = @child.fetch_all(:e, :f)
         
     | 
| 
      
 397 
     | 
    
         
            +
                refute_empty b
         
     | 
| 
      
 398 
     | 
    
         
            +
                assert b.all?(&:nil?)
         
     | 
| 
      
 399 
     | 
    
         
            +
              end
         
     | 
| 
      
 400 
     | 
    
         
            +
             
     | 
| 
      
 401 
     | 
    
         
            +
              it 'should return values, even if `nil`, for all keys' do
         
     | 
| 
      
 402 
     | 
    
         
            +
                method = @child.child(0)
         
     | 
| 
      
 403 
     | 
    
         
            +
                arguments = @child.child(1)
         
     | 
| 
      
 404 
     | 
    
         
            +
             
     | 
| 
      
 405 
     | 
    
         
            +
                m, a, f = @child.fetch_all(:method, :arguments, :fake)
         
     | 
| 
      
 406 
     | 
    
         
            +
             
     | 
| 
      
 407 
     | 
    
         
            +
                assert_equal method, m
         
     | 
| 
      
 408 
     | 
    
         
            +
                assert_equal arguments, a
         
     | 
| 
      
 409 
     | 
    
         
            +
                assert_nil f
         
     | 
| 
      
 410 
     | 
    
         
            +
              end
         
     | 
| 
       355 
411 
     | 
    
         
             
            end
         
     | 
    
        data/tree_sitter.gemspec
    CHANGED
    
    | 
         @@ -18,7 +18,7 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
              spec.extensions    = %(ext/tree_sitter/extconf.rb)
         
     | 
| 
       20 
20 
     | 
    
         
             
              spec.files         = %w[LICENSE README.md tree_sitter.gemspec]
         
     | 
| 
       21 
     | 
    
         
            -
              spec.files        += Dir.glob('ext/**/*. 
     | 
| 
      
 21 
     | 
    
         
            +
              spec.files        += Dir.glob('ext/**/*.{c,h,rb}')
         
     | 
| 
       22 
22 
     | 
    
         
             
              spec.files        += Dir.glob('lib/**/*.rb')
         
     | 
| 
       23 
23 
     | 
    
         
             
              spec.test_files    = Dir.glob('test/**/*')
         
     | 
| 
       24 
24 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: ruby_tree_sitter
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.20.8. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.20.8.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: x86_64-linux
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Firas al-Khalil
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2023-12- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2023-12-18 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: minitest
         
     | 
| 
         @@ -135,6 +135,7 @@ files: 
     | 
|
| 
       135 
135 
     | 
    
         
             
            - ext/tree_sitter/query_match.c
         
     | 
| 
       136 
136 
     | 
    
         
             
            - ext/tree_sitter/query_predicate_step.c
         
     | 
| 
       137 
137 
     | 
    
         
             
            - ext/tree_sitter/range.c
         
     | 
| 
      
 138 
     | 
    
         
            +
            - ext/tree_sitter/repo.rb
         
     | 
| 
       138 
139 
     | 
    
         
             
            - ext/tree_sitter/symbol_type.c
         
     | 
| 
       139 
140 
     | 
    
         
             
            - ext/tree_sitter/tree.c
         
     | 
| 
       140 
141 
     | 
    
         
             
            - ext/tree_sitter/tree_cursor.c
         
     |