Class: RubyToken::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/rdoc/parsers/parse_rb.rb

Direct Known Subclasses

TkError, TkId, TkNode, TkOp, TkUnknownChar, TkVal

Constant Summary collapse

NO_TEXT =
"??".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line_no, char_no) ⇒ Token

Returns a new instance of Token.



44
45
46
47
48
# File 'lib/rdoc/parsers/parse_rb.rb', line 44

def initialize(line_no, char_no)
  @line_no = line_no
  @char_no = char_no
  @text    = NO_TEXT
end

Instance Attribute Details

#char_noObject (readonly)

Returns the value of attribute char_no.



57
58
59
# File 'lib/rdoc/parsers/parse_rb.rb', line 57

def char_no
  @char_no
end

#line_noObject (readonly)

Returns the value of attribute line_no.



57
58
59
# File 'lib/rdoc/parsers/parse_rb.rb', line 57

def line_no
  @line_no
end

#textObject

Returns the value of attribute text.



42
43
44
# File 'lib/rdoc/parsers/parse_rb.rb', line 42

def text
  @text
end

Instance Method Details

#set_text(text) ⇒ Object

Because we’re used in contexts that expect to return a token, we set the text string and then return ourselves



52
53
54
55
# File 'lib/rdoc/parsers/parse_rb.rb', line 52

def set_text(text)
  @text = text
  self
end