Re: [Jruby-devel] SourcePosition in the AST

2006-05-07 Thread Charles O Nutter
Also, please feel free to send code or patches (working or not working) any time and we may be able to help you further. Patches help us see a bit better what you're trying to do and then we may be able to offer more guidance. I'm very interested in your project, and I'll try to help as much as I

Re: [Jruby-devel] SourcePosition in the AST

2006-05-07 Thread Thomas E Enebo
On Sun, 07 May 2006, Thomas Corbat defenestrated me: > > Thomas E Enebo wrote: > >On Tue, 25 Apr 2006, Mirko Stocker defenestrated me: > >>On Tuesday 25 April 2006 19:44, Thomas E Enebo wrote: > >> > >The biggest challenge is determining where in grammar we should accept > >the token. It seems

Re: [Jruby-devel] SourcePosition in the AST

2006-05-07 Thread Thomas Corbat
Thomas E Enebo wrote: On Tue, 25 Apr 2006, Mirko Stocker defenestrated me: On Tuesday 25 April 2006 19:44, Thomas E Enebo wrote: We don't and neither does C Ruby. �Our parser is based on theirs and we both eat comments in the lexing process. Ok, would it be much work? Could you g

Re: [Jruby-devel] SourcePosition in the AST

2006-05-01 Thread Mirko Stocker
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. > >

Re: [Jruby-devel] SourcePosition in the AST

2006-05-01 Thread Thomas E Enebo
On Mon, 01 May 2006, Mirko Stocker defenestrated me: > 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. > > O

Re: [Jruby-devel] SourcePosition in the AST

2006-05-01 Thread Mirko Stocker
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

Re: [Jruby-devel] SourcePosition in the AST

2006-04-28 Thread Thomas E Enebo
On Fri, 28 Apr 2006, Mirko Stocker defenestrated me: > On Thursday 27 April 2006 16:00, Thomas E Enebo wrote: > > ? Take a shot at it. ?I have put the parser processing code at: > > http://www.tc.umn.edu/~enebo/jruby/parser.tar.gz > > > > ? Compile Jay for your platform (I believe I have the windo

Re: [Jruby-devel] SourcePosition in the AST

2006-04-27 Thread Mirko Stocker
On Thursday 27 April 2006 16:00, Thomas E Enebo wrote: >   Take a shot at it.  I have put the parser processing code at: > http://www.tc.umn.edu/~enebo/jruby/parser.tar.gz > >   Compile Jay for your platform (I believe I have the windows binaries > there).  Install it somewhere.  Update 'update' to

Re: [Jruby-devel] SourcePosition in the AST

2006-04-27 Thread Thomas E Enebo
On Thu, 27 Apr 2006, Mirko Stocker defenestrated me: > > Hi Tom > > On Tuesday 25 April 2006 16:46, Thomas E Enebo wrote: > > If you understand this code you can create some simple > > unit tests to add to testPositions and I can likely figure those out (or > > help you figure them out). > > I st

Re: [Jruby-devel] SourcePosition in the AST

2006-04-27 Thread Mirko Stocker
Hi Tom On Tuesday 25 April 2006 16:46, Thomas E Enebo wrote: > If you understand this code you can create some simple > unit tests to add to testPositions and I can likely figure those out (or > help you figure them out). I studied the code and wrote a test for the ClassVarDeclNode, InstAsgnNode

Re: [Jruby-devel] SourcePosition in the AST

2006-04-26 Thread Werner Schuster (murphee)
Mirko Stocker wrote: On Tuesday 25 April 2006 18:27, Werner Schuster (murphee) wrote: I'm wondering: why don't you just generate TextEdits for the original TextBuffer (file, or whatever) instead of generating the code from the AST? Well yes, we thought about that, but our tutor suggeste

Re: [Jruby-devel] SourcePosition in the AST

2006-04-25 Thread Thomas E Enebo
On Tue, 25 Apr 2006, Mirko Stocker defenestrated me: > On Tuesday 25 April 2006 19:44, Thomas E Enebo wrote: > > We don't and neither does C Ruby. ?Our parser is based on theirs and > > we both eat comments in the lexing process. > > Ok, would it be much work? Could you give me some ideas on how t

Re: [Jruby-devel] SourcePosition in the AST

2006-04-25 Thread Charles O Nutter
Thanks, and good luck! On 4/25/06, Mirko Stocker <[EMAIL PROTECTED]> wrote: > On Tuesday 25 April 2006 18:11, Charles O Nutter wrote: > > I hope you will consider contributing some or all of this back to RDT > > and JRuby; > > Of course we'll do that! > > > I would especially be interested in your

Re: [Jruby-devel] SourcePosition in the AST

2006-04-25 Thread Mirko Stocker
On Tuesday 25 April 2006 19:44, Thomas E Enebo wrote: > We don't and neither does C Ruby.  Our parser is based on theirs and > we both eat comments in the lexing process. Ok, would it be much work? Could you give me some ideas on how to do it? Unfortunately, I don't have much experience on these

Re: [Jruby-devel] SourcePosition in the AST

2006-04-25 Thread Mirko Stocker
On Tuesday 25 April 2006 18:11, Charles O Nutter wrote: > I hope you will consider contributing some or all of this back to RDT > and JRuby; Of course we'll do that! > I would especially be interested in your code that > reconstructs the source file from the AST since it would allow us to > cre

Re: [Jruby-devel] SourcePosition in the AST

2006-04-25 Thread Mirko Stocker
On Tuesday 25 April 2006 18:27, Werner Schuster (murphee) wrote: > I'm wondering: why don't you just generate TextEdits for the original > TextBuffer (file, or whatever) > instead of generating the code from the AST? > > Ie. calculate a bunch of replace operations (use the Eclipse TextEdit > APIs s

Re: [Jruby-devel] SourcePosition in the AST

2006-04-25 Thread Thomas E Enebo
On Tue, 25 Apr 2006, Charles O Nutter defenestrated me: > > I'd think this is as simple as creating a node to contain comments and > sticking them in there rather than skipping them, no? Perhaps we could > even hook into RI/Rubydoc subsystem to create DocNodes too... Yep. We create a new Comme

Re: [Jruby-devel] SourcePosition in the AST

2006-04-25 Thread Werner Schuster (murphee)
Charles O Nutter wrote: This shouldn't be difficult to do, and would give RDT another, cooler potential feature: RI/RubyDoc documentation on hover like Javadocs are with Java :) There's actually support for that in RDT already; if your mouse is over a symbol you'll get a Documentation Hover,

Re: [Jruby-devel] SourcePosition in the AST

2006-04-25 Thread Charles O Nutter
This shouldn't be difficult to do, and would give RDT another, cooler potential feature: RI/RubyDoc documentation on hover like Javadocs are with Java :) I'd think this is as simple as creating a node to contain comments and sticking them in there rather than skipping them, no? Perhaps we could ev

Re: [Jruby-devel] SourcePosition in the AST

2006-04-25 Thread Thomas E Enebo
On Tue, 25 Apr 2006, Mirko Stocker defenestrated me: > On Tuesday 25 April 2006 16:46, Thomas E Enebo wrote: > > > ? The positions are as follows: > > 1. index of first character for node > > 2. index of last character for node > > 3. start line for node > > 4. end line for node > > > > ? Just gu

Re: [Jruby-devel] SourcePosition in the AST

2006-04-25 Thread Charles O Nutter
I hope you will consider contributing some or all of this back to RDT and JRuby; I would especially be interested in your code that reconstructs the source file from the AST since it would allow us to create a sort of "uneval" feature that spits out code given already-parsed nodes. An obvious next

Re: [Jruby-devel] SourcePosition in the AST

2006-04-25 Thread Werner Schuster (murphee)
Mirko Stocker wrote: That's what I expected, too. For our project we have to rely on correct positions (or have to create a workaround for the wrong ones), because we'd like to reconstruct the sourcefile from the AST. I'm wondering: why don't you just generate TextEdits for the original Text

Re: [Jruby-devel] SourcePosition in the AST

2006-04-25 Thread Mirko Stocker
On Tuesday 25 April 2006 16:46, Thomas E Enebo wrote: >   This is probably an error in our positioning.  I got several important > positions working properly, but not all of them.  If you look at > test/testPositions.rb in our sourcecode, you can see the nodes I last > concentrated on.  If you unde

Re: [Jruby-devel] SourcePosition in the AST

2006-04-25 Thread Thomas E Enebo
On Tue, 25 Apr 2006, Mirko Stocker defenestrated me: > > Hi! > > I'm currently analyzing the JRuby AST to create refactorings for the RDT. To > analyze the AST, im just stepping through it with the Debugger, and i'm > wondering if the SourcePositions in the AST are correct. with this Class: > >

Re: [Jruby-devel] SourcePosition in the AST

2006-04-25 Thread Charles O Nutter
The position holds both character indices and line indices. In your class Test, the InstAsgn starts at or around the 37th character, which is reflected in the position data. If you check the starting line in the position data, you should get the numbers you're expecting. On 4/25/06, Mirko Stocker

[Jruby-devel] SourcePosition in the AST

2006-04-25 Thread Mirko Stocker
Hi! I'm currently analyzing the JRuby AST to create refactorings for the RDT. To analyze the AST, im just stepping through it with the Debugger, and i'm wondering if the SourcePositions in the AST are correct. with this Class: class Test def initialize @field = "test" end end the InstA