CoffeeTags 0.3.1 → 0.4.0
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 +8 -8
- data/lib/CoffeeTags/formatter.rb +6 -3
- data/lib/CoffeeTags/parser.rb +16 -15
- data/lib/CoffeeTags/version.rb +1 -1
- data/plugin/coffee-autotag.vim +4 -0
- data/spec/coffeetags_spec.rb +6 -5
- data/spec/fixtures/append-expected.ctags +12 -9
- data/spec/fixtures/append.ctags +2 -2
- data/spec/fixtures/blockcomment.ctags +6 -6
- data/spec/fixtures/campfire.js.tags +1 -1
- data/spec/fixtures/out.test-relative-append.ctags +28 -18
- data/spec/fixtures/out.test-relative.ctags +27 -17
- data/spec/fixtures/out.test-two.ctags +27 -17
- data/spec/fixtures/out.test.ctags +16 -9
- data/spec/fixtures/test.coffee +3 -0
- data/spec/fixtures/test_tree.yaml +3 -2
- data/spec/fixtures/tree.yaml +10 -0
- data/spec/formatter_spec.rb +3 -3
- data/spec/parser_spec.rb +18 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YWM5NzhiNzg0NDBiNmQ5OGUzM2IyYTAxOTM2OTk5NjA1NDFlMTZjYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjdkMjdkZGQwNTBjNzY0ZmMwYjA5MDA1MDg4NTI1NDBjZjc0YjhhYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTFkYzZmNzRkZjRkZTZjZTEwNmMwM2FhMWUwZDNlY2ViYjlhZThiYjBhMTk1
|
10
|
+
ZWI1YTI1YWRkNzY5Y2FkMThiNTI1YzdjMjBmMTJjM2Q4NDY0ZGRkZTZjY2Vj
|
11
|
+
MDdkMzQ3YTkwM2U0MzZmNmZkYjgxZWE2OTMwN2ZmYmUyY2NiMWY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjFhOWM4ZGUyNjliMzFiZTQyZTQzM2I2YjAyZDlmN2U4MzdjOTMwNjMwZjY5
|
14
|
+
OGI0MDk2YWNhMTYxNTE2ODYxNTQyNGRiZDkwNDk4NmE1Y2RhYTUzOTUyNjgy
|
15
|
+
MzBhM2YwZDZhNjk5YzY4ODdmMTY3ZTFjNGM3NDQ1NTgwYTM3NWY=
|
data/lib/CoffeeTags/formatter.rb
CHANGED
@@ -18,7 +18,9 @@ module Coffeetags
|
|
18
18
|
'f' => 'function',
|
19
19
|
'c' => 'class',
|
20
20
|
'o' => 'object',
|
21
|
-
'v' => 'var'
|
21
|
+
'v' => 'var',
|
22
|
+
'p' => 'proto',
|
23
|
+
'b' => 'block'
|
22
24
|
}
|
23
25
|
end
|
24
26
|
|
@@ -43,16 +45,17 @@ module Coffeetags
|
|
43
45
|
namespace = (entry[:parent].blank?) ? entry[:name]: entry[:parent]
|
44
46
|
namespace = namespace == entry[:name] ? '' : "object:#{namespace}"
|
45
47
|
|
46
|
-
[
|
48
|
+
output = [
|
47
49
|
entry[:name],
|
48
50
|
@file,
|
49
51
|
regex_line(entry[:source]),
|
50
52
|
entry[:kind],
|
51
53
|
"line:#{entry[:line]}",
|
52
|
-
namespace,
|
53
54
|
"type:"+Formatter::kinds()[entry[:kind]],
|
54
55
|
"language:coffee"
|
55
56
|
].join("\t")
|
57
|
+
unless namespace.empty? then output << "\t#{namespace}" end
|
58
|
+
output
|
56
59
|
end
|
57
60
|
|
58
61
|
def parse_tree
|
data/lib/CoffeeTags/parser.rb
CHANGED
@@ -19,8 +19,8 @@ module Coffeetags
|
|
19
19
|
@block = /^\s*(if|unless|switch|loop|do)/
|
20
20
|
@class_regex = /\s*class\s*(?:@)?([\w\.]*)/
|
21
21
|
@proto_meths = /^\s*([A-Za-z]*)::([@a-zA-Z0-9_]*)/
|
22
|
-
@var_regex = /([@a-zA-Z0-9_]*)\s*[
|
23
|
-
@token_regex = /([@a-zA-Z0-9_]*)\s*[:=]
|
22
|
+
@var_regex = /([@a-zA-Z0-9_]*)\s*[:=]\s*$/
|
23
|
+
@token_regex = /([@a-zA-Z0-9_]*)\s*[:=]/
|
24
24
|
@iterator_regex = /^\s*for\s*([a-zA-Z0-9_]*)\s*/
|
25
25
|
@comment_regex = /^\s*#/
|
26
26
|
@start_block_comment_regex = /^\s*###/
|
@@ -100,9 +100,14 @@ module Coffeetags
|
|
100
100
|
def item_for_regex line, regex, level, additional_fields={}
|
101
101
|
if item = line.match(regex)
|
102
102
|
entry_for_item = {
|
103
|
-
:name => item[1],
|
104
103
|
:level => level
|
105
104
|
}
|
105
|
+
if item.length > 2 # proto method
|
106
|
+
entry_for_item[:parent] = item[1]
|
107
|
+
entry_for_item[:name] = item[2]
|
108
|
+
else
|
109
|
+
entry_for_item[:name] = item[1]
|
110
|
+
end
|
106
111
|
entry_for_item.merge(additional_fields)
|
107
112
|
end
|
108
113
|
end
|
@@ -115,28 +120,24 @@ module Coffeetags
|
|
115
120
|
level = 0
|
116
121
|
@source.each_line do |line|
|
117
122
|
line_n += 1
|
123
|
+
line.chomp!
|
118
124
|
# indentify scopes
|
119
125
|
level = line_level line
|
120
126
|
|
121
127
|
# ignore comments!
|
122
128
|
next if @comment_lines.include? line_n
|
123
129
|
|
124
|
-
# extract elements for given line
|
125
130
|
[
|
126
|
-
@class_regex,
|
127
|
-
@proto_meths,
|
128
|
-
@var_regex
|
129
|
-
|
130
|
-
|
131
|
+
[@class_regex, 'c'],
|
132
|
+
[@proto_meths, 'p'],
|
133
|
+
[@var_regex, 'v'],
|
134
|
+
[@block, 'b']
|
135
|
+
].each do |regex, kind|
|
136
|
+
mt = item_for_regex line, regex, level, :source => line, :line => line_n, :kind => kind
|
131
137
|
@tree << mt unless mt.nil?
|
132
138
|
end
|
133
139
|
|
134
140
|
|
135
|
-
# does this line contain a block?
|
136
|
-
mt = item_for_regex line, @block, level, :kind => 'b'
|
137
|
-
@tree << mt unless mt.nil?
|
138
|
-
|
139
|
-
|
140
141
|
# instance variable or iterator (for/in)?
|
141
142
|
token = line.match(@token_regex )
|
142
143
|
token ||= line.match(@iterator_regex)
|
@@ -147,7 +148,7 @@ module Coffeetags
|
|
147
148
|
:name => token[1],
|
148
149
|
:level => level,
|
149
150
|
:parent => '',
|
150
|
-
:source => line
|
151
|
+
:source => line,
|
151
152
|
:line => line_n
|
152
153
|
}
|
153
154
|
|
data/lib/CoffeeTags/version.rb
CHANGED
data/plugin/coffee-autotag.vim
CHANGED
data/spec/coffeetags_spec.rb
CHANGED
@@ -36,6 +36,8 @@ f function
|
|
36
36
|
c class
|
37
37
|
o object
|
38
38
|
v var
|
39
|
+
p proto
|
40
|
+
b block
|
39
41
|
TAG
|
40
42
|
|
41
43
|
options[:exit].should == true
|
@@ -119,7 +121,6 @@ FF
|
|
119
121
|
it "generates tags for given files" do
|
120
122
|
Coffeetags::Utils.run({ :output => 'test.out', :files => ['spec/fixtures/test.coffee', 'spec/fixtures/campfire.coffee'] })
|
121
123
|
|
122
|
-
|
123
124
|
File.read("test.out").should == File.read("./spec/fixtures/out.test-two.ctags")
|
124
125
|
|
125
126
|
end
|
@@ -179,7 +180,7 @@ FF
|
|
179
180
|
|
180
181
|
it "returns contents of output file without header and without tags for files that will be indexed" do
|
181
182
|
lines = Coffeetags::Utils.setup_tag_lines("spec/fixtures/out.test-two.ctags", ["spec/fixtures/test.coffee"], true).map {|l| l.split("\t")[0]}
|
182
|
-
lines.should == %w{bump constructor handlers onFailure onSuccess recent roomInfo rooms}
|
183
|
+
lines.should == %w{Campfire Test bump constructor handlers onFailure onSuccess recent resp roomInfo rooms}
|
183
184
|
end
|
184
185
|
|
185
186
|
it "returns contents of output file with relative file paths without header and without tags for files that will be indexed" do
|
@@ -189,7 +190,7 @@ FF
|
|
189
190
|
FileUtils.cp "spec/fixtures/out.test-relative.ctags", output
|
190
191
|
|
191
192
|
lines = Coffeetags::Utils.setup_tag_lines(output, ["spec/fixtures/test.coffee"], true).map {|l| l.split("\t")[0]}
|
192
|
-
lines.should == %w{bump constructor handlers onFailure onSuccess recent roomInfo rooms}
|
193
|
+
lines.should == %w{Campfire Test bump constructor handlers onFailure onSuccess recent resp roomInfo rooms}
|
193
194
|
end
|
194
195
|
|
195
196
|
it "returns contents of output file with relative file paths from absolute file path" do
|
@@ -201,7 +202,7 @@ FF
|
|
201
202
|
expanded_path = Pathname.new("spec/fixtures/test.coffee").expand_path.to_s
|
202
203
|
|
203
204
|
lines = Coffeetags::Utils.setup_tag_lines(output, [expanded_path], true).map {|l| l.split("\t")[0]}
|
204
|
-
lines.should == %w{bump constructor handlers onFailure onSuccess recent roomInfo rooms}
|
205
|
+
lines.should == %w{Campfire Test bump constructor handlers onFailure onSuccess recent resp roomInfo rooms}
|
205
206
|
end
|
206
207
|
|
207
208
|
it "returns contents of output file with relative file paths from absolution output path" do
|
@@ -211,7 +212,7 @@ FF
|
|
211
212
|
FileUtils.cp "spec/fixtures/out.test-relative.ctags", output
|
212
213
|
|
213
214
|
lines = Coffeetags::Utils.setup_tag_lines(Pathname.new(output).expand_path.to_s, ["spec/fixtures/test.coffee"], true).map {|l| l.split("\t")[0]}
|
214
|
-
lines.should == %w{bump constructor handlers onFailure onSuccess recent roomInfo rooms}
|
215
|
+
lines.should == %w{Campfire Test bump constructor handlers onFailure onSuccess recent resp roomInfo rooms}
|
215
216
|
end
|
216
217
|
end
|
217
218
|
|
@@ -3,25 +3,28 @@
|
|
3
3
|
!_TAG_PROGRAM_AUTHOR Łukasz Korecki /lukasz@coffeesounds.com/
|
4
4
|
!_TAG_PROGRAM_NAME CoffeeTags //
|
5
5
|
!_TAG_PROGRAM_URL https://github.com/lukaszkorecki/CoffeeTags /GitHub repository/
|
6
|
-
!_TAG_PROGRAM_VERSION 0.
|
6
|
+
!_TAG_PROGRAM_VERSION 0.4.0 //
|
7
7
|
@filter spec/fixtures/test.coffee /^ @filter = ->$/;" f line:14 object:Wat.ho type:function language:coffee
|
8
|
+
Campfire spec/fixtures/campfire.coffee /^class Campfire$/;" c line:3 type:class language:coffee
|
9
|
+
Test spec/fixtures/campfire.coffee /^class Test$/;" c line:45 type:class language:coffee
|
8
10
|
_loop spec/fixtures/test.coffee /^_loop = (x) ->$/;" f line:19 object:window type:function language:coffee
|
9
11
|
baz spec/fixtures/blockcomment.coffee /^baz : (x, y) ->$/;" f line:15 object:window type:function language:coffee
|
10
12
|
beam_magnum spec/fixtures/test.coffee /^beam_magnum : -> deployed(true)$/;" f line:44 object:window type:function language:coffee
|
11
13
|
bound_func spec/fixtures/test.coffee /^bound_func = (ok) => wat(ok)$/;" f line:41 object:window type:function language:coffee
|
12
|
-
bump spec/fixtures/campfire.coffee /^ bump : ->$/;" f line:46
|
14
|
+
bump spec/fixtures/campfire.coffee /^ bump : ->$/;" f line:46 type:function language:coffee object:Test
|
13
15
|
bump spec/fixtures/test.coffee /^ bump : ->$/;" f line:10 object:Wat.ho.@lolWat type:function language:coffee
|
14
16
|
bump spec/fixtures/test.coffee /^bump = (wat) ->$/;" f line:1 object:window type:function language:coffee
|
15
17
|
bump_up spec/fixtures/test.coffee /^ bump_up : ->$/;" f line:12 object:Wat.ho.@lolWat type:function language:coffee
|
16
|
-
constructor spec/fixtures/campfire.coffee /^ constructor: (api_key, host) ->$/;" f line:8
|
18
|
+
constructor spec/fixtures/campfire.coffee /^ constructor: (api_key, host) ->$/;" f line:8 type:function language:coffee object:Campfire
|
17
19
|
echo2 spec/fixtures/blockcomment.coffee /^echo2 :-> console.log 'echo'$/;" f line:7 object:window type:function language:coffee
|
18
20
|
echo3 spec/fixtures/blockcomment.coffee /^echo3 :-> console.log 'echo'$/;" f line:23 object:window type:function language:coffee
|
19
21
|
foo spec/fixtures/blockcomment.coffee /^foo : (x) -> console.log 'bar #{x}'$/;" f line:26 object:window type:function language:coffee
|
20
22
|
foo2 spec/fixtures/blockcomment.coffee /^foo2 : (x) -> console.log 'bar #{x}'$/;" f line:10 object:window type:function language:coffee
|
21
|
-
handlers spec/fixtures/campfire.coffee /^ handlers: (callbacks) ->$/;" f line:14
|
23
|
+
handlers spec/fixtures/campfire.coffee /^ handlers: (callbacks) ->$/;" f line:14 type:function language:coffee object:Campfire
|
22
24
|
ho spec/fixtures/test.coffee /^ ho : (x) ->$/;" f line:5 object:Wat type:function language:coffee
|
23
|
-
onFailure spec/fixtures/campfire.coffee /^ onFailure: (response) ->$/;" f line:24 object:Campfire.handlers.resp
|
24
|
-
onSuccess spec/fixtures/campfire.coffee /^ onSuccess : (response) ->$/;" f line:16 object:Campfire.handlers.resp
|
25
|
-
recent spec/fixtures/campfire.coffee /^ recent: (id, since, callbacks) ->$/;" f line:40
|
26
|
-
|
27
|
-
|
25
|
+
onFailure spec/fixtures/campfire.coffee /^ onFailure: (response) ->$/;" f line:24 type:function language:coffee object:Campfire.handlers.resp
|
26
|
+
onSuccess spec/fixtures/campfire.coffee /^ onSuccess : (response) ->$/;" f line:16 type:function language:coffee object:Campfire.handlers.resp
|
27
|
+
recent spec/fixtures/campfire.coffee /^ recent: (id, since, callbacks) ->$/;" f line:40 type:function language:coffee object:Campfire
|
28
|
+
resp spec/fixtures/campfire.coffee /^ resp =$/;" v line:15 type:var language:coffee
|
29
|
+
roomInfo spec/fixtures/campfire.coffee /^ roomInfo: (id, callbacks) ->$/;" f line:34 type:function language:coffee object:Campfire
|
30
|
+
rooms spec/fixtures/campfire.coffee /^ rooms: (callbacks) ->$/;" f line:29 type:function language:coffee object:Campfire
|
data/spec/fixtures/append.ctags
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
!_TAG_PROGRAM_AUTHOR Łukasz Korecki /lukasz@coffeesounds.com/
|
4
4
|
!_TAG_PROGRAM_NAME CoffeeTags //
|
5
5
|
!_TAG_PROGRAM_URL https://github.com/lukaszkorecki/CoffeeTags /GitHub repository/
|
6
|
-
!_TAG_PROGRAM_VERSION 0.
|
7
|
-
!_TAG_PROGRAM_VERSION 0.
|
6
|
+
!_TAG_PROGRAM_VERSION 0.4.0 //
|
7
|
+
!_TAG_PROGRAM_VERSION 0.4.0 //
|
8
8
|
!_THIS_LINE_SHOULD_GET_REMOVED Nothing to see here //
|
9
9
|
@filter spec/fixtures/test.coffee /^ @filter = ->$/;" f line:14 object:Wat.ho type:function language:coffee
|
10
10
|
_loop spec/fixtures/test.coffee /^_loop = (x) ->$/;" f line:19 object:window type:function language:coffee
|
@@ -3,9 +3,9 @@
|
|
3
3
|
!_TAG_PROGRAM_AUTHOR Łukasz Korecki /lukasz@coffeesounds.com/
|
4
4
|
!_TAG_PROGRAM_NAME CoffeeTags //
|
5
5
|
!_TAG_PROGRAM_URL https://github.com/lukaszkorecki/CoffeeTags /GitHub repository/
|
6
|
-
!_TAG_PROGRAM_VERSION 0.
|
7
|
-
baz spec/fixtures/blockcomment.coffee /^baz : (x, y) ->$/;" f line:15
|
8
|
-
echo2 spec/fixtures/blockcomment.coffee /^echo2 :-> console.log 'echo'$/;" f line:7
|
9
|
-
echo3 spec/fixtures/blockcomment.coffee /^echo3 :-> console.log 'echo'$/;" f line:23
|
10
|
-
foo spec/fixtures/blockcomment.coffee /^foo : (x) -> console.log 'bar #{x}'$/;" f line:26
|
11
|
-
foo2 spec/fixtures/blockcomment.coffee /^foo2 : (x) -> console.log 'bar #{x}'$/;" f line:10
|
6
|
+
!_TAG_PROGRAM_VERSION 0.4.0 //
|
7
|
+
baz spec/fixtures/blockcomment.coffee /^baz : (x, y) ->$/;" f line:15 type:function language:coffee object:window
|
8
|
+
echo2 spec/fixtures/blockcomment.coffee /^echo2 :-> console.log 'echo'$/;" f line:7 type:function language:coffee object:window
|
9
|
+
echo3 spec/fixtures/blockcomment.coffee /^echo3 :-> console.log 'echo'$/;" f line:23 type:function language:coffee object:window
|
10
|
+
foo spec/fixtures/blockcomment.coffee /^foo : (x) -> console.log 'bar #{x}'$/;" f line:26 type:function language:coffee object:window
|
11
|
+
foo2 spec/fixtures/blockcomment.coffee /^foo2 : (x) -> console.log 'bar #{x}'$/;" f line:10 type:function language:coffee object:window
|
@@ -3,7 +3,7 @@
|
|
3
3
|
!_TAG_PROGRAM_AUTHOR Łukasz Korecki /lukasz@coffeesounds.com/
|
4
4
|
!_TAG_PROGRAM_NAME CoffeeTags //
|
5
5
|
!_TAG_PROGRAM_URL https://github.com/lukaszkorecki/CoffeeTags /GitHub repository/
|
6
|
-
!_TAG_PROGRAM_VERSION 0.
|
6
|
+
!_TAG_PROGRAM_VERSION 0.4.0 //
|
7
7
|
bump spec/fixtures/campfire.coffee /^ bump : ->$/;" f lineno:46 object:Test type:function
|
8
8
|
constructor spec/fixtures/campfire.coffee /^ constructor: (api_key, host) ->$/;" f lineno:8 object:Campfire type:function
|
9
9
|
handlers spec/fixtures/campfire.coffee /^ handlers: (callbacks) ->$/;" f lineno:14 object:Campfire type:function
|
@@ -3,22 +3,32 @@
|
|
3
3
|
!_TAG_PROGRAM_AUTHOR Łukasz Korecki /lukasz@coffeesounds.com/
|
4
4
|
!_TAG_PROGRAM_NAME CoffeeTags //
|
5
5
|
!_TAG_PROGRAM_URL https://github.com/lukaszkorecki/CoffeeTags /GitHub repository/
|
6
|
-
!_TAG_PROGRAM_VERSION 0.
|
7
|
-
!_TAG_PROGRAM_VERSION 0.
|
6
|
+
!_TAG_PROGRAM_VERSION 0.4.0 //
|
7
|
+
!_TAG_PROGRAM_VERSION 0.4.0 //
|
8
8
|
!_THIS_LINE_SHOULD_GET_REMOVED Nothing to see here //
|
9
|
-
@filter ../spec/fixtures/test.coffee /^ @filter = ->$/;" f line:14
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
9
|
+
@filter ../spec/fixtures/test.coffee /^ @filter = ->$/;" f line:14 type:function language:coffee object:Wat.ho
|
10
|
+
@lolWat ../spec/fixtures/test.coffee /^ @lolWat =$/;" v line:9 type:var language:coffee
|
11
|
+
Campfire ../spec/fixtures/campfire.coffee /^class Campfire$/;" c line:3 type:class language:coffee
|
12
|
+
Test ../spec/fixtures/campfire.coffee /^class Test$/;" c line:45 type:class language:coffee
|
13
|
+
Wat ../spec/fixtures/test.coffee /^Wat =$/;" v line:4 type:var language:coffee
|
14
|
+
_loop ../spec/fixtures/test.coffee /^_loop = (x) ->$/;" f line:19 type:function language:coffee object:window
|
15
|
+
beam_magnum ../spec/fixtures/test.coffee /^beam_magnum : -> deployed(true)$/;" f line:44 type:function language:coffee object:window
|
16
|
+
bound_func ../spec/fixtures/test.coffee /^bound_func = (ok) => wat(ok)$/;" f line:41 type:function language:coffee object:window
|
17
|
+
bump ../spec/fixtures/test.coffee /^ bump : ->$/;" f line:10 type:function language:coffee object:Wat.ho.@lolWat
|
18
|
+
bump ../spec/fixtures/test.coffee /^bump = (wat) ->$/;" f line:1 type:function language:coffee object:window
|
19
|
+
bump_up ../spec/fixtures/test.coffee /^ bump_up : ->$/;" f line:12 type:function language:coffee object:Wat.ho.@lolWat
|
20
|
+
constructor ../spec/fixtures/campfire.coffee /^ constructor: (api_key, host) ->$/;" f line:8 type:function language:coffee object:Campfire
|
21
|
+
constructor2 ../spec/fixtures/campfire.coffee /^ constructor: (api_key, host) ->$/;" f lineno:8 object:Campfire type:function
|
22
|
+
do ../spec/fixtures/test.coffee /^ do (element)$/;" b line:29 type:block language:coffee
|
23
|
+
do ../spec/fixtures/test.coffee /^ do (f) ->$/;" b line:36 type:block language:coffee
|
24
|
+
handlers ../spec/fixtures/campfire.coffee /^ handlers: (callbacks) ->$/;" f line:14 type:function language:coffee object:Campfire
|
25
|
+
ho ../spec/fixtures/test.coffee /^ ho : (x) ->$/;" f line:5 type:function language:coffee object:Wat
|
26
|
+
if ../spec/fixtures/test.coffee /^ if wat$/;" b line:24 type:block language:coffee
|
27
|
+
if ../spec/fixtures/test.coffee /^ if z.isSomethingRidic$/;" b line:21 type:block language:coffee
|
28
|
+
loop ../spec/fixtures/test.coffee /^Array::loop = (x) ->$/;" p line:46 type:proto language:coffee object:Array
|
29
|
+
onFailure ../spec/fixtures/campfire.coffee /^ onFailure: (response) ->$/;" f line:24 type:function language:coffee object:Campfire.handlers.resp
|
30
|
+
onSuccess ../spec/fixtures/campfire.coffee /^ onSuccess : (response) ->$/;" f line:16 type:function language:coffee object:Campfire.handlers.resp
|
31
|
+
recent ../spec/fixtures/campfire.coffee /^ recent: (id, since, callbacks) ->$/;" f line:40 type:function language:coffee object:Campfire
|
32
|
+
resp ../spec/fixtures/campfire.coffee /^ resp =$/;" v line:15 type:var language:coffee
|
33
|
+
roomInfo ../spec/fixtures/campfire.coffee /^ roomInfo: (id, callbacks) ->$/;" f line:34 type:function language:coffee object:Campfire
|
34
|
+
rooms ../spec/fixtures/campfire.coffee /^ rooms: (callbacks) ->$/;" f line:29 type:function language:coffee object:Campfire
|
@@ -3,20 +3,30 @@
|
|
3
3
|
!_TAG_PROGRAM_AUTHOR Łukasz Korecki /lukasz@coffeesounds.com/
|
4
4
|
!_TAG_PROGRAM_NAME CoffeeTags //
|
5
5
|
!_TAG_PROGRAM_URL https://github.com/lukaszkorecki/CoffeeTags /GitHub repository/
|
6
|
-
!_TAG_PROGRAM_VERSION 0.
|
7
|
-
@filter ../spec/fixtures/test.coffee /^ @filter = ->$/;" f line:14
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
6
|
+
!_TAG_PROGRAM_VERSION 0.4.0 //
|
7
|
+
@filter ../spec/fixtures/test.coffee /^ @filter = ->$/;" f line:14 type:function language:coffee object:Wat.ho
|
8
|
+
@lolWat ../spec/fixtures/test.coffee /^ @lolWat =$/;" v line:9 type:var language:coffee
|
9
|
+
Campfire ../spec/fixtures/campfire.coffee /^class Campfire$/;" c line:3 type:class language:coffee
|
10
|
+
Test ../spec/fixtures/campfire.coffee /^class Test$/;" c line:45 type:class language:coffee
|
11
|
+
Wat ../spec/fixtures/test.coffee /^Wat =$/;" v line:4 type:var language:coffee
|
12
|
+
_loop ../spec/fixtures/test.coffee /^_loop = (x) ->$/;" f line:19 type:function language:coffee object:window
|
13
|
+
beam_magnum ../spec/fixtures/test.coffee /^beam_magnum : -> deployed(true)$/;" f line:44 type:function language:coffee object:window
|
14
|
+
bound_func ../spec/fixtures/test.coffee /^bound_func = (ok) => wat(ok)$/;" f line:41 type:function language:coffee object:window
|
15
|
+
bump ../spec/fixtures/campfire.coffee /^ bump : ->$/;" f line:46 type:function language:coffee object:Test
|
16
|
+
bump ../spec/fixtures/test.coffee /^ bump : ->$/;" f line:10 type:function language:coffee object:Wat.ho.@lolWat
|
17
|
+
bump ../spec/fixtures/test.coffee /^bump = (wat) ->$/;" f line:1 type:function language:coffee object:window
|
18
|
+
bump_up ../spec/fixtures/test.coffee /^ bump_up : ->$/;" f line:12 type:function language:coffee object:Wat.ho.@lolWat
|
19
|
+
constructor ../spec/fixtures/campfire.coffee /^ constructor: (api_key, host) ->$/;" f line:8 type:function language:coffee object:Campfire
|
20
|
+
do ../spec/fixtures/test.coffee /^ do (element)$/;" b line:29 type:block language:coffee
|
21
|
+
do ../spec/fixtures/test.coffee /^ do (f) ->$/;" b line:36 type:block language:coffee
|
22
|
+
handlers ../spec/fixtures/campfire.coffee /^ handlers: (callbacks) ->$/;" f line:14 type:function language:coffee object:Campfire
|
23
|
+
ho ../spec/fixtures/test.coffee /^ ho : (x) ->$/;" f line:5 type:function language:coffee object:Wat
|
24
|
+
if ../spec/fixtures/test.coffee /^ if wat$/;" b line:24 type:block language:coffee
|
25
|
+
if ../spec/fixtures/test.coffee /^ if z.isSomethingRidic$/;" b line:21 type:block language:coffee
|
26
|
+
loop ../spec/fixtures/test.coffee /^Array::loop = (x) ->$/;" p line:46 type:proto language:coffee object:Array
|
27
|
+
onFailure ../spec/fixtures/campfire.coffee /^ onFailure: (response) ->$/;" f line:24 type:function language:coffee object:Campfire.handlers.resp
|
28
|
+
onSuccess ../spec/fixtures/campfire.coffee /^ onSuccess : (response) ->$/;" f line:16 type:function language:coffee object:Campfire.handlers.resp
|
29
|
+
recent ../spec/fixtures/campfire.coffee /^ recent: (id, since, callbacks) ->$/;" f line:40 type:function language:coffee object:Campfire
|
30
|
+
resp ../spec/fixtures/campfire.coffee /^ resp =$/;" v line:15 type:var language:coffee
|
31
|
+
roomInfo ../spec/fixtures/campfire.coffee /^ roomInfo: (id, callbacks) ->$/;" f line:34 type:function language:coffee object:Campfire
|
32
|
+
rooms ../spec/fixtures/campfire.coffee /^ rooms: (callbacks) ->$/;" f line:29 type:function language:coffee object:Campfire
|
@@ -3,20 +3,30 @@
|
|
3
3
|
!_TAG_PROGRAM_AUTHOR Łukasz Korecki /lukasz@coffeesounds.com/
|
4
4
|
!_TAG_PROGRAM_NAME CoffeeTags //
|
5
5
|
!_TAG_PROGRAM_URL https://github.com/lukaszkorecki/CoffeeTags /GitHub repository/
|
6
|
-
!_TAG_PROGRAM_VERSION 0.
|
7
|
-
@filter spec/fixtures/test.coffee /^ @filter = ->$/;" f line:14
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
6
|
+
!_TAG_PROGRAM_VERSION 0.4.0 //
|
7
|
+
@filter spec/fixtures/test.coffee /^ @filter = ->$/;" f line:14 type:function language:coffee object:Wat.ho
|
8
|
+
@lolWat spec/fixtures/test.coffee /^ @lolWat =$/;" v line:9 type:var language:coffee
|
9
|
+
Campfire spec/fixtures/campfire.coffee /^class Campfire$/;" c line:3 type:class language:coffee
|
10
|
+
Test spec/fixtures/campfire.coffee /^class Test$/;" c line:45 type:class language:coffee
|
11
|
+
Wat spec/fixtures/test.coffee /^Wat =$/;" v line:4 type:var language:coffee
|
12
|
+
_loop spec/fixtures/test.coffee /^_loop = (x) ->$/;" f line:19 type:function language:coffee object:window
|
13
|
+
beam_magnum spec/fixtures/test.coffee /^beam_magnum : -> deployed(true)$/;" f line:44 type:function language:coffee object:window
|
14
|
+
bound_func spec/fixtures/test.coffee /^bound_func = (ok) => wat(ok)$/;" f line:41 type:function language:coffee object:window
|
15
|
+
bump spec/fixtures/campfire.coffee /^ bump : ->$/;" f line:46 type:function language:coffee object:Test
|
16
|
+
bump spec/fixtures/test.coffee /^ bump : ->$/;" f line:10 type:function language:coffee object:Wat.ho.@lolWat
|
17
|
+
bump spec/fixtures/test.coffee /^bump = (wat) ->$/;" f line:1 type:function language:coffee object:window
|
18
|
+
bump_up spec/fixtures/test.coffee /^ bump_up : ->$/;" f line:12 type:function language:coffee object:Wat.ho.@lolWat
|
19
|
+
constructor spec/fixtures/campfire.coffee /^ constructor: (api_key, host) ->$/;" f line:8 type:function language:coffee object:Campfire
|
20
|
+
do spec/fixtures/test.coffee /^ do (element)$/;" b line:29 type:block language:coffee
|
21
|
+
do spec/fixtures/test.coffee /^ do (f) ->$/;" b line:36 type:block language:coffee
|
22
|
+
handlers spec/fixtures/campfire.coffee /^ handlers: (callbacks) ->$/;" f line:14 type:function language:coffee object:Campfire
|
23
|
+
ho spec/fixtures/test.coffee /^ ho : (x) ->$/;" f line:5 type:function language:coffee object:Wat
|
24
|
+
if spec/fixtures/test.coffee /^ if wat$/;" b line:24 type:block language:coffee
|
25
|
+
if spec/fixtures/test.coffee /^ if z.isSomethingRidic$/;" b line:21 type:block language:coffee
|
26
|
+
loop spec/fixtures/test.coffee /^Array::loop = (x) ->$/;" p line:46 type:proto language:coffee object:Array
|
27
|
+
onFailure spec/fixtures/campfire.coffee /^ onFailure: (response) ->$/;" f line:24 type:function language:coffee object:Campfire.handlers.resp
|
28
|
+
onSuccess spec/fixtures/campfire.coffee /^ onSuccess : (response) ->$/;" f line:16 type:function language:coffee object:Campfire.handlers.resp
|
29
|
+
recent spec/fixtures/campfire.coffee /^ recent: (id, since, callbacks) ->$/;" f line:40 type:function language:coffee object:Campfire
|
30
|
+
resp spec/fixtures/campfire.coffee /^ resp =$/;" v line:15 type:var language:coffee
|
31
|
+
roomInfo spec/fixtures/campfire.coffee /^ roomInfo: (id, callbacks) ->$/;" f line:34 type:function language:coffee object:Campfire
|
32
|
+
rooms spec/fixtures/campfire.coffee /^ rooms: (callbacks) ->$/;" f line:29 type:function language:coffee object:Campfire
|
@@ -3,12 +3,19 @@
|
|
3
3
|
!_TAG_PROGRAM_AUTHOR Łukasz Korecki /lukasz@coffeesounds.com/
|
4
4
|
!_TAG_PROGRAM_NAME CoffeeTags //
|
5
5
|
!_TAG_PROGRAM_URL https://github.com/lukaszkorecki/CoffeeTags /GitHub repository/
|
6
|
-
!_TAG_PROGRAM_VERSION 0.
|
7
|
-
@filter spec/fixtures/test.coffee /^ @filter = ->$/;" f line:14
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
6
|
+
!_TAG_PROGRAM_VERSION 0.4.0 //
|
7
|
+
@filter spec/fixtures/test.coffee /^ @filter = ->$/;" f line:14 type:function language:coffee object:Wat.ho
|
8
|
+
@lolWat spec/fixtures/test.coffee /^ @lolWat =$/;" v line:9 type:var language:coffee
|
9
|
+
Wat spec/fixtures/test.coffee /^Wat =$/;" v line:4 type:var language:coffee
|
10
|
+
_loop spec/fixtures/test.coffee /^_loop = (x) ->$/;" f line:19 type:function language:coffee object:window
|
11
|
+
beam_magnum spec/fixtures/test.coffee /^beam_magnum : -> deployed(true)$/;" f line:44 type:function language:coffee object:window
|
12
|
+
bound_func spec/fixtures/test.coffee /^bound_func = (ok) => wat(ok)$/;" f line:41 type:function language:coffee object:window
|
13
|
+
bump spec/fixtures/test.coffee /^ bump : ->$/;" f line:10 type:function language:coffee object:Wat.ho.@lolWat
|
14
|
+
bump spec/fixtures/test.coffee /^bump = (wat) ->$/;" f line:1 type:function language:coffee object:window
|
15
|
+
bump_up spec/fixtures/test.coffee /^ bump_up : ->$/;" f line:12 type:function language:coffee object:Wat.ho.@lolWat
|
16
|
+
do spec/fixtures/test.coffee /^ do (element)$/;" b line:29 type:block language:coffee
|
17
|
+
do spec/fixtures/test.coffee /^ do (f) ->$/;" b line:36 type:block language:coffee
|
18
|
+
ho spec/fixtures/test.coffee /^ ho : (x) ->$/;" f line:5 type:function language:coffee object:Wat
|
19
|
+
if spec/fixtures/test.coffee /^ if wat$/;" b line:24 type:block language:coffee
|
20
|
+
if spec/fixtures/test.coffee /^ if z.isSomethingRidic$/;" b line:21 type:block language:coffee
|
21
|
+
loop spec/fixtures/test.coffee /^Array::loop = (x) ->$/;" p line:46 type:proto language:coffee object:Array
|
data/spec/fixtures/test.coffee
CHANGED
data/spec/fixtures/tree.yaml
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
---
|
2
2
|
- :name: Campfire
|
3
3
|
:level: 0
|
4
|
+
:kind: c
|
4
5
|
- :source: " constructor: (api_key, host) ->"
|
5
6
|
:parent: Campfire
|
6
7
|
:kind: f
|
@@ -21,6 +22,9 @@
|
|
21
22
|
:level: 2
|
22
23
|
- :name: resp
|
23
24
|
:level: 4
|
25
|
+
:source: " resp ="
|
26
|
+
:line: 15
|
27
|
+
:kind: v
|
24
28
|
- :source: " onSuccess : (response) ->"
|
25
29
|
:parent: Campfire.handlers.resp
|
26
30
|
:kind: f
|
@@ -60,6 +64,9 @@
|
|
60
64
|
|
61
65
|
- :name: App.Campfire
|
62
66
|
:level: 0
|
67
|
+
:source: "class App.Campfire"
|
68
|
+
:line: 1
|
69
|
+
:kind: c
|
63
70
|
- :source: " constructor: ->"
|
64
71
|
:parent: App.Campfire
|
65
72
|
:kind: f
|
@@ -70,6 +77,9 @@
|
|
70
77
|
|
71
78
|
- :name: Test
|
72
79
|
:level: 0
|
80
|
+
:source: "class Test"
|
81
|
+
:line: 45
|
82
|
+
:kind: c
|
73
83
|
- :source: " bump : ->"
|
74
84
|
:parent: Test
|
75
85
|
:kind: f
|
data/spec/formatter_spec.rb
CHANGED
@@ -14,14 +14,14 @@ describe 'CoffeeTags::Formatter' do
|
|
14
14
|
|
15
15
|
it "generates a line for method definition" do
|
16
16
|
exp = [ 'constructor', 'test.coffee', "/^ constructor: (api_key, host) ->$/;\"",
|
17
|
-
'f', 'line:8', '
|
17
|
+
'f', 'line:8', 'type:function', 'language:coffee', 'object:Campfire'
|
18
18
|
].join("\t")
|
19
19
|
@instance.parse_tree.first.should == exp
|
20
20
|
end
|
21
21
|
|
22
22
|
it "generates line for second class" do
|
23
|
-
exp = [ 'bump', 'test.coffee', "/^ bump : ->$/;\"",
|
24
|
-
'
|
23
|
+
exp = [ 'bump', 'test.coffee', "/^ bump : ->$/;\"", 'f',
|
24
|
+
'line:46', 'type:function', 'language:coffee', 'object:Test'
|
25
25
|
].join "\t"
|
26
26
|
@instance.parse_tree.last.should == exp
|
27
27
|
end
|
data/spec/parser_spec.rb
CHANGED
@@ -68,13 +68,20 @@ describe 'CoffeeTags::Parser' do
|
|
68
68
|
@coffee_parser.execute!
|
69
69
|
end
|
70
70
|
|
71
|
+
def cf_defined_values_should_equal(cf, c)
|
72
|
+
cf.each do |k, v|
|
73
|
+
c[k].should == v
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
71
77
|
it "parses the class" do
|
72
|
-
c
|
73
|
-
|
78
|
+
c = @coffee_parser.tree.find { |i| i[:name] == 'Campfire'}
|
79
|
+
cf = @cf_tree.find {|i| i[:name] == 'Campfire'}
|
80
|
+
cf_defined_values_should_equal cf, c
|
74
81
|
end
|
75
82
|
|
76
83
|
it "parses the 2nd class" do
|
77
|
-
c
|
84
|
+
c = @coffee_parser.tree.find { |i| i[:name] == 'Test'}
|
78
85
|
c.should == @cf_tree.find {|i| i[:name] == 'Test'}
|
79
86
|
end
|
80
87
|
|
@@ -91,26 +98,27 @@ describe 'CoffeeTags::Parser' do
|
|
91
98
|
@coffee_parser.execute!
|
92
99
|
|
93
100
|
c = @coffee_parser.tree.find { |i| i[:name] == 'Campfire'}
|
94
|
-
|
101
|
+
cf = @cf_tree.find {|i| i[:name] == 'Campfire'}
|
102
|
+
cf_defined_values_should_equal cf, c
|
95
103
|
end
|
96
104
|
|
97
105
|
it "parses the instance variable" do
|
98
|
-
c
|
106
|
+
c = @coffee_parser.tree.find { |i| i[:name] == '@url'}
|
99
107
|
c.should == @cf_tree.find {|i| i[:name] == '@url'}
|
100
108
|
end
|
101
109
|
|
102
110
|
it "parses the object literal with functions" do
|
103
|
-
c
|
111
|
+
c = @coffee_parser.tree.find { |i| i[:name] == 'resp'}
|
104
112
|
c.should == @cf_tree.find {|i| i[:name] == 'resp'}
|
105
113
|
end
|
106
114
|
|
107
115
|
it "parses a nested function" do
|
108
|
-
c
|
116
|
+
c = @coffee_parser.tree.find { |i| i[:name] == 'onSuccess'}
|
109
117
|
c.should == @cf_tree.find {|i| i[:name] == 'onSuccess'}
|
110
118
|
end
|
111
119
|
|
112
120
|
it "parses a method var" do
|
113
|
-
c
|
121
|
+
c = @coffee_parser.tree.find { |i| i[:name] == 'url'}
|
114
122
|
c.should == @cf_tree.find {|i| i[:name] == 'url'}
|
115
123
|
end
|
116
124
|
end
|
@@ -145,9 +153,8 @@ describe 'CoffeeTags::Parser' do
|
|
145
153
|
|
146
154
|
end
|
147
155
|
it "extracts a method defined in a prototype" do
|
148
|
-
|
149
|
-
|
150
|
-
exp = @test_tree.find { |i| i[:name] == '_loop'}
|
156
|
+
pro = @parser_test.tree.find { |i| i[:name] == 'loop'}
|
157
|
+
exp = @test_tree.find { |i| i[:name] == 'loop'}
|
151
158
|
pro.should_not be nil
|
152
159
|
pro.should == exp
|
153
160
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: CoffeeTags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Łukasz Korecki
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-08-
|
12
|
+
date: 2014-08-23 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: CoffeeTags generates ctags compatibile tags for CoffeeScript.
|
15
15
|
email:
|