123456789_123456789_123456789_123456789_123456789_

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

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Inherits: Object
Defined in: lib/yard/parser/ruby/legacy/ruby_lex.rb

Overview

Represents a token in the ::YARD::Parser::Ruby lexer

Constant Summary

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(line_no, char_no) ⇒ Token

Creates a new Token object

Parameters:

  • line_no (Integer) —

    the line number to initialize the token to

  • char_no (Integer) —

    the char number to initialize the token to

[ GitHub ]

  
# File 'lib/yard/parser/ruby/legacy/ruby_lex.rb', line 37

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

Instance Attribute Details

#char_no ⇒ Integer (readonly)

Returns:

  • (Integer) —

    the character number in the file/stream the token is located.

[ GitHub ]

  
# File 'lib/yard/parser/ruby/legacy/ruby_lex.rb', line 23

attr_reader :char_no

#lex_state ⇒ Symbol (rw)

Returns:

  • (Symbol) —

    the lexical state at the token

[ GitHub ]

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

attr_accessor :lex_state

#line_no ⇒ Integer (readonly)

Returns:

  • (Integer) —

    the line number in the file/stream the token is located.

[ GitHub ]

  
# File 'lib/yard/parser/ruby/legacy/ruby_lex.rb', line 19

attr_reader :line_no

#text ⇒ String (readonly)

Returns:

  • (String) —

    the token text value

[ GitHub ]

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

attr_reader :text

Instance Method Details

#set_text(text) ⇒ Token

Chainable way to sets the text attribute

Parameters:

  • text (String) —

    the new text

Returns:

  • (Token) —

    this token object

[ GitHub ]

  
# File 'lib/yard/parser/ruby/legacy/ruby_lex.rb', line 47

def set_text(text)
  @text = text
  self
end