ParseTree 2.0.2 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +27 -0
- data/bin/parse_tree_show +20 -3
- data/lib/parse_tree.rb +139 -134
- data/lib/sexp.rb +1 -1
- data/lib/sexp_processor.rb +10 -11
- data/lib/unified_ruby.rb +18 -4
- data/test/pt_testcase.rb +1155 -97
- data/test/test_parse_tree.rb +6 -5
- metadata +64 -57
data/test/test_parse_tree.rb
CHANGED
@@ -68,22 +68,23 @@ class TestParseTree < ParseTreeTestCase
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def test_parse_tree_for_string
|
71
|
-
actual = @processor.parse_tree_for_string '1 + nil', '(string)', 1
|
71
|
+
actual = @processor.parse_tree_for_string '1 + nil', '(string)', 1
|
72
72
|
expected = [[:call, [:lit, 1], :+, [:array, [:nil]]]]
|
73
73
|
|
74
74
|
assert_equal expected, actual
|
75
75
|
end
|
76
76
|
|
77
77
|
def test_parse_tree_for_string_with_newlines
|
78
|
-
|
79
|
-
|
80
|
-
|
78
|
+
@processor = ParseTree.new(true)
|
79
|
+
actual = @processor.parse_tree_for_string "1 +\n nil", 'test.rb', 5
|
80
|
+
expected = [[:newline, 6, "test.rb",
|
81
|
+
[:call, [:lit, 1], :+, [:array, [:nil]]]]]
|
81
82
|
|
82
83
|
assert_equal expected, actual
|
83
84
|
end
|
84
85
|
|
85
86
|
def test_parse_tree_for_str
|
86
|
-
actual = @processor.parse_tree_for_str '1 + nil', '(string)', 1
|
87
|
+
actual = @processor.parse_tree_for_str '1 + nil', '(string)', 1
|
87
88
|
expected = [[:call, [:lit, 1], :+, [:array, [:nil]]]]
|
88
89
|
|
89
90
|
assert_equal expected, actual
|
metadata
CHANGED
@@ -1,34 +1,48 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.4
|
3
|
-
specification_version: 1
|
4
2
|
name: ParseTree
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 2.0
|
7
|
-
date: 2007-09-20 00:00:00 -07:00
|
8
|
-
summary: ParseTree is a C extension (using RubyInline) that extracts the parse tree for an entire class or a specific method and returns it as a s-expression (aka sexp) using ruby's arrays, strings, symbols, and integers.
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
- test
|
12
|
-
email: ryand-ruby@zenspider.com
|
13
|
-
homepage: http://www.zenspider.com/ZSS/Products/ParseTree/
|
14
|
-
rubyforge_project: parsetree
|
15
|
-
description: "ParseTree is a C extension (using RubyInline) that extracts the parse tree for an entire class or a specific method and returns it as a s-expression (aka sexp) using ruby's arrays, strings, symbols, and integers. As an example: def conditional1(arg1) if arg1 == 0 then return 1 end return 0 end becomes: [:defn, :conditional1, [:scope, [:block, [:args, :arg1], [:if, [:call, [:lvar, :arg1], :==, [:array, [:lit, 0]]], [:return, [:lit, 1]], nil], [:return, [:lit, 0]]]]] * Uses RubyInline, so it just drops in. * Includes SexpProcessor and CompositeSexpProcessor. * Allows you to write very clean filters. * Includes UnifiedRuby, allowing you to automatically rewrite ruby quirks. * ParseTree#parse_tree_for_string lets you parse arbitrary strings of ruby. * Includes parse_tree_show, which lets you quickly snoop code. * echo \"1+1\" | parse_tree_show -f for quick snippet output. * Includes parse_tree_abc, which lets you get abc metrics on code. * abc metrics = numbers of assignments, branches, and calls. * whitespace independent metric for method complexity. * Includes parse_tree_deps, which shows you basic class level dependencies. * Does not work on the core classes, as they are not ruby (yet)."
|
16
|
-
autorequire:
|
17
|
-
default_executable:
|
18
|
-
bindir: bin
|
19
|
-
has_rdoc: true
|
20
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
21
|
-
requirements:
|
22
|
-
- - ">"
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version: 0.0.0
|
25
|
-
version:
|
4
|
+
version: 2.1.0
|
26
5
|
platform: ruby
|
27
|
-
signing_key:
|
28
|
-
cert_chain:
|
29
|
-
post_install_message:
|
30
6
|
authors:
|
31
7
|
- Ryan Davis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2007-12-22 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: RubyInline
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.6.0
|
23
|
+
version:
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
name: hoe
|
26
|
+
version_requirement:
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 1.4.0
|
32
|
+
version:
|
33
|
+
description: "ParseTree is a C extension (using RubyInline) that extracts the parse tree for an entire class or a specific method and returns it as a s-expression (aka sexp) using ruby's arrays, strings, symbols, and integers. As an example: def conditional1(arg1) if arg1 == 0 then return 1 end return 0 end becomes: [:defn, :conditional1, [:scope, [:block, [:args, :arg1], [:if, [:call, [:lvar, :arg1], :==, [:array, [:lit, 0]]], [:return, [:lit, 1]], nil], [:return, [:lit, 0]]]]] * Uses RubyInline, so it just drops in. * Includes SexpProcessor and CompositeSexpProcessor. * Allows you to write very clean filters. * Includes UnifiedRuby, allowing you to automatically rewrite ruby quirks. * ParseTree#parse_tree_for_string lets you parse arbitrary strings of ruby. * Includes parse_tree_show, which lets you quickly snoop code. * echo \"1+1\" | parse_tree_show -f for quick snippet output. * Includes parse_tree_abc, which lets you get abc metrics on code. * abc metrics = numbers of assignments, branches, and calls. * whitespace independent metric for method complexity. * Includes parse_tree_deps, which shows you basic class level dependencies. * Does not work on the core classes, as they are not ruby (yet)."
|
34
|
+
email: ryand-ruby@zenspider.com
|
35
|
+
executables:
|
36
|
+
- parse_tree_abc
|
37
|
+
- parse_tree_audit
|
38
|
+
- parse_tree_deps
|
39
|
+
- parse_tree_show
|
40
|
+
extensions: []
|
41
|
+
|
42
|
+
extra_rdoc_files:
|
43
|
+
- History.txt
|
44
|
+
- Manifest.txt
|
45
|
+
- README.txt
|
32
46
|
files:
|
33
47
|
- History.txt
|
34
48
|
- Manifest.txt
|
@@ -54,40 +68,33 @@ files:
|
|
54
68
|
- test/test_sexp_processor.rb
|
55
69
|
- test/test_unified_ruby.rb
|
56
70
|
- validate.sh
|
57
|
-
|
58
|
-
|
71
|
+
has_rdoc: true
|
72
|
+
homepage: http://www.zenspider.com/ZSS/Products/ParseTree/
|
73
|
+
post_install_message:
|
59
74
|
rdoc_options:
|
60
75
|
- --main
|
61
76
|
- README.txt
|
62
|
-
|
63
|
-
-
|
64
|
-
-
|
65
|
-
|
66
|
-
|
67
|
-
-
|
68
|
-
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
- test
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: "0"
|
85
|
+
version:
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: "0"
|
91
|
+
version:
|
73
92
|
requirements: []
|
74
93
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: 3.6.0
|
84
|
-
version:
|
85
|
-
- !ruby/object:Gem::Dependency
|
86
|
-
name: hoe
|
87
|
-
version_requirement:
|
88
|
-
version_requirements: !ruby/object:Gem::Version::Requirement
|
89
|
-
requirements:
|
90
|
-
- - ">="
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
version: 1.3.0
|
93
|
-
version:
|
94
|
+
rubyforge_project: parsetree
|
95
|
+
rubygems_version: 1.0.1
|
96
|
+
signing_key:
|
97
|
+
specification_version: 2
|
98
|
+
summary: ParseTree is a C extension (using RubyInline) that extracts the parse tree for an entire class or a specific method and returns it as a s-expression (aka sexp) using ruby's arrays, strings, symbols, and integers.
|
99
|
+
test_files:
|
100
|
+
- test/test_all.rb
|