sexp_path 0.5.0 → 0.5.1
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/Gemfile +1 -6
- data/README.rdoc +6 -2
- data/examples/print_methods.rb +1 -2
- data/examples/sexp_grep.rb +1 -3
- data/lib/sexp_path.rb +2 -4
- data/test/sexp_path_capture_test.rb +1 -1
- data/test/sexp_path_matching_test.rb +1 -1
- data/test/sexp_replacement_test.rb +1 -1
- data/test/use_case_test.rb +2 -1
- metadata +57 -115
- data/Gemfile.lock +0 -30
- data/Rakefile +0 -41
- data/TODO +0 -3
- data/VERSION.yml +0 -5
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -86,6 +86,10 @@ into SexpPath.
|
|
86
86
|
-s(:a) => s(:a,:b), s(:b), but not s(:a)
|
87
87
|
s(is_not :a) => s(:b), s(:c), but not s(:a) or s(:a, :b)
|
88
88
|
|
89
|
+
[Remaining] Matches the remainder of an s-expression.
|
90
|
+
|
91
|
+
s(:a, ___) => s(:a), s(:a, :b, :c), but not s(:b)
|
92
|
+
|
89
93
|
== Searching
|
90
94
|
|
91
95
|
You may use any SexpPath to search an S-Expression. SexpPath defines the `/` operator as search,
|
@@ -127,7 +131,6 @@ in `method_name`.
|
|
127
131
|
Here is an example of using SexpPath to grab all the classes and their methods from
|
128
132
|
a file:
|
129
133
|
|
130
|
-
require 'rubygems'
|
131
134
|
require 'sexp_path'
|
132
135
|
require 'ruby_parser' # `gem install ruby_parser`
|
133
136
|
|
@@ -164,4 +167,5 @@ Ideas for Hacking on SexpPath:
|
|
164
167
|
|
165
168
|
I'd love to see what people do with this library, let me know if you find it useful.
|
166
169
|
|
167
|
-
Adam Sanderson, netghost@gmail.com
|
170
|
+
Adam Sanderson, netghost@gmail.com
|
171
|
+
http://monkeyandcrow.com
|
data/examples/print_methods.rb
CHANGED
data/examples/sexp_grep.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
|
-
|
2
|
-
require File.dirname(__FILE__) + '/../lib/sexp_path'
|
1
|
+
require_relative '../lib/sexp_path'
|
3
2
|
require 'ruby_parser'
|
4
3
|
|
5
4
|
# Example program, this will scan a file for anything
|
6
5
|
# matching the Sexp passed in.
|
7
6
|
|
8
|
-
|
9
7
|
pattern = ARGV.shift
|
10
8
|
paths = ARGV
|
11
9
|
|
data/lib/sexp_path.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'rubygems'
|
2
1
|
require 'sexp_processor'
|
3
2
|
|
4
3
|
module SexpPath
|
@@ -10,14 +9,13 @@ module SexpPath
|
|
10
9
|
end
|
11
10
|
end
|
12
11
|
|
13
|
-
sexp_path_root = File.dirname(__FILE__)+'/sexp_path/'
|
14
12
|
%w[
|
15
13
|
traverse
|
16
14
|
sexp_query_builder
|
17
15
|
ruby_query_builder
|
18
16
|
sexp_result
|
19
17
|
sexp_collection
|
20
|
-
|
18
|
+
|
21
19
|
matcher/base
|
22
20
|
matcher/any
|
23
21
|
matcher/all
|
@@ -33,7 +31,7 @@ sexp_path_root = File.dirname(__FILE__)+'/sexp_path/'
|
|
33
31
|
matcher/sibling
|
34
32
|
|
35
33
|
].each do |path|
|
36
|
-
|
34
|
+
require_relative "./sexp_path/#{path}"
|
37
35
|
end
|
38
36
|
|
39
37
|
# Pattern building helper, see SexpQueryBuilder
|
data/test/use_case_test.rb
CHANGED
metadata
CHANGED
@@ -1,109 +1,55 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: sexp_path
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 5
|
8
|
-
- 0
|
9
|
-
version: 0.5.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.1
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Adam Sanderson
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
21
|
-
name: sexp_path
|
12
|
+
date: 2013-07-23 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: sexp_processor
|
22
16
|
prerelease: false
|
23
|
-
requirement:
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '4.2'
|
24
22
|
none: false
|
25
|
-
requirements:
|
26
|
-
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 0
|
30
|
-
version: "0"
|
31
23
|
type: :runtime
|
32
|
-
version_requirements:
|
33
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '4.2'
|
29
|
+
none: false
|
30
|
+
- !ruby/object:Gem::Dependency
|
34
31
|
name: ruby_parser
|
35
32
|
prerelease: false
|
36
|
-
requirement:
|
37
|
-
|
38
|
-
requirements:
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
39
35
|
- - ~>
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
|
42
|
-
- 3
|
43
|
-
- 1
|
44
|
-
version: "3.1"
|
45
|
-
type: :development
|
46
|
-
version_requirements: *id002
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: jeweler
|
49
|
-
prerelease: false
|
50
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '3.2'
|
51
38
|
none: false
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
segments:
|
56
|
-
- 0
|
57
|
-
version: "0"
|
58
39
|
type: :development
|
59
|
-
version_requirements:
|
60
|
-
|
61
|
-
name: sexp_processor
|
62
|
-
prerelease: false
|
63
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
64
|
-
none: false
|
65
|
-
requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
66
42
|
- - ~>
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
|
69
|
-
- 3
|
70
|
-
- 0
|
71
|
-
version: "3.0"
|
72
|
-
type: :runtime
|
73
|
-
version_requirements: *id004
|
74
|
-
- !ruby/object:Gem::Dependency
|
75
|
-
name: ruby_parser
|
76
|
-
prerelease: false
|
77
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '3.2'
|
78
45
|
none: false
|
79
|
-
|
80
|
-
- - ~>
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
segments:
|
83
|
-
- 2
|
84
|
-
- 0
|
85
|
-
version: "2.0"
|
86
|
-
type: :development
|
87
|
-
version_requirements: *id005
|
88
|
-
description: " Allows you to do example based pattern matching and queries against S Expressions (sexp).\n"
|
46
|
+
description: Example based structural pattern matching for S-Expressions
|
89
47
|
email: netghost@gmail.com
|
90
48
|
executables: []
|
91
|
-
|
92
49
|
extensions: []
|
93
|
-
|
94
|
-
extra_rdoc_files:
|
50
|
+
extra_rdoc_files:
|
95
51
|
- README.rdoc
|
96
|
-
|
97
|
-
files:
|
98
|
-
- Gemfile
|
99
|
-
- Gemfile.lock
|
100
|
-
- README.rdoc
|
101
|
-
- Rakefile
|
102
|
-
- TODO
|
103
|
-
- VERSION.yml
|
104
|
-
- examples/print_methods.rb
|
105
|
-
- examples/sexp_grep.rb
|
106
|
-
- lib/sexp_path.rb
|
52
|
+
files:
|
107
53
|
- lib/sexp_path/matcher/all.rb
|
108
54
|
- lib/sexp_path/matcher/any.rb
|
109
55
|
- lib/sexp_path/matcher/atom.rb
|
@@ -122,45 +68,41 @@ files:
|
|
122
68
|
- lib/sexp_path/sexp_query_builder.rb
|
123
69
|
- lib/sexp_path/sexp_result.rb
|
124
70
|
- lib/sexp_path/traverse.rb
|
71
|
+
- lib/sexp_path.rb
|
72
|
+
- examples/print_methods.rb
|
73
|
+
- examples/sexp_grep.rb
|
125
74
|
- test/sample.rb
|
126
75
|
- test/sexp_path_capture_test.rb
|
127
76
|
- test/sexp_path_matching_test.rb
|
128
77
|
- test/sexp_replacement_test.rb
|
129
78
|
- test/use_case_test.rb
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
79
|
+
- README.rdoc
|
80
|
+
- Gemfile
|
81
|
+
homepage: https://github.com/adamsanderson/sexp_path
|
82
|
+
licenses:
|
83
|
+
- MIT
|
134
84
|
post_install_message:
|
135
|
-
rdoc_options:
|
136
|
-
|
137
|
-
|
85
|
+
rdoc_options:
|
86
|
+
- --main
|
87
|
+
- README.rdoc
|
88
|
+
require_paths:
|
138
89
|
- lib
|
139
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '1.9'
|
140
95
|
none: false
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
version: "0"
|
147
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ! '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
148
101
|
none: false
|
149
|
-
requirements:
|
150
|
-
- - ">="
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
segments:
|
153
|
-
- 0
|
154
|
-
version: "0"
|
155
102
|
requirements: []
|
156
|
-
|
157
103
|
rubyforge_project:
|
158
|
-
rubygems_version: 1.
|
104
|
+
rubygems_version: 1.8.24
|
159
105
|
signing_key:
|
160
106
|
specification_version: 3
|
161
|
-
summary: Pattern matching for S-Expressions
|
162
|
-
test_files:
|
163
|
-
- test/sexp_path_capture_test.rb
|
164
|
-
- test/sexp_path_matching_test.rb
|
165
|
-
- test/sexp_replacement_test.rb
|
166
|
-
- test/use_case_test.rb
|
107
|
+
summary: Pattern matching for S-Expressions
|
108
|
+
test_files: []
|
data/Gemfile.lock
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
sexp_path (0.4.6)
|
5
|
-
sexp_processor (~> 4.2)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
git (1.2.5)
|
11
|
-
jeweler (1.8.4)
|
12
|
-
bundler (~> 1.0)
|
13
|
-
git (>= 1.2.5)
|
14
|
-
rake
|
15
|
-
rdoc
|
16
|
-
json (1.8.0)
|
17
|
-
rake (10.1.0)
|
18
|
-
rdoc (4.0.1)
|
19
|
-
json (~> 1.4)
|
20
|
-
ruby_parser (3.1.3)
|
21
|
-
sexp_processor (~> 4.1)
|
22
|
-
sexp_processor (4.2.1)
|
23
|
-
|
24
|
-
PLATFORMS
|
25
|
-
ruby
|
26
|
-
|
27
|
-
DEPENDENCIES
|
28
|
-
jeweler
|
29
|
-
ruby_parser (~> 3.1)
|
30
|
-
sexp_path!
|
data/Rakefile
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/testtask'
|
3
|
-
require 'rdoc/task'
|
4
|
-
|
5
|
-
begin
|
6
|
-
require 'jeweler'
|
7
|
-
|
8
|
-
Jeweler::Tasks.new do |s|
|
9
|
-
s.name = "sexp_path"
|
10
|
-
s.summary = "Pattern matching for S-Expressions (sexp)."
|
11
|
-
s.description = <<-DESC
|
12
|
-
Allows you to do example based pattern matching and queries against S Expressions (sexp).
|
13
|
-
DESC
|
14
|
-
s.email = "netghost@gmail.com"
|
15
|
-
s.homepage = "http://github.com/adamsanderson/sexp_path"
|
16
|
-
s.authors = ["Adam Sanderson"]
|
17
|
-
s.files = FileList["[A-Z]*", "{bin,lib,test,examples}/**/*"]
|
18
|
-
|
19
|
-
s.add_dependency 'sexp_processor', '~> 3.0'
|
20
|
-
|
21
|
-
# Testing
|
22
|
-
s.test_files = FileList["test/**/*_test.rb"]
|
23
|
-
s.add_development_dependency 'ruby_parser', '~> 2.0'
|
24
|
-
end
|
25
|
-
|
26
|
-
rescue LoadError
|
27
|
-
puts "Jeweler not available. Install it for jeweler-related tasks with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
28
|
-
end
|
29
|
-
|
30
|
-
Rake::RDocTask.new do |t|
|
31
|
-
t.main = "README.rdoc"
|
32
|
-
t.rdoc_files.include("README.rdoc", "lib/**/*.rb")
|
33
|
-
end
|
34
|
-
|
35
|
-
Rake::TestTask.new do |t|
|
36
|
-
t.libs << 'lib'
|
37
|
-
t.pattern = 'test/**/*_test.rb'
|
38
|
-
t.verbose = false
|
39
|
-
end
|
40
|
-
|
41
|
-
task :default => :test
|
data/TODO
DELETED