Class: Rly::LexToken
- Inherits:
-
Object
- Object
- Rly::LexToken
- Defined in:
- lib/rly/lex_token.rb
Instance Attribute Summary collapse
-
#lexer ⇒ Object
readonly
Returns the value of attribute lexer.
-
#location_info ⇒ Object
Returns the value of attribute location_info.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(type, value, lexer, pos = 0, lineno = 0, filename = nil) ⇒ LexToken
constructor
A new instance of LexToken.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(type, value, lexer, pos = 0, lineno = 0, filename = nil) ⇒ LexToken
Returns a new instance of LexToken.
7 8 9 10 11 12 |
# File 'lib/rly/lex_token.rb', line 7 def initialize(type, value, lexer, pos=0, lineno=0, filename=nil) @type = type @value = value @lexer = lexer @location_info = { pos: pos, lineno: lineno, filename: filename } end |
Instance Attribute Details
#lexer ⇒ Object (readonly)
Returns the value of attribute lexer.
5 6 7 |
# File 'lib/rly/lex_token.rb', line 5 def lexer @lexer end |
#location_info ⇒ Object
Returns the value of attribute location_info.
4 5 6 |
# File 'lib/rly/lex_token.rb', line 4 def location_info @location_info end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/rly/lex_token.rb', line 4 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/rly/lex_token.rb', line 4 def value @value end |
Instance Method Details
#inspect ⇒ Object
18 19 20 |
# File 'lib/rly/lex_token.rb', line 18 def inspect "#<LexToken #{@type} '#{@value}'>" end |
#to_s ⇒ Object
14 15 16 |
# File 'lib/rly/lex_token.rb', line 14 def to_s @value.to_s end |