class RuboCop::AST::NodePattern::Parser::WithMeta::Lexer
Overrides Lexer to token locations and comments
def emit_comment
def emit_comment @comments << Comment.new(pos) super end
def initialize(str_or_buffer)
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
def pos
-
(::Parser::Source::Range)
- last match's position
def pos ::Parser::Source::Range.new(source_buffer, ss.pos - ss.matched_size, ss.pos) end
def token(type, value)
def token(type, value) super(type, [value, pos]) end