Re: trying to understand irb: why does it have its own lexer, instead of forwarding input to ruby ?



Joachim (München) wrote:
Robert and Tim, thank you for your clear explanations.

As mentioned before, I want to extend the ruby language.
Specifically, I want to twist the interpreter so that it expands
for instance w8s6ny into w[8].s[6].y.size(). Do you experts
think this can be achieved by modifying IRB's ruby code,
without diving into Ruby's C code?

Yes, easily.

You could put code like Robert's in the RubyLex#buf_input method (in
irb/ruby-lex.rb), for example, after @input.call but before @rests.concat.

Cheers,
Dave
.