]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/assembly/parser/scanner.flex
mod change (-x)
[helm.git] / matita / matita / contribs / assembly / parser / scanner.flex
1 /* ******************************** */\r
2 /* PER UNA CORRETTA VISUALIZZAZIONE */\r
3 /*           tab size=4             */\r
4 /* ******************************** */\r
5 \r
6 /* - stati del preprocessore */\r
7 %x      defbegin\r
8 %x      defend\r
9 \r
10 /* - discard dei commenti / * ...  * / */\r
11 %x      combegin\r
12 \r
13 %{\r
14 \r
15 /* ************************************************************************* */\r
16 \r
17 #include        <stdio.h>\r
18 #include        <stdlib.h>\r
19 #include        <string.h>\r
20 \r
21 /* ************************************************************************* */\r
22 \r
23 #define         MAX_DEPTH       1000    /* numero massimo di annidamenti */\r
24 \r
25 #define         ERR_EXIT        0               /* uscita ok */\r
26 #define         OK_EXIT         1               /* uscita errore */\r
27 \r
28 #define         SEP                     '\n'    /* separatore dei campi in output */\r
29 \r
30 #define         EXP_OPT         "-e"    /* opzione di solo preprocessing */\r
31 \r
32 /* stringhe di errore */\r
33 #define         ERR_UNK         "ScanError:UnknownToken"\r
34 #define         ERR_OPT         "ScanError:UnknownOption"\r
35 #define         ERR_NL          "ScanError:UnexptedNewline"\r
36 #define         ERR_STR         "ScanError:EmptyString"\r
37 #define         ERR_CHR         "ScanError:EmptyChar"\r
38 #define         ERR_ALR         "ScanError:RepeatedDefine"\r
39 #define         ERR_MANYCHR     "ScanError:TooManyChars"\r
40 #define         ERR_INC         "ScanError:TooManyExpansionsOrNestings"\r
41 #define         ERR_MIS         "ScanError:MissingIncludeFile"\r
42 #define         ERR_MEM         "ScanError:OutOfMemory"\r
43 #define         ERR_ARG         "ScanError:IncorrectArgumentNumber"\r
44 #define         ERR_OPEN        "ScanError:FileNotFound"\r
45 #define         ERR_UNA         "ScanError:UnallowedExpansion"\r
46 #define         ERR_UNE         "ScanError:Unexpected(#endif)"\r
47 #define         ERR_UNS         "ScanError:Unexpected(#switch)"\r
48 #define         ERR_END         "ScanError:Missing(#endif)"\r
49 #define         ERR_LOP         "ScanError:ExpansionLoopDetected"\r
50 #define         ERR_RES         "ScanError:ReservedToken"\r
51 \r
52 /* ************************************************************************* */\r
53 \r
54 /* elemento lista dei token */\r
55 typedef struct listElem\r
56         {\r
57         char                            *scanTxt;\r
58         struct listElem         *next;\r
59         } listELEM;\r
60 \r
61 /* elemento lista delle espansioni */\r
62 typedef struct defElem\r
63         {\r
64         char                            *defId;\r
65         char                            *defTxt;\r
66         struct defElem          *next;\r
67         } defELEM;\r
68 \r
69 /* ************************************************************************* */\r
70 \r
71 YY_BUFFER_STATE         inStream[MAX_DEPTH];                    /* buffer: input stream buffer */\r
72 int                                     inNesting=0;                                    /* contatore: livello di annidamento */\r
73 char                            inName[MAX_DEPTH][257];                 /* buffer: nomi dei sorgenti */\r
74 int                                     inLine[MAX_DEPTH];                              /* buffer: linea corrente */\r
75 int                                     inRow[MAX_DEPTH];                               /* buffer: colonna corrente */\r
76 \r
77 listELEM                        *rootElem=NULL,*curElem=NULL;   /* lista dei token */\r
78 defELEM                         *rootDef=NULL,*curDef=NULL;             /* lista delle espansioni */\r
79 \r
80 int                                     stringFound;                                    /* flag: stringa non vuota */\r
81 int                                     charFound;                                              /* flag: carattere non vuoto */\r
82 int                                     expand=0;                                               /* flag: espansione in corso */\r
83 int                                     startExpansion;                                 /* variabile: espansione iniziale (per evitare loop) */\r
84 int                                     eatTrueEndif=0;                                 /* contatore: #endif validi (a seguito di true) */\r
85 int                                     eatFalseEndif=0;                                /* contatore: #endif validi (a seguito di false) */\r
86 int                                     expOnly=0;                                              /* flag: preprocessare senza generare token */\r
87 \r
88 char                            tempBuf[2000];                                  /* spazio temporaneo per formattare l'output/error */\r
89 \r
90 /* espansioni riservate */\r
91 char    *reserved[]={\r
92                         "array",\r
93                         "of",\r
94                         "struct",\r
95                         "if",\r
96                         "elsif",\r
97                         "else",\r
98                         "while",\r
99                         "const",\r
100                         "b2w",\r
101                         "b2dw",\r
102                         "w2b",\r
103                         "w2dw",\r
104                         "dw2b",\r
105                         "dw2w",\r
106                         "byte",\r
107                         "word",\r
108                         "dword",\r
109                         NULL };\r
110 \r
111 /* ************************************************************************* */\r
112 \r
113 void    addOkBuf(char *token,char *ytext);\r
114 void    errExit(char *ytext);\r
115 void    addDefId(char *ytext);\r
116 int             checkDefId(char *ytext);\r
117 void    checkRsvd(char *ytext);\r
118 void    delDefId(char *ytext);\r
119 void    addDefTxt(char *ytext);\r
120 void    usage(char *name);\r
121 \r
122 /* ************************************************************************* */\r
123 \r
124 %}\r
125 \r
126 KEYWORD         ("array"|"of"|"struct"|"if"|"elsif"|"else"|"while"|"const"|"b2w"|"b2dw"|"w2b"|"w2dw"|"dw2b"|"dw2w")\r
127 TYPE            ("byte"|"word"|"dword")\r
128 BRACKET         ("{"|"}"|"["|"]"|"("|")")\r
129 MONOOP          ("!"|"~")\r
130 DUALOP          ("&"|"|"|"^"|"+"|"-"|"*"|"/"|"!="|"=="|"<"|">"|"<="|">="|"<<"|">>"|"=")\r
131 SEPARATOR       (";"|"."|",")\r
132 \r
133 IDWORD          ("0x"[a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9])\r
134 IWORD           ("0x"[a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9])\r
135 IBYTE           ("0x"[a-fA-F0-9][a-fA-F0-9])\r
136 INUM            ([0-9]+)\r
137 ID                      ([_a-zA-Z][_a-zA-Z0-9]*)\r
138 \r
139 BLANK           ([ \t])\r
140 NL                      (\n|\r\n)\r
141 \r
142 /* ************************************************************************* */\r
143 \r
144 %%\r
145 \r
146 <INITIAL>"#define"              {\r
147                                                 /* ************** */\r
148                                                 /* DEFINIZIONE ID */\r
149                                                 /* ************** */\r
150 \r
151                                                 if(expand)\r
152                                                         { sprintf(tempBuf,"%s",ERR_UNA); errExit(tempBuf); exit(ERR_EXIT); }\r
153 \r
154                                                 inRow[inNesting]+=yyleng;\r
155                                                 BEGIN(defbegin);\r
156                                                 }\r
157 <defbegin>{BLANK}+              { inRow[inNesting]+=yyleng; }\r
158 <defbegin>{ID}                  { checkRsvd(yytext); addDefId(yytext); inRow[inNesting]+=yyleng; BEGIN(defend); }\r
159 <defbegin>{NL}                  { sprintf(tempBuf,"%s",ERR_NL); errExit(tempBuf); exit(ERR_EXIT); }\r
160 <defbegin>.                             { sprintf(tempBuf,"%s(%s)",ERR_UNK,yytext); errExit(tempBuf); exit(ERR_EXIT); } \r
161 <defend>[^\r\n]+                { addDefTxt(yytext); inRow[inNesting]+=yyleng; }\r
162 <defend>{NL}                    { inLine[inNesting]++; inRow[inNesting]=1; BEGIN(INITIAL); }\r
163 \r
164 \r
165 \r
166 <INITIAL>"/*"                   {\r
167                                                 /* *************** */\r
168                                                 /* INIZIO COMMENTO */\r
169                                                 /* *************** */\r
170                                                 \r
171                                                 if(!expand)\r
172                                                         { inRow[inNesting]+=yyleng; }\r
173                                                         \r
174                                                 BEGIN(combegin);\r
175                                                 }\r
176 <combegin>{NL}                  {\r
177                                                 if(expand)\r
178                                                         { sprintf(tempBuf,"%s",ERR_NL); errExit(tempBuf); exit(ERR_EXIT); }\r
179 \r
180                                                 inLine[inNesting]++;\r
181                                                 inRow[inNesting]=1;\r
182                                                 }\r
183 <combegin>[^\r\n]               {\r
184                                                 if(!expand)\r
185                                                         { inRow[inNesting]+=yyleng; }\r
186                                                 }\r
187 <combegin>"*/"                  {\r
188                                                 if(!expand)\r
189                                                         { inRow[inNesting]+=yyleng; }\r
190                                                 \r
191                                                 BEGIN(INITIAL);\r
192                                                 }\r
193 \r
194 \r
195 \r
196 <INITIAL>{KEYWORD}              {\r
197                                                 /* ******************** */\r
198                                                 /* TOKEN DEL LINGUAGGIO */\r
199                                                 /* ******************** */\r
200 \r
201                                                 addOkBuf("KEW",yytext);\r
202                                                 \r
203                                                 if(!expand)\r
204                                                         { inRow[inNesting]+=yyleng; }\r
205                                                 }\r
206 <INITIAL>{TYPE}                 {\r
207                                                 addOkBuf("TYP",yytext);\r
208                                                 \r
209                                                 if(!expand)\r
210                                                         { inRow[inNesting]+=yyleng; }\r
211                                                 }\r
212 <INITIAL>{BRACKET}              {\r
213                                                 addOkBuf("BRK",yytext);\r
214                                                 \r
215                                                 if(!expand)\r
216                                                         { inRow[inNesting]+=yyleng; }\r
217                                                 }\r
218 <INITIAL>{MONOOP}               {\r
219                                                 addOkBuf("MOP",yytext);\r
220                                                 \r
221                                                 if(!expand)\r
222                                                         { inRow[inNesting]+=yyleng; }\r
223                                                 }\r
224 <INITIAL>{DUALOP}               {\r
225                                                 addOkBuf("DOP",yytext);\r
226                                                 \r
227                                                 if(!expand)\r
228                                                         { inRow[inNesting]+=yyleng; }\r
229                                                 }\r
230 <INITIAL>{SEPARATOR}    {\r
231                                                 addOkBuf("SEP",yytext);\r
232                                                 \r
233                                                 if(!expand)\r
234                                                         { inRow[inNesting]+=yyleng; }\r
235                                                 }\r
236 <INITIAL>{IDWORD}               {\r
237                                                 addOkBuf("W32",yytext);\r
238                                                 \r
239                                                 if(!expand)\r
240                                                         { inRow[inNesting]+=yyleng; }\r
241                                                 }\r
242 <INITIAL>{IWORD}                {\r
243                                                 addOkBuf("W16",yytext);\r
244                                                 \r
245                                                 if(!expand)\r
246                                                         { inRow[inNesting]+=yyleng; }\r
247                                                 }\r
248 <INITIAL>{IBYTE}                {\r
249                                                 addOkBuf("BY8",yytext);\r
250                                                 \r
251                                                 if(!expand)\r
252                                                         { inRow[inNesting]+=yyleng; }\r
253                                                 }\r
254 <INITIAL>{INUM}                 {\r
255                                                 addOkBuf("INU",yytext);\r
256                                                 \r
257                                                 if(!expand)\r
258                                                         { inRow[inNesting]+=yyleng; }\r
259                                                 }\r
260 \r
261 \r
262 \r
263 <INITIAL>{ID}                   {\r
264                                                 /* ********************* */\r
265                                                 /* TOKEN ID O ESPANSIONE */\r
266                                                 /* ********************* */\r
267 \r
268                                                 defELEM *tmp;\r
269                                                 int             found=0;\r
270                                                 int             index;\r
271 \r
272                                                 for(index=0,tmp=rootDef;tmp;tmp=tmp->next,index++)\r
273                                                         {\r
274                                                         if(!strcmp(tmp->defId,yytext))\r
275                                                                 {\r
276                                                                 found=1;\r
277 \r
278                                                                 /* Prima espansione */\r
279                                                                 if(!expand)\r
280                                                                         {\r
281                                                                         startExpansion=index;\r
282                                                                         break;\r
283                                                                         }\r
284                                                                 /* Espansione dentro un'espansione */\r
285                                                                 else if(startExpansion!=index)\r
286                                                                         { break; }\r
287                                                                 /* Loop detected */\r
288                                                                 else\r
289                                                                         { sprintf(tempBuf,"%s",ERR_LOP); errExit(tempBuf); exit(ERR_EXIT); }\r
290                                                                 }\r
291                                                         }\r
292 \r
293                                                 /* espandi */\r
294                                                 if(found)\r
295                                                         {\r
296                                                         expand++;\r
297 \r
298                                                         if(inNesting>=MAX_DEPTH)\r
299                                                                 { sprintf(tempBuf,"%s",ERR_INC); errExit(tempBuf); exit(ERR_EXIT); }\r
300 \r
301                                                         inStream[inNesting++]=YY_CURRENT_BUFFER;\r
302                                                         inLine[inNesting]=inLine[inNesting-1];\r
303                                                         inRow[inNesting]=inRow[inNesting-1];\r
304                                                         if(expand<2)\r
305                                                                 { inRow[inNesting-1]+=yyleng; }\r
306                                                         strcpy(inName[inNesting],inName[inNesting-1]);\r
307                         \r
308                                                         /* cambio di input stream -> espansione */\r
309                                                         if(tmp->defTxt)\r
310                                                                 { yy_scan_string(tmp->defTxt); }\r
311                                                         else\r
312                                                                 { yy_scan_string(""); }\r
313                                                         }\r
314                                                 /* genera token */\r
315                                                 else\r
316                                                         {\r
317                                                         addOkBuf("IID",yytext);\r
318 \r
319                                                         if(!expand)\r
320                                                                 { inRow[inNesting]+=yyleng; }\r
321                                                         }\r
322                                                 }\r
323 \r
324 \r
325 \r
326 <INITIAL>{BLANK}+               {\r
327                                                 /* **************** */\r
328                                                 /* NEW LINE E BLANK */\r
329                                                 /* **************** */\r
330 \r
331                                                 if(expOnly)\r
332                                                         { printf("%s",yytext); }\r
333                                                 if(!expand)\r
334                                                         { inRow[inNesting]+=yyleng; }\r
335                                                 }\r
336 <INITIAL>{NL}                   {\r
337                                                 if(expOnly)\r
338                                                         { printf("%s",yytext); }\r
339                                                 if(expand)\r
340                                                         { sprintf(tempBuf,"%s",ERR_NL); errExit(tempBuf); exit(ERR_EXIT); }\r
341 \r
342                                                 inLine[inNesting]++;\r
343                                                 inRow[inNesting]=1;\r
344                                                 }\r
345 \r
346 \r
347 \r
348 <INITIAL,defend><<EOF>> {\r
349                                                 /* **************************************** */\r
350                                                 /* EOF = FINE DI UN'ESPANSIONE O INCLUSIONE */\r
351                                                 /* **************************************** */\r
352 \r
353                                                 if((--inNesting)<0)\r
354                                                         {\r
355                                                         if(eatTrueEndif||eatFalseEndif)\r
356                                                                 { ++inNesting; sprintf(tempBuf,"%s",ERR_END); errExit(tempBuf); exit(ERR_EXIT); }\r
357 \r
358                                                         yyterminate();\r
359                                                         }\r
360                                                 else\r
361                                                         {\r
362                                                         yy_delete_buffer(YY_CURRENT_BUFFER);\r
363                                                         yy_switch_to_buffer(inStream[inNesting]);\r
364                                                         }\r
365 \r
366                                                 if(expand)\r
367                                                         { expand--; }\r
368                                                 }\r
369 \r
370 \r
371 \r
372 <INITIAL>.                              {\r
373                                                 /* ************************** */\r
374                                                 /* CARATTERE NON RICONOSCIUTO */\r
375                                                 /* ************************** */\r
376                                         \r
377                                                 sprintf(tempBuf,"%s(%s)",ERR_UNK,yytext);\r
378                                                 errExit(tempBuf);\r
379                                                 exit(ERR_EXIT);\r
380                                                 }                               \r
381 \r
382 %%\r
383 \r
384 /* ************************************************************************* */\r
385 \r
386 /* formattazione dell'errore ed uscita */\r
387 void errExit(char *ytext)\r
388 {\r
389         printf("%s:%d,%d\tERR\t%s\t%c",inName[inNesting],inLine[inNesting],inRow[inNesting],ytext,SEP);\r
390 }\r
391 \r
392 /* ************************************************************************* */\r
393 \r
394 /* controllo se ID e' gia' stato definito come espansione */\r
395 int checkDefId(char *ytext)\r
396 {\r
397         defELEM *tmp;\r
398 \r
399         for(tmp=rootDef;tmp;tmp=tmp->next)\r
400                 {\r
401                 if(!strcmp(tmp->defId,ytext))\r
402                         { return(1); }\r
403                 }\r
404 \r
405         return(0);\r
406 }\r
407 \r
408 /* ************************************************************************* */\r
409 \r
410 /* controllo se ID corrisponde ad un elemento di reserved[] */\r
411 void checkRsvd(char *ytext)\r
412 {\r
413         int     index;\r
414 \r
415         for(index=0;reserved[index];index++)\r
416                 {\r
417                 if(!strcmp(reserved[index],ytext))\r
418                         { sprintf(tempBuf,"%s(%s)",ERR_RES,yytext); errExit(tempBuf); exit(ERR_EXIT);}\r
419                 }\r
420 \r
421         return;\r
422 }\r
423 \r
424 /* ************************************************************************* */\r
425 \r
426 /* allocazione di ID come nuova espansione */\r
427 void addDefId(char *ytext)\r
428 {\r
429         if(!rootDef)\r
430                 { \r
431                 if(!(curDef=rootDef=(defELEM *) malloc(sizeof(defELEM))))\r
432                         { sprintf(tempBuf,"%s",ERR_MEM); errExit(tempBuf); exit(ERR_EXIT); }\r
433                 }\r
434         else\r
435                 {\r
436                 defELEM *tmp;\r
437 \r
438                 for(tmp=rootDef;tmp;tmp=tmp->next)\r
439                         {\r
440                         if(!strcmp(tmp->defId,ytext))\r
441                                 { sprintf(tempBuf,"%s",ERR_ALR); errExit(tempBuf); exit(ERR_EXIT); }\r
442                         }\r
443 \r
444                 if(!(curDef->next=(defELEM *) malloc(sizeof(defELEM))))\r
445                         { sprintf(tempBuf,"%s",ERR_MEM); errExit(tempBuf); exit(ERR_EXIT); }\r
446 \r
447                 curDef=curDef->next;\r
448                 }\r
449 \r
450         curDef->next=NULL;\r
451         curDef->defTxt=NULL;\r
452 \r
453         if(!(curDef->defId=(char *) malloc(strlen(ytext)+1)))\r
454                 { sprintf(tempBuf,"%s",ERR_MEM); errExit(tempBuf); exit(ERR_EXIT); }\r
455 \r
456         strcpy(curDef->defId,ytext);\r
457 \r
458         return;\r
459 }\r
460 \r
461 /* ************************************************************************* */\r
462 \r
463 /* rimozione di ID come espansione */\r
464 void delDefId(char *ytext)\r
465 {\r
466         defELEM *tmp,*prevTmp;\r
467 \r
468         for(prevTmp=NULL,tmp=rootDef;tmp;prevTmp=tmp,tmp=tmp->next)\r
469                 {\r
470                 if(!strcmp(tmp->defId,ytext))\r
471                         {\r
472                         if(prevTmp)\r
473                                 {\r
474                                 prevTmp->next=tmp->next;\r
475 \r
476                                 free(tmp->defId);\r
477                                 if(tmp->defTxt)\r
478                                         { free(tmp->defTxt); }\r
479                                 free(tmp);\r
480                                 }\r
481                         else\r
482                                 {\r
483                                 rootDef=tmp->next;\r
484 \r
485                                 free(tmp->defId);\r
486                                 if(tmp->defTxt)\r
487                                         { free(tmp->defTxt); }\r
488                                 free(tmp);\r
489                                 }\r
490 \r
491                         break;\r
492                         }\r
493                 }\r
494 \r
495         return;\r
496 }\r
497 \r
498 /* ************************************************************************* */\r
499 \r
500 /* definizione del testo dell'espansione di ID */\r
501 void addDefTxt(char *ytext)\r
502 {\r
503         if(!(curDef->defTxt=(char *) malloc(strlen(ytext)+1)))\r
504                 { sprintf(tempBuf,"%s",ERR_MEM); errExit(tempBuf); exit(ERR_EXIT); }\r
505 \r
506         strcpy(curDef->defTxt,ytext);\r
507 \r
508         return;\r
509 }\r
510 \r
511 /* ************************************************************************* */\r
512 \r
513 /* formattazione e aggiunta di yytext alla lista dei token */\r
514 void addOkBuf(char *token,char *ytext)\r
515 {\r
516         if(expOnly)\r
517                 { printf("%s",ytext); }\r
518         else\r
519                 {\r
520                 sprintf(tempBuf,"%s:%d,%d\t%s\t%s\t%c",inName[inNesting],inLine[inNesting],inRow[inNesting],token,ytext,SEP);\r
521 \r
522                 if(!rootElem)\r
523                         {\r
524                         if(!(curElem=rootElem=(listELEM *) malloc(sizeof(listELEM))))\r
525                                 { sprintf(tempBuf,"%s",ERR_MEM); errExit(tempBuf); exit(ERR_EXIT); }\r
526                         }\r
527                 else\r
528                         {\r
529                         if(!(curElem->next=(listELEM *) malloc(sizeof(listELEM))))\r
530                                 { sprintf(tempBuf,"%s",ERR_MEM); errExit(tempBuf); exit(ERR_EXIT); }\r
531 \r
532                         curElem=curElem->next;\r
533                         }\r
534 \r
535                 curElem->next=NULL;\r
536 \r
537                 if(!(curElem->scanTxt=(char *) malloc(strlen(tempBuf)+1)))\r
538                  { sprintf(tempBuf,"%s",ERR_MEM); errExit(tempBuf); exit(ERR_EXIT); }\r
539 \r
540                 strcpy(curElem->scanTxt,tempBuf);\r
541                 }\r
542 \r
543         return;\r
544 }\r
545 \r
546 /* ************************************************************************* */\r
547 \r
548 void usage(char *name)\r
549 {\r
550         printf("\nC Scanner - Cosimo Oliboni\n\n");\r
551         printf("\"%s -e source\" preprocessing di un sorgente\n",name);\r
552         printf("\"%s source\" scanning di un sorgente\n",name);\r
553         printf("\"%s\" scanning da stdin\n\n",name);\r
554 \r
555         return;\r
556 }\r
557 \r
558 /* ************************************************************************* */\r
559 \r
560 int main(int argc, char **argv)\r
561 {\r
562         inLine[inNesting]=0;\r
563         inRow[inNesting]=0;\r
564 \r
565         if(argc>1)\r
566                 {\r
567                 /* "scanner -e sorgente" */\r
568                 if(argc==3)\r
569                         {\r
570                         if(strcmp(argv[1],EXP_OPT))\r
571                                 { sprintf(tempBuf,"%s",ERR_OPT); errExit(tempBuf); usage(argv[0]); exit(ERR_EXIT); }\r
572 \r
573                         expOnly=1;\r
574 \r
575                         strcpy(inName[inNesting],argv[2]);\r
576                         }\r
577                 /* "scanner sorgente" */\r
578                 else if(argc==2)\r
579                         { strcpy(inName[inNesting],argv[1]); }\r
580                 else\r
581                         { sprintf(tempBuf,"%s",ERR_ARG); errExit(tempBuf); usage(argv[0]); exit(ERR_EXIT); }\r
582 \r
583                 if(!(yyin=fopen(inName[inNesting],"r")))\r
584                         { sprintf(tempBuf,"%s(%s)",ERR_OPEN,inName[inNesting]); errExit(tempBuf); usage(argv[0]); exit(ERR_EXIT); }\r
585                 }\r
586         /* "scanner <stdin>" */\r
587         else\r
588                 { strcpy(inName[inNesting],"stdin"); }\r
589 \r
590         inLine[inNesting]=1;\r
591         inRow[inNesting]=1;\r
592 \r
593         /* scanning */\r
594         yylex();\r
595 \r
596         /* se non ci sono stati errori && se non si effettua solo preprocessing */\r
597         /* output della lista di token creata */\r
598         /* preceduta da OK && seguita da EOF */\r
599 \r
600         if(!expOnly)\r
601                 {\r
602                 inNesting++;\r
603 \r
604                 addOkBuf("EOF","EOF");\r
605 \r
606                 printf("%s:0,0\tOK\tOK\t%c",inName[0],SEP);\r
607 \r
608                 for(curElem=rootElem;curElem;curElem=curElem->next)\r
609                         { printf("%s",curElem->scanTxt); }\r
610                 }\r
611 \r
612         return(OK_EXIT);\r
613 }\r
614 \r
615 yywrap()\r
616 {\r
617         return(1);\r
618 }\r