class RuboCop::AST::NodePattern::Lexer
/docs/modules/ROOT/pages/node_pattern.adoc
Doc on how this fits in the compiling process:
Lexer class for ‘NodePattern`
def do_parse
def do_parse # Called by the generated `parse` method, do nothing here. end
def emit(type)
-
(token)
-
def emit(type) value = ss[1] || ss.matched value = yield value if block_given? token = token(type, value) @tokens << token token end
def emit_comment
def emit_comment nil end
def emit_regexp
def emit_regexp body = ss[1] options = ss[2] flag = options.each_char.sum { |c| REGEXP_OPTIONS[c] } emit(:tREGEXP) { Regexp.new(body, flag) } end
def initialize(source)
def initialize(source) @tokens = [] super() parse(source) end
def token(type, value)
def token(type, value) [type, value] end