PIPS
solpip_scan.l
Go to the documentation of this file.
1 /*
2 
3  $Id: solpip_scan.l 23065 2016-03-02 09:05:50Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 
25 %{
26 /* Name : solpip_scan.l
27  * Package : paf-util
28  * Author : F. Lamour, F. Dumontet
29  * Date : 25 march 93
30  * Historic : 2 august 93, moved into (package) paf-util, AP
31  * Documents:
32  *
33  * Comments :
34  * Grammaire Lex pour interpreter une solution fournie par PIP en un "quast
35  * newgen".
36  */
37 #ifdef HAVE_CONFIG_H
38  #include "pips_config.h"
39 #endif
40 
41 #include "solpip_parse.h"
42 %}
43 
44  /* Pour que espace, cr, et tabulation soient ignores */
45 chiffre [0-9]
46 op [\/\-]
47 letter [A-Za-z_]
48 symboles {letter}({letter}|{chiffre})*
49 
50 %%
51 "list" {return (LST);}
52 "#" {return (DIES);}
53 "[" {return (LCRO);}
54 "]" {return (RCRO);}
55 "(" {return (LPAR);}
56 ")" {return (RPAR);}
57 "if" {return (IF);}
58 "(newparm" {return (NEWPARM);}
59 "div" {return (DIV);}
60 "/" {return (DIV_OP);}
61 "-" {return (MOINS_OP);}
62 
63 {chiffre}+ {sscanf(yytext,"%d",&yylval.valeur); return(ENTIER);}
64 {symboles} {sscanf(yytext, "%c",&yylval.blabla); return(TEXTE);}
65 [ \t\n] {;}
66 %%
67 
68 yywrap()
69 {return(1);}