End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Ripper#token
ripper.token → String
parse.c
View on GitHub ↗
static VALUE
ripper_token(VALUE self)
{
struct parser_params *p;
long pos, len;
TypedData_Get_Struct(self, struct parser_params, &parser_data_type, p);
if (!ripper_initialized_p(p)) {
rb_raise(rb_eArgError, "method called for uninitialized object");
}
if (NIL_P(p->parsing_thread)) return Qnil;
pos = p->lex.ptok - p->lex.pbeg;
len = p->lex.pcur - p->lex.ptok;
return rb_str_subseq(p->lex.lastline, pos, len);
}
Return the current token string.