Class: RubyToken::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/rdoc-f95/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.



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

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.



56
57
58
# File 'lib/rdoc-f95/parsers/parse_rb.rb', line 56

def char_no
  @char_no
end

#line_noObject (readonly)

Returns the value of attribute line_no.



56
57
58
# File 'lib/rdoc-f95/parsers/parse_rb.rb', line 56

def line_no
  @line_no
end

#textObject

Returns the value of attribute text.



41
42
43
# File 'lib/rdoc-f95/parsers/parse_rb.rb', line 41

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



51
52
53
54
# File 'lib/rdoc-f95/parsers/parse_rb.rb', line 51

def set_text(text)
  @text = text
  self
end