Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 88 lines (66 sloc) 2.747 kB
512f595 @zenspider Fixed and improved the readme
zenspider authored
1 = ruby_parser
2
3e11dcd @zenspider Updated url section, switched to github for repo/home url, and cleane…
zenspider authored
3 home :: https://github.com/seattlerb/ruby_parser
9b345da @zenspider prepped for release
zenspider authored
4 bugs :: https://github.com/seattlerb/ruby_parser/issues
e1d634d @zenspider fixed url
zenspider authored
5 rdoc :: http://docs.seattlerb.org/ruby_parser
afc6228 @zenspider MOSTLY DONE... importing now so I can track.
zenspider authored
6
7 == DESCRIPTION:
2749468 @zenspider Removed ruby_parser.rb from manifest and worked into package rule ins…
zenspider authored
8
9 ruby_parser (RP) is a ruby parser written in pure ruby (utilizing
10 racc--which does by default use a C extension). RP's output is
11 the same as ParseTree's output: s-expressions using ruby's arrays and
12 base types.
afc6228 @zenspider MOSTLY DONE... importing now so I can track.
zenspider authored
13
512f595 @zenspider Fixed and improved the readme
zenspider authored
14 As an example:
15
16 def conditional1(arg1)
17 if arg1 == 0 then
18 return 1
19 end
20 return 0
21 end
22
23 becomes:
24
25 s(:defn, :conditional1,
26 s(:args, :arg1),
27 s(:scope,
28 s(:block,
29 s(:if,
30 s(:call, s(:lvar, :arg1), :==, s(:arglist, s(:lit, 0))),
31 s(:return, s(:lit, 1)),
32 nil),
33 s(:return, s(:lit, 0)))))
34
afc6228 @zenspider MOSTLY DONE... importing now so I can track.
zenspider authored
35 == FEATURES/PROBLEMS:
2749468 @zenspider Removed ruby_parser.rb from manifest and worked into package rule ins…
zenspider authored
36
37 * Pure ruby, no compiles.
af96092 @zenspider Refactored several smallish areas.
zenspider authored
38 * Includes preceding comment data for defn/defs/class/module nodes!
2749468 @zenspider Removed ruby_parser.rb from manifest and worked into package rule ins…
zenspider authored
39 * Incredibly simple interface.
40 * Output is 100% equivalent to ParseTree.
41 * Can utilize PT's SexpProcessor and UnifiedRuby for language processing.
512f595 @zenspider Fixed and improved the readme
zenspider authored
42 * Known Issue: Speed is now pretty good, but can always improve:
43 * RP parses a corpus of 3702 files in 125s (avg 108 Kb/s)
44 * MRI+PT parsed the same in 67.38s (avg 200.89 Kb/s)
45 * Known Issue: Code is much better, but still has a long way to go.
2749468 @zenspider Removed ruby_parser.rb from manifest and worked into package rule ins…
zenspider authored
46 * Known Issue: Totally awesome.
512f595 @zenspider Fixed and improved the readme
zenspider authored
47 * Known Issue: line number values can be slightly off. Parsing LR sucks.
afc6228 @zenspider MOSTLY DONE... importing now so I can track.
zenspider authored
48
49 == SYNOPSIS:
50
9b345da @zenspider prepped for release
zenspider authored
51 Ruby19Parser.new.parse "1+1"
52 # => s(:call, s(:lit, 1), :+, s(:lit, 1))
afc6228 @zenspider MOSTLY DONE... importing now so I can track.
zenspider authored
53
54 == REQUIREMENTS:
55
2749468 @zenspider Removed ruby_parser.rb from manifest and worked into package rule ins…
zenspider authored
56 * ruby. woot.
9b345da @zenspider prepped for release
zenspider authored
57 * sexp_processor for Sexp and SexpProcessor classes, and testing.
512f595 @zenspider Fixed and improved the readme
zenspider authored
58 * racc full package for parser development (compiling .y to .rb).
afc6228 @zenspider MOSTLY DONE... importing now so I can track.
zenspider authored
59
60 == INSTALL:
61
2749468 @zenspider Removed ruby_parser.rb from manifest and worked into package rule ins…
zenspider authored
62 * sudo gem install ruby_parser
afc6228 @zenspider MOSTLY DONE... importing now so I can track.
zenspider authored
63
64 == LICENSE:
65
66 (The MIT License)
67
cf2703f @zenspider + Refactored and added new_resbody to ruby_parser_extras.
zenspider authored
68 Copyright (c) Ryan Davis, seattle.rb
afc6228 @zenspider MOSTLY DONE... importing now so I can track.
zenspider authored
69
70 Permission is hereby granted, free of charge, to any person obtaining
71 a copy of this software and associated documentation files (the
72 'Software'), to deal in the Software without restriction, including
73 without limitation the rights to use, copy, modify, merge, publish,
74 distribute, sublicense, and/or sell copies of the Software, and to
75 permit persons to whom the Software is furnished to do so, subject to
76 the following conditions:
77
78 The above copyright notice and this permission notice shall be
79 included in all copies or substantial portions of the Software.
80
81 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
82 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
83 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
84 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
85 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
86 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
87 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Something went wrong with that request. Please try again.