get_byte()
public
Show source
/*
* Scans one byte and returns it.
* This method is NOT multi-byte character sensitive.
* See also #getch.
*
* s = StringScanner.new('ab')
* s.get_byte # => "a"
* s.get_byte # => "b"
* s.get_byte # => nil
*
* s = StringScanner.new("\244\242")
* s.get_byte # => "\244"
* s.get_byte # => "\242"
* s.get_byte # => nil
*/
static VALUE
strscan_get_byte(VALUE self)
{
struct strscanner *p;
GET_SCANNER(self, p);
CLEAR_MATCH_STATUS(p);
if (EOS_P(p)) {
return Qnil;
}
p->prev = p->curr;
p->curr++;
MATCHED(p);
adjust_registers_to_matched(p);
return extract_range(p, p->prev + p->regs.beg[0],
p->prev + p->regs.end[0]);
}