blob: 7d788a5340bafc53320dfd67c876ae7aedd56b54 (
plain)
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
|
#define NULL ((char*) 0)
#define YYCTYPE char
#define YYCURSOR p
#define YYLIMIT p
#define YYMARKER q
#define YYFILL(n)
YYCTYPE yych;
int yySavedState;
#define YYGETSTATE() yySavedState
#define YYSETSTATE(n) yySavedState = n;
#include <stdio.h>
int scan(char *p)
{
int n = 0;
char *q;
printf("[--------------\n");
printf("%s\n", p);
printf("]--------------\n");
start:
/*!re2c
[^\n\000]* '\n'
{
++n;
goto start;
}
[^\n\000]* '\000'
{
return n;
}
*/
}
int main(int argc, char **argv)
{
int n = 0;
char *largv[4];
if (argc < 2)
{
argc = 4;
argv = largv;
argv[1] = "";
argv[2] = "1\n\n";
argv[3] = "1\n2\n";
}
while(++n < argc)
{
printf("%d\n", scan(argv[n]));
}
return 0;
}
|