Class: ScaleRb::OldRegistry::TypeExp::Tokenizer
- Inherits:
-
Object
- Object
- ScaleRb::OldRegistry::TypeExp::Tokenizer
- Defined in:
- lib/scale_rb/old_registry.rb
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#tokens ⇒ Object
readonly
Returns the value of attribute tokens.
Instance Method Summary collapse
-
#eof? ⇒ Boolean
- % eof?
-
-> Bool.
-
#initialize(type_exp) ⇒ Tokenizer
constructor
- % tokenize
-
String -> [String].
-
#next_token ⇒ Object
- % next_token
-
-> String.
-
#peek_token ⇒ Object
- % peek_token
-
-> String.
Constructor Details
#initialize(type_exp) ⇒ Tokenizer
- % tokenize
-
String -> [String]
266 267 268 269 |
# File 'lib/scale_rb/old_registry.rb', line 266 def initialize(type_exp) @tokens = tokenize(type_exp) @index = 0 end |
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
263 264 265 |
# File 'lib/scale_rb/old_registry.rb', line 263 def index @index end |
#tokens ⇒ Object (readonly)
Returns the value of attribute tokens.
263 264 265 |
# File 'lib/scale_rb/old_registry.rb', line 263 def tokens @tokens end |
Instance Method Details
#eof? ⇒ Boolean
- % eof?
-
-> Bool
284 285 286 |
# File 'lib/scale_rb/old_registry.rb', line 284 def eof? @index >= @tokens.length end |
#next_token ⇒ Object
- % next_token
-
-> String
272 273 274 275 276 |
# File 'lib/scale_rb/old_registry.rb', line 272 def next_token token = @tokens[@index] @index += 1 token end |
#peek_token ⇒ Object
- % peek_token
-
-> String
279 280 281 |
# File 'lib/scale_rb/old_registry.rb', line 279 def peek_token @tokens[@index] end |