gzdoom-gles/tools/re2c/examples/repeater.re
Randy Heit 43abfba723 - Modified ccdv-win32 to show "Generating X" messages when running lemon and
re2c instead of "Linking X".
- Updated lemon and re2c to the latest versions and ported dehsupp to use them
  for code generation. (Xlatcc is next.)
- Added function level linking for Makefile.mingw.


SVN r144 (trunk)
2006-05-25 04:32:20 +00:00

44 lines
763 B
C++

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define RET(n) printf("%d\n", n); return n
int scan(char *s, int l){
char *p = s;
char *q;
#define YYCTYPE char
#define YYCURSOR p
#define YYLIMIT (s+l)
#define YYMARKER q
#define YYFILL(n)
/*!re2c
'a'{1}"\n" {RET(1);}
'a'{2,3}"\n" {RET(2);}
'a'{6}"\n" {RET(4);}
'a'{4,}"\n" {RET(3);}
[^aq]|"\n" {RET(0);}
*/
}
#define do_scan(str) scan(str, strlen(str))
main()
{
do_scan("a\n");
do_scan("aa\n");
do_scan("aaa\n");
do_scan("aaaa\n");
do_scan("q");
do_scan("a");
do_scan("A\n");
do_scan("AA\n");
do_scan("aAa\n");
do_scan("AaaA\n");
do_scan("Q");
do_scan("AaaAa\n");
do_scan("AaaAaA\n");
do_scan("A");
do_scan("\n");
do_scan("0");
}