5 #include "fileparser.tab.h"
10 #define MAX_TOK_LEN 32
11 static char buf[MAX_TOK_LEN];
12 static char *p, *pe; /* scanner points to p, pe points to end of buf */
19 'env_street_road03_0.png' => {ret=VDAT;memmove(rbuf, ts, (te-ts)); yylval.str=strdup(rbuf); printf("Lexer matched with %s\n",yylval.str);fbreak; };
20 '.' => {printf("matched with .\n");fbreak;};
21 '..' => {printf("matched with ..\n");fbreak;};
32 pe = p + fread(buf, 1, MAX_TOK_LEN, yyin);
33 printf("buf in rinit is %s\n", buf);
41 char rbuf[MAX_TOK_LEN];
45 /*init cs, ts, te, act */
55 printf("This is a lexical error, tokens can not be larger than max token length\n buf is = %s | ts = %s | te = %s\n", buf,ts,te);
60 /* We matched a token, remove it from buf and set
61 buf to have rest of unmatched buf (buf - matchedtoken).*/
63 { int r = pe-te; /* remainder length */
64 memmove(buf, te, r); /* also the max more buf can hold */
66 pe = p + r + fread(buf+r,1,MAX_TOK_LEN -r,yyin);
68 if((p+1) == pe && feof(yyin))
75 /0x[xdigit]{8}/ => {};
77 /[digit]{2}/ => {}; /* CC */