WS [ \r\n\t]+ LT [A-Za-z] KR [A-Za-z0-9_\[\]\{\}/.&#$%~'@^] DI [0-9] INNM {DI}+ NM (({DI}+\.?{DI}*)|(\.{DI}+))([Ee][-+]?{DI}+)? VR {LT}{KR}*(<{KR}+>)? OPLE [<]?=? OPGE [>]=? EOW $|[*+-;<=>]|{WS} INF [ \r\n\t]*[-+][Ii][Nn][Ff]([Ii][Nn][Ii][Tt]([Ee]|[Yy]))?/{EOW} S_OP [-+ \t\n\r]+ MIN [mM][iI][nN]([iI][mM][iI][zZsS][eE])?[ \t]*: MAX [mM][aA][xX]([iI][mM][iI][zZsS][eE])?[ \t]*: INT ^[ \t]*[Ii][Nn][Tt]([Ee][Gg][Ee][Rr])? SEC ^[ \t]*([Ss][Ee][Cc])|([Ss][Ee][Mm][Ii]-[Cc][Oo][Nn][Tt][Ii][Nn][Uu][Oo][Uu][Ss])|([Ss][Ee][Mm][Ii])|([Ss][Ee][Mm][Ii][Ss]) SOS ^[ \t]*([Ss][Oo][Ss][12]*)|([Ss][Ee][Tt][Ss]) FREE ^[ \t]*[Ff][Rr][Ee][Ee] LBL {VR}: SOSD {LBL}: %start COMMENT %start LINECOMMENT %% "/*" { BEGIN COMMENT; } /* begin skip comment */ "*/" { BEGIN INITIAL; } /* end skip comment */ . { } \n { } \r { } "//" { BEGIN LINECOMMENT; } /* begin skip LINECOMMENT */ \n { BEGIN INITIAL; } /* end skip LINECOMMENT */ \r { BEGIN INITIAL; } /* end skip LINECOMMENT */ . { } {WS} { } "," { return(COMMA); } {MIN} { return(MINIMISE); } {MAX} { return(MAXIMISE); } {INNM} { f = atof((char *)yytext); return(INTCONS); } /* f contains the last float */ {NM} { f = atof((char *)yytext); return(CONS); } /* f contains the last float */ {INF} { char *ptr; f = DEF_INFINITE; Sign = 0; ptr = (char *)yytext; while (isspace(*ptr)) ptr++; if(*ptr == '-') Sign = 1; return(INF); } /* f contains the last float */ {S_OP} { Sign = 0; for(x = 0; x < yyleng; x++) if(yytext[x] == '-' || yytext[x] == '+') Sign = (Sign == (yytext[x] == '+')); return (SIGN); /* Sign is TRUE if the sign-string represents a '-'. Otherwise Sign is FALSE */ } {INT} { if((!Within_int_decl) && (!Within_sec_decl) && (!Within_sos_decl) && (!Within_free_decl)) { Within_int_decl = TRUE; Within_sos_decl1 = FALSE; } return(SEC_INT); } {SEC} { if((!Within_int_decl) && (!Within_sec_decl) && (!Within_sos_decl) && (!Within_free_decl)) { Within_sec_decl = TRUE; Within_sos_decl1 = FALSE; } return(SEC_SEC); } {SOS} { if(!Within_sos_decl) SOStype0 = (short)atoi(((char *)yytext) + 3); if((!Within_int_decl) && (!Within_sec_decl) && (!Within_sos_decl) && (!Within_free_decl)) Within_sos_decl = TRUE; return(SEC_SOS); } {SOSD} { FREE(Last_var); Last_var = strdup((char *)yytext); Last_var[strlen(Last_var) - 2] = 0; return(SOSDESCR); } {FREE} { if((!Within_int_decl) && (!Within_sec_decl) && (!Within_sos_decl) && (!Within_free_decl)) { Within_free_decl = TRUE; Within_sos_decl1 = FALSE; } return(SEC_FREE); } {LBL} { FREE(Last_var); Last_var = strdup((char *)yytext); Last_var[strlen(Last_var) - 1] = 0; return(VARIABLECOLON); } {VR} { FREE(Last_var); Last_var = strdup((char *)yytext); return(VAR); } ":" { return (COLON); } "*" { return(AR_M_OP); } {OPLE} { return(RE_OPLE); } {OPGE} { return(RE_OPGE); } ";" { Within_int_decl = Within_sec_decl = Within_sos_decl = Within_free_decl = FALSE; check_int_sec_sos_free_decl(Within_int_decl, Within_sec_decl, Within_sos_decl, Within_free_decl); return(END_C); } . { report(NULL, CRITICAL, "LEX ERROR : %s lineno %d\n", yytext, yylineno); return(UNDEFINED); } %%