Initial version of donated sources by Avertec, 3.4p5.
[tas-yagle.git] / distrib / sources / api / api / gen_library_lexer.l
1 /****************************************************************************/
2 /* */
3 /* Chaine de CAO & VLSI Alliance */
4 /* */
5 /* Produit : GENIUS v1.00 */
6 /* Fichier : gen_library_lexer.lex */
7 /* */
8 /* (c) copyright 1999 Laboratoire MASI equipe CAO & VLSI */
9 /* Tous droits reserves */
10 /* Support : e-mail alliance-support@asim.lip6.fr */
11 /* */
12 /* Auteur(s) : Francois DONNET le : 04/05/1999 */
13 /* */
14 /* Modifie par : le : ../../.... */
15 /* Modifie par : le : ../../.... */
16 /* Modifie par : le : ../../.... */
17 /* */
18 /****************************************************************************/
19
20
21 %{
22 #include "string.h"
23 #include "stdlib.h"
24 #include MUT_H
25 #define API_HIDE_TOKENS
26 #include "api_lib.h"
27 #include "gen_library_parser.h"
28
29 #define yylval gen_library_parserlval
30
31 int lineno_library=1; /* to count the number of lines parsed */
32
33 #define YY_NO_UNPUT
34
35 %}
36
37 word ([a-zA-Z0-9_\.\/]*)
38 num (([1-9][0-9]*)|0)
39
40 %x COMMENTARY
41
42 %%
43 <INITIAL>rule(s)? {return _RULE;}
44 <INITIAL>action(s)? {return _ACTIONS;}
45
46 [ \t] {}
47 <COMMENTARY,INITIAL>\n {lineno_library++;}
48 \-\-.* {}
49 \/\* {BEGIN COMMENTARY;}
50 <COMMENTARY>[^(\n|(\*\/))]+ {}
51 <COMMENTARY>\* {}
52 <COMMENTARY>\*\/ {BEGIN INITIAL;}
53 <COMMENTARY>. {}
54 <INITIAL>\/\/[^\n]* {}
55 <INITIAL>{num} {yylval.integer=atoi(yytext); return _DIGIT;}
56 <INITIAL>{word} {yylval.string=(char*)mbkalloc(strlen(yytext)+1); yylval.string=strcpy(yylval.string,yytext); return _IDENT;}
57 <INITIAL>\"[^\"]*\" { char buf[1024]; yylval.string=(char*)mbkalloc(strlen(yytext)+1); yylval.string=strcpy(yylval.string,&yytext[1]); yylval.string[strlen(yylval.string)-1]='\0'; return _IDENT;}
58 <INITIAL>. {return *yytext;}
59 %%
60
61
62
63 /*****************************************************************************/
64 /* stop searching other files to parse ? */
65 /*****************************************************************************/
66 extern int yywrap() {
67 return 1;
68 }
69