Class: YARD::Parser::Ruby::Legacy::RubyToken::Token
- Inherits:
-
Object
- Object
- YARD::Parser::Ruby::Legacy::RubyToken::Token
- Defined in:
- lib/yard/parser/ruby/legacy/ruby_lex.rb
Overview
Represents a token in the Ruby lexer
Direct Known Subclasses
TkBlockContents, TkError, TkId, TkNode, TkOp, TkStatementEnd, TkUnknownChar, TkVal, TkWhitespace
Constant Summary collapse
- NO_TEXT =
"??".freeze
Instance Attribute Summary collapse
-
#char_no ⇒ Integer
readonly
The character number in the file/stream the token is located.
-
#lex_state ⇒ Symbol
The lexical state at the token.
-
#line_no ⇒ Integer
readonly
The line number in the file/stream the token is located.
-
#text ⇒ String
readonly
The token text value.
Instance Method Summary collapse
-
#initialize(line_no, char_no) ⇒ Token
constructor
Creates a new Token object.
-
#set_text(text) ⇒ Token
Chainable way to sets the text attribute.
Constructor Details
Instance Attribute Details
#char_no ⇒ Integer (readonly)
Returns the character number in the file/stream the token is located.
23 24 25 |
# File 'lib/yard/parser/ruby/legacy/ruby_lex.rb', line 23 def char_no @char_no end |
#lex_state ⇒ Symbol
Returns the lexical state at the token.
29 30 31 |
# File 'lib/yard/parser/ruby/legacy/ruby_lex.rb', line 29 def lex_state @lex_state end |
#line_no ⇒ Integer (readonly)
Returns the line number in the file/stream the token is located.
19 20 21 |
# File 'lib/yard/parser/ruby/legacy/ruby_lex.rb', line 19 def line_no @line_no end |
#text ⇒ String (readonly)
Returns the token text value.
26 27 28 |
# File 'lib/yard/parser/ruby/legacy/ruby_lex.rb', line 26 def text @text end |
Instance Method Details
#set_text(text) ⇒ Token
Chainable way to sets the text attribute
47 48 49 50 |
# File 'lib/yard/parser/ruby/legacy/ruby_lex.rb', line 47 def set_text(text) @text = text self end |