Class

RubyLex::BufferedReader

Inheritance
< 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.

Attributes

Name Visibility R/W Description
line_num public R

Methods

Class

Visibility Signature
public new (content)

Instance

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

Class Method Detail

new(content)

Instance Method Detail

column()

divert_read_from(reserve)

get_read()

getc()

getc_already_read()

peek(at)

peek_equal(str)

ungetc(ch)