sydparse 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/test/class.rb ADDED
@@ -0,0 +1,7 @@
1
+ # Bring in all the libc shit.
2
+ # Jump jump.
3
+ class Libc
4
+ # Does blah.
5
+ def blah
6
+ end
7
+ end
data/test/pt.rb ADDED
@@ -0,0 +1,19 @@
1
+ require 'rubygems'
2
+ require 'parse_tree'
3
+ require 'pp'
4
+
5
+ class Blah
6
+ def blah(*aoeu)
7
+ blah do |a,b|
8
+ c = a + b
9
+
10
+ go do |d|
11
+ c = c + d
12
+ end
13
+ end
14
+ end
15
+ end
16
+
17
+ pt = ParseTree.new
18
+
19
+ pp pt.parse_tree(Blah)
data/test/show.rb ADDED
@@ -0,0 +1,20 @@
1
+
2
+ require 'sydparse'
3
+ require 'pp'
4
+
5
+ STDOUT.sync = true
6
+
7
+ path = ARGV.shift
8
+ io = File.open(path)
9
+ if ARGV.shift
10
+ syd = SydneyParser.load_file io
11
+ pp syd.sexp
12
+ exit
13
+ end
14
+ pp SydneyParser.unified_sexp(io)
15
+ exit
16
+ syd = SydneyParser.load_file io, false, true
17
+ sx = syd.sexp(true)
18
+ pp sx
19
+ com = syd.comments
20
+ p syd.collapse_per_line(com)
data/test/t.rb ADDED
@@ -0,0 +1,53 @@
1
+
2
+ require 'sydparse'
3
+ require 'find'
4
+ require 'pp'
5
+
6
+ STDOUT.sync = true
7
+
8
+ def test_file(path)
9
+ pid = fork {
10
+ print "#{path}: "
11
+ io = File.open(path)
12
+ print "o"
13
+ syd = SydneyParser.load_file io
14
+ print "p"
15
+ sx = syd.sexp
16
+ # sx = []
17
+ # pp sx
18
+ print "x"
19
+ sx.inspect
20
+ puts " ok"
21
+ io.close
22
+ }
23
+ Process.wait(pid)
24
+ end
25
+
26
+ path = ARGV.shift
27
+
28
+ Find.find(path) do |path|
29
+ next if File.directory?(path)
30
+ if /\.rb$/.match(path)
31
+ test_file(path)
32
+ end
33
+ end
34
+ exit
35
+ io = File.open(ARGV.shift)
36
+
37
+ syd = SydneyParser.load_file io
38
+
39
+ p syd
40
+
41
+ sx = syd.sexp
42
+ p sx.size
43
+ ary = sx[0]
44
+ a3 = ary[2]
45
+ # p a3.size
46
+ # p a3[1][1][2]
47
+
48
+ pp sx
49
+ exit
50
+ File.open("last.o", "w") do |f|
51
+ f << Marshal.dump(sx)
52
+ end
53
+ # pp syd.sexp
data/test/t3.rb ADDED
@@ -0,0 +1,6 @@
1
+ blah do |a,b|
2
+ c = a + b
3
+ go do |d|
4
+ c = c + d
5
+ end
6
+ end
data/test/t4.rb ADDED
@@ -0,0 +1,4 @@
1
+ def blah(*jump)
2
+ p $~
3
+ p $_
4
+ end
data/test/test.rb ADDED
@@ -0,0 +1,2 @@
1
+ a = 1
2
+ 1 + 2
data/test/ubs.rb ADDED
@@ -0,0 +1 @@
1
+ \blah
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.8.11
3
+ specification_version: 1
4
+ name: sydparse
5
+ version: !ruby/object:Gem::Version
6
+ version: 1.0.0
7
+ date: 2006-10-02 00:00:00 -07:00
8
+ summary: A standalone ruby parser with sexp support.
9
+ require_paths:
10
+ - lib
11
+ email: evan@fallingsnow.net
12
+ homepage:
13
+ rubyforge_project:
14
+ description:
15
+ autorequire:
16
+ default_executable: ""
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ authors:
29
+ - Evan Webb
30
+ files:
31
+ - env.h
32
+ - extconf.rb
33
+ - internal.h
34
+ - lex.c.tab
35
+ - lib
36
+ - bin/syd_pt_show
37
+ - lib/sydparse
38
+ - lib/sydparse.rb
39
+ - Manifest.txt
40
+ - node.h
41
+ - parse_override.h
42
+ - Rakefile
43
+ - runtime.c
44
+ - runtime.h
45
+ - state.h
46
+ - sydparse.c
47
+ - sydparse.y
48
+ - test
49
+ - test/class.rb
50
+ - test/pt.rb
51
+ - test/show.rb
52
+ - test/t.rb
53
+ - test/t3.rb
54
+ - test/t4.rb
55
+ - test/test.rb
56
+ - test/ubs.rb
57
+ test_files: []
58
+
59
+ rdoc_options: []
60
+
61
+ extra_rdoc_files: []
62
+
63
+ executables:
64
+ - syd_pt_show
65
+ extensions:
66
+ - extconf.rb
67
+ requirements: []
68
+
69
+ dependencies: []
70
+