starscope 1.3.0.pre.rc1 → 1.3.0.pre.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -1
- data/Gemfile.lock +1 -1
- data/bin/starscope +2 -1
- data/lib/starscope/db.rb +1 -0
- data/lib/starscope/exportable.rb +25 -19
- data/lib/starscope/langs/ruby.rb +9 -3
- data/lib/starscope/queryable.rb +1 -1
- data/lib/starscope/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8990a179b74e33abc0f11be5138cafbb0c753268
|
4
|
+
data.tar.gz: 24799a335d01f5cbe1402e8f375cf39b5e0ec28b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7181a98649ff618e53d35d1f182ecea36ee33dee532ecfa892dc576033b222010b196879270af803376bd8d6eb5b2fd4533b8950878cffbf69de2c52557c552c
|
7
|
+
data.tar.gz: 8fb98b2744e28b9cbee19a8d90866ab95d49963a5f5b331bd3f97934da76699a6867d447d64afa16bbba9d42b21952e3a720c9a1a7d4c5edfc8763be5aad9593
|
data/CHANGELOG.md
CHANGED
@@ -13,7 +13,9 @@ New Features:
|
|
13
13
|
integration with cscope's "find this C symbol" (#60).
|
14
14
|
|
15
15
|
Bug Fixes:
|
16
|
-
* Simplify query logic to match user expectations (#91)
|
16
|
+
* Simplify query logic to match user expectations (#91).
|
17
|
+
* Cscope: fix export of inline function definitions.
|
18
|
+
* DB: fix saving of upconverted databases in rare circumstances.
|
17
19
|
|
18
20
|
v1.2.0 (2014-09-02)
|
19
21
|
--------------------
|
data/Gemfile.lock
CHANGED
data/bin/starscope
CHANGED
@@ -193,7 +193,8 @@ db = Starscope::DB.new(output)
|
|
193
193
|
db_exists = File.exists?(options[:db])
|
194
194
|
|
195
195
|
if options[:read] && db_exists
|
196
|
-
|
196
|
+
# we consider it 'new data' if the db was upconverted from an old format
|
197
|
+
new_data = !db.load(options[:db])
|
197
198
|
else
|
198
199
|
# no need to run an update if we didn't read any old data
|
199
200
|
options[:update] = false
|
data/lib/starscope/db.rb
CHANGED
data/lib/starscope/exportable.rb
CHANGED
@@ -144,13 +144,7 @@ END
|
|
144
144
|
# use the column if we have it, otherwise fall back to scanning
|
145
145
|
index = record[:col] || line.index(key)
|
146
146
|
|
147
|
-
|
148
|
-
# either the preceeding or succeeding character is a word character
|
149
|
-
# (meaning we've accidentally matched the middle of some other token)
|
150
|
-
while index &&
|
151
|
-
((line[index, key.length] != key) ||
|
152
|
-
(index > 0 && line[index-1] =~ /\w/) ||
|
153
|
-
(index+key.length < line.length && line[index+key.length] =~ /\w/))
|
147
|
+
while index && !valid_index?(line, index, key)
|
154
148
|
index = line.index(key, index+1)
|
155
149
|
end
|
156
150
|
|
@@ -174,22 +168,27 @@ END
|
|
174
168
|
|
175
169
|
def cscope_output(line, prev, offset, record)
|
176
170
|
buf = ""
|
177
|
-
buf << CSCOPE_GLOBAL_HACK_STOP if record[:type] == :func && record[:tbl] == :defs
|
178
171
|
|
179
|
-
|
180
|
-
|
172
|
+
if record[:type] == :func && record[:tbl] == :defs
|
173
|
+
buf << " " if prev > 0 # urgh cscope
|
174
|
+
buf << CSCOPE_GLOBAL_HACK_STOP
|
175
|
+
end
|
176
|
+
|
177
|
+
record[:name][0...-1].each do |key|
|
181
178
|
# output previous components of the name (ie the Foo in Foo::bar) as unmarked symbols
|
182
|
-
|
183
|
-
|
179
|
+
key = key.to_s.sub(/\W+$/, '')
|
180
|
+
next if key.empty?
|
181
|
+
|
182
|
+
index = line.index(key, prev)
|
183
|
+
|
184
|
+
while index && index+key.length < offset && !valid_index?(line, index, key)
|
185
|
+
index = line.index(key, index+1)
|
186
|
+
end
|
184
187
|
|
185
|
-
|
186
|
-
tok = rxp.match(line[index..-1])[1]
|
187
|
-
index += 1
|
188
|
-
break if index+tok.length > offset
|
188
|
+
if index && index+key.length < offset
|
189
189
|
buf << cscope_plaintext(line, prev, index) << "\n"
|
190
|
-
buf << "#{
|
191
|
-
prev = index +
|
192
|
-
index = line.index(rxp, prev)
|
190
|
+
buf << "#{key}\n"
|
191
|
+
prev = index + key.length
|
193
192
|
end
|
194
193
|
end
|
195
194
|
|
@@ -203,6 +202,13 @@ END
|
|
203
202
|
line
|
204
203
|
end
|
205
204
|
|
205
|
+
def valid_index?(line, index, key)
|
206
|
+
# index is valid if the key exists at it, and the prev/next chars are not word characters
|
207
|
+
((line[index, key.length] == key) &&
|
208
|
+
(index == 0 || line[index-1] !~ /\w/) &&
|
209
|
+
(index+key.length == line.length || line[index+key.length] !~ /\w/))
|
210
|
+
end
|
211
|
+
|
206
212
|
def cscope_plaintext(line, start, stop)
|
207
213
|
ret = line.slice(start, stop-start)
|
208
214
|
ret.lstrip! if start == 0
|
data/lib/starscope/langs/ruby.rb
CHANGED
@@ -2,7 +2,7 @@ require "parser/current"
|
|
2
2
|
|
3
3
|
module Starscope::Lang
|
4
4
|
module Ruby
|
5
|
-
VERSION =
|
5
|
+
VERSION = 2
|
6
6
|
|
7
7
|
def self.match_file(name)
|
8
8
|
return true if name.end_with?(".rb")
|
@@ -78,10 +78,16 @@ module Starscope::Lang
|
|
78
78
|
yield :reads, name, :line_no => loc.line, :col => loc.name.column
|
79
79
|
|
80
80
|
when :lvar, :ivar, :cvar, :gvar
|
81
|
-
yield :reads, scope + [node.children[0]], :line_no => loc.line, :col => loc.
|
81
|
+
yield :reads, scope + [node.children[0]], :line_no => loc.line, :col => loc.name.column
|
82
82
|
|
83
83
|
when :sym
|
84
|
-
|
84
|
+
# handle `:foo` vs `foo: 1`
|
85
|
+
col = if loc.begin
|
86
|
+
loc.begin.column+1
|
87
|
+
else
|
88
|
+
loc.expression.column
|
89
|
+
end
|
90
|
+
yield :sym, [node.children[0]], :line_no => loc.line, :col => col
|
85
91
|
end
|
86
92
|
end
|
87
93
|
|
data/lib/starscope/queryable.rb
CHANGED
@@ -4,7 +4,7 @@ module Starscope::Queryable
|
|
4
4
|
|
5
5
|
def query(tables, value, filters={})
|
6
6
|
tables = [tables] if tables.is_a?(Symbol)
|
7
|
-
tables.each { |t| raise NoTableError, "Table '#{t}' not found" unless @tables[t] }
|
7
|
+
tables.each { |t| raise Starscope::DB::NoTableError, "Table '#{t}' not found" unless @tables[t] }
|
8
8
|
input = Enumerator.new do |y|
|
9
9
|
tables.each do |t|
|
10
10
|
@tables[t].each do |elem|
|
data/lib/starscope/version.rb
CHANGED