Class: ScaleRb::OldRegistry::TypeExp::Tokenizer

Inherits:
Object
  • Object
show all
Defined in:
lib/scale_rb/old_registry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#indexObject (readonly)

Returns the value of attribute index.



263
264
265
# File 'lib/scale_rb/old_registry.rb', line 263

def index
  @index
end

#tokensObject (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

Returns:

  • (Boolean)


284
285
286
# File 'lib/scale_rb/old_registry.rb', line 284

def eof?
  @index >= @tokens.length
end

#next_tokenObject

% 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_tokenObject

% peek_token

-> String



279
280
281
# File 'lib/scale_rb/old_registry.rb', line 279

def peek_token
  @tokens[@index]
end