Module: Ripl::MultiLine::Irb
- Defined in:
- lib/ripl/multi_line/irb.rb
Overview
# # # This multi-line implementation uses IRB’s RubyLex parser
works on: 2.0 1.9 1.8 jruby rbx
analyze features: none
Constant Summary collapse
- VERSION =
'0.1.0'
Class Attribute Summary collapse
-
.scanner ⇒ Object
readonly
Returns the value of attribute scanner.
Class Method Summary collapse
Instance Method Summary collapse
Class Attribute Details
.scanner ⇒ Object (readonly)
Returns the value of attribute scanner.
16 17 18 |
# File 'lib/ripl/multi_line/irb.rb', line 16 def scanner @scanner end |
Class Method Details
.lex ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/ripl/multi_line/irb.rb', line 35 def @scanner.lex until (((tk = token).kind_of?(RubyLex::TkNL) || tk.kind_of?(RubyLex::TkEND_OF_SCRIPT)) && !@continue or tk.nil?) #p tk #p @lex_state #p self end @found_eof = true if tk.kind_of?(RubyLex::TkEND_OF_SCRIPT) line = get_readed # print self.inspect if line == "" and tk.kind_of?(RubyLex::TkEND_OF_SCRIPT) || tk.nil? nil else line end end |
.multiline? ⇒ Boolean
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ripl/multi_line/irb.rb', line 22 def @scanner.multiline? initialize_input @continue = false @found_eof = false while line = lex @line << line @continue = false end !!( !@found_eof or @ltype or @continue or @indent > 0 ) end |