/* Generated by re2c 4.5 */
#line 1 "../lib/test_helper.re"
#include "lib/test_helper.h"

static inline regoff_t parse_offset(const char* s, const char* e) {
    regoff_t n = 0;
    for (; s < e; ++s) {
        n = n * 10 + (*s - '0');
    }
    return n;
}

bool parse_submatch(const char* s, std::vector<std::vector<regoff_t> >& result) {
    result.clear();
    if (!s) return true;

    std::vector<regoff_t>* v;
    const char* n1, *n2, *m1, *m2, *YYMARKER, *YYCURSOR = s;
    
#line 21 "lib/test_helper.cc"
const char *yyt1;const char *yyt2;
#line 17 "../lib/test_helper.re"


next:
    result.push_back(std::vector<regoff_t>());
    v = &result.back();

loop: 
#line 31 "lib/test_helper.cc"
{
	char yych;
	static const unsigned char yybm[256] = {
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		128, 128, 128, 128, 128, 128, 128, 128,
		128, 128,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0,
		  0,   0,   0,   0,   0,   0,   0,   0
	};
	yych = *YYCURSOR;
	if (yych <= '(') {
		if (yych <= 0x00) goto yy1;
		if (yych <= '\'') goto yy2;
		goto yy4;
	} else {
		if (yych == ',') goto yy5;
		goto yy2;
	}
yy1:
	++YYCURSOR;
#line 29 "../lib/test_helper.re"
	{ return true; }
#line 81 "lib/test_helper.cc"
yy2:
	++YYCURSOR;
yy3:
#line 28 "../lib/test_helper.re"
	{ return false; }
#line 87 "lib/test_helper.cc"
yy4:
	yych = *(YYMARKER = ++YYCURSOR);
	if (yych <= '/') goto yy3;
	if (yych <= '9') {
		yyt1 = YYCURSOR;
		goto yy6;
	}
	if (yych == '?') goto yy8;
	goto yy3;
yy5:
	++YYCURSOR;
#line 30 "../lib/test_helper.re"
	{ goto next; }
#line 101 "lib/test_helper.cc"
yy6:
	yych = *++YYCURSOR;
	if (yybm[0+yych] & 128) goto yy6;
	if (yych == ',') goto yy9;
yy7:
	YYCURSOR = YYMARKER;
	goto yy3;
yy8:
	yych = *++YYCURSOR;
	if (yych == ',') goto yy10;
	goto yy7;
yy9:
	yych = *++YYCURSOR;
	if (yych <= '/') goto yy7;
	if (yych <= '9') {
		yyt2 = YYCURSOR;
		goto yy11;
	}
	goto yy7;
yy10:
	yych = *++YYCURSOR;
	if (yych == '?') goto yy12;
	goto yy7;
yy11:
	yych = *++YYCURSOR;
	if (yych == ')') goto yy13;
	if (yych <= '/') goto yy7;
	if (yych <= '9') goto yy11;
	goto yy7;
yy12:
	yych = *++YYCURSOR;
	if (yych == ')') goto yy14;
	goto yy7;
yy13:
	++YYCURSOR;
	n1 = yyt1;
	m1 = yyt2;
	n2 = yyt2;
	n2 -= 1;
	m2 = YYCURSOR;
	m2 -= 1;
#line 38 "../lib/test_helper.re"
	{
        v->push_back(parse_offset(n1, n2));
        v->push_back(parse_offset(m1, m2));
        goto loop;
    }
#line 149 "lib/test_helper.cc"
yy14:
	++YYCURSOR;
#line 32 "../lib/test_helper.re"
	{
        v->push_back(-1);
        v->push_back(-1);
        goto loop;
    }
#line 158 "lib/test_helper.cc"
}
#line 43 "../lib/test_helper.re"

}
