redparse 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING.LGPL +165 -0
- data/Manifest.txt +40 -0
- data/README.txt +461 -0
- data/Rakefile +26 -0
- data/lib/redparse.rb +1083 -0
- data/lib/redparse/babynodes.rb +137 -0
- data/lib/redparse/babyparser.rb +276 -0
- data/lib/redparse/decisiontree.rb +372 -0
- data/lib/redparse/node.rb +3808 -0
- data/lib/redparse/problemfiles.rb +84 -0
- data/lib/redparse/reg_more_sugar.rb +99 -0
- data/nurli/test_control.nurli +261 -0
- data/redparse.vpj +92 -0
- data/redparse.vpw +8 -0
- data/test/data/__end.rb +5 -0
- data/test/data/__f.rb +2 -0
- data/test/data/be.rb +3 -0
- data/test/data/be2.rb +6 -0
- data/test/data/bqhd.rb +3 -0
- data/test/data/bqhd2.rb +3 -0
- data/test/data/case.rb +8 -0
- data/test/data/datetime.rb +66 -0
- data/test/data/defd.rb +9 -0
- data/test/data/hd-def.rb +8 -0
- data/test/data/hd.rb +3 -0
- data/test/data/hd2.rb +3 -0
- data/test/data/hd3.rb +3 -0
- data/test/data/hd4.rb +75 -0
- data/test/data/hd5.rb +4 -0
- data/test/data/hdcat.rb +4 -0
- data/test/data/hdx.rb +3 -0
- data/test/data/heredoc.rb +3 -0
- data/test/data/if.rb +7 -0
- data/test/data/jbridge.rb +779 -0
- data/test/data/mod.rb +3 -0
- data/test/data/nl_as_strdelim.rb +7 -0
- data/test/data/pw.rb +2 -0
- data/test/data/wvt.rb +2 -0
- data/test/rp-locatetest.rb +344 -0
- data/test/test_redparse.rb +3319 -0
- metadata +113 -0
data/COPYING.LGPL
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
2
|
+
Version 3, 29 June 2007
|
3
|
+
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
6
|
+
of this license document, but changing it is not allowed.
|
7
|
+
|
8
|
+
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
11
|
+
License, supplemented by the additional permissions listed below.
|
12
|
+
|
13
|
+
0. Additional Definitions.
|
14
|
+
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
17
|
+
General Public License.
|
18
|
+
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
20
|
+
other than an Application or a Combined Work as defined below.
|
21
|
+
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
25
|
+
of using an interface provided by the Library.
|
26
|
+
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
28
|
+
Application with the Library. The particular version of the Library
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
30
|
+
Version".
|
31
|
+
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
35
|
+
based on the Application, and not on the Linked Version.
|
36
|
+
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
38
|
+
object code and/or source code for the Application, including any data
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
41
|
+
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
43
|
+
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
46
|
+
|
47
|
+
2. Conveying Modified Versions.
|
48
|
+
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
51
|
+
that uses the facility (other than as an argument passed when the
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
53
|
+
version:
|
54
|
+
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
56
|
+
ensure that, in the event an Application does not supply the
|
57
|
+
function or data, the facility still operates, and performs
|
58
|
+
whatever part of its purpose remains meaningful, or
|
59
|
+
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
61
|
+
this License applicable to that copy.
|
62
|
+
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
64
|
+
|
65
|
+
The object code form of an Application may incorporate material from
|
66
|
+
a header file that is part of the Library. You may convey such object
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
68
|
+
material is not limited to numerical parameters, data structure
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
71
|
+
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
73
|
+
Library is used in it and that the Library and its use are
|
74
|
+
covered by this License.
|
75
|
+
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
77
|
+
document.
|
78
|
+
|
79
|
+
4. Combined Works.
|
80
|
+
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
82
|
+
taken together, effectively do not restrict modification of the
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
85
|
+
the following:
|
86
|
+
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
88
|
+
the Library is used in it and that the Library and its use are
|
89
|
+
covered by this License.
|
90
|
+
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
92
|
+
document.
|
93
|
+
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
95
|
+
execution, include the copyright notice for the Library among
|
96
|
+
these notices, as well as a reference directing the user to the
|
97
|
+
copies of the GNU GPL and this license document.
|
98
|
+
|
99
|
+
d) Do one of the following:
|
100
|
+
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
102
|
+
License, and the Corresponding Application Code in a form
|
103
|
+
suitable for, and under terms that permit, the user to
|
104
|
+
recombine or relink the Application with a modified version of
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
107
|
+
Corresponding Source.
|
108
|
+
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
111
|
+
a copy of the Library already present on the user's computer
|
112
|
+
system, and (b) will operate properly with a modified version
|
113
|
+
of the Library that is interface-compatible with the Linked
|
114
|
+
Version.
|
115
|
+
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
117
|
+
be required to provide such information under section 6 of the
|
118
|
+
GNU GPL, and only to the extent that such information is
|
119
|
+
necessary to install and execute a modified version of the
|
120
|
+
Combined Work produced by recombining or relinking the
|
121
|
+
Application with a modified version of the Linked Version. (If
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
126
|
+
for conveying Corresponding Source.)
|
127
|
+
|
128
|
+
5. Combined Libraries.
|
129
|
+
|
130
|
+
You may place library facilities that are a work based on the
|
131
|
+
Library side by side in a single library together with other library
|
132
|
+
facilities that are not Applications and are not covered by this
|
133
|
+
License, and convey such a combined library under terms of your
|
134
|
+
choice, if you do both of the following:
|
135
|
+
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
137
|
+
on the Library, uncombined with any other library facilities,
|
138
|
+
conveyed under the terms of this License.
|
139
|
+
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
141
|
+
is a work based on the Library, and explaining where to find the
|
142
|
+
accompanying uncombined form of the same work.
|
143
|
+
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
145
|
+
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
148
|
+
versions will be similar in spirit to the present version, but may
|
149
|
+
differ in detail to address new problems or concerns.
|
150
|
+
|
151
|
+
Each version is given a distinguishing version number. If the
|
152
|
+
Library as you received it specifies that a certain numbered version
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
154
|
+
applies to it, you have the option of following the terms and
|
155
|
+
conditions either of that published version or of any later version
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
160
|
+
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
164
|
+
permanent authorization for you to choose that version for the
|
165
|
+
Library.
|
data/Manifest.txt
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
lib/redparse/decisiontree.rb
|
2
|
+
lib/redparse/reg_more_sugar.rb
|
3
|
+
lib/redparse/babyparser.rb
|
4
|
+
lib/redparse/node.rb
|
5
|
+
lib/redparse/babynodes.rb
|
6
|
+
lib/redparse.rb
|
7
|
+
test/rp-locatetest.rb
|
8
|
+
lib/redparse/problemfiles.rb
|
9
|
+
test/data/wvt.rb
|
10
|
+
test/data/mod.rb
|
11
|
+
test/data/bqhd2.rb
|
12
|
+
test/data/__end.rb
|
13
|
+
test/data/hdx.rb
|
14
|
+
test/data/hd2.rb
|
15
|
+
test/data/be.rb
|
16
|
+
test/data/hd5.rb
|
17
|
+
test/data/if.rb
|
18
|
+
test/data/hdcat.rb
|
19
|
+
test/data/hd3.rb
|
20
|
+
test/data/pw.rb
|
21
|
+
test/data/__f.rb
|
22
|
+
test/data/jbridge.rb
|
23
|
+
test/data/hd-def.rb
|
24
|
+
test/data/hd.rb
|
25
|
+
test/data/hd4.rb
|
26
|
+
test/data/nl_as_strdelim.rb
|
27
|
+
test/data/defd.rb
|
28
|
+
test/data/datetime.rb
|
29
|
+
test/data/bqhd.rb
|
30
|
+
test/data/be2.rb
|
31
|
+
test/data/heredoc.rb
|
32
|
+
test/data/case.rb
|
33
|
+
test/test_redparse.rb
|
34
|
+
Manifest.txt
|
35
|
+
README.txt
|
36
|
+
Rakefile
|
37
|
+
COPYING.LGPL
|
38
|
+
nurli/test_control.nurli
|
39
|
+
redparse.vpj
|
40
|
+
redparse.vpw
|
data/README.txt
ADDED
@@ -0,0 +1,461 @@
|
|
1
|
+
= RedParse
|
2
|
+
* redparse.rubyforge.org
|
3
|
+
* rubyforge.org/projects/redparse
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
RedParse is a ruby parser written in pure ruby. Instead of YACC or
|
8
|
+
ANTLR, it's parse tool is a home-brewed "compiler-interpreter". (The
|
9
|
+
tool is LALR(1)-equivalent and the 'parse language' is pretty nice,
|
10
|
+
even in it's current crude form.)
|
11
|
+
|
12
|
+
My intent is to have a completely correct parser for ruby, in 100%
|
13
|
+
ruby. It's not all there yet, but I'm getting pretty close. Currently,
|
14
|
+
RedParse can parse slightly in excess of 99% of ruby files found in
|
15
|
+
the wild. For known problems, see below.
|
16
|
+
|
17
|
+
== REQUIREMENTS:
|
18
|
+
* RedParse requires RubyLexer, my hand-coded lexer for ruby. It also
|
19
|
+
uses Reg, (a pattern-matcher). RubyLexer depends on Sequence,
|
20
|
+
(external iterators). Reg depends on Sequence's predecessor, Cursor,
|
21
|
+
altho Cursor isn't used at all in RedParse. The (long-delayed) next
|
22
|
+
version of Reg will use Sequence. To summarize:
|
23
|
+
* RedParse 0.9.0 requires RubyLexer>=0.7.1 and Reg>=0.4.7
|
24
|
+
* RubyLexer 0.7.1 requires Sequence>=0.2.0
|
25
|
+
* Reg 0.4.7 requires Cursor (not really needed here)
|
26
|
+
* All are available as gems. (Or tarballs on rubyforge, if you must.)
|
27
|
+
|
28
|
+
== INSTALL:
|
29
|
+
* gem install redparse #(if root as necssary)
|
30
|
+
|
31
|
+
== LICENSE:
|
32
|
+
|
33
|
+
RedParse is available under the Library General Public License (LGPL).
|
34
|
+
Please see COPYING.LGPL for details.
|
35
|
+
|
36
|
+
== Benefits:
|
37
|
+
|
38
|
+
* Pure ruby, through and through. No part is written in C, YACC,
|
39
|
+
ANTLR, lisp, assembly, intercal, befunge or any other language
|
40
|
+
except ruby.
|
41
|
+
* Pretty AST trees (at least, I think so). (To program for, not
|
42
|
+
necessarily to look at.)
|
43
|
+
* AST trees closely mirror the actual structure of source code.
|
44
|
+
* ParseTree format output too, if you want that.
|
45
|
+
* Did I mention that there's no YACC at all? YACC grammars are
|
46
|
+
notoriously difficult to modify, (I've never successfully done it)
|
47
|
+
but I've found it easy, at times even pleasant to modify the parse
|
48
|
+
rules of this grammar as necessary.
|
49
|
+
* Relatively small parser: 70 rules in 240 lines
|
50
|
+
(vs (by my count) 320 rules in 2200 lines for MRI 1.8.7. This is
|
51
|
+
by no means a fair comparison, tho, since RubyLexer does a lot
|
52
|
+
more than MRI's lexer, and MRI's 2200 lines include its
|
53
|
+
actions (which occupy somewhere under 3100 lines in RedParse).
|
54
|
+
Also, what is a rule? I counted most things which required a
|
55
|
+
separate action in MRI's parser, I'm not sure if that's fair.
|
56
|
+
But in the end, I still think RedParse is still much easier to
|
57
|
+
understand than MRI's parse.y.)
|
58
|
+
* "loosey-goosey" parser happily parses many expressions which normal
|
59
|
+
ruby considers errors.
|
60
|
+
|
61
|
+
== Drawbacks:
|
62
|
+
|
63
|
+
* Pathetically, rediculously slow (to be addressed soon).
|
64
|
+
* Error handling is very minimal right now.
|
65
|
+
* No warnings at all.
|
66
|
+
* Some expressions aren't parsed correctly. see below.
|
67
|
+
* Line numbers in ParseTrees not supported yet.
|
68
|
+
* AST tree format is not finalized yet.
|
69
|
+
* Unit test takes a fairly long time.
|
70
|
+
* Lots of warnings printed during unit test.
|
71
|
+
* Debugging parse rules is not straightforward.
|
72
|
+
* No support for ruby 1.9.
|
73
|
+
* No support for any charset but ascii (until rubylexer gets it).
|
74
|
+
* "loosey-goosey" parser happily parses many expressions which normal
|
75
|
+
ruby considers errors.
|
76
|
+
|
77
|
+
== SYNOPSIS:
|
78
|
+
|
79
|
+
#simple example of usage:
|
80
|
+
|
81
|
+
require 'redparse'
|
82
|
+
|
83
|
+
parser=RedParse.new("some ruby code here")
|
84
|
+
tree=parser.parse
|
85
|
+
|
86
|
+
tree.walk{|parent,i,subi,node|
|
87
|
+
case node
|
88
|
+
when CallNode: #... do something with method calls
|
89
|
+
when AssignNode: #... maybe alter assignments somehow
|
90
|
+
#.... and so on
|
91
|
+
end
|
92
|
+
}
|
93
|
+
|
94
|
+
#presumably tree was altered somehow in the walk-"loop" above
|
95
|
+
#when done mucking with the tree, you can turn it into one
|
96
|
+
#of two other formats: ParseTree s-exps or (experimental)
|
97
|
+
#ruby source code.
|
98
|
+
|
99
|
+
tree.to_parsetree #=> turns a tree into an ParseTree-style s-exp.
|
100
|
+
|
101
|
+
tree.unparse({}) #=> turns a tree back into ruby source code.
|
102
|
+
|
103
|
+
#to understand the tree format, you must understand the node classes,
|
104
|
+
#which are documented in the next section.
|
105
|
+
|
106
|
+
== NODE TYPES:
|
107
|
+
|
108
|
+
Syntax trees are represented by trees of nested Nodes. All Nodes descend from
|
109
|
+
Array, and their subnodes can be addressed by numeric index, just like normal
|
110
|
+
Arrays. However, many subnodes want to have names as well, thus most (but not
|
111
|
+
all) array slots within the various Node classes have names. The general rule
|
112
|
+
is that Node slots may contain a Node, a VarNameToken, a plain Array, a
|
113
|
+
String, or nil. However, many cases are more specific than that. Specific
|
114
|
+
Node classes are documented briefly below in this format:
|
115
|
+
|
116
|
+
NodeName #comments describing node
|
117
|
+
(slot1: Type, slot2: Type)
|
118
|
+
-OR-
|
119
|
+
(Array[Type*])
|
120
|
+
|
121
|
+
Here's an example of how to use this imaginary Node:
|
122
|
+
|
123
|
+
if NodeName===node
|
124
|
+
do_something_with node.slot1
|
125
|
+
do_something_else_with node.slot2
|
126
|
+
# -OR-
|
127
|
+
do_something_with node[0] #slot1
|
128
|
+
do_something_else_with node[1] #slot2
|
129
|
+
end
|
130
|
+
|
131
|
+
Types are specified in an psuedo-BNF syntax. | * + ? all have the same meaning
|
132
|
+
as in Regexp. Array[Spec] indicates a plain Array (not a Node). The Spec
|
133
|
+
describes the constraints on the Array's contents.
|
134
|
+
In the cases where node slots don't have names, there will be no colon-
|
135
|
+
terminated slot name(s) on the second line, just an Array[] specification.
|
136
|
+
|
137
|
+
And just to make everyone's life a little more complicated, I should add that
|
138
|
+
there is still one token type which leaks through into the syntax tree:
|
139
|
+
VarNameToken. It's descended from a RubyLexer::Token, not a Node. In the
|
140
|
+
future this will be replaced with an actual Node.
|
141
|
+
|
142
|
+
In fact, there are several areas where rough edges in the syntax tree could be
|
143
|
+
removed. So don't consider this current depiction to be final. But it should
|
144
|
+
be pretty close.
|
145
|
+
|
146
|
+
Several abbreviations are used:
|
147
|
+
Value means ValueNode
|
148
|
+
LValue means ConstantNode|VarNameToken|UnaryStarNode|CallNode|
|
149
|
+
BracketsGetNode|AssigneeList[LValue*]
|
150
|
+
UnAmpNode means UnOpNode with op == "&"
|
151
|
+
|
152
|
+
VarNameToken<RubyLexer::Token #represents variables and constants
|
153
|
+
(ident: String)
|
154
|
+
Node<Array #abstract ancestor of all nodes (except VarNameToken)
|
155
|
+
+RescueNode #a rescue clause in a def of begin statement
|
156
|
+
| (exceptions: Array[Value*], varname: VarNameToken|nil, action: Value)
|
157
|
+
+WhenNode #a when clause in a case statement
|
158
|
+
| (when: Value|Array[Value+] then: Value|nil )
|
159
|
+
+ElsifNode #an elsif clause in an if statement
|
160
|
+
| (elsif: Value, then: Value|nil)
|
161
|
+
+ValueNode #abstract, a node which has a value (an expression)
|
162
|
+
|+ListOpNode #abstract, ancestor for nodes which are lists of
|
163
|
+
||| #things separated by some op
|
164
|
+
||+SequenceNode #a sequence of statements
|
165
|
+
||| (Array[Value*])
|
166
|
+
||+ConstantNode #a constant expression of the form A::B::C or the like
|
167
|
+
|| #first expression can be anything
|
168
|
+
|| (Array[String|Value|nil,String+])
|
169
|
+
|+RawOpNode #ancestor of all operators (but not . :: ; , ?..:)
|
170
|
+
||| (left: Value, op: String, right: Value)
|
171
|
+
||+OpNode #ancestor of some operators
|
172
|
+
|||+RangeNode #a range literal node
|
173
|
+
|||+KeywordOpNode #abstract, ancestor of keyword operators
|
174
|
+
||||+LogicalNode #and or && || expressions
|
175
|
+
||||+WhileOpNode #while as an operator
|
176
|
+
||||+UntilOpNode #until as an operator
|
177
|
+
||||+IfOpNode #if as an operator
|
178
|
+
||||+UnlessOpNode #unless as an operator
|
179
|
+
|||+NotEqualNode #!= expressions
|
180
|
+
|||+MatchNode #=~ expressions
|
181
|
+
|||+NotMatchNode #!~ expressions
|
182
|
+
|+LiteralNode #literal symbols, integers
|
183
|
+
|| (val: Numeric|Symbol|StringNode)
|
184
|
+
|+StringNode #literal strings
|
185
|
+
||| (Array[(String|Value)+])
|
186
|
+
||+HereDocNode #here documents
|
187
|
+
|+StringCatNode #adjacent strings are catenated ("foo" "bar" == "foobar")
|
188
|
+
|| (Array[StringNode+])
|
189
|
+
|+NopNode #an expression with no tokens at all in it
|
190
|
+
|| (no attributes)
|
191
|
+
|+VarLikeNode #nil,false,true,__FILE__,__LINE__,self
|
192
|
+
|| (name: String)
|
193
|
+
|+UnOpNode #unary operators
|
194
|
+
|| (op: String, val: Value)
|
195
|
+
||+UnaryStarNode #unary star (splat)
|
196
|
+
|||+DanglingStarNode #unary star with no argument
|
197
|
+
||||| (no attributes)
|
198
|
+
||||+DanglingCommaNode #comma with no rhs
|
199
|
+
|| (no attributes)
|
200
|
+
|+ParenedNode #ugly, parenthesized expressions and begin..end
|
201
|
+
|| (body: Value) -OR- (parentheses)
|
202
|
+
|| (body: Value|nil, rescues: Array[RescueNode*],
|
203
|
+
|| else: Value|nil, ensure: Value|nil) (begin...end and rescue as operator)
|
204
|
+
|+AssignNode #assignment (including eg +=)
|
205
|
+
|| (left:AssigneeList|LValue, op:String ,right:Array[Value*]|Value)
|
206
|
+
|+AssigneeList #abstract, comma-delimited list of assignables
|
207
|
+
||| (Array[LValue*])
|
208
|
+
||+NestedAssign #nested lhs, in parentheses
|
209
|
+
||+MultiAssign #regular top-level lhs
|
210
|
+
||+BlockParams #block formal parameter list
|
211
|
+
|+CallSiteNode #abstract, method calls
|
212
|
+
||| (receiver: Value|nil, name: String, params: nil|Array[Value+,UnaryStarNode?,UnAmpNode?],
|
213
|
+
||| block_params: BlockParams, block: Value)
|
214
|
+
||+CallNode #normal method calls
|
215
|
+
||+KWCallNode #keywords that look (more or less) like methods (BEGIN END yield return break continue next)
|
216
|
+
|+ArrayLiteralNode #[..]
|
217
|
+
|| (Array[Value*])
|
218
|
+
|+IfNode #if..end and unless..end
|
219
|
+
|| (if: Value, then: Value|nil, elsifs: Array[ElsifNode+]|Nil, else: Value|nil)
|
220
|
+
|+LoopNode #while..end and until..end
|
221
|
+
|| (while: Value, do: Value:nil)
|
222
|
+
|+CaseNode #case..end
|
223
|
+
|| (case: Value|nil, whens: Array[WhenNode*], else: Value|nil)
|
224
|
+
|+ForNode #for..end
|
225
|
+
|| (for: LValue, in: Value, do: Value|nil)
|
226
|
+
|+HashLiteralNode #{..}
|
227
|
+
|| (Array[Value*]) (size must be even)
|
228
|
+
|+TernaryNode # ? .. :
|
229
|
+
|| (if: Value, then: Value, else: Value)
|
230
|
+
|+MethodNode #def..end
|
231
|
+
|| (receiver:Value|nil, name:String,
|
232
|
+
|| params:Array[VarNameToken*,AssignNode*,UnaryStarNode?,UnAmpNode?]|nil,
|
233
|
+
|| body: Value|nil, rescues: Array[RescueNode+]|nil, else: Value|nil, ensure: Value|nil)
|
234
|
+
|+AliasNode #alias foo bar
|
235
|
+
|| (to: String|VarNameToken|StringNode, from: String|VarNameToken|StringNode)
|
236
|
+
|+UndefNode #undef foo
|
237
|
+
|| (Array[String|StringNode+])
|
238
|
+
|+NamespaceNode #abstract
|
239
|
+
||+ModuleNode #module..end
|
240
|
+
||| (name: VarNameToken|ConstantNode, body: Value|nil)
|
241
|
+
||+ClassNode #class..end
|
242
|
+
||| (name: VarNameToken|ConstantNode, parent: Value|nil, body: Value|nil)
|
243
|
+
||+MetaClassNode #class<<x..end
|
244
|
+
|| (val: Value, body: Value|nil)
|
245
|
+
|+BracketsGetNode #a[b]
|
246
|
+
| (receiver: Value, params: Array[Value+,UnaryStarNode?]|nil)
|
247
|
+
|
|
248
|
+
ErrorNode #mixed in to nodes with a syntax error
|
249
|
+
+MisparsedNode #mismatched braces or begin..end or the like
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
== Known failing expressions
|
254
|
+
* The following expressions are known to parse incorrectly currently:
|
255
|
+
* m.cn= 1, V
|
256
|
+
* "#{}"""
|
257
|
+
* $11111111111111111111111111111111111111111111111111111111111111111111
|
258
|
+
* begin;mode;rescue;o_chmod rescue nil;end
|
259
|
+
* case F;when G; else;case; when j; end;end
|
260
|
+
* def i;"..#{@@c = 1}";end
|
261
|
+
* e { |c|; print "%02X" % c }
|
262
|
+
* File.open() {|f| ; }
|
263
|
+
* %W(white\ \ \ \ \ space).should == ["white ", " ", " ", " space"]
|
264
|
+
* %w[- \\ e]
|
265
|
+
* %w[- \\ ]
|
266
|
+
* module A; b; rescue C=>d; e; else g; ensure f; end
|
267
|
+
* class A; b; rescue C=>d; e; else g; ensure f; end
|
268
|
+
* class<<A; b; rescue C=>d; e; else g; ensure f; end
|
269
|
+
|
270
|
+
== Homie doan' play dat
|
271
|
+
* These expressions don't parse the same as in MRI, I believe because of
|
272
|
+
bug(s) in MRI.
|
273
|
+
* p = p m %(1)
|
274
|
+
* p=556;p (e) /a
|
275
|
+
|
276
|
+
==Known failing files
|
277
|
+
* And here's a list of files which are known to parse incorrectly:
|
278
|
+
* alib-0.5.1/lib/alib-0.5.1/util.rb
|
279
|
+
* stick-1.3.3/test/test_matrix.rb
|
280
|
+
* rubyslippers-1.03/extras/rconftool.rb
|
281
|
+
* rubysync-0.2.1/lib/ruby_sync/connectors/base_connector.rb
|
282
|
+
* karmasphere-client-0.6.4/lib/karmasphere/query.rb
|
283
|
+
* roby-0.7.2/test/test_transactions.rb
|
284
|
+
* rwddemo-0.92/extras/rconftool.rb
|
285
|
+
* rmail-1.0.0/test/testmessage.rb
|
286
|
+
* passenger-2.0.1/lib/passenger/abstract_server.rb
|
287
|
+
* rubywebdialogs/rubywebdialogs.rb
|
288
|
+
* aspectr-0.3.7/lib/aspectr.rb
|
289
|
+
* rubywebdialogs-0.2.0/realstuff.rb
|
290
|
+
* stick-1.3.3/lib/stick/matrix.rb
|
291
|
+
* rb2html-2.4/rb2html/haskell_lexer.rb
|
292
|
+
* mspire-0.3.9/lib/spec_id/srf.rb
|
293
|
+
* rb-wartslib-0.9.14/lib/wartslib/wl-file.rb
|
294
|
+
* sqliki_generator-0.0.4/templates/lib_sanitize_html.rb
|
295
|
+
* rwdshell-1.00/extras/rconftool.rb
|
296
|
+
* main-2.8.0/lib/main/base.rb
|
297
|
+
* pseudoxml-0.1.0/RAKEFILE
|
298
|
+
* rubytorrent-0.3/lib/rubytorrent/server.rb
|
299
|
+
* Nephila-0.6.0/config/environment.rb
|
300
|
+
* ruby-rpm-1.2.3/lib/rpm.rb
|
301
|
+
* ya2yaml-0.26/lib/ya2yaml.rb
|
302
|
+
* spree-0.2.0/vendor/rails/activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb
|
303
|
+
* rq-3.4.0/rails/vendor/rails/actionpack/test/controller/fragment_store_setting_test.rb
|
304
|
+
* typo-5.0.3.98.1/config/environment.rb
|
305
|
+
* aeditor-1.9/lib/aeditor/test_lexer.rb
|
306
|
+
* gecoder-with-gecode-0.8.2/lib/gecoder/interface/constraints/set/connection.rb
|
307
|
+
* onebody-0.3.0/vendor/rails/actionpack/test/controller/caching_test.rb
|
308
|
+
* rwdhypernote-0.10/extras/rconftool.rb
|
309
|
+
* radiant-0.6.7/vendor/rails/railties/lib/initializer.rb
|
310
|
+
* rwdgutenberg-0.07/extras/rconftool.rb
|
311
|
+
* aspectr-0-3-5/lib/aspectr.rb
|
312
|
+
* rubygems-update-1.2.0/lib/rubygems/test_utilities.rb
|
313
|
+
* live_console-0.1.0/lib/live_console.rb
|
314
|
+
* html-table-1.3.1/test/tc_header.rb
|
315
|
+
* authorails-1.0.0/lib/initializer.rb
|
316
|
+
* allinoneruby-0.2.11/realstuff.rb
|
317
|
+
* typo-5.0.3.98.1/db/migrate/040_attach_content_to_blog.rb
|
318
|
+
* rq-3.4.0/lib/rq/lockfile.rb
|
319
|
+
* rubygame-2.3.0/lib/rubygame/rect.rb
|
320
|
+
* html-table-1.3.1/test/tc_foot.rb
|
321
|
+
* html-table-1.3.1/test/tc_caption.rb
|
322
|
+
* extract-curves-0.1.1/ruby_libs/pav/string/observable.rb
|
323
|
+
* starling-0.9.3/lib/starling/runner.rb
|
324
|
+
* RbYAML-0.2.0/lib/rbyaml/types.rb
|
325
|
+
* rwdaddresses-1.03/extras/vpim/rrule.rb
|
326
|
+
* Dnsruby-1.0/test/tc_tsig.rb
|
327
|
+
* rubyscript2exe/rubyscript2exe.rb
|
328
|
+
* rq-3.4.0/rails/vendor/rails/railties/builtin/rails_info/rails/info.rb
|
329
|
+
* extract_curves-0.0.1/ruby_libs/pav/string/observable.rb
|
330
|
+
* simplemapper-0.0.6/lib/simple_mapper/default_plugins/oauth.rb
|
331
|
+
* text-hyphen-1.0.0/lib/text/hyphen/language/id.rb
|
332
|
+
* ruby-nxt-0.8.1/examples/commands.rb
|
333
|
+
* gettext-1.91.0/test/test_rails_caching.rb
|
334
|
+
* rwdschedule-1.02/extras/rconftool.rb
|
335
|
+
* rabbit-0.5.6/lib/rabbit/image/base.rb
|
336
|
+
* sqliki-0.0.4/templates/lib_sanitize_html.rb
|
337
|
+
* whistle-0.1.1/lib/resource.rb
|
338
|
+
* html-table-1.3.1/examples/intermediate2.rb
|
339
|
+
* xmlparser-0.6.8/xmlparser/samples/digesttest.rb
|
340
|
+
* datamapper-0.3.2/lib/data_mapper/adapters/sql/mappings/table.rb
|
341
|
+
* openwferu-0.9.17/test/raw_prog_test.rb
|
342
|
+
* rubytorrent-0.3/lib/rubytorrent/controller.rb
|
343
|
+
* rails-2.1.0/builtin/rails_info/rails/info.rb
|
344
|
+
* mongrel-1.1.5/lib/mongrel.rb
|
345
|
+
* stream-0.5/lib/stream.rb
|
346
|
+
* dhaka-2.2.1/lib/dhaka/lexer/alphabet.rb
|
347
|
+
* roby-0.7.2/lib/roby/planning/model.rb
|
348
|
+
* data_objects-0.9.2/lib/data_objects/connection.rb
|
349
|
+
* logging-0.8.0/test/test_logger.rb
|
350
|
+
* hobo-0.7.5/hobo_files/plugin/lib/hobo/scopes/defined_scope_proxy_extender.rb
|
351
|
+
* logtwuncator-0.1.2/lib/log_twuncator/win32_file.rb
|
352
|
+
* Dnsruby-1.0/test/tc_axfr.rb
|
353
|
+
* spree-0.2.0/vendor/rails/railties/builtin/rails_info/rails/info.rb
|
354
|
+
* margot-0.5.0/Rakefile
|
355
|
+
* ruby-style-1.2.1/lib/style.rb
|
356
|
+
* preferences-0.1.3/test/functional/preferences_test.rb
|
357
|
+
* mogilefs-client-1.2.1/lib/mogilefs/backend.rb
|
358
|
+
* flatulent-0.0.4/lib/flatulent.rb
|
359
|
+
* actionpack-2.1.0/test/controller/caching_test.rb
|
360
|
+
* buildr-1.3.1.1/lib/buildr/packaging/zip.rb
|
361
|
+
* typo-5.0.3.98.1/vendor/syntax/lib/syntax/lang/ruby.rb
|
362
|
+
* starling-0.9.3/lib/starling/server.rb
|
363
|
+
* ruby-odbc-0.9995/ruby-odbc-0.9995/extconf.rb
|
364
|
+
* ruby-ajp-0.2.1/lib/net/ajp13.rb
|
365
|
+
* radiant-0.6.7/vendor/rails/railties/builtin/rails_info/rails/info.rb
|
366
|
+
* xmlparser-0.6.8/xmlparser/samples/digesttest2.rb
|
367
|
+
* rwdtorrent-0.05/extras/rubytorrent/controller.rb
|
368
|
+
* typo-5.0.3.98.1/db/migrate/039_serialize_blog_attributes.rb
|
369
|
+
* sparrow-0.3.1/lib/sparrow/runner.rb
|
370
|
+
* rubyscript2exe-0.5.3/realstuff.rb
|
371
|
+
* stomp-1.0.5/lib/stomp.rb
|
372
|
+
* adhearsion-0.7.7/lib/rami.rb
|
373
|
+
* bigtinker-0.93/extras/rconftool.rb
|
374
|
+
* Buildr-0.17.0/lib/tasks/zip.rb
|
375
|
+
* rmail-1.0.0/test/testheader.rb
|
376
|
+
* datamapper-0.3.2/lib/data_mapper/adapters/sql/mappings/column.rb
|
377
|
+
* fhlow-1.91.0/lib/module_cmdparse/cmdparse.rb
|
378
|
+
* can_has_bots-0.1.0/adapters/jabber/bot.rb
|
379
|
+
* spree-0.2.0/vendor/rails/actionpack/test/controller/caching_test.rb
|
380
|
+
* nitro-0.41.0/lib/nitro/compiler/include.rb
|
381
|
+
* wwwsrv-0.15.3/test/test_token.rb
|
382
|
+
* wwwsrv-0.15.3/wwwsrv/fastcgi.rb
|
383
|
+
* rgen-0.4.2/redist/xmlscan/tests/deftestcase.rb
|
384
|
+
* muding-0.2.0/lib/initializer.rb
|
385
|
+
* bj-1.0.1/lib/bj/runner.rb
|
386
|
+
* dnsruby-1.1/test/tc_tsig.rb
|
387
|
+
* ruote-0.9.18/test/ft_0c_testname.rb
|
388
|
+
* aquarium-0.4.2/spec/aquarium/aspects/aspect_spec.rb
|
389
|
+
* Ruby-MemCache-0.0.1/tests/stats.tests.rb
|
390
|
+
* docdiff-0.3.2/docdiff/charstring.rb
|
391
|
+
* automateit-0.80624/lib/automateit/account_manager/posix.rb
|
392
|
+
* simplemapper-0.0.6/lib/simple_mapper/default_plugins/associations.rb
|
393
|
+
* onebody-0.3.0/vendor/rails/activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb
|
394
|
+
* notification-0.2/Rakefile
|
395
|
+
* websitary-0.5/lib/websitary/htmldiff.rb
|
396
|
+
* feedupdater-0.2.5/lib/feed_updater/vendor/daemons/daemonize.rb
|
397
|
+
* rogdl-0.2.3/lib/string.rb
|
398
|
+
* yapra-0.1.1/legacy_plugins/Filter/sort.rb
|
399
|
+
* rwdaddresses-1.03/extras/rconftool.rb
|
400
|
+
* ruote-0.9.18/test/raw_prog_test.rb
|
401
|
+
* sequel_core-2.2.0/lib/sequel_core/core_sql.rb
|
402
|
+
* html-table-1.3.1/examples/advanced.rb
|
403
|
+
* swivel-0.0.175/vendor/activesupport-2.0.2-/lib/active_support/multibyte/handlers/utf8_handler.rb
|
404
|
+
* Rubernate-0.1.7/tests/rubernate/impl/dbi_generic_stub.rb
|
405
|
+
* logmerge-1.0.0/lib/logmerge/resolv.rb
|
406
|
+
* mongoose-0.2.5/lib/mongoose/column.rb
|
407
|
+
* aquarium-0.4.2/spec/aquarium/aspects/advice_chain_node_spec.rb
|
408
|
+
* qualitysmith_extensions-0.0.64/lib/qualitysmith_extensions/object/ancestry_of_method.rb
|
409
|
+
* rubygame-2.3.0/samples/chimp.rb
|
410
|
+
* rshell-0.1.0/lib/g/misc.rb
|
411
|
+
* bibliomori-0.2.3/src/filter.rb
|
412
|
+
* Ruby-MemCache-0.0.4/lib/memcache.rb
|
413
|
+
* raggle-0.4.2/extras/test_html_renderer.rb
|
414
|
+
* vpim-0.619/lib/vpim/rrule.rb
|
415
|
+
* command-set-0.10.4/lib/command-set/arguments.rb
|
416
|
+
* activerdf-1.6.10/lib/active_rdf/queryengine/query2jars2.rb
|
417
|
+
* hobofields-0.7.5/lib/hobo_fields/field_spec.rb
|
418
|
+
* mssqlclient-0.1.0/RAKEFILE
|
419
|
+
* html-table-1.3.1/test/tc_head.rb
|
420
|
+
* ruby-odbc-0.9995/ruby-odbc-0.9995/utf8/extconf.rb
|
421
|
+
* ditz-0.3/lib/operator.rb
|
422
|
+
* tolerances-1.0.0/lib/tolerance.rb
|
423
|
+
* raingrams-0.0.9/lib/raingrams/multigram_model.rb
|
424
|
+
* cheat-1.2.1/lib/site.rb
|
425
|
+
* ap4r-0.3.6/lib/ap4r/mongrel.rb
|
426
|
+
* radiant-0.6.7/vendor/rails/actionpack/test/controller/fragment_store_setting_test.rb
|
427
|
+
* datamapper-0.3.2/lib/data_mapper/associations/belongs_to_association.rb
|
428
|
+
* rools-0.4/RAKEFILE
|
429
|
+
* gettext-1.91.0/test/test_gettext.rb
|
430
|
+
* multibyte-0.0.1/lib/multibyte/handlers/utf8_handler.rb
|
431
|
+
* data_objects-0.9.2/lib/data_objects/transaction.rb
|
432
|
+
* onebody-0.3.0/vendor/rails/railties/builtin/rails_info/rails/info.rb
|
433
|
+
* mongrel_esi-0.5.4/test/net/server_test.rb
|
434
|
+
* dbc-2.0.0/lib/dbc/ocl.rb
|
435
|
+
* rubylexer/test/data/heremonsters_dos.rb
|
436
|
+
* lib/ftools.rb
|
437
|
+
* lib/rdoc/generators/template/html/html.rb
|
438
|
+
* lib/yaml/types.rb
|
439
|
+
* ruby-1.8.7/sample/test.rb
|
440
|
+
* ruby-1.8.7/test/fileutils/test_fileutils.rb
|
441
|
+
* ruby-1.8.7/test/ruby/test_proc.rb
|
442
|
+
* reg/regcompiler.rb
|
443
|
+
* reg/regvar.rb
|
444
|
+
* rubyparser/rubyparser.rb
|
445
|
+
* /usr/lib/ruby/1.9.0/resolv.rb
|
446
|
+
* /usr/lib/ruby/1.8/cmdparse2.rb
|
447
|
+
* /usr/lib/ruby/1.8/puppet/provider/package/appdmg.rb
|
448
|
+
* /usr/lib/ruby/1.8/qwik/util-css.rb
|
449
|
+
* /usr/lib/ruby/1.8/rbbr/doc/ri2.rb
|
450
|
+
* libxml-parser-ruby1.8/examples/digesttest.rb
|
451
|
+
* glark/optproc.rb
|
452
|
+
* hiki/hiki/plugin.rb
|
453
|
+
* kagemai/lib/xmlscan/parser.rb
|
454
|
+
* actionpack/test/controller/caching_test.rb
|
455
|
+
* activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb
|
456
|
+
* railties/builtin/rails_info/rails/info.rb
|
457
|
+
* railties/lib/initializer.rb
|
458
|
+
* skktools/filters/skkdictools.rb
|
459
|
+
* cursor-0.9/duck.rb
|
460
|
+
* Ron-0.1.0/lib/ron.rb
|
461
|
+
* ruby-debug-0.10.0/cli/ruby-debug/processor.rb
|