jsduck 5.0.0.beta4 → 5.0.0.beta5

Sign up to get free protection for your applications and to get access to all the features.
data/jsduck.gemspec CHANGED
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
2
2
  s.required_rubygems_version = ">= 1.3.5"
3
3
 
4
4
  s.name = 'jsduck'
5
- s.version = '5.0.0.beta4'
5
+ s.version = '5.0.0.beta5'
6
6
  s.date = Time.new.strftime('%Y-%m-%d')
7
7
  s.summary = "Simple JavaScript Duckumentation generator"
8
8
  s.description = "Documentation generator for Sencha JS frameworks"
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.add_dependency 'rdiscount'
23
23
  s.add_dependency 'json'
24
24
  s.add_dependency 'parallel'
25
- s.add_dependency 'rkelly-remix', '= 0.0.1'
25
+ s.add_dependency 'rkelly-remix', '~> 0.0.2'
26
26
  s.add_dependency 'dimensions'
27
27
 
28
28
  s.add_development_dependency 'rspec'
@@ -5,10 +5,10 @@ require 'rkelly'
5
5
  module JsDuck
6
6
  module Js
7
7
 
8
- # An alternative JsDuck::Js::Parser implementation that uses
9
- # RKelly instead of Esprima.
10
- class RKellyParser
11
- RKELLY = RKelly::Parser.new
8
+ # A JavaScript parser implementation that uses RKelly and adapts
9
+ # its output to be the same as the old Esprima parser used to
10
+ # produce.
11
+ class Parser
12
12
  ADAPTER = Js::RKellyAdapter.new
13
13
 
14
14
  def initialize(input, options={})
@@ -79,10 +79,10 @@ module JsDuck
79
79
  :this
80
80
  elsif boolean?(ast)
81
81
  "Boolean"
82
- elsif string?(ast)
83
- "String"
84
82
  elsif regexp?(ast)
85
83
  "RegExp"
84
+ elsif string?(ast)
85
+ "String"
86
86
  else
87
87
  :other
88
88
  end
@@ -101,6 +101,13 @@ module JsDuck
101
101
  "left" => adapt_node(node.left),
102
102
  "right" => adapt_node(node.value),
103
103
  })
104
+ when LOGICAL_NODES[node.class]
105
+ make(node, {
106
+ "type" => "LogicalExpression",
107
+ "operator" => LOGICAL_NODES[node.class],
108
+ "left" => adapt_node(node.left),
109
+ "right" => adapt_node(node.value),
110
+ })
104
111
  when UNARY_NODES[node.class]
105
112
  make(node, {
106
113
  "type" => "UnaryExpression",
@@ -257,8 +264,8 @@ module JsDuck
257
264
  when RKelly::Nodes::DoWhileNode == node.class
258
265
  make(node, {
259
266
  "type" => "DoWhileStatement",
260
- "test" => adapt_node(node.left),
261
- "body" => adapt_node(node.value),
267
+ "test" => adapt_node(node.value),
268
+ "body" => adapt_node(node.left),
262
269
  })
263
270
  when RKelly::Nodes::ForNode == node.class
264
271
  make(node, {
@@ -271,7 +278,16 @@ module JsDuck
271
278
  when RKelly::Nodes::ForInNode == node.class
272
279
  make(node, {
273
280
  "type" => "ForInStatement",
274
- "left" => adapt_node(node.left),
281
+ "left" =>
282
+ if node.left.class == RKelly::Nodes::VarDeclNode
283
+ make(node.left, {
284
+ "type" => "VariableDeclaration",
285
+ "kind" => "var",
286
+ "declarations" => [adapt_node(node.left)]
287
+ })
288
+ else
289
+ adapt_node(node.left)
290
+ end,
275
291
  "right" => adapt_node(node.right),
276
292
  "body" => adapt_node(node.value),
277
293
  "each" => false,
@@ -449,7 +465,6 @@ module JsDuck
449
465
  RKelly::Nodes::AddNode => "+",
450
466
  RKelly::Nodes::MultiplyNode => "*",
451
467
  RKelly::Nodes::NotEqualNode => "!=",
452
- RKelly::Nodes::LogicalAndNode => "&&",
453
468
  RKelly::Nodes::UnsignedRightShiftNode => ">>>",
454
469
  RKelly::Nodes::ModulusNode => "%",
455
470
  RKelly::Nodes::NotStrictEqualNode => "!==",
@@ -458,7 +473,6 @@ module JsDuck
458
473
  RKelly::Nodes::GreaterNode => ">",
459
474
  RKelly::Nodes::BitOrNode => "|",
460
475
  RKelly::Nodes::StrictEqualNode => "===",
461
- RKelly::Nodes::LogicalOrNode => "||",
462
476
  RKelly::Nodes::BitXOrNode => "^",
463
477
  RKelly::Nodes::LeftShiftNode => "<"+"<",
464
478
  RKelly::Nodes::EqualNode => "==",
@@ -468,6 +482,11 @@ module JsDuck
468
482
  RKelly::Nodes::RightShiftNode => ">>",
469
483
  }
470
484
 
485
+ LOGICAL_NODES = {
486
+ RKelly::Nodes::LogicalAndNode => "&&",
487
+ RKelly::Nodes::LogicalOrNode => "||",
488
+ }
489
+
471
490
  UNARY_NODES = {
472
491
  RKelly::Nodes::UnaryMinusNode => "-",
473
492
  RKelly::Nodes::UnaryPlusNode => "+",
@@ -94,7 +94,7 @@ module JsDuck
94
94
  ]
95
95
  @ext4_events = nil
96
96
 
97
- @version = "5.0.0.beta4"
97
+ @version = "5.0.0.beta5"
98
98
  # Customizing output
99
99
  @title = "Documentation - JSDuck"
100
100
  @header = "<strong>Documentation</strong> JSDuck"
data/lib/jsduck/parser.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'jsduck/js/rkelly_parser'
1
+ require 'jsduck/js/parser'
2
2
  require 'jsduck/js/ast'
3
3
  require 'jsduck/css/parser'
4
4
  require 'jsduck/doc/parser'
@@ -41,7 +41,7 @@ module JsDuck
41
41
  if filename =~ /\.s?css$/
42
42
  docs = Css::Parser.new(contents, options).parse
43
43
  else
44
- docs = Js::RKellyParser.new(contents, options).parse
44
+ docs = Js::Parser.new(contents, options).parse
45
45
  docs = Js::Ast.new(docs).detect_all!
46
46
  end
47
47
  end
metadata CHANGED
@@ -1,148 +1,152 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: jsduck
3
- version: !ruby/object:Gem::Version
4
- hash: -776968786
3
+ version: !ruby/object:Gem::Version
4
+ version: 5.0.0.beta5
5
5
  prerelease: 6
6
- segments:
7
- - 5
8
- - 0
9
- - 0
10
- - beta
11
- - 4
12
- version: 5.0.0.beta4
13
6
  platform: ruby
14
- authors:
7
+ authors:
15
8
  - Rene Saarsoo
16
9
  - Nick Poulden
17
10
  autorequire:
18
11
  bindir: bin
19
12
  cert_chain: []
20
-
21
- date: 2013-07-04 00:00:00 Z
22
- dependencies:
23
- - !ruby/object:Gem::Dependency
13
+ date: 2013-07-04 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
24
16
  name: rdiscount
25
- prerelease: false
26
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
27
18
  none: false
28
- requirements:
29
- - - ">="
30
- - !ruby/object:Gem::Version
31
- hash: 3
32
- segments:
33
- - 0
34
- version: "0"
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
35
23
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: json
39
24
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
31
+ - !ruby/object:Gem::Dependency
32
+ name: json
33
+ requirement: !ruby/object:Gem::Requirement
41
34
  none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 3
46
- segments:
47
- - 0
48
- version: "0"
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
49
39
  type: :runtime
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- name: parallel
53
40
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: parallel
49
+ requirement: !ruby/object:Gem::Requirement
55
50
  none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 3
60
- segments:
61
- - 0
62
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
63
55
  type: :runtime
64
- version_requirements: *id003
65
- - !ruby/object:Gem::Dependency
66
- name: rkelly-remix
67
56
  prerelease: false
68
- requirement: &id004 !ruby/object:Gem::Requirement
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ - !ruby/object:Gem::Dependency
64
+ name: rkelly-remix
65
+ requirement: !ruby/object:Gem::Requirement
69
66
  none: false
70
- requirements:
71
- - - "="
72
- - !ruby/object:Gem::Version
73
- hash: 29
74
- segments:
75
- - 0
76
- - 0
77
- - 1
78
- version: 0.0.1
67
+ requirements:
68
+ - - ~>
69
+ - !ruby/object:Gem::Version
70
+ version: 0.0.2
79
71
  type: :runtime
80
- version_requirements: *id004
81
- - !ruby/object:Gem::Dependency
82
- name: dimensions
83
72
  prerelease: false
84
- requirement: &id005 !ruby/object:Gem::Requirement
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ~>
77
+ - !ruby/object:Gem::Version
78
+ version: 0.0.2
79
+ - !ruby/object:Gem::Dependency
80
+ name: dimensions
81
+ requirement: !ruby/object:Gem::Requirement
85
82
  none: false
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- hash: 3
90
- segments:
91
- - 0
92
- version: "0"
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
93
87
  type: :runtime
94
- version_requirements: *id005
95
- - !ruby/object:Gem::Dependency
96
- name: rspec
97
88
  prerelease: false
98
- requirement: &id006 !ruby/object:Gem::Requirement
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ - !ruby/object:Gem::Dependency
96
+ name: rspec
97
+ requirement: !ruby/object:Gem::Requirement
99
98
  none: false
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- hash: 3
104
- segments:
105
- - 0
106
- version: "0"
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
107
103
  type: :development
108
- version_requirements: *id006
109
- - !ruby/object:Gem::Dependency
110
- name: rake
111
104
  prerelease: false
112
- requirement: &id007 !ruby/object:Gem::Requirement
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rake
113
+ requirement: !ruby/object:Gem::Requirement
113
114
  none: false
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- hash: 3
118
- segments:
119
- - 0
120
- version: "0"
115
+ requirements:
116
+ - - ! '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
121
119
  type: :development
122
- version_requirements: *id007
123
- - !ruby/object:Gem::Dependency
124
- name: compass
125
120
  prerelease: false
126
- requirement: &id008 !ruby/object:Gem::Requirement
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ! '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ - !ruby/object:Gem::Dependency
128
+ name: compass
129
+ requirement: !ruby/object:Gem::Requirement
127
130
  none: false
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- hash: 3
132
- segments:
133
- - 0
134
- version: "0"
131
+ requirements:
132
+ - - ! '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
135
  type: :development
136
- version_requirements: *id008
136
+ prerelease: false
137
+ version_requirements: !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
137
143
  description: Documentation generator for Sencha JS frameworks
138
144
  email: rene.saarsoo@sencha.com
139
- executables:
145
+ executables:
140
146
  - jsduck
141
147
  extensions: []
142
-
143
148
  extra_rdoc_files: []
144
-
145
- files:
149
+ files:
146
150
  - .gitignore
147
151
  - .travis.yml
148
152
  - COPYING
@@ -223,10 +227,10 @@ files:
223
227
  - lib/jsduck/js/method_calls.rb
224
228
  - lib/jsduck/js/node.rb
225
229
  - lib/jsduck/js/node_array.rb
230
+ - lib/jsduck/js/parser.rb
226
231
  - lib/jsduck/js/property.rb
227
232
  - lib/jsduck/js/returns.rb
228
233
  - lib/jsduck/js/rkelly_adapter.rb
229
- - lib/jsduck/js/rkelly_parser.rb
230
234
  - lib/jsduck/js/scoped_traverser.rb
231
235
  - lib/jsduck/js/serializer.rb
232
236
  - lib/jsduck/js/utils.rb
@@ -351,7 +355,7 @@ files:
351
355
  - template-min/template.html
352
356
  - template-min/favicon.ico
353
357
  - template-min/print-template.html
354
- - template-min/app-9e2b5792598a6c48013dbd19f7a176ad.js
358
+ - template-min/app-437ace20e4b34ff36bb9071208984e6d.js
355
359
  - template-min/extjs/ext-all.js
356
360
  - template-min/extjs/resources/themes/images/default/dd/drop-add.gif
357
361
  - template-min/extjs/resources/themes/images/default/dd/drop-no.gif
@@ -774,38 +778,26 @@ files:
774
778
  - template-min/mobile-redirect.js
775
779
  homepage: https://github.com/senchalabs/jsduck
776
780
  licenses: []
777
-
778
781
  post_install_message:
779
782
  rdoc_options: []
780
-
781
- require_paths:
783
+ require_paths:
782
784
  - lib
783
- required_ruby_version: !ruby/object:Gem::Requirement
785
+ required_ruby_version: !ruby/object:Gem::Requirement
784
786
  none: false
785
- requirements:
786
- - - ">="
787
- - !ruby/object:Gem::Version
788
- hash: 3
789
- segments:
790
- - 0
791
- version: "0"
792
- required_rubygems_version: !ruby/object:Gem::Requirement
787
+ requirements:
788
+ - - ! '>='
789
+ - !ruby/object:Gem::Version
790
+ version: '0'
791
+ required_rubygems_version: !ruby/object:Gem::Requirement
793
792
  none: false
794
- requirements:
795
- - - ">"
796
- - !ruby/object:Gem::Version
797
- hash: 25
798
- segments:
799
- - 1
800
- - 3
801
- - 1
793
+ requirements:
794
+ - - ! '>'
795
+ - !ruby/object:Gem::Version
802
796
  version: 1.3.1
803
797
  requirements: []
804
-
805
798
  rubyforge_project: jsduck
806
799
  rubygems_version: 1.8.24
807
800
  signing_key:
808
801
  specification_version: 3
809
802
  summary: Simple JavaScript Duckumentation generator
810
803
  test_files: []
811
-