Issue #14683 has been updated by hsbt (Hiroshi SHIBATA).

Status changed from Open to Assigned
Assignee set to keiju (Keiju Ishitsuka)

----------------------------------------
Feature #14683: IRB with Ripper
https://bugs.ruby-lang.org/issues/14683#change-71473

* Author: aycabta (aycabta .)
* Status: Assigned
* Priority: Normal
* Assignee: keiju (Keiju Ishitsuka)
* Target version: 
----------------------------------------
I replaced lexical analyzer with Ripper. It's important for supporting new syntax.

I explain what I did.

## Replace with Ripper

I talked with @matz about it and I decided to use mirb of mruby as a reference.
https://github.com/mruby/mruby/blob/1905091634a6a2925c911484434448e568330626/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c#L118-L217

The mirb uses compile error messages and token information such as token type and lex_state for that whether or not inputted code continues(and PROMPT_N). I used RubyVM::InstructionSequence#compile and Ripper for the same action.

ref. IRB#each_top_level_statement, IRB#lex and IRB#check_code_block

## Continue(PROMPT_N), literal type(PROMPT_S), nesting level(%NNi)

IRB needs statuses of code snippets. @nobu implemented it as Ripper's features at irb-ripper branch on GitHub.
https://github.com/nobu/ruby/commits/feature/irb-ripper

I implemented by pure Ruby because I heard what @nobu thinks pure Ruby implementation for it. I think that it's the best way for that Ripper keeps simple.

ref. IRB#process_continue, IRB#process_nesting_level, IRB#check_string_literal and IRB#process_literal_type

## Erase --irb_debug option

Because this is just for pure Ruby lexical analyzer.


---Files--------------------------------
irb.patch (51.8 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>