Giles Bowkett wrote:
> 
> is that what you need, basically?

Close, but it doesn't let me enter arbitrary lines of input and know 
whether they need to be joined to execution or can be executed 
individually, the way IRB does.

I've got the majority of my desired behavior now, by applying some 
patches to RubyLex: http://pastie.caboo.se/91797

When the user presses enter, I call get_statement on the lexer, which 
either returns the line and line number if it's ready for execution or 
nil if it's not.

The only thing this doesn't currently handle is string continuations -- 
once again, IRB happily enters an infinite loop when it detects an 
incomplete string in a line. I would like to hit this border case as 
well, but it's looking like it's going to require some pretty deep digs 
into the lexing code. It doesn't terribly excite me, and I don't 
personally use string continuation very much, so I'm tempted to just 
call it a halfway-victory.

Unless there are some particularly knowledgeable IRB hackers waiting in 
the wings to offer advice...
-- 
Posted via http://www.ruby-forum.com/.