1 2 %option noinput 3 %option nounput 4 5 %{ 6 #include <ctype.h> 7 #include "mut.h" 8 #include "rds.h" 9 #include "drucompi_y.h" 10 #include "drucutil.h" 11 #include "drucompi.h" 12 #include "vmctools.h" 13 14 #ifdef FLEX_SCANNER 15 16 #ifdef YY_INPUT 17 #undef YY_INPUT 18 #endif 19 20 #define YY_INPUT(buf,result,max_size) \ 21 do { \ 22 int c = getc(yyin); \ 23 result = (c == EOF) ? YY_NULL \ 24 : (buf[0] = isupper(c) ? toupper(c) : c, 1); \ 25 } while(0) 26 27 int yylineno; 28 29 #else /* using lex, for sure */ 30 31 #ifdef input 32 #undef input 33 #endif 34 35 #define input() (((yytchar = yysptr > yysbuf ? U(*--yysptr) \ 36 : getc(yyin)) == 10 ?(yylineno++,yytchar) \ 37 : yytchar) == EOF ? 0 \ 38 : isupper(yytchar) ? toupper(yytchar) \ 39 : yytchar) 40 #endif 41 42 %} 43 44 %p 3000 45 %option yylineno 46 47 delim [ \n\t] 48 esp [ \t] 49 rc [\n] 50 pct [\.\,\;\:\'\"\?\/\~\`\@\^<>\!\&\*\(\)\-\_\=\+\{\}\[\]\$\%\\\|] 51 blanc {delim}+ 52 53 lettre [A-Za-z] 54 ident {lettre}({lettre}*|{dec}*|[_]*)* 55 dec [0-9] 56 decimal {dec}+ 57 reel {dec}*([\.]{dec}*) 58 negat [\-]{reel} 59 comment [#]({lettre}*{dec}*{esp}*{pct}*)*{rc} 60 61 %% 62 63 64 {blanc} { DrucEcho ( yytext ); 65 } 66 layer { DrucEcho ( yytext ); 67 return(DRUC_LAYER);} 68 regle { DrucEcho ( yytext ); 69 return(DRUC_REGLE);} 70 regles { DrucEcho ( yytext ); 71 return(DRUC_REGLES);} 72 fin { DrucEcho ( yytext ); 73 return(DRUC_FIN);} 74 75 define { DrucEcho ( yytext ); 76 return(DRUC_DEFINE);} 77 undefine { DrucEcho ( yytext ); 78 return(DRUC_UNDEFINE);} 79 caracterise { DrucEcho ( yytext ); 80 return(DRUC_CARACTERISE);} 81 relation { DrucEcho ( yytext ); 82 return(DRUC_RELATION);} 83 84 resize { DrucEcho ( yytext ); 85 return(DRUC_RESIZE);} 86 exclusion { DrucEcho ( yytext ); 87 return(DRUC_EXCLUSION);} 88 union { DrucEcho ( yytext ); 89 return(DRUC_UNION);} 90 enveloppe { DrucEcho ( yytext ); 91 return(DRUC_ENVELOPPE);} 92 marge { DrucEcho ( yytext ); 93 return(DRUC_MARGE);} 94 croix { DrucEcho ( yytext ); 95 return(DRUC_CROIX);} 96 intersection { DrucEcho ( yytext ); 97 return(DRUC_INTERSECT);} 98 extension { DrucEcho ( yytext ); 99 return(DRUC_EXTENSION);} 100 inclusion { DrucEcho ( yytext ); 101 return(DRUC_INCLUSION);} 102 distance { DrucEcho ( yytext ); 103 return(DRUC_DISTANCE);} 104 105 surface_inter { DrucEcho ( yytext ); 106 return(DRUC_SURFACE_INTER);} 107 longueur_inter { DrucEcho ( yytext ); 108 return(DRUC_LONG_INTER);} 109 largeur_inter { DrucEcho ( yytext ); 110 return(DRUC_LARGE_INTER);} 111 penetre_inter { DrucEcho ( yytext ); 112 return(DRUC_PENET_INTER);} 113 parallele_inter { DrucEcho ( yytext ); 114 return(DRUC_PARAL_INTER);} 115 perpendiculaire_inter { DrucEcho ( yytext ); 116 return(DRUC_PERPEN_INTER);} 117 118 axiale { DrucEcho ( yytext ); 119 return(DRUC_AXIALE);} 120 geodesique { DrucEcho ( yytext ); 121 return(DRUC_GEODESIQUE);} 122 frontale { DrucEcho ( yytext ); 123 return(DRUC_FRONTALE);} 124 laterale_min { DrucEcho ( yytext ); 125 return(DRUC_LATERALE_MIN);} 126 laterale_max { DrucEcho ( yytext ); 127 return(DRUC_LATERALE_MAX);} 128 129 longueur_min { DrucEcho ( yytext ); 130 return(DRUC_LONGUEUR_MIN);} 131 longueur_max { DrucEcho ( yytext ); 132 return(DRUC_LONGUEUR_MAX);} 133 largeur_min { DrucEcho ( yytext ); 134 return(DRUC_LARGEUR_MIN);} 135 largeur_max { DrucEcho ( yytext ); 136 return(DRUC_LARGEUR_MAX);} 137 superieure { DrucEcho ( yytext ); 138 return(DRUC_SUP);} 139 inferieure { DrucEcho ( yytext ); 140 return(DRUC_INF);} 141 142 surface { DrucEcho ( yytext ); 143 return(DRUC_SURFACE);} 144 longueur { DrucEcho ( yytext ); 145 return(DRUC_LONGUEUR);} 146 largeur { DrucEcho ( yytext ); 147 return(DRUC_LARGEUR);} 148 149 notch { DrucEcho ( yytext ); 150 return(DRUC_NOTCH);} 151 min { DrucEcho ( yytext ); 152 return(DRUC_MIN);} 153 max { DrucEcho ( yytext ); 154 return(DRUC_MAX);} 155 "<=" { DrucEcho ( yytext ); 156 return(DRUC_INFEQ);} 157 ">=" { DrucEcho ( yytext ); 158 return(DRUC_SUPEQ);} 159 160 "->" { DrucEcho ( yytext ); 161 return(DRUC_DESTINATION);} 162 163 {decimal} { DrucEcho ( yytext ); 164 sscanf(yytext,"%d",&DrucInputEntier); 165 return(DRUC_ENTIER); 166 } 167 {reel} { DrucEcho ( yytext ); 168 sscanf( yytext,"%f",& DrucInputFloat); 169 return(DRUC_FLOAT); 170 } 171 {negat} { DrucEcho ( yytext ); 172 sscanf( yytext,"%f",& DrucInputFloat); 173 return(DRUC_NEG_FLOAT); 174 } 175 {ident} { DrucEcho ( yytext ); 176 sscanf(yytext,"%s",DrucInputChaine); 177 return(DRUC_NOM); 178 } 179 {comment} { DrucEcho ( yytext ); 180 } 181 . { DrucEcho ( yytext ); 182 return (*yytext);} 183 184 %% 185 186 void DrucEcho ( text ) 187 { 188 if ( DrucStructStat.FLAG_VIEW_RULE_MODE == DRUC_VERBOSE 189 ) 190 { 191 DrucViewString ( text ); 192 } 193 } 194 195 #ifndef yywrap 196 197 int yywrap() 198 { return(1) ; } 199 #endif 200