Class: CodeLexer::Token
- Inherits:
-
Object
- Object
- CodeLexer::Token
- Defined in:
- lib/code-lexer/token.rb
Constant Summary collapse
- SPECIAL_TOKEN_OPEN =
"¬"- SPECIAL_TOKEN_CLOSE =
"¬"
Instance Attribute Summary collapse
-
#abstracted_value ⇒ Object
Returns the value of attribute abstracted_value.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #==(oth) ⇒ Object
-
#initialize(type, value) ⇒ Token
constructor
A new instance of Token.
- #to_s ⇒ Object
Constructor Details
#initialize(type, value) ⇒ Token
Returns a new instance of Token.
14 15 16 17 |
# File 'lib/code-lexer/token.rb', line 14 def initialize(type, value) @type = type self.value = value end |
Instance Attribute Details
#abstracted_value ⇒ Object
Returns the value of attribute abstracted_value.
12 13 14 |
# File 'lib/code-lexer/token.rb', line 12 def abstracted_value @abstracted_value end |
#type ⇒ Object
Returns the value of attribute type.
10 11 12 |
# File 'lib/code-lexer/token.rb', line 10 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
11 12 13 |
# File 'lib/code-lexer/token.rb', line 11 def value @value end |
Class Method Details
.special(token) ⇒ Object
6 7 8 |
# File 'lib/code-lexer/token.rb', line 6 def self.special(token) "#{SPECIAL_TOKEN_OPEN}#{token}#{SPECIAL_TOKEN_CLOSE}" end |
Instance Method Details
#==(oth) ⇒ Object
38 39 40 |
# File 'lib/code-lexer/token.rb', line 38 def ==(oth) @type == oth.type && @value == oth.value && @abstracted_value == oth.abstracted_value end |
#to_s ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/code-lexer/token.rb', line 30 def to_s if @abstracted_value != @value return "<#@type:#{@value.inspect}:#{@abstracted_value.inspect}>" else return "<#@type:#{@value.inspect}>" end end |