diff options
Diffstat (limited to 'lib/test_helper.re')
-rw-r--r-- | lib/test_helper.re | 54 |
1 files changed, 25 insertions, 29 deletions
diff --git a/lib/test_helper.re b/lib/test_helper.re index 9ae6cc23..40b2d9c4 100644 --- a/lib/test_helper.re +++ b/lib/test_helper.re @@ -1,8 +1,6 @@ #include "lib/test_helper.h" - -static inline regoff_t parse_offset(const char *s, const char *e) -{ +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'); @@ -10,39 +8,37 @@ static inline regoff_t parse_offset(const char *s, const char *e) return n; } -bool parse_submatch(const char *s, std::vector<std::vector<regoff_t> > &result) -{ +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; + std::vector<regoff_t>* v; + const char* n1, *n2, *m1, *m2, *YYMARKER, *YYCURSOR = s; /*!stags:re2c format = "const char *@@;"; */ next: result.push_back(std::vector<regoff_t>()); v = &result.back(); -loop: - /*!re2c - re2c:define:YYCTYPE = char; - re2c:yyfill:enable = 0; - re2c:flags:tags = 1; - - * { return false; } - "\x00" { return true; } - "," { goto next; } - - "(?,?)" { - v->push_back(-1); - v->push_back(-1); - goto loop; - } - - "(" @n1 [0-9]+ @n2 "," @m1 [0-9]+ @m2 ")" { - v->push_back(parse_offset(n1, n2)); - v->push_back(parse_offset(m1, m2)); - goto loop; - } - */ +loop: /*!re2c + re2c:define:YYCTYPE = char; + re2c:yyfill:enable = 0; + re2c:flags:tags = 1; + + * { return false; } + "\x00" { return true; } + "," { goto next; } + + "(?,?)" { + v->push_back(-1); + v->push_back(-1); + goto loop; + } + + "(" @n1 [0-9]+ @n2 "," @m1 [0-9]+ @m2 ")" { + v->push_back(parse_offset(n1, n2)); + v->push_back(parse_offset(m1, m2)); + goto loop; + } +*/ } |