Class: TokenParser::Token

Inherits:
Object show all
Defined in:
lib/mega/tokenparser.rb

Overview

Token Definition Class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, start = nil, stop = nil) ⇒ Token

Returns a new instance of Token.



332
333
334
335
336
# File 'lib/mega/tokenparser.rb', line 332

def initialize( key, start=nil, stop=nil )
  @key = key
  @start = start
  @stop = stop
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



329
330
331
# File 'lib/mega/tokenparser.rb', line 329

def key
  @key
end

#parserObject

Returns the value of attribute parser.



330
331
332
# File 'lib/mega/tokenparser.rb', line 330

def parser
  @parser
end

#start(match = nil) ⇒ Object

def raw? ; @type == :raw ; end def normal? ; @type != :raw && @type != :unit ; end



342
343
344
# File 'lib/mega/tokenparser.rb', line 342

def start
  @start
end

#stop(match = nil) ⇒ Object

Returns the value of attribute stop.



330
331
332
# File 'lib/mega/tokenparser.rb', line 330

def stop
  @stop
end

#typeObject (readonly)

Returns the value of attribute type.



329
330
331
# File 'lib/mega/tokenparser.rb', line 329

def type
  @type
end

Instance Method Details

#unit?Boolean

Returns:

  • (Boolean)


338
# File 'lib/mega/tokenparser.rb', line 338

def unit? ; false  ; end