Class: SDL4R::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/sdl4r/token.rb

Overview

Used internally by Tokenizer for keeping track of its state. Don’t use directly.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, type, matcher, line_no, pos) ⇒ Token

Returns a new instance of Token.



27
28
29
30
31
32
33
# File 'lib/sdl4r/token.rb', line 27

def initialize(text, type, matcher, line_no, pos)
  @text = text
  @type = type
  @matcher = matcher
  @line_no = line_no
  @pos = pos
end

Instance Attribute Details

#line_noObject

Line number of the token



36
37
38
# File 'lib/sdl4r/token.rb', line 36

def line_no
  @line_no
end

#matcherObject

Matcher object associated that discovered this Token



42
43
44
# File 'lib/sdl4r/token.rb', line 42

def matcher
  @matcher
end

#posObject

Position of the token in the line



38
39
40
# File 'lib/sdl4r/token.rb', line 38

def pos
  @pos
end

#textObject

The token text



44
45
46
# File 'lib/sdl4r/token.rb', line 44

def text
  @text
end

#typeObject

Type of token (e.g. :WHITESPACE)



40
41
42
# File 'lib/sdl4r/token.rb', line 40

def type
  @type
end