Class: XfOOrth::AbstractSource
- Includes:
- ReadPoint
- Defined in:
- lib/fOOrth/compiler/source.rb
Overview
The Source class used to contain code common to most sources.
Direct Known Subclasses
Instance Attribute Summary
Attributes included from ReadPoint
Instance Method Summary collapse
-
#close ⇒ Object
Close the source.
-
#eof? ⇒ Boolean
Has the source reached the end of the available data?
Returns: * True if the end is reached else false. -
#get ⇒ Object
Get the next character of input data
Returns: * The next character or nil if none are available. -
#initialize ⇒ AbstractSource
constructor
Initialize the abstract base class.
Methods included from ReadPoint
#eoln?, #read, #reset_read_point
Constructor Details
#initialize ⇒ AbstractSource
Initialize the abstract base class.
13 14 15 16 |
# File 'lib/fOOrth/compiler/source.rb', line 13 def initialize reset_read_point @eof = false end |
Instance Method Details
#close ⇒ Object
Close the source.
19 20 21 22 |
# File 'lib/fOOrth/compiler/source.rb', line 19 def close @eoln = true @eof = true end |
#eof? ⇒ Boolean
Has the source reached the end of the available data?
Returns:
-
True if the end is reached else false.
43 44 45 |
# File 'lib/fOOrth/compiler/source.rb', line 43 def eof? @eof end |
#get ⇒ Object
Get the next character of input data
Returns:
-
The next character or nil if none are available.
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/fOOrth/compiler/source.rb', line 27 def get return nil if @eof read do begin @read_step.next.rstrip rescue StopIteration @eof = true nil end end end |