New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 2715 for trunk/NEMOGCM/EXTERNAL/AGRIF/LIB/fortran.lex – NEMO

Ignore:
Timestamp:
2011-03-30T17:58:35+02:00 (13 years ago)
Author:
rblod
Message:

First attempt to put dynamic allocation on the trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMOGCM/EXTERNAL/AGRIF/LIB/fortran.lex

    r2528 r2715  
    7272           }\ 
    7373           strcpy(motparse1,yytext);\ 
    74            /*printf("yytext = %s\n",yytext);*/\ 
     74/*           printf("yytext = %s\n",yytext);*/\ 
    7575        /*if ( firstpass == 1 )  
    7676                      printf("yytext = %s %d\n",yytext,strlen(yytext));*/\ 
     
    100100 
    101101COMMENTAIRESFORTRAN77 ^([Cc*](([ \t]*\n)|([^AaHhOo\n]{NIMPORTEQUOI}*\n))) 
     102COMMENTAIRESFORTRAN77_2 \n([Cc*](([ \t]*\n)|([^AaHhOo\n]{NIMPORTEQUOI}*\n))) 
    102103COMMENTAIRESFORTRAN90 ^([ \t]*!{NIMPORTEQUOI}*\n) 
    103104COMMENTAIRESFORTRAN90_2 (!{NIMPORTEQUOI}*) 
    104105NEXTLINEF90 "&"{NIMPORTEQUOI}*[\n]* 
    105 NEXTLINEF77 \n[ \t]{5}("&"|"+"|"$"|"*"|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"."|"#") 
     106NEXTLINEF77 [\n \t]*\n[ \t]{5}("&"|"+"|"$"|"*"|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9"|"."|"#") 
    106107%% 
    107108  if (infixed) BEGIN(fortran77style) ; 
     
    117118program                 {return TOK_PROGRAM;} 
    118119allocate                {inallocate = 1; return TOK_ALLOCATE;} 
     120nullify        {return TOK_NULLIFY;} 
    119121deallocate              {inallocate = 1; return TOK_DEALLOCATE;} 
    120122result                  {return TOK_RESULT;} 
     
    254256maxloc                  {return TOK_MAXLOC;} 
    255257minval                  {return TOK_MINVAL;} 
    256 interface               {return TOK_INTERFACE;} 
    257258backspace               {return TOK_BACKSPACE;} 
    258 end[ \t]*interface      {return TOK_ENDINTERFACE;} 
    259259\({SLASH}               {return TOK_LEFTAB;} 
    260260{SLASH}\)               {return TOK_RIGHTAB;} 
     
    268268(\")[^\n"]*(\")         {strcpy(yylval.na,yytext);return TOK_CHAR_MESSAGE;} 
    269269({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                  } 
    270278{NAME}                  {strcpy(yylval.na,yytext);return TOK_NAME;} 
    271279{REAL}                  {strcpy(yylval.na,yytext);return TOK_CSTREAL;} 
     
    277285\'|\"                   {return TOK_QUOTE;} 
    278286\.                      {} 
    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;} 
    280289\;                      {return TOK_SEMICOLON;} 
    281290\,                      {return (int) *yytext;} 
     
    299308                           else 
    300309                           { 
    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; 
    303313                             if ( !strcasecmp(motparse1,"C$AGRIF_END_DO_NOT_TREAT\n")) return TOK_ENDDONOTTREAT; 
     314                             unput('\n'); 
    304315                           } 
    305316                         } 
    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++;} 
    309343{COMMENTAIRESFORTRAN90}   { 
    310344                             colnum = 0; 
     
    323357   if (!strcasecmp(curfile,mainfile)) 
    324358   { 
    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); 
    326360   } 
    327361   else 
    328362   { 
    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); 
    330364   } 
    331    /*exit(0);*/ 
     365/*   exit(0);*/ 
    332366} 
    333367 
Note: See TracChangeset for help on using the changeset viewer.