Class: Parser::Registry

Inherits:
Object show all
Defined in:
lib/carat/parser.rb,
lib/carat/parser-old.rb

Overview

Registry

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*tokens) ⇒ Registry

Returns a new instance of Registry.



276
277
278
279
# File 'lib/carat/parser.rb', line 276

def initialize( *tokens )
  @registry = []
  register( *tokens )
end

Instance Attribute Details

#registryObject (readonly)

Returns the value of attribute registry.



274
275
276
# File 'lib/carat/parser.rb', line 274

def registry
  @registry
end

Instance Method Details

#each(&yld) ⇒ Object



293
294
295
# File 'lib/carat/parser.rb', line 293

def each( &yld )
  registry.each( &yld )
end

#empty?Boolean

Returns:

  • (Boolean)


291
# File 'lib/carat/parser.rb', line 291

def empty? ; @registry.empty? ; end

#register(*tokens) ⇒ Object



281
282
283
284
285
286
287
288
289
# File 'lib/carat/parser.rb', line 281

def register( *tokens )
  tokens.each { |tkn|
    unless Parser::Token === tkn or Parser::UnitToken === tkn
      raise( ArgumentError, "#{tkn.inspect} is not a Parser::Token" )
    end
  }
  @registry.concat( tokens )
  #@sorted = false
end