comment-ripper 0.0.2 → 0.1.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.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/Gemfile +3 -0
- data/Rakefile +1 -19
- data/VERSION +1 -0
- data/bin/DEADJOE +40 -0
- data/bin/rip-comments +20 -17
- data/bin/rip-comments~ +21 -19
- data/lib/exceptions.rb +11 -0
- data/lib/javascript/comment_stripper.rb +25 -0
- data/lib/javascript/lexer.rb +182 -0
- data/lib/tokens/comments.rb +24 -0
- data/lib/tokens/quotes.rb +12 -0
- data/lib/tokens/special.rb +5 -0
- data/lib/tokens/token.rb +80 -0
- data/lib/tokens/whitespace.rb +11 -0
- data/lib/tokens/words.rb +13 -0
- data/spec/comment-ripper_spec.rb +213 -11
- data/spec/sample_data/swfobject_src.expected.js +708 -0
- data/spec/sample_data/swfobject_src.js +777 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +1 -2
- metadata +28 -21
- data/lib/grammars/javascript.tt +0 -35
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
CHANGED
@@ -17,8 +17,7 @@ Bundler.require(:default, :test)
|
|
17
17
|
|
18
18
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
19
19
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
20
|
-
|
21
|
-
require 'comment-ripper'
|
20
|
+
#$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib', 'grammars', 'generated_parsers'))
|
22
21
|
require 'spec'
|
23
22
|
require 'spec/autorun'
|
24
23
|
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
+
- 1
|
7
8
|
- 0
|
8
|
-
|
9
|
-
version: 0.0.2
|
9
|
+
version: 0.1.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Max Aller
|
@@ -14,26 +14,13 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-04-08 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
21
|
-
name: treetop
|
22
|
-
prerelease: false
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 1
|
29
|
-
- 4
|
30
|
-
version: "1.4"
|
31
|
-
type: :runtime
|
32
|
-
version_requirements: *id001
|
33
20
|
- !ruby/object:Gem::Dependency
|
34
21
|
name: rspec
|
35
22
|
prerelease: false
|
36
|
-
requirement: &
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
37
24
|
requirements:
|
38
25
|
- - ">="
|
39
26
|
- !ruby/object:Gem::Version
|
@@ -43,22 +30,42 @@ dependencies:
|
|
43
30
|
- 9
|
44
31
|
version: 1.2.9
|
45
32
|
type: :development
|
46
|
-
version_requirements: *
|
33
|
+
version_requirements: *id001
|
47
34
|
description: Strip comments from your source files. Useful removing potentially sensitive files before transferring to, say, clients, while preserving some readability.
|
48
35
|
email: nanodeath@gmail.com
|
49
36
|
executables:
|
50
37
|
- rip-comments
|
38
|
+
- DEADJOE
|
51
39
|
- rip-comments~
|
52
40
|
- test.js~
|
53
|
-
extensions:
|
54
|
-
|
41
|
+
extensions: []
|
42
|
+
|
55
43
|
extra_rdoc_files:
|
56
44
|
- LICENSE
|
57
45
|
- README.rdoc
|
58
46
|
files:
|
59
|
-
-
|
47
|
+
- .document
|
48
|
+
- .gitignore
|
49
|
+
- Gemfile
|
60
50
|
- LICENSE
|
61
51
|
- README.rdoc
|
52
|
+
- Rakefile
|
53
|
+
- VERSION
|
54
|
+
- bin/rip-comments
|
55
|
+
- lib/exceptions.rb
|
56
|
+
- lib/javascript/comment_stripper.rb
|
57
|
+
- lib/javascript/lexer.rb
|
58
|
+
- lib/tokens/comments.rb
|
59
|
+
- lib/tokens/quotes.rb
|
60
|
+
- lib/tokens/special.rb
|
61
|
+
- lib/tokens/token.rb
|
62
|
+
- lib/tokens/whitespace.rb
|
63
|
+
- lib/tokens/words.rb
|
64
|
+
- spec/comment-ripper_spec.rb
|
65
|
+
- spec/sample_data/swfobject_src.expected.js
|
66
|
+
- spec/sample_data/swfobject_src.js
|
67
|
+
- spec/spec.opts
|
68
|
+
- spec/spec_helper.rb
|
62
69
|
has_rdoc: true
|
63
70
|
homepage: http://github.com/nanodeath/comment-ripper
|
64
71
|
licenses: []
|
data/lib/grammars/javascript.tt
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
grammar Javascript
|
2
|
-
rule monkey
|
3
|
-
(one_line_comment / multi_line_comment / code)* {
|
4
|
-
def value
|
5
|
-
elements.map do |e|
|
6
|
-
e.value if e.respond_to? :value
|
7
|
-
end.join
|
8
|
-
end
|
9
|
-
}
|
10
|
-
end
|
11
|
-
|
12
|
-
rule one_line_comment
|
13
|
-
newline? ' '* '//' (!newline . )+ newline?
|
14
|
-
end
|
15
|
-
|
16
|
-
rule multi_line_comment
|
17
|
-
'/*' (!'*/' . )* '*/'
|
18
|
-
end
|
19
|
-
|
20
|
-
rule code
|
21
|
-
(!(one_line_comment / multi_line_comment) . )+ {
|
22
|
-
def value
|
23
|
-
text_value
|
24
|
-
end
|
25
|
-
}
|
26
|
-
end
|
27
|
-
|
28
|
-
rule newline
|
29
|
-
"\n" {
|
30
|
-
def value
|
31
|
-
text_value
|
32
|
-
end
|
33
|
-
}
|
34
|
-
end
|
35
|
-
end
|