class RuboCop::AST::NodePattern::Lexer
Experimental RBS support (using type sampling data from the type_fusion project).
# sig/rubocop/ast/node_pattern/lexer.rbs class RuboCop::AST::NodePattern::Lexer < RuboCop::AST::NodePattern::LexerRex def do_parse: () -> nil def emit: ((String | Symbol) type) -> untyped def token: ((String | Symbol) type, (Symbol | String) value) -> untyped end
/docs/modules/ROOT/pages/node_pattern.adoc
Doc on how this fits in the compiling process:
Lexer class for ‘NodePattern`
def do_parse
Experimental RBS support (using type sampling data from the type_fusion project).
def do_parse: () -> nil
This signature was generated using 1 sample from 1 application.
def do_parse # Called by the generated `parse` method, do nothing here. end
def emit(type)
Experimental RBS support (using type sampling data from the type_fusion project).
def emit: ((String | Symbol) type) -> untyped
This signature was generated using 7 samples from 1 application.
-
(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)
Experimental RBS support (using type sampling data from the type_fusion project).
def token: ((String | Symbol) type, (Symbol | String) value) -> untyped
This signature was generated using 10 samples from 1 application.
def token(type, value) [type, value] end