Class: YARD::Parser::Ruby::Legacy::RubyToken::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/yard/parser/ruby/legacy/ruby_lex.rb

Overview

Represents a token in the Ruby lexer

Constant Summary

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Token) initialize(line_no, char_no)

Creates a new Token object



38
39
40
41
42
# File 'lib/yard/parser/ruby/legacy/ruby_lex.rb', line 38

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

Instance Attribute Details

- (Integer) char_no (readonly)



24
25
26
# File 'lib/yard/parser/ruby/legacy/ruby_lex.rb', line 24

def char_no
  @char_no
end

- (Symbol) lex_state



30
31
32
# File 'lib/yard/parser/ruby/legacy/ruby_lex.rb', line 30

def lex_state
  @lex_state
end

- (Integer) line_no (readonly)



20
21
22
# File 'lib/yard/parser/ruby/legacy/ruby_lex.rb', line 20

def line_no
  @line_no
end

- (String) text (readonly)



27
28
29
# File 'lib/yard/parser/ruby/legacy/ruby_lex.rb', line 27

def text
  @text
end

Instance Method Details

- (Token) set_text(text)

Chainable way to sets the text attribute



48
49
50
51
# File 'lib/yard/parser/ruby/legacy/ruby_lex.rb', line 48

def set_text(text)
  @text = text
  self
end