From ba066c34dde204aa192d03a23a81356374d93731 Mon Sep 17 00:00:00 2001 From: chatty Date: Wed, 7 Apr 1993 11:50:31 +0000 Subject: Initial revision --- comm/OLD/ReqMgr.l | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 comm/OLD/ReqMgr.l (limited to 'comm/OLD/ReqMgr.l') diff --git a/comm/OLD/ReqMgr.l b/comm/OLD/ReqMgr.l new file mode 100644 index 0000000..bad288c --- /dev/null +++ b/comm/OLD/ReqMgr.l @@ -0,0 +1,95 @@ +%{ +/* + * 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)["client"] = (void*) (Y_CLIENT); + (*ResWords)["request"] = (void*) (Y_REQUEST); + (*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); + } -- cgit v1.1