Class: Rly::LexToken

Inherits:
Object
  • Object
show all
Defined in:
lib/rly/lex_token.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#lexerObject (readonly)

Returns the value of attribute lexer.



5
6
7
# File 'lib/rly/lex_token.rb', line 5

def lexer
  @lexer
end

#location_infoObject

Returns the value of attribute location_info.



4
5
6
# File 'lib/rly/lex_token.rb', line 4

def location_info
  @location_info
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/rly/lex_token.rb', line 4

def type
  @type
end

#valueObject

Returns the value of attribute value.



4
5
6
# File 'lib/rly/lex_token.rb', line 4

def value
  @value
end

Instance Method Details

#inspectObject



18
19
20
# File 'lib/rly/lex_token.rb', line 18

def inspect
  "#<LexToken #{@type} '#{@value}'>"
end

#to_sObject



14
15
16
# File 'lib/rly/lex_token.rb', line 14

def to_s
  @value.to_s
end