beginning_of_line?()
public
Show source
/*
* Returns +true+ iff the scan pointer is at the beginning of the line.
*
* s = StringScanner.new("test\ntest\n")
* s.bol? # => true
* s.scan(/te/)
* s.bol?
* s.scan(/st\n/)
* s.bol?
* s.terminate
* s.bol?
*/
static VALUE
strscan_bol_p(VALUE self)
{
struct strscanner *p;
GET_SCANNER(self, p);
if (CURPTR(p) > S_PEND(p)) return Qnil;
if (p->curr == 0) return Qtrue;
return (*(CURPTR(p) - 1) == '\n') ? Qtrue : Qfalse;
}