%{ /* * The Unix Channel * * by Michel Beaudouin-Lafon * * Copyright 1993 * Centre d'Etudes de la Navigation Aerienne (CENA) * * Request management, by Stephane Chatty * * $Id$ * $CurLog$ */ #include #include #include "ccu/HashTable.h" #include "ccu/String.h" #include "ReqMgr.yacc.h" // produced from the parser file with '-d' option of yacc extern int tee (int); #define RETURN(x) return (tee(x)) extern "C" { int atoi (const char *); void exit (int); int read (int, char*, int); } CcuDictionnary* ResWords; int LineNo = 1; static char IdBuf [1024]; void LexInit () { if (!ResWords) { ResWords = new CcuDictionnary (10); (*ResWords)["service"] = (void*) (Y_SERVICE); (*ResWords)["request"] = (void*) (Y_REQUEST); (*ResWords)["answer"] = (void*) (Y_ANSWER); (*ResWords)["event"] = (void*) (Y_EVENT); (*ResWords)["getters"] = (void*) (Y_GETTERS); (*ResWords)["setters"] = (void*) (Y_SETTERS); (*ResWords)["const"] = (void*) (Y_CONST); // (*ResWords)[""] = (void*) (Y_); } LineNo = 1; #ifdef FLEX_SCANNER static void yyrestart (FILE*); yyrestart (0); #endif } %} Int [-]?[0-9]+ Ident [a-zA-Z_][a-zA-Z_0-9]* nl [\n] sp0 [ \t]* sp1 [ \t]+ LocHeader \"{Ident}.h\" GlobHeader \ %% [,();{}*] RETURN (yytext[0]); \%.*\n { /* comments */ ++LineNo; } {sp1} {} {nl} { ++LineNo; } -> { RETURN (Y_YIELDS); } #include {Ident} { CcuHashCell* c; if (c = ResWords->Get (yytext)) { RETURN(int (c->GetInfo ())); } else { yylval.string = NewString (yytext); RETURN (Y_ID); } } . { RETURN (-1); }