ripper 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +5 -1
- data/ext/parse.y +1 -1
- data/test/test_ripper.rb +14 -0
- metadata +13 -11
- data/ext/Makefile +0 -195
data/Rakefile
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake/gempackagetask'
|
3
|
+
require 'rake/testtask'
|
3
4
|
|
4
5
|
WINDOWS = (PLATFORM =~ /win32|cygwin/ ? true : false) rescue false
|
5
6
|
SUDO = WINDOWS ? '' : 'sudo'
|
6
7
|
|
7
8
|
desc "Builds the gem"
|
8
9
|
task :gem do
|
9
|
-
sh "cd ext
|
10
|
+
sh "cd ext; make clean; rm Makefile; echo"
|
10
11
|
load 'ripper.gemspec'
|
11
12
|
Gem::Builder.new(SPEC).build
|
12
13
|
end
|
@@ -20,3 +21,6 @@ desc 'Build the extension'
|
|
20
21
|
task :build do
|
21
22
|
sh "cd ext && ruby extconf.rb && make clean && make"
|
22
23
|
end
|
24
|
+
|
25
|
+
Rake::TestTask.new
|
26
|
+
|
data/ext/parse.y
CHANGED
data/test/test_ripper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "test/unit"
|
2
|
+
require File.dirname(__FILE__) + '/../lib/ripper'
|
3
|
+
|
4
|
+
class TestRipper < Test::Unit::TestCase
|
5
|
+
def test_ripper
|
6
|
+
sexp = Ripper.sexp("module Foo; def v=(value) value += 1 end end")
|
7
|
+
assert_equal sexp, [:program,
|
8
|
+
[[:module, [:const_ref, [:@const, "Foo", [1, 7]]], [:bodystmt, [[:void_stmt],
|
9
|
+
[:def, [:@ident, "v=", [1, 16]], [:paren, [:params, [[:@ident, "value", [1, 19]]],
|
10
|
+
nil, nil, nil, nil]], [:bodystmt, [[:opassign, [:var_field, [:@ident, "value",
|
11
|
+
[1, 26]]], [:@op, "+=", [1, 32]], [:@int, "1", [1, 35]]]], nil, nil, nil]]],
|
12
|
+
nil, nil, nil]]]]
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ripper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Loren Segal
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-01-
|
19
|
+
date: 2011-01-24 00:00:00 -05:00
|
20
20
|
default_executable:
|
21
21
|
dependencies: []
|
22
22
|
|
@@ -45,7 +45,6 @@ files:
|
|
45
45
|
- ext/id.c
|
46
46
|
- ext/id.h
|
47
47
|
- ext/lex.c
|
48
|
-
- ext/Makefile
|
49
48
|
- ext/parse.h
|
50
49
|
- ext/parse.y
|
51
50
|
- ext/tools/generate-param-macros.rb
|
@@ -53,6 +52,7 @@ files:
|
|
53
52
|
- ext/tools/preproc.rb
|
54
53
|
- ext/tools/strip.rb
|
55
54
|
- ext/tools/ytab.sed
|
55
|
+
- test/test_ripper.rb
|
56
56
|
- Rakefile
|
57
57
|
- README
|
58
58
|
has_rdoc: true
|
@@ -68,12 +68,14 @@ require_paths:
|
|
68
68
|
required_ruby_version: !ruby/object:Gem::Requirement
|
69
69
|
none: false
|
70
70
|
requirements:
|
71
|
-
- -
|
71
|
+
- - ~>
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
hash:
|
73
|
+
hash: 57
|
74
74
|
segments:
|
75
|
-
-
|
76
|
-
|
75
|
+
- 1
|
76
|
+
- 8
|
77
|
+
- 7
|
78
|
+
version: 1.8.7
|
77
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
80
|
none: false
|
79
81
|
requirements:
|
@@ -90,5 +92,5 @@ rubygems_version: 1.4.0
|
|
90
92
|
signing_key:
|
91
93
|
specification_version: 3
|
92
94
|
summary: Ripper parses Ruby source and tokenizes or builds an AST
|
93
|
-
test_files:
|
94
|
-
|
95
|
+
test_files:
|
96
|
+
- test/test_ripper.rb
|
data/ext/Makefile
DELETED
@@ -1,195 +0,0 @@
|
|
1
|
-
|
2
|
-
SHELL = /bin/sh
|
3
|
-
|
4
|
-
#### Start of system configuration section. ####
|
5
|
-
|
6
|
-
srcdir = .
|
7
|
-
topdir = /usr/local/lib/ruby/1.8/i686-darwin10.0.0
|
8
|
-
hdrdir = $(topdir)
|
9
|
-
VPATH = $(srcdir):$(topdir):$(hdrdir)
|
10
|
-
exec_prefix = $(prefix)
|
11
|
-
prefix = $(DESTDIR)/usr/local
|
12
|
-
sharedstatedir = $(prefix)/com
|
13
|
-
mandir = $(datarootdir)/man
|
14
|
-
psdir = $(docdir)
|
15
|
-
oldincludedir = $(DESTDIR)/usr/include
|
16
|
-
localedir = $(datarootdir)/locale
|
17
|
-
bindir = $(exec_prefix)/bin
|
18
|
-
libexecdir = $(exec_prefix)/libexec
|
19
|
-
sitedir = $(libdir)/ruby/site_ruby
|
20
|
-
htmldir = $(docdir)
|
21
|
-
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
22
|
-
includedir = $(prefix)/include
|
23
|
-
infodir = $(datarootdir)/info
|
24
|
-
vendorlibdir = $(vendordir)/$(ruby_version)
|
25
|
-
sysconfdir = $(prefix)/etc
|
26
|
-
libdir = $(exec_prefix)/lib
|
27
|
-
sbindir = $(exec_prefix)/sbin
|
28
|
-
rubylibdir = $(libdir)/ruby/$(ruby_version)
|
29
|
-
docdir = $(datarootdir)/doc/$(PACKAGE)
|
30
|
-
dvidir = $(docdir)
|
31
|
-
vendordir = $(libdir)/ruby/vendor_ruby
|
32
|
-
datarootdir = $(prefix)/share
|
33
|
-
pdfdir = $(docdir)
|
34
|
-
archdir = $(rubylibdir)/$(arch)
|
35
|
-
sitearchdir = $(sitelibdir)/$(sitearch)
|
36
|
-
datadir = $(datarootdir)
|
37
|
-
localstatedir = $(prefix)/var
|
38
|
-
sitelibdir = $(sitedir)/$(ruby_version)
|
39
|
-
|
40
|
-
CC = gcc
|
41
|
-
LIBRUBY = $(LIBRUBY_A)
|
42
|
-
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
43
|
-
LIBRUBYARG_SHARED =
|
44
|
-
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
|
45
|
-
|
46
|
-
RUBY_EXTCONF_H =
|
47
|
-
CFLAGS = -fno-common -g -O2 -pipe -fno-common $(cflags)
|
48
|
-
INCFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir) -I$(srcdir)/backports
|
49
|
-
DEFS =
|
50
|
-
CPPFLAGS = -DRIPPER -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags)
|
51
|
-
CXXFLAGS = $(CFLAGS)
|
52
|
-
ldflags = -L.
|
53
|
-
dldflags =
|
54
|
-
archflag =
|
55
|
-
DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
|
56
|
-
LDSHARED = cc -dynamic -bundle -undefined suppress -flat_namespace
|
57
|
-
AR = ar
|
58
|
-
EXEEXT =
|
59
|
-
|
60
|
-
RUBY_INSTALL_NAME = ruby18
|
61
|
-
RUBY_SO_NAME = ruby18
|
62
|
-
arch = i686-darwin10.0.0
|
63
|
-
sitearch = i686-darwin10.0.0
|
64
|
-
ruby_version = 1.8
|
65
|
-
ruby = /usr/local/bin/ruby18
|
66
|
-
RUBY = $(ruby)
|
67
|
-
RM = rm -f
|
68
|
-
MAKEDIRS = mkdir -p
|
69
|
-
INSTALL = /usr/bin/install -c
|
70
|
-
INSTALL_PROG = $(INSTALL) -m 0755
|
71
|
-
INSTALL_DATA = $(INSTALL) -m 644
|
72
|
-
COPY = cp
|
73
|
-
|
74
|
-
#### End of system configuration section. ####
|
75
|
-
|
76
|
-
preload =
|
77
|
-
|
78
|
-
libpath = . $(libdir)
|
79
|
-
LIBPATH = -L. -L$(libdir)
|
80
|
-
DEFFILE =
|
81
|
-
|
82
|
-
CLEANFILES = mkmf.log ripper.y ripper.c ripper.E ripper.output y.output eventids1.c eventids2table.c
|
83
|
-
DISTCLEANFILES =
|
84
|
-
|
85
|
-
extout =
|
86
|
-
extout_prefix =
|
87
|
-
target_prefix =
|
88
|
-
LOCAL_LIBS =
|
89
|
-
LIBS = -ldl -lobjc
|
90
|
-
SRCS = ripper.c
|
91
|
-
OBJS = ripper.o
|
92
|
-
TARGET = ripper
|
93
|
-
DLLIB = $(TARGET).bundle
|
94
|
-
EXTSTATIC =
|
95
|
-
STATIC_LIB =
|
96
|
-
|
97
|
-
BINDIR = $(bindir)
|
98
|
-
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
99
|
-
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
100
|
-
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
101
|
-
|
102
|
-
TARGET_SO = $(DLLIB)
|
103
|
-
CLEANLIBS = $(TARGET).bundle $(TARGET).il? $(TARGET).tds $(TARGET).map
|
104
|
-
CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
|
105
|
-
|
106
|
-
all: $(DLLIB)
|
107
|
-
static: $(STATIC_LIB)
|
108
|
-
|
109
|
-
clean:
|
110
|
-
@-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
|
111
|
-
|
112
|
-
distclean: clean
|
113
|
-
@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
114
|
-
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
115
|
-
|
116
|
-
realclean: distclean
|
117
|
-
install: install-so install-rb
|
118
|
-
|
119
|
-
install-so: $(RUBYARCHDIR)
|
120
|
-
install-so: $(RUBYARCHDIR)/$(DLLIB)
|
121
|
-
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
|
122
|
-
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
123
|
-
install-rb: pre-install-rb install-rb-default
|
124
|
-
install-rb-default: pre-install-rb-default
|
125
|
-
pre-install-rb: Makefile
|
126
|
-
pre-install-rb-default: Makefile
|
127
|
-
$(RUBYARCHDIR):
|
128
|
-
$(MAKEDIRS) $@
|
129
|
-
|
130
|
-
site-install: site-install-so site-install-rb
|
131
|
-
site-install-so: install-so
|
132
|
-
site-install-rb: install-rb
|
133
|
-
|
134
|
-
.SUFFIXES: .c .m .cc .cxx .cpp .C .o
|
135
|
-
|
136
|
-
.cc.o:
|
137
|
-
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
138
|
-
|
139
|
-
.cxx.o:
|
140
|
-
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
141
|
-
|
142
|
-
.cpp.o:
|
143
|
-
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
144
|
-
|
145
|
-
.C.o:
|
146
|
-
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
147
|
-
|
148
|
-
.c.o:
|
149
|
-
$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
|
150
|
-
|
151
|
-
$(DLLIB): $(OBJS) Makefile
|
152
|
-
@-$(RM) $@
|
153
|
-
$(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
###
|
158
|
-
.SUFFIXES: .y .c
|
159
|
-
|
160
|
-
GEN = $(srcdir)/tools/generate.rb
|
161
|
-
SRC1 = parse.y
|
162
|
-
SRC2 = $(srcdir)/eventids2.c
|
163
|
-
BISON = bison
|
164
|
-
|
165
|
-
.SUFFIXES: .y
|
166
|
-
|
167
|
-
src: ripper.c eventids1.c eventids2table.c
|
168
|
-
|
169
|
-
ripper.o: ripper.c lex.c eventids1.c eventids2.c eventids2table.c
|
170
|
-
|
171
|
-
.y.c:
|
172
|
-
$(BISON) -t -v -oy.tab.c $<
|
173
|
-
sed -f tools/ytab.sed -e "/^#/s!y\.tab\.c!$@!" y.tab.c > $@
|
174
|
-
@$(RM) y.tab.c
|
175
|
-
|
176
|
-
all: check
|
177
|
-
static: check
|
178
|
-
|
179
|
-
ripper.y: $(srcdir)/tools/preproc.rb parse.y
|
180
|
-
$(RUBY) $(srcdir)/tools/preproc.rb parse.y --output=$@
|
181
|
-
|
182
|
-
check: $(GEN) $(SRC1) $(SRC2)
|
183
|
-
$(RUBY) $(GEN) --mode=check --ids1src=$(SRC1) --ids2src=$(SRC2)
|
184
|
-
|
185
|
-
eventids1.c: tools/generate.rb $(SRC1)
|
186
|
-
$(RUBY) $(GEN) --mode=eventids1 --ids1src=$(SRC1) --output=$@
|
187
|
-
|
188
|
-
eventids2table.c: tools/generate.rb $(SRC2)
|
189
|
-
$(RUBY) $(GEN) --mode=eventids2table --ids2src=$(SRC2) --output=$@
|
190
|
-
|
191
|
-
# Entries for Ripper maintainer
|
192
|
-
|
193
|
-
preproc: ripper.E
|
194
|
-
ripper.E: ripper.c
|
195
|
-
$(CC) -E $(CPPFLAGS) ripper.c | $(RUBY) $(srcdir)/tools/strip.rb > $@
|