On Friday 28 April 2006 14:55, Thomas E Enebo wrote: > Yeah it could be. Some functions creating nodes in ParserSupport > are just sticking a position in it. Not necesarily the right > position so much as the current position.
Ok, thanks.
I kind of fixed the wrong positions in the assignments.
I've tried to make my changes in the DefaultRubyParser.y file, but the
generated file wasn't compatible to our jruby-version (we are using the
RDT_0_7_0 tagged version). So I had to change DefaultRubyParser.java
directly. Did I change the right things?
Unfortunately, I found other wrong positions in Arrays. I'll see if I can fix
them too. Oh and you could perhaps help me with something I don't understand:
This code:
"a_string"
gives me the following nodes:
DStrNode[]: {DStrNode[]: {StrNode[]}}, position -> test.rb:[0,0]:[9,10]
DStrNode[]: {StrNode[]}, position -> test.rb:[0,0]:[9,9]
StrNode[], position -> test.rb:[0,0]:[0,9]
What are these two DStrNodes doing there? One marks the terminating " of the
string at position 9,9, but why does the other one include the 10th
character, which is just the linebreak? Is this also a bug?
Thanks!
Mirko
Index: DefaultRubyParser.java
===================================================================
--- DefaultRubyParser.java (revision 24)
+++ DefaultRubyParser.java (working copy)
@@ -1477,7 +1477,7 @@
case 82:
// line 681 "DefaultRubyParser.y"
{
- yyVal = support.assignable(getPosition(((ISourcePositionHolder)yyVals[0+yyTop])), yyVals[0+yyTop], null);
+ yyVal = support.assignable(getPosition(((ISourcePositionHolder)yyVals[0+yyTop]), true), yyVals[0+yyTop], null);
}
break;
case 83:
@@ -1698,6 +1698,7 @@
// line 793 "DefaultRubyParser.y"
{
yyVal = support.node_assign(((Node)yyVals[-2+yyTop]), ((Node)yyVals[0+yyTop]));
+ ((Node)yyVal).setPosition(support.union(((Node)yyVals[-2+yyTop]), ((Node)yyVals[0+yyTop])));
}
break;
case 173:
pgps27oKP5jE4.pgp
Description: PGP signature
