On Tuesday 02 May 2006 00:10, Thomas E Enebo wrote: > If you could give me a patch for the .y file which would generate > the equivalent of what you changed in the .java file (along with the > tests I will add it). A newer version of RDT will end up picking up > these changes at some point. > > I believe what you changed is ok for your purposes, but for JRuby > we need them in the .y.
Ok, I've attached the patch.
>
> I think this is a bug. I also notice our evaluator seems to take into
> account multiple DStrNodes. I think ParserSupport.literal_concat is
> adding this extra empty DStrNode when head is null. I will need to
> consider this a bit more though. It certainly seems wrong from a surface
> view of the code.
I would really appreciate if you could take a look at it. In the meantime, I'm
going to work on Array-positions. Currently, this:
[5, 10, 15]
gives me:
ArrayNode[]: {FixnumNode[]FixnumNode[]FixnumNode[]}, position -> test.rb:
[0,0]:[1,3]
FixnumNode[], position -> test.rb:[0,0]:[1,1]
FixnumNode[], position -> test.rb:[0,0]:[4,5]
FixnumNode[], position -> test.rb:[0,0]:[8,9]
While the Fixnums are correct, the ArrayNode certainly isn't.
Mirko
Index: DefaultRubyParser.y
===================================================================
--- DefaultRubyParser.y (revision 32)
+++ DefaultRubyParser.y (working copy)
@@ -679,7 +679,7 @@
}
lhs : variable {
- $$ = support.assignable(getPosition($<ISourcePositionHolder>1), $1, null);
+ $$ = support.assignable(getPosition($<ISourcePositionHolder>1, true), $1, null);
}
| primary_value '[' aref_args ']' {
$$ = support.getElementAssignmentNode($1, $3);
@@ -792,6 +792,7 @@
arg : lhs '=' arg {
$$ = support.node_assign($1, $3);
+ $<Node>$.setPosition(support.union($1, $3));
}
| lhs '=' arg kRESCUE_MOD arg {
$$ = support.node_assign($1, new RescueNode(getPosition($<ISourcePositionHolder>1), $3, new RescueBodyNode(getPosition($<ISourcePositionHolder>1), null,$5, null), null));
pgpsEF9ohNvhV.pgp
Description: PGP signature
