CoffeeTags 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,7 +23,9 @@ module Coffeetags
23
23
  @token_regex = /([@a-zA-Z0-9_]*)\s*[:=]{1}/
24
24
  @iterator_regex = /^\s*for\s*([a-zA-Z0-9_]*)\s*/
25
25
  @comment_regex = /^\s*#/
26
- @block_comment_regex = /^\s*###/
26
+ @start_block_comment_regex = /^\s*###/
27
+ @end_block_comment_regex = /^.*###/
28
+ @oneline_block_comment_regex = /^\s*###.*###/
27
29
  @comment_lines = mark_commented_lines
28
30
  end
29
31
 
@@ -34,12 +36,18 @@ module Coffeetags
34
36
  [].tap do |reg|
35
37
  in_block_comment = false
36
38
  line_no = 0
39
+ start_block = 0
40
+ end_block = 0
37
41
  @source.each_line do |line|
38
42
  line_no = line_no+1
39
43
 
40
- in_block_comment = !(in_block_comment) if line =~ @block_comment_regex
41
- reg << line_no if in_block_comment
42
- reg << line_no if line =~ @comment_regex and not in_block_comment
44
+ start_block = line_no if !in_block_comment and line =~ @start_block_comment_regex
45
+ end_block = line_no if start_block < line_no and line =~ @end_block_comment_regex
46
+ end_block = line_no if line =~ @oneline_block_comment_regex
47
+
48
+ in_block_comment = end_block < start_block
49
+
50
+ reg << line_no if in_block_comment or end_block == line_no or line =~ @comment_regex
43
51
  end
44
52
  end
45
53
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Coffeetags
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
@@ -5,3 +5,22 @@ echoes
5
5
  ###
6
6
 
7
7
  echo2 :-> console.log 'echo'
8
+
9
+ ### One line blockcomment ###
10
+ foo2 : (x) -> console.log 'bar #{x}'
11
+
12
+ ###
13
+ not so well formatted blockcomment
14
+ echo4 :-> console.log 'echo4' ###
15
+ baz : (x, y) ->
16
+ console.log 'baz #{x} : #{y}'
17
+
18
+ ###
19
+ well formatted
20
+ block comment
21
+ ###
22
+
23
+ echo3 :-> console.log 'echo'
24
+
25
+ ### One line blockcomment ###
26
+ foo : (x) -> console.log 'bar #{x}'
@@ -3,5 +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.1.0 //
6
+ !_TAG_PROGRAM_VERSION 0.1.2 //
7
+ baz spec/fixtures/blockcomment.coffee /^baz : (x, y) ->$/;" f lineno:15 object:window type:function
7
8
  echo2 spec/fixtures/blockcomment.coffee /^echo2 :-> console.log 'echo'$/;" f lineno:7 object:window type:function
9
+ echo3 spec/fixtures/blockcomment.coffee /^echo3 :-> console.log 'echo'$/;" f lineno:23 object:window type:function
10
+ foo spec/fixtures/blockcomment.coffee /^foo : (x) -> console.log 'bar #{x}'$/;" f lineno:26 object:window type:function
11
+ foo2 spec/fixtures/blockcomment.coffee /^foo2 : (x) -> console.log 'bar #{x}'$/;" f lineno:10 object:window type:function
@@ -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.1.0 //
6
+ !_TAG_PROGRAM_VERSION 0.1.1 //
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,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.1.0 //
6
+ !_TAG_PROGRAM_VERSION 0.1.2 //
7
7
  @filter spec/fixtures/test.coffee /^ @filter = ->$/;" f lineno:14 object:Wat.ho type:function
8
8
  _loop spec/fixtures/test.coffee /^_loop = (x) ->$/;" f lineno:19 object:window type:function
9
9
  beam_magnum spec/fixtures/test.coffee /^beam_magnum : -> deployed(true)$/;" f lineno:44 object:window type:function
@@ -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.1.0 //
6
+ !_TAG_PROGRAM_VERSION 0.1.2 //
7
7
  @filter spec/fixtures/test.coffee /^ @filter = ->$/;" f lineno:14 object:Wat.ho type:function
8
8
  _loop spec/fixtures/test.coffee /^_loop = (x) ->$/;" f lineno:19 object:window type:function
9
9
  beam_magnum spec/fixtures/test.coffee /^beam_magnum : -> deployed(true)$/;" f lineno:44 object:window type:function
data/spec/parser_spec.rb CHANGED
@@ -186,7 +186,37 @@ describe 'CoffeeTags::Parser' do
186
186
  :source=>"echo2 :-> console.log 'echo'",
187
187
  :line=>7,
188
188
  :kind=>"f",
189
- :name=>"echo2"}]
189
+ :name=>"echo2"},
190
+ {:level=>0,
191
+ :parent=>"window",
192
+ :source=>"foo2 : (x) -> console.log 'bar \#{x}'",
193
+ :line=>10,
194
+ :kind=>"f",
195
+ :name=>"foo2"},
196
+ {:level=>0,
197
+ :parent=>"window",
198
+ :source=>"baz : (x, y) ->",
199
+ :line=>15,
200
+ :kind=>"f",
201
+ :name=>"baz"},
202
+ {:level=>2,
203
+ :parent=>"baz",
204
+ :source=>" console.log 'baz \#{x} : \#{y}'",
205
+ :line=>16,
206
+ :kind=>"o",
207
+ :name=>""},
208
+ {:level=>0,
209
+ :parent=>"window",
210
+ :source=>"echo3 :-> console.log 'echo'",
211
+ :line=>23,
212
+ :kind=>"f",
213
+ :name=>"echo3"},
214
+ {:level=>0,
215
+ :parent=>"window",
216
+ :source=>"foo : (x) -> console.log 'bar \#{x}'",
217
+ :line=>26,
218
+ :kind=>"f",
219
+ :name=>"foo"}]
190
220
  }
191
221
 
192
222
  subject {
@@ -196,7 +226,9 @@ describe 'CoffeeTags::Parser' do
196
226
  }
197
227
 
198
228
  it 'ignores block comments when parsing the contents' do
199
- subject.tree.first.should == blockcomment_tree.first
229
+ subject.tree.zip(blockcomment_tree).each do |subject_node, blockcomment_node|
230
+ subject_node.should == blockcomment_node
231
+ end
200
232
  end
201
233
 
202
234
 
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: CoffeeTags
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
5
4
  prerelease:
5
+ version: 0.1.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Łukasz Korecki
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-14 00:00:00.000000000 Z
12
+ date: 2013-07-31 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: CoffeeTags generates ctags compatibile tags for CoffeeScript.
15
15
  email:
@@ -60,38 +60,27 @@ rdoc_options: []
60
60
  require_paths:
61
61
  - lib
62
62
  required_ruby_version: !ruby/object:Gem::Requirement
63
- none: false
64
63
  requirements:
65
64
  - - ! '>='
66
65
  - !ruby/object:Gem::Version
66
+ segments:
67
+ - 0
68
+ hash: 2580621725479967409
67
69
  version: '0'
68
- required_rubygems_version: !ruby/object:Gem::Requirement
69
70
  none: false
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
72
  requirements:
71
73
  - - ! '>='
72
74
  - !ruby/object:Gem::Version
75
+ segments:
76
+ - 0
77
+ hash: 2580621725479967409
73
78
  version: '0'
79
+ none: false
74
80
  requirements: []
75
81
  rubyforge_project: CoffeeTags
76
- rubygems_version: 1.8.24
82
+ rubygems_version: 1.8.25
77
83
  signing_key:
78
84
  specification_version: 3
79
85
  summary: tags generator for CoffeeScript
80
- test_files:
81
- - spec/coffeetags_spec.rb
82
- - spec/fixtures/blockcomment.coffee
83
- - spec/fixtures/blockcomment.ctags
84
- - spec/fixtures/campfire.coffee
85
- - spec/fixtures/campfire.js
86
- - spec/fixtures/campfire.js.tags
87
- - spec/fixtures/class_with_at.coffee
88
- - spec/fixtures/class_with_dot.coffee
89
- - spec/fixtures/exported_class.coffee
90
- - spec/fixtures/out.test-two.ctags
91
- - spec/fixtures/out.test.ctags
92
- - spec/fixtures/test.coffee
93
- - spec/fixtures/test_tree.yaml
94
- - spec/fixtures/tree.yaml
95
- - spec/formatter_spec.rb
96
- - spec/parser_spec.rb
97
- - spec/spec_helper.rb
86
+ test_files: []