Class: Token
- Inherits:
-
Object
- Object
- Token
- Defined in:
- lib/token.rb
Overview
Note:
This class is used to represent a token
Token class for Melissa Converter NG
Instance Attribute Summary collapse
-
#position ⇒ Object
Returns the value of attribute position.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
-
#initialize(type, value, position) ⇒ Token
constructor
A new instance of Token.
- #is_a?(type) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(type, value, position) ⇒ Token
Returns a new instance of Token.
10 11 12 13 14 |
# File 'lib/token.rb', line 10 def initialize(type, value, position) @type = type @value = value @position = position end |
Instance Attribute Details
#position ⇒ Object
Returns the value of attribute position.
8 9 10 |
# File 'lib/token.rb', line 8 def position @position end |
#type ⇒ Object
Returns the value of attribute type.
8 9 10 |
# File 'lib/token.rb', line 8 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
8 9 10 |
# File 'lib/token.rb', line 8 def value @value end |
Class Method Details
Instance Method Details
#accept(visitor) ⇒ Object
20 |
# File 'lib/token.rb', line 20 def accept visitor; end |
#is_a?(type) ⇒ Boolean
16 17 18 |
# File 'lib/token.rb', line 16 def is_a? type @type == type end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/token.rb', line 26 def to_s "#{@type} : #{@value}" end |