Next: C2.2 Le programme Yacc
Up: C2. Les source des
Previous: C2. Les source des
  Table des matières
C2.1 Le programme Lex : service_parser.lex
C [A-Z_?a-z]
A [0-9A-Z_a-z]
WC [ \t\n]*\:
#include <string.h>
#include <stdlib.h>
#include "service.h"
#include "service_parser.tab.h"
%option noyywrap
%%
[ \t] ;
\n num_ligne++;
"service" {return SERVICE;}
"module"/{WC} {yylval.ival = MODULE;return MODULE;}
"request"/{WC} {yylval.ival = REQUEST;return REQUEST;}
"inter"/{WC} {yylval.ival = INTER;return INTER;}
"wait"/{WC} {yylval.ival = WAIT;return WAIT;}
"group"/{WC} {yylval.ival = GROUP;return GROUP;}
{C}+{A}* { yylval.idStr = (ID_STR *)malloc(strlen(yytext) + 1);
strcpy((char *)yylval.idStr, yytext);
return(IDENTIFICATEUR); }
[\[\]\.\,\;\:\{\}\*\&\(\)\?\|\^\=\<\<\+\-\/\%\@] {
return(yytext[0]);
}
%%
Next: C2.2 Le programme Yacc
Up: C2. Les source des
Previous: C2. Les source des
  Table des matières
Thomas Nemeth
1999-10-03