Class: SystemRDL::Parser::Token
- Inherits:
-
Object
- Object
- SystemRDL::Parser::Token
- Defined in:
- lib/systemrdl/parser/token.rb
Instance Attribute Summary collapse
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(text, kind, position) ⇒ Token
constructor
A new instance of Token.
- #to_sym ⇒ Object
- #to_token_range ⇒ Object
Constructor Details
#initialize(text, kind, position) ⇒ Token
Returns a new instance of Token.
23 24 25 26 27 28 |
# File 'lib/systemrdl/parser/token.rb', line 23 def initialize(text, kind, position) @text = text @kind = kind @position = position freeze end |
Instance Attribute Details
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
31 32 33 |
# File 'lib/systemrdl/parser/token.rb', line 31 def kind @kind end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
32 33 34 |
# File 'lib/systemrdl/parser/token.rb', line 32 def position @position end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
30 31 32 |
# File 'lib/systemrdl/parser/token.rb', line 30 def text @text end |
Instance Method Details
#==(other) ⇒ Object
42 43 44 |
# File 'lib/systemrdl/parser/token.rb', line 42 def ==(other) text == ((other.is_a?(Token) && other.text) || other) end |
#to_sym ⇒ Object
34 35 36 |
# File 'lib/systemrdl/parser/token.rb', line 34 def to_sym text.to_sym end |
#to_token_range ⇒ Object
38 39 40 |
# File 'lib/systemrdl/parser/token.rb', line 38 def to_token_range TokenRange.new(self) end |