Re: [RDT-Dev] AST from Editor

2007-01-26 Thread Christopher Williams

murphee,
 There's no shortcut right now to grab the root AST node from an editor.
You can grab the IRubyScript from an editor, and then traverse the
IRubyElement model hierarchy. You can also provide the root AST to findNode
on Members (fields, methods, classes, modules) and get the corresponding
node for the RubyElement. And you can grab a hold of the source of a script
and parse it to get the root.
 A number of places in our code parse the source to grab the root AST, but
that is because we haven't standardized (and a number of people were more
familiar and comfortable with working on the AST level instead of the
IRubyElement level). As far as I'm concerned, there should be very few
places that actually need a pointer to the AST. We need it in the process of
converting the AST to the IRubyElement hierarchy, we should provide it
during the build process for builders which need that level of detail
(right now we provide the IFile to the compiler/builder participants, and it
should be used for manipulating the underlying structure of the script for
refactoring, adding methods, etc.
 I think the part we need to clean up is the build process. We grab the
source and parse it a number of times there. Instead we should do it once
and pass along the contents, root AST node and pointer to the IFile to each
build participant.
I've never cached the root AST underneath a RubyScript because I was unsure
how much memory overhead it'd take up to hold onto that in memory, and
because I wanted to discourage dropping to the AST easily. A lot of the
stuff we're doing should be doen at the higher level IRubyElement level.

Syntax coloring is a whole different issue (we use Eclipse's facilities for
it, which are hard to shoehorn Ruby's syntax into, and right now it is rule
based and not AST based).

On 1/25/07, Werner Schuster (murphee) [EMAIL PROTECTED] wrote:


Chris and all RDTers,

is there any standard way of getting from an Editor - JRuby AST?
I am basically just getting the String from the Editor/Document, and
then running the Ruby Parser on it...
but this happens for various systems (Outline, Syntax Coloring, Realtime
Lint, etc), it'd be convenient to cache a copy of the AST somewhere.
Whenever a change happens in the editor, this would be updated.

The Builder could use this as well.

murphee
--

Blog @ http://jroller.com/page/murphee
Maintainer of EclipseShell @ http://eclipse-shell.sourceforge.net/





--
http://cwilliams.textdriven.com
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
Rubyeclipse-development mailing list
Rubyeclipse-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rubyeclipse-development


[RDT-Dev] AST from Editor

2007-01-25 Thread Werner Schuster (murphee)
Chris and all RDTers,

is there any standard way of getting from an Editor - JRuby AST?
I am basically just getting the String from the Editor/Document, and
then running the Ruby Parser on it...
but this happens for various systems (Outline, Syntax Coloring, Realtime
Lint, etc), it'd be convenient to cache a copy of the AST somewhere.
Whenever a change happens in the editor, this would be updated.

The Builder could use this as well.

murphee
-- 

Blog @ http://jroller.com/page/murphee 
Maintainer of EclipseShell @ http://eclipse-shell.sourceforge.net/


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Rubyeclipse-development mailing list
Rubyeclipse-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rubyeclipse-development