-/* Generated by re2c 1.1.1 on Sat Jul 13 19:06:36 2019 */
+/* Generated by re2c 1.2.1 on Thu Aug 29 22:25:45 2019 */
#line 1 "../lib/lex.re"
#include <stdio.h>
std::vector<ASTChar> *str = new std::vector<ASTChar>;
str->push_back(c);
yylval.regexp = ast_str(NOWHERE, str, false);
- return REGEXP;
+ return TOKEN_REGEXP;
}
#line 115 "lib/lex.cc"
yy6:
#line 46 "../lib/lex.re"
{
error("anchors are not supported");
- return ERROR;
+ return TOKEN_ERROR;
}
#line 123 "lib/lex.cc"
yy8:
#line 72 "../lib/lex.re"
{
yylval.regexp = ast_dot(NOWHERE);
- return REGEXP;
+ return TOKEN_REGEXP;
}
#line 136 "lib/lex.cc"
yy12:
{
if (!s_to_u32_unsafe(x, cur - 1, yylval.bounds.min)) goto err_cnt;
yylval.bounds.max = yylval.bounds.min;
- return COUNT;
+ return TOKEN_COUNT;
}
#line 184 "lib/lex.cc"
yy23:
{
if (!s_to_u32_unsafe(x, cur - 2, yylval.bounds.min)) goto err_cnt;
yylval.bounds.max = AST::MANY;
- return COUNT;
+ return TOKEN_COUNT;
}
#line 200 "lib/lex.cc"
yy27:
{
if (!s_to_u32_unsafe(x, y - 1, yylval.bounds.min)
|| !s_to_u32_unsafe(y, cur - 1, yylval.bounds.max)) goto err_cnt;
- return COUNT;
+ return TOKEN_COUNT;
}
#line 211 "lib/lex.cc"
}
std::vector<ASTRange> *p = new std::vector<ASTRange>;
p->swap(cls);
yylval.regexp = ast_cls(NOWHERE, p, neg);
- return REGEXP;
+ return TOKEN_REGEXP;
}
#line 263 "lib/lex.cc"
}
err:
error("syntax error: %s\n", cur);
- return ERROR;
+ return TOKEN_ERROR;
err_cnt:
error("repetition count overflow");
- return ERROR;
+ return TOKEN_ERROR;
}
int32_t lex_cls_chr(const char *&cur, uint32_t &c)
# define YYTOKENTYPE
enum yytokentype
{
- COUNT = 258,
- ERROR = 259,
- REGEXP = 260
+ TOKEN_COUNT = 258,
+ TOKEN_ERROR = 259,
+ TOKEN_REGEXP = 260
};
#endif
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
- "$end", "error", "$undefined", "COUNT", "ERROR", "REGEXP", "'|'", "'*'",
- "'+'", "'?'", "'('", "')'", "$accept", "regexp", "expr", "term",
- "factor", "primary", YY_NULLPTR
+ "$end", "error", "$undefined", "TOKEN_COUNT", "TOKEN_ERROR",
+ "TOKEN_REGEXP", "'|'", "'*'", "'+'", "'?'", "'('", "')'", "$accept",
+ "regexp", "expr", "term", "factor", "primary", YY_NULLPTR
};
#endif
# define YYTOKENTYPE
enum yytokentype
{
- COUNT = 258,
- ERROR = 259,
- REGEXP = 260
+ TOKEN_COUNT = 258,
+ TOKEN_ERROR = 259,
+ TOKEN_REGEXP = 260
};
#endif
[$^] {
error("anchors are not supported");
- return ERROR;
+ return TOKEN_ERROR;
}
"[^" { neg = true; goto cls; }
"{" @x num "}" {
if (!s_to_u32_unsafe(x, cur - 1, yylval.bounds.min)) goto err_cnt;
yylval.bounds.max = yylval.bounds.min;
- return COUNT;
+ return TOKEN_COUNT;
}
"{" @x num "," @y num "}" {
if (!s_to_u32_unsafe(x, y - 1, yylval.bounds.min)
|| !s_to_u32_unsafe(y, cur - 1, yylval.bounds.max)) goto err_cnt;
- return COUNT;
+ return TOKEN_COUNT;
}
"{" @x num ",}" {
if (!s_to_u32_unsafe(x, cur - 2, yylval.bounds.min)) goto err_cnt;
yylval.bounds.max = AST::MANY;
- return COUNT;
+ return TOKEN_COUNT;
}
"." {
yylval.regexp = ast_dot(NOWHERE);
- return REGEXP;
+ return TOKEN_REGEXP;
}
[^] \ nil {
std::vector<ASTChar> *str = new std::vector<ASTChar>;
str->push_back(c);
yylval.regexp = ast_str(NOWHERE, str, false);
- return REGEXP;
+ return TOKEN_REGEXP;
}
*/
std::vector<ASTRange> *p = new std::vector<ASTRange>;
p->swap(cls);
yylval.regexp = ast_cls(NOWHERE, p, neg);
- return REGEXP;
+ return TOKEN_REGEXP;
}
*/
err:
error("syntax error: %s\n", cur);
- return ERROR;
+ return TOKEN_ERROR;
err_cnt:
error("repetition count overflow");
- return ERROR;
+ return TOKEN_ERROR;
}
int32_t lex_cls_chr(const char *&cur, uint32_t &c)
re2c::ASTBounds bounds;
};
-%token COUNT
-%token ERROR
-%token REGEXP
+%token TOKEN_COUNT
+%token TOKEN_ERROR
+%token TOKEN_REGEXP
-%type <regexp> REGEXP regexp expr term factor primary
-%type <bounds> COUNT
+%type <regexp> TOKEN_REGEXP regexp expr term factor primary
+%type <bounds> TOKEN_COUNT
%%
factor
: primary
-| primary '*' { $$ = ast_iter($1, 0, AST::MANY); }
-| primary '+' { $$ = ast_iter($1, 1, AST::MANY); }
-| primary '?' { $$ = ast_iter($1, 0, 1); }
-| primary COUNT { $$ = ast_iter($1, $2.min, $2.max); }
+| primary '*' { $$ = ast_iter($1, 0, AST::MANY); }
+| primary '+' { $$ = ast_iter($1, 1, AST::MANY); }
+| primary '?' { $$ = ast_iter($1, 0, 1); }
+| primary TOKEN_COUNT { $$ = ast_iter($1, $2.min, $2.max); }
;
primary
-: REGEXP
+: TOKEN_REGEXP
| '(' ')' { $$ = ast_cap(ast_nil(NOWHERE)); }
| '(' expr ')' { $$ = ast_cap($2); }
;