D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby18
/
share
/
ri
/
1.8
/
system
/
RubyLex
/
BufferedReader
/
Filename :
cdesc-BufferedReader.yaml
back
Copy
--- !ruby/object:RI::ClassDescription attributes: - !ruby/object:RI::Attribute comment: name: line_num rw: R class_methods: - !ruby/object:RI::MethodSummary name: new comment: - !ruby/struct:SM::Flow::P body: Read an input stream character by character. We allow for unlimited ungetting of characters just read. - !ruby/struct:SM::Flow::P body: We simplify the implementation greatly by reading the entire input into a buffer initially, and then simply traversing it using pointers. - !ruby/struct:SM::Flow::P body: "We also have to allow for the <em>here document diversion</em>. 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" - !ruby/struct:SM::Flow::VERB body: " do_something(<<-A, <<-B)\n stuff\n for\n A\n stuff\n for\n B\n" - !ruby/struct:SM::Flow::P body: 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. constants: [] full_name: RubyLex::BufferedReader includes: [] instance_methods: - !ruby/object:RI::MethodSummary name: column - !ruby/object:RI::MethodSummary name: divert_read_from - !ruby/object:RI::MethodSummary name: get_read - !ruby/object:RI::MethodSummary name: getc - !ruby/object:RI::MethodSummary name: getc_already_read - !ruby/object:RI::MethodSummary name: peek - !ruby/object:RI::MethodSummary name: peek_equal - !ruby/object:RI::MethodSummary name: ungetc name: BufferedReader superclass: Object