Changeset 2715 for trunk/NEMOGCM/EXTERNAL/AGRIF/LIB/fortran.lex
- Timestamp:
- 2011-03-30T17:58:35+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/NEMOGCM/EXTERNAL/AGRIF/LIB/fortran.lex
r2528 r2715 72 72 }\ 73 73 strcpy(motparse1,yytext);\ 74 /*printf("yytext = %s\n",yytext);*/\74 /* printf("yytext = %s\n",yytext);*/\ 75 75 /*if ( firstpass == 1 ) 76 76 printf("yytext = %s %d\n",yytext,strlen(yytext));*/\ … … 100 100 101 101 COMMENTAIRESFORTRAN77 ^([Cc*](([ \t]*\n)|([^AaHhOo\n]{NIMPORTEQUOI}*\n))) 102 COMMENTAIRESFORTRAN77_2 \n([Cc*](([ \t]*\n)|([^AaHhOo\n]{NIMPORTEQUOI}*\n))) 102 103 COMMENTAIRESFORTRAN90 ^([ \t]*!{NIMPORTEQUOI}*\n) 103 104 COMMENTAIRESFORTRAN90_2 (!{NIMPORTEQUOI}*) 104 105 NEXTLINEF90 "&"{NIMPORTEQUOI}*[\n]* 105 NEXTLINEF77 \n[ \t]{5}("&"|"+"|"$"|"*"|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"."|"#")106 NEXTLINEF77 [\n \t]*\n[ \t]{5}("&"|"+"|"$"|"*"|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9"|"."|"#") 106 107 %% 107 108 if (infixed) BEGIN(fortran77style) ; … … 117 118 program {return TOK_PROGRAM;} 118 119 allocate {inallocate = 1; return TOK_ALLOCATE;} 120 nullify {return TOK_NULLIFY;} 119 121 deallocate {inallocate = 1; return TOK_DEALLOCATE;} 120 122 result {return TOK_RESULT;} … … 254 256 maxloc {return TOK_MAXLOC;} 255 257 minval {return TOK_MINVAL;} 256 interface {return TOK_INTERFACE;}257 258 backspace {return TOK_BACKSPACE;} 258 end[ \t]*interface {return TOK_ENDINTERFACE;}259 259 \({SLASH} {return TOK_LEFTAB;} 260 260 {SLASH}\) {return TOK_RIGHTAB;} … … 268 268 (\")[^\n"]*(\") {strcpy(yylval.na,yytext);return TOK_CHAR_MESSAGE;} 269 269 ({NAME}{REAL}) {strcpy(yylval.na,yytext);return TOK_CHAR_INT;} 270 ^[ \t]*interface {printf("debug interfacer\n");BEGIN(donottreat);} 271 <donottreat>^[ \t]*end[ \t]*interface[ \t]*\n { 272 BEGIN(INITIAL); 273 if (infixed) BEGIN(fortran77style) ; 274 if (infree) BEGIN(fortran90style) ; 275 line_num_fortran++;line_num_fortran_common++; 276 return '\n'; 277 } 270 278 {NAME} {strcpy(yylval.na,yytext);return TOK_NAME;} 271 279 {REAL} {strcpy(yylval.na,yytext);return TOK_CSTREAL;} … … 277 285 \'|\" {return TOK_QUOTE;} 278 286 \. {} 279 \(|\)|:|\[|\]|\+|\-|\*|\% {strcpy(yylval.na,yytext);return (int) *yytext;} 287 \(|\)|:|\[|\]|\+|\-|\* {strcpy(yylval.na,yytext);return (int) *yytext;} 288 \% {afterpercent = 1; strcpy(yylval.na,yytext);return (int) *yytext;} 280 289 \; {return TOK_SEMICOLON;} 281 290 \, {return (int) *yytext;} … … 299 308 else 300 309 { 301 colnum=0;line_num_fortran++;line_num_fortran_common++; 302 if ( !strcasecmp(motparse1,"C$AGRIF_DO_NOT_TREAT\n")) return TOK_DONOTTREAT; 310 /* colnum=0;line_num_fortran++;line_num_fortran_common++;*/ 311 if ( !strcasecmp(motparse1,"C$AGRIF_DO_NOT_TREAT\n")) 312 return TOK_DONOTTREAT; 303 313 if ( !strcasecmp(motparse1,"C$AGRIF_END_DO_NOT_TREAT\n")) return TOK_ENDDONOTTREAT; 314 unput('\n'); 304 315 } 305 316 } 306 ^"!$AGRIF_DO_NOT_TREAT\n" BEGIN(donottreat); 307 <donottreat>^"!$AGRIF_END_DO_NOT_TREAT\n" BEGIN(INITIAL); 308 <donottreat>.*\n 317 <fortran77style>{COMMENTAIRESFORTRAN77_2} { 318 convert2lower(&motparse1[1]); 319 if ( strncasecmp(&motparse1[1],"contains",8) == 0 ) 320 { 321 return TOK_CONTAINS; 322 } 323 else 324 { 325 /* colnum=0;line_num_fortran++;line_num_fortran_common++;*/ 326 if ( !strcasecmp(&motparse1[1],"C$AGRIF_DO_NOT_TREAT\n")) 327 return TOK_DONOTTREAT; 328 if ( !strcasecmp(&motparse1[1],"C$AGRIF_END_DO_NOT_TREAT\n")) return TOK_ENDDONOTTREAT; 329 unput('\n'); 330 } 331 } 332 ^"!$AGRIF_DO_NOT_TREAT"[ \t]*\n { 333 BEGIN(donottreat); 334 } 335 <donottreat>^"!$AGRIF_END_DO_NOT_TREAT"[ \t]*\n { 336 BEGIN(INITIAL); 337 if (infixed) BEGIN(fortran77style) ; 338 if (infree) BEGIN(fortran90style) ; 339 line_num_fortran++;line_num_fortran_common++; 340 return '\n'; 341 } 342 <donottreat>.*\n {line_num_fortran++;line_num_fortran_common++;} 309 343 {COMMENTAIRESFORTRAN90} { 310 344 colnum = 0; … … 323 357 if (!strcasecmp(curfile,mainfile)) 324 358 { 325 printf("%s line %d, file %s \n",s,line_num_fortran,curfile);359 printf("%s line %d, file %s motclef = %s\n",s,line_num_fortran,curfile,yytext); 326 360 } 327 361 else 328 362 { 329 printf("%s line %d, file %s \n",s,line_num_fortran_common,curfile);363 printf("%s line %d, file %s motclef = %s curbuf = %s\n",s,line_num_fortran_common,curfile,yytext,curbuf); 330 364 } 331 /*exit(0);*/365 /* exit(0);*/ 332 366 } 333 367
Note: See TracChangeset
for help on using the changeset viewer.