Class: Aurum::Engine::PushbackString

Inherits:
Object
  • Object
show all
Defined in:
lib/aurum/engine/tokenization_facility.rb

Instance Method Summary collapse

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

Returns:

  • (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_charObject



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