1// re2c $INPUT -o $OUTPUT 2#include <stdlib.h> 3#include <stdio.h> 4#include <string.h> 5 6#define RET(n) printf("%d\n", n); return n 7#define TAG_EOI 0 8#define TAG_A 1 9#define TAG_TAG 2 10 11int scan(char *s, int l) 12{ 13 char *p = s; 14 char *q; 15#define YYCTYPE char 16#define YYCURSOR p 17#define YYLIMIT (s+l) 18#define YYMARKER q 19#define YYFILL(n) 20cont: 21/*!re2c 22any = [\001-\377]; 23'<a' { RET(TAG_A); } 24[<][A-Za-z]+ { RET(TAG_TAG); } 25[\000] { RET(TAG_EOI); } 26any { goto cont; } 27*/ 28} 29 30#define do_scan(str) scan(str, strlen(str)) 31 32main() 33{ 34 do_scan("0"); 35} 36