1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
/* Generated by re2c */
// re2c $INPUT -o $OUTPUT -i --input custom
// POSIX and leftmost policies produce different results.
#include <stddef.h>
#include <stdio.h>
static void lex(const char *s)
{
#define YYPEEK() *s
#define YYSKIP() ++s
#define YYBACKUP() marker = s
#define YYRESTORE() s = marker
#define YYSTAGP(t) t = (s - p)
#define YYSTAGN(t) t = 0
#define YYMAXNMATCH 2
size_t yynmatch;
const char *marker, *p = s;
long yypmatch[YYMAXNMATCH * 2];
long yyt1;long yyt2;long yyt3;
{
char yych;
yych = YYPEEK();
switch (yych) {
case 'a':
YYSTAGP(yyt1);
YYSTAGP(yyt2);
goto yy2;
default: goto yy1;
}
yy1:
YYSKIP();
{ printf("error\n"); return; }
yy2:
YYSKIP();
yych = YYPEEK();
switch (yych) {
case 'a':
YYSTAGP(yyt2);
goto yy2;
default:
YYSTAGP(yyt3);
goto yy3;
}
yy3:
yynmatch = 2;
yypmatch[0] = yyt1;
yypmatch[2] = yyt2;
yypmatch[3] = yyt3;
YYSTAGP(yypmatch[1]);
{
printf("'%.*s', '%.*s'\n",
yypmatch[1] - yypmatch[0], p + yypmatch[0],
yypmatch[3] - yypmatch[2], p + yypmatch[2]);
return;
}
}
}
int main(int argc, char **argv)
{
for (int i = 1; i < argc; ++i) {
lex(argv[i]);
}
return 0;
}
captures/diff1_leftmost.re:25:22: warning: rule matches empty string [-Wmatch-empty-string]
|