Class: RuboCop::AST::NodePattern::Parser::WithMeta::Lexer
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
::RuboCop::AST::NodePattern::Lexer ,
LexerRex
|
|
Instance Chain:
self,
::RuboCop::AST::NodePattern::Lexer ,
LexerRex
|
|
Inherits: |
RuboCop::AST::NodePattern::Lexer
|
Defined in: | lib/rubocop/ast/node_pattern/with_meta.rb |
Overview
Overrides Lexer to token locations and comments
Constant Summary
::RuboCop::AST::NodePattern::Lexer
- Inherited
Class Method Summary
Instance Attribute Summary
- #source_buffer readonly
::RuboCop::AST::NodePattern::Lexer
- Inherited
Instance Method Summary
::RuboCop::AST::NodePattern::Lexer
- Inherited
Constructor Details
.new(str_or_buffer) ⇒ Lexer
# File 'lib/rubocop/ast/node_pattern/with_meta.rb', line 13
def initialize(str_or_buffer) @source_buffer = if str_or_buffer.respond_to?(:source) str_or_buffer else ::Parser::Source::Buffer.new('(string)', source: str_or_buffer) end @comments = [] super(@source_buffer.source) end
Instance Attribute Details
#source_buffer (readonly)
[ GitHub ]# File 'lib/rubocop/ast/node_pattern/with_meta.rb', line 11
attr_reader :source_buffer
Instance Method Details
#emit_comment
[ GitHub ]
#pos ⇒ ::Parser::Source::Range
# File 'lib/rubocop/ast/node_pattern/with_meta.rb', line 33
def pos ::Parser::Source::Range.new(source_buffer, ss.pos - ss.matched_size, ss.pos) end
#token(type, value)
[ GitHub ]# File 'lib/rubocop/ast/node_pattern/with_meta.rb', line 23
def token(type, value) super(type, [value, pos]) end