Class: SDL4R::Token
- Inherits:
-
Object
- Object
- SDL4R::Token
- 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
-
#line_no ⇒ Object
Line number of the token.
-
#matcher ⇒ Object
Matcher object associated that discovered this Token.
-
#pos ⇒ Object
Position of the token in the line.
-
#text ⇒ Object
The token text.
-
#type ⇒ Object
Type of token (e.g. :WHITESPACE).
Instance Method Summary collapse
-
#initialize(text, type, matcher, line_no, pos) ⇒ Token
constructor
A new instance of Token.
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_no ⇒ Object
Line number of the token
36 37 38 |
# File 'lib/sdl4r/token.rb', line 36 def line_no @line_no end |
#matcher ⇒ Object
Matcher object associated that discovered this Token
42 43 44 |
# File 'lib/sdl4r/token.rb', line 42 def matcher @matcher end |
#pos ⇒ Object
Position of the token in the line
38 39 40 |
# File 'lib/sdl4r/token.rb', line 38 def pos @pos end |
#text ⇒ Object
The token text
44 45 46 |
# File 'lib/sdl4r/token.rb', line 44 def text @text end |
#type ⇒ Object
Type of token (e.g. :WHITESPACE)
40 41 42 |
# File 'lib/sdl4r/token.rb', line 40 def type @type end |