Class | YARD::Parser::Ruby::Legacy::RubyLex::BufferedReader
In: | lib/yard/parser/ruby/legacy/ruby_lex.rb
Parent: | Object

Read an input stream character by character. We allow for unlimited ungetting of characters just read.

We simplify the implementation greatly by reading the entire input into a buffer initially, and then simply traversing it using pointers.

We also have to allow for the here document diversion. This little gem comes about when the lexer encounters a here document. At this point we effectively need to split the input stream into two parts: one to read the body of the here document, the other to read the rest of the input line where the here document was initially encountered. For example, we might have

      do_something(<<-A, <<-B)
        stuff
        for
      A
        stuff
        for
      B

When the lexer encounters the <<A, it reads until the end of the line, and keeps it around for later. It then reads the body of the here document. Once complete, it needs to read the rest of the original line, but then skip the here document body.

@private

### Methods

column divert_read_from get_read getc getc_already_read new peek peek_equal ungetc

### Attributes

line_num | [R] |

### Public Class methods

new(content)

### Public Instance methods

column()
divert_read_from(reserve)
get_read()
getc()
getc_already_read()
peek(at)
peek_equal(str)
ungetc(ch)

[Validate]