%{ enum token_kind {END,IDENT,NUMBER,STRING,PATTERN,KEYWORD,REAL_NUMBER,TEXT,TOKEN_NOT_RECOGNIZED}; int text_yytext_curr; char text_char; int patsign_begin; #undef YYLMAX #define YYLMAX 10000 #define NL_CHECKTEXTLIMIT if (text_char == '\n') { \ yylineno++; \ yytext[text_yytext_curr] = '\n'; \ text_yytext_curr++; \ if (text_yytext_curr >= YYLMAX) { \ fprintf(stderr, \ "SCANNER: warning: truncated on line %d : The Text token exceeds the max length %d.\n",yylineno,YYLMAX); \ yytext[text_yytext_curr-1] = '\0'; \ yyleng = text_yytext_curr-1; \ return (TOKEN_NOT_RECOGNIZED); \ } \ else \ continue;\ } \ #define ADVANCE_CHECKLIMIT {\ yytext[text_yytext_curr] = text_char;\ text_yytext_curr++;\ if (text_yytext_curr >= YYLMAX) {\ fprintf(stderr,"SCANNER: warning: truncated on line %d : The Text token exceeds the max length %d.\n",yylineno,YYLMAX);\ yytext[text_yytext_curr-1] = '\0';\ yyleng = text_yytext_curr-1;\ return (TOKEN_NOT_RECOGNIZED);\ }\ }\ #define CHECKLIMIT if (text_yytext_curr >= YYLMAX)\ {\ fprintf(stderr,"SCANNER: warning: truncated on line %d : The Text token exceeds the max length %d.\n",yylineno,YYLMAX);\ yytext[text_yytext_curr-1] = '\0';\ yyleng = text_yytext_curr-1;\ return (TOKEN_NOT_RECOGNIZED);\ }\ %} %p 7000 %n 7000 %e 2000 Digit [0-9] Letter [A-Za-z] Sep [_-] whitesp [ \n\t] %%