Class: Aurum::Engine::PushbackString
- Inherits:
-
Object
- Object
- Aurum::Engine::PushbackString
- Defined in:
- lib/aurum/engine/tokenization_facility.rb
Instance Method Summary collapse
- #eof? ⇒ Boolean
- #get_char ⇒ Object
-
#initialize(string) ⇒ PushbackString
constructor
A new instance of PushbackString.
- #pushback(char) ⇒ Object
Constructor Details
#initialize(string) ⇒ PushbackString
Returns a new instance of PushbackString.
67 68 69 |
# File 'lib/aurum/engine/tokenization_facility.rb', line 67 def initialize string @string = string end |
Instance Method Details
#eof? ⇒ Boolean
76 77 78 79 |
# File 'lib/aurum/engine/tokenization_facility.rb', line 76 def eof? @get_char_index = -1 unless @get_char_index @get_char_index >= (@string.length - 1) end |
#get_char ⇒ Object
71 72 73 74 |
# File 'lib/aurum/engine/tokenization_facility.rb', line 71 def get_char @get_char_index = -1 unless @get_char_index @string[@get_char_index += 1] end |
#pushback(char) ⇒ Object
81 82 83 |
# File 'lib/aurum/engine/tokenization_facility.rb', line 81 def pushback char @get_char_index -= 1 end |