[5596] | 1 | /******************************************************************************/ |
---|
| 2 | /* */ |
---|
| 3 | /* CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran) */ |
---|
| 4 | /* */ |
---|
| 5 | /* Copyright or or Copr. Laurent Debreu (Laurent.Debreu@imag.fr) */ |
---|
| 6 | /* Cyril Mazauric (Cyril_Mazauric@yahoo.fr) */ |
---|
| 7 | /* This software is governed by the CeCILL-C license under French law and */ |
---|
| 8 | /* abiding by the rules of distribution of free software. You can use, */ |
---|
| 9 | /* modify and/ or redistribute the software under the terms of the CeCILL-C */ |
---|
| 10 | /* license as circulated by CEA, CNRS and INRIA at the following URL */ |
---|
| 11 | /* "http://www.cecill.info". */ |
---|
| 12 | /* */ |
---|
| 13 | /* As a counterpart to the access to the source code and rights to copy, */ |
---|
| 14 | /* modify and redistribute granted by the license, users are provided only */ |
---|
| 15 | /* with a limited warranty and the software's author, the holder of the */ |
---|
| 16 | /* economic rights, and the successive licensors have only limited */ |
---|
| 17 | /* liability. */ |
---|
| 18 | /* */ |
---|
| 19 | /* In this respect, the user's attention is drawn to the risks associated */ |
---|
| 20 | /* with loading, using, modifying and/or developing or reproducing the */ |
---|
| 21 | /* software by the user in light of its specific status of free software, */ |
---|
| 22 | /* that may mean that it is complicated to manipulate, and that also */ |
---|
| 23 | /* therefore means that it is reserved for developers and experienced */ |
---|
| 24 | /* professionals having in-depth computer knowledge. Users are therefore */ |
---|
| 25 | /* encouraged to load and test the software's suitability as regards their */ |
---|
| 26 | /* requirements in conditions enabling the security of their systems and/or */ |
---|
| 27 | /* data to be ensured and, more generally, to use and operate it in the */ |
---|
| 28 | /* same conditions as regards security. */ |
---|
| 29 | /* */ |
---|
| 30 | /* The fact that you are presently reading this means that you have had */ |
---|
| 31 | /* knowledge of the CeCILL-C license and that you accept its terms. */ |
---|
| 32 | /******************************************************************************/ |
---|
| 33 | /* version 1.7 */ |
---|
| 34 | /******************************************************************************/ |
---|
| 35 | %option warn |
---|
| 36 | %option noyywrap |
---|
| 37 | |
---|
| 38 | %x parameter |
---|
| 39 | %s character |
---|
| 40 | %x donottreat |
---|
[13027] | 41 | %x donottreat_interface |
---|
| 42 | %x includestate |
---|
[5596] | 43 | %s fortran77style |
---|
| 44 | %s fortran90style |
---|
| 45 | %{ |
---|
| 46 | #include <math.h> |
---|
| 47 | #include <stdlib.h> |
---|
| 48 | #include <string.h> |
---|
| 49 | extern FILE * yyin; |
---|
| 50 | #define MAX_INCLUDE_DEPTH 30 |
---|
[13027] | 51 | #define YY_BUF_SIZE 64000 |
---|
[5596] | 52 | YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; |
---|
[13027] | 53 | int line_num_input = 0; |
---|
[5596] | 54 | int newlinef90 = 0; |
---|
[13027] | 55 | int tmpc; |
---|
[5596] | 56 | |
---|
[13027] | 57 | int lastwasendofstmt = 1; |
---|
[5596] | 58 | |
---|
[13027] | 59 | extern char linebuf1[1024]; |
---|
| 60 | extern char linebuf2[1024]; |
---|
| 61 | |
---|
| 62 | int count_newlines(const char* str_in) |
---|
| 63 | { |
---|
| 64 | int k, i = 0; |
---|
| 65 | for( k=0 ; k<strlen(str_in) ; k++) |
---|
| 66 | if (str_in[k] == '\n') i++; |
---|
| 67 | return i; |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | #define PRINT_LINE_NUM() // { fprintf(stderr,"== Parsing l.%4d...\n", line_num_input); } |
---|
| 71 | #define INCREMENT_LINE_NUM() { line_num_input+=count_newlines(fortran_text) ; PRINT_LINE_NUM(); } |
---|
| 72 | #define YY_USER_ACTION { if (increment_nbtokens !=0) token_since_endofstmt++; increment_nbtokens = 1; if (token_since_endofstmt>=1) lastwasendofstmt=0; /*printf("VALLIJSDFLSD = %d %d %s \n",lastwasendofstmt,token_since_endofstmt,fortran_text); */ if (firstpass) { strcpy(linebuf1, linebuf2); strncpy(linebuf2, fortran_text,80);} \ |
---|
| 73 | else {my_position_before=setposcur();/*printf("muposition = %d\n",my_position_before);*/ECHO;} } |
---|
| 74 | #define YY_BREAK {/*printf("VALL = %d %d\n",lastwasendofstmt,token_since_endofstmt);*/if (token_since_endofstmt>=1) lastwasendofstmt=0; break;} |
---|
| 75 | |
---|
[5596] | 76 | void out_of_donottreat(void); |
---|
| 77 | |
---|
| 78 | %} |
---|
| 79 | |
---|
| 80 | SLASH "/" |
---|
| 81 | HEXA Z\'[0-9a-fA-F]+\' |
---|
| 82 | INTEGER [0-9]+ |
---|
[13027] | 83 | NAME [a-zA-Z][a-zA-Z0-9\_]* |
---|
[5596] | 84 | EXPONENT [edq][-+]?{INTEGER} |
---|
| 85 | |
---|
[13027] | 86 | BEG_DNT ^[C!]"$AGRIF_DO_NOT_TREAT"[ \t]*([ \t\n]*(!.*\n)*)+\n |
---|
| 87 | END_DNT ^[C!]"$AGRIF_END_DO_NOT_TREAT"[ \t]*([ \t\n]*(!.*\n)*)+\n |
---|
[5596] | 88 | |
---|
| 89 | BEG_INTERFACE ^[ \t]*interface |
---|
| 90 | END_INTERFACE ^[ \t]*end[ \t]*interface.*\n |
---|
| 91 | |
---|
| 92 | ASSIGNTYPE "assignment"[ \t]*"("[ \t]*[-+=]+[ \t]*")" |
---|
| 93 | |
---|
[13027] | 94 | COMM_F77 ^[c*].*\n |
---|
| 95 | COMM_F90_1 ^([ \t\n]*(!.*\n)*)+\n |
---|
[5596] | 96 | COMM_F90_2 !.* |
---|
[13027] | 97 | NEXTLINEF90 &([ \t\n]|(!.*\n))* |
---|
| 98 | NEXTLINEF77 \n(([c*].*\n)|(([ \t]{0,4}|[ \t]{6,})!.*\n)|[\n])*[ ]{5}([a-z0-9&+$*.#/!;]) |
---|
| 99 | LABEL ^[ 0-9]{1,5}[ \t]+ |
---|
[5596] | 100 | |
---|
| 101 | %% |
---|
| 102 | if (infixed) BEGIN(fortran77style) ; |
---|
| 103 | if (infree) BEGIN(fortran90style) ; |
---|
| 104 | |
---|
| 105 | subroutine { return TOK_SUBROUTINE; } |
---|
| 106 | program { return TOK_PROGRAM; } |
---|
| 107 | allocate { inallocate = 1; return TOK_ALLOCATE; } |
---|
[13027] | 108 | continue { return TOK_CONTINUE; } |
---|
[5596] | 109 | nullify { return TOK_NULLIFY; } |
---|
| 110 | deallocate { inallocate = 1; return TOK_DEALLOCATE; } |
---|
| 111 | result { return TOK_RESULT; } |
---|
| 112 | function { return TOK_FUNCTION; } |
---|
| 113 | end { strcpy(yylval.na,fortran_text); return TOK_ENDUNIT;} |
---|
[13027] | 114 | include { pos_curinclude = setposcur()-9; BEGIN(includestate); } |
---|
| 115 | use { return TOK_USE;} |
---|
[5596] | 116 | rewind { return TOK_REWIND; } |
---|
| 117 | implicit { return TOK_IMPLICIT; } |
---|
| 118 | none { return TOK_NONE; } |
---|
| 119 | call { return TOK_CALL; } |
---|
[13027] | 120 | .true. { strcpy(yylval.na,fortran_text); return TOK_TRUE; } |
---|
| 121 | .false. { strcpy(yylval.na,fortran_text); return TOK_FALSE; } |
---|
[5596] | 122 | \=\> { return TOK_POINT_TO; } |
---|
| 123 | {ASSIGNTYPE} { strcpy(yylval.na,fortran_text); return TOK_ASSIGNTYPE;} |
---|
| 124 | \*\* { strcpy(yylval.na,fortran_text); return TOK_DASTER; } |
---|
[13027] | 125 | \.eqv\. { strcpy(yylval.na,fortran_text); return TOK_EQV; } |
---|
| 126 | \.[ \t]*eq[ \t]*\. { strcpy(yylval.na,fortran_text); return TOK_EQ; } |
---|
| 127 | \.gt\. { strcpy(yylval.na,fortran_text); return TOK_GT; } |
---|
| 128 | \.ge\. { strcpy(yylval.na,fortran_text); return TOK_GE; } |
---|
| 129 | \.lt\. { strcpy(yylval.na,fortran_text); return TOK_LT; } |
---|
| 130 | \.le\. { strcpy(yylval.na,fortran_text); return TOK_LE; } |
---|
| 131 | \.neqv\. { strcpy(yylval.na,fortran_text); return TOK_NEQV;} |
---|
| 132 | \.[ \t]*ne[ \t]*\. { strcpy(yylval.na,fortran_text); return TOK_NE; } |
---|
| 133 | \.not\. { strcpy(yylval.na,fortran_text); return TOK_NOT; } |
---|
| 134 | \.or\. { strcpy(yylval.na,fortran_text); return TOK_OR; } |
---|
[5596] | 135 | \.[ \t]*xor\. { strcpy(yylval.na,fortran_text); return TOK_XOR; } |
---|
[13027] | 136 | \.and\. { strcpy(yylval.na,fortran_text); return TOK_AND; } |
---|
| 137 | \=\= { strcpy(yylval.na,fortran_text); return TOK_EQUALEQUAL; } |
---|
| 138 | \/\= { strcpy(yylval.na,fortran_text); return TOK_SLASHEQUAL; } |
---|
| 139 | \<\= { strcpy(yylval.na,fortran_text); return TOK_INFEQUAL; } |
---|
| 140 | \>\= { strcpy(yylval.na,fortran_text); return TOK_SUPEQUAL; } |
---|
[5596] | 141 | module { return TOK_MODULE; } |
---|
| 142 | while { return TOK_WHILE; } |
---|
| 143 | concurrent { return TOK_CONCURRENT; } |
---|
| 144 | end[ \t]*do { return TOK_ENDDO; } |
---|
[13027] | 145 | do[\ t]+{INTEGER} { strcpy(yylval.na,&fortran_text[2]); |
---|
| 146 | if (testandextractfromlist(&List_Do_labels,&fortran_text[2]) == 1) |
---|
| 147 | { |
---|
| 148 | return TOK_PLAINDO_LABEL_DJVIEW; |
---|
| 149 | } |
---|
| 150 | else |
---|
| 151 | { |
---|
| 152 | List_Do_labels=Insertname(List_Do_labels,yylval.na,1); |
---|
| 153 | return TOK_PLAINDO_LABEL; |
---|
| 154 | } |
---|
| 155 | } |
---|
| 156 | do { increment_nbtokens = 0; return TOK_PLAINDO;} |
---|
[5596] | 157 | real { strcpy(yylval.na,fortran_text); return TOK_REAL; } |
---|
| 158 | integer { strcpy(yylval.na,fortran_text); return TOK_INTEGER; } |
---|
| 159 | logical { strcpy(yylval.na,fortran_text); return TOK_LOGICAL; } |
---|
| 160 | character { strcpy(yylval.na,fortran_text); return TOK_CHARACTER; } |
---|
| 161 | {HEXA} { strcpy(yylval.na,fortran_text); return TOK_HEXA;} |
---|
| 162 | double[ \t]*precision { strcpy(yylval.na,fortran_text); return TOK_DOUBLEPRECISION; } |
---|
| 163 | double[ \t]*complex { strcpy(yylval.na,fortran_text); return TOK_DOUBLECOMPLEX; } |
---|
[13027] | 164 | complex { strcpy(yylval.na,fortran_text); return TOK_COMPLEX; } |
---|
[5596] | 165 | allocatable { return TOK_ALLOCATABLE; } |
---|
| 166 | close { return TOK_CLOSE; } |
---|
| 167 | inquire { return TOK_INQUIRE; } |
---|
| 168 | dimension { return TOK_DIMENSION; } |
---|
| 169 | pause { return TOK_PAUSE; } |
---|
| 170 | equivalence { return TOK_EQUIVALENCE; } |
---|
| 171 | stop { return TOK_STOP; } |
---|
| 172 | where { return TOK_WHERE; } |
---|
| 173 | end[ \t]*where { return TOK_ENDWHERE; } |
---|
| 174 | else[ \t]*where[ \t]*\( { return TOK_ELSEWHEREPAR; } |
---|
| 175 | else[ \t]*where { return TOK_ELSEWHERE; } |
---|
| 176 | ^[ \t]*contains { return TOK_CONTAINS; } |
---|
| 177 | only { return TOK_ONLY; } |
---|
| 178 | parameter { return TOK_PARAMETER; } |
---|
| 179 | recursive { return TOK_RECURSIVE; } |
---|
| 180 | common { return TOK_COMMON; } |
---|
| 181 | ^[ \t]*global[ \t]+ { return TOK_GLOBAL; } |
---|
| 182 | external { return TOK_EXTERNAL; } |
---|
[13027] | 183 | intent { intent_spec = 1; return TOK_INTENT; } |
---|
[5596] | 184 | pointer { return TOK_POINTER; } |
---|
| 185 | optional { return TOK_OPTIONAL; } |
---|
| 186 | save { return TOK_SAVE; } |
---|
[13027] | 187 | ^[ \t]*type[ \t]*\( { pos_cur_decl = setposcur()-strlen(fortran_text); return TOK_TYPEPAR; } |
---|
| 188 | ^[ \t]*type/[ \t\,:]+ { return TOK_TYPE; } |
---|
[5596] | 189 | end[ \t]*type { return TOK_ENDTYPE; } |
---|
| 190 | stat { if (inallocate == 1) return TOK_STAT; else { strcpy(yylval.na,fortran_text); return TOK_NAME; } } |
---|
| 191 | open { return TOK_OPEN; } |
---|
| 192 | return { return TOK_RETURN; } |
---|
[13027] | 193 | exit { return TOK_EXIT; } |
---|
[5596] | 194 | print { return TOK_PRINT; } |
---|
| 195 | module[ \t]*procedure { return TOK_PROCEDURE; } |
---|
[13027] | 196 | read[ \t]*\( { in_io_control_spec = 1; return TOK_READ_PAR; } |
---|
[5596] | 197 | read { return TOK_READ; } |
---|
| 198 | namelist { return TOK_NAMELIST; } |
---|
[13027] | 199 | write[ \t]*\( { in_io_control_spec = 1; return TOK_WRITE_PAR; } |
---|
[5596] | 200 | write { return TOK_WRITE; } |
---|
[13027] | 201 | flush { strcpy(yylval.na,fortran_text); return TOK_FLUSH; } |
---|
[5596] | 202 | target { return TOK_TARGET; } |
---|
| 203 | public { return TOK_PUBLIC; } |
---|
| 204 | private { return TOK_PRIVATE; } |
---|
[13027] | 205 | in { strcpy(yylval.na,fortran_text); |
---|
| 206 | if (intent_spec==1) |
---|
| 207 | {return TOK_IN; } |
---|
| 208 | else |
---|
| 209 | { |
---|
| 210 | return TOK_NAME; |
---|
| 211 | } |
---|
| 212 | } |
---|
| 213 | ^[ \t]*data[ \t]+ { pos_curdata = setposcur()-strlen(fortran_text); /*Init_List_Data_Var();*/ return TOK_DATA; } |
---|
[5596] | 214 | go[ \t]*to { return TOK_PLAINGOTO; } |
---|
[13027] | 215 | out { strcpy(yylval.na,fortran_text); |
---|
| 216 | if (intent_spec==1) |
---|
| 217 | {return TOK_OUT; } |
---|
| 218 | else |
---|
| 219 | { |
---|
| 220 | return TOK_NAME; |
---|
| 221 | } |
---|
| 222 | } |
---|
| 223 | inout { strcpy(yylval.na,fortran_text); |
---|
| 224 | if (intent_spec==1) |
---|
| 225 | {return TOK_IN; } |
---|
| 226 | else |
---|
| 227 | { |
---|
| 228 | return TOK_INOUT; |
---|
| 229 | } |
---|
| 230 | } |
---|
[5596] | 231 | intrinsic { return TOK_INTRINSIC; } |
---|
| 232 | then { return TOK_THEN; } |
---|
| 233 | else[ \t]*if { return TOK_ELSEIF; } |
---|
| 234 | else { return TOK_ELSE; } |
---|
| 235 | end[ \t]*if { return TOK_ENDIF; } |
---|
[13027] | 236 | if[ \t]*\(/(.*\)[ \t]*[\=|\+|\-]+.*\)) {strcpy(yylval.na,fortran_text); |
---|
| 237 | return TOK_LOGICALIF_PAR; |
---|
| 238 | } |
---|
| 239 | if/([ \t]*\([^(]*\)[ \t]*[\=|\+|\-]+) {strcpy(yylval.na,fortran_text); |
---|
| 240 | return TOK_NAME; |
---|
| 241 | } |
---|
| 242 | if[ \t]*\( {strcpy(yylval.na,fortran_text); |
---|
| 243 | return TOK_LOGICALIF_PAR; |
---|
| 244 | } |
---|
[5596] | 245 | select[ \t]*case { return TOK_SELECTCASE; } |
---|
[13027] | 246 | ^[ \t]*case[ \t]* { if (in_select_case_stmt > 0) return TOK_CASE ; else return TOK_NAME;} |
---|
[5596] | 247 | default { return TOK_DEFAULT; } |
---|
| 248 | end[ \t]*select { return TOK_ENDSELECT; } |
---|
| 249 | file[ \t]*\= { return TOK_FILE; } |
---|
[13027] | 250 | access[ \t]*\= { return TOK_ACCESS; } |
---|
| 251 | action[ \t]*\= { return TOK_ACTION; } |
---|
| 252 | iolength[ \t]*\= { return TOK_IOLENGTH; } |
---|
[5596] | 253 | unit[ \t]*\= { return TOK_UNIT; } |
---|
[13027] | 254 | opened[ \t]*\= { return TOK_OPENED; } |
---|
[5596] | 255 | fmt[ \t]*\= { return TOK_FMT; } |
---|
| 256 | nml[ \t]*\= { return TOK_NML; } |
---|
| 257 | end[ \t]*\= { return TOK_END; } |
---|
| 258 | eor[ \t]*\= { return TOK_EOR; } |
---|
[13027] | 259 | len/([ \t]*\=) { |
---|
| 260 | if (in_char_selector ==1) |
---|
| 261 | return TOK_LEN; |
---|
| 262 | else |
---|
| 263 | { |
---|
| 264 | strcpy(yylval.na,fortran_text); return TOK_NAME; |
---|
| 265 | } |
---|
| 266 | } |
---|
| 267 | kind/([ \t]*\=) { |
---|
| 268 | if ((in_char_selector==1) || (in_kind_selector == 1)) |
---|
| 269 | return TOK_KIND; |
---|
| 270 | else |
---|
| 271 | { |
---|
| 272 | strcpy(yylval.na,fortran_text); return TOK_NAME; |
---|
| 273 | } |
---|
| 274 | } |
---|
| 275 | errmsg[ \t]*\= { return TOK_ERRMSG; } |
---|
| 276 | mold[ \t]*\= { return TOK_MOLD; } |
---|
| 277 | source[ \t]*\= { return TOK_SOURCE; } |
---|
| 278 | position[ \t]*\= { return TOK_POSITION; } |
---|
| 279 | iomsg[ \t]*\= { return TOK_IOMSG; } |
---|
| 280 | iostat[ \t]*\= { return TOK_IOSTAT; } |
---|
[5596] | 281 | err[ \t]*\= { return TOK_ERR; } |
---|
[13027] | 282 | form[ \t]*\= { return TOK_FORM; } |
---|
| 283 | name/([ \t]*\=) { |
---|
| 284 | if (in_inquire==1) |
---|
| 285 | return TOK_NAME_EQ; |
---|
| 286 | else |
---|
| 287 | { |
---|
| 288 | strcpy(yylval.na,fortran_text); return TOK_NAME; |
---|
| 289 | } |
---|
| 290 | } |
---|
| 291 | recl[ \t]*\= { return TOK_RECL; } |
---|
| 292 | rec/([ \t]*\=) { if (in_io_control_spec == 1) |
---|
| 293 | return TOK_REC; |
---|
| 294 | else |
---|
| 295 | { |
---|
| 296 | strcpy(yylval.na,fortran_text); return TOK_NAME; |
---|
| 297 | } |
---|
| 298 | } |
---|
| 299 | status/([ \t]*\=) { if (close_or_connect == 1) |
---|
| 300 | return TOK_STATUS; |
---|
| 301 | else |
---|
| 302 | { |
---|
| 303 | strcpy(yylval.na,fortran_text); return TOK_NAME; |
---|
| 304 | } |
---|
| 305 | } |
---|
| 306 | status { strcpy(yylval.na,fortran_text); return TOK_NAME;} |
---|
[5596] | 307 | exist[ \t]*\= { return TOK_EXIST; } |
---|
| 308 | cycle { return TOK_CYCLE; } |
---|
| 309 | backspace { return TOK_BACKSPACE; } |
---|
| 310 | :: { return TOK_FOURDOTS; } |
---|
[13027] | 311 | \/[ \t]*({NEXTLINEF90}|{NEXTLINEF77})*[ \t]*\/ { strcpy(yylval.na,fortran_text); return TOK_DSLASH; } |
---|
[5596] | 312 | \({SLASH} { return TOK_LEFTAB; } |
---|
| 313 | {SLASH}\) { return TOK_RIGHTAB; } |
---|
| 314 | {SLASH} { strcpy(yylval.na,fortran_text); return TOK_SLASH; } |
---|
[13027] | 315 | ((\')[^']*&{0,1}\n[ \t]*&{0,1}[^']*(\'))+ { |
---|
| 316 | INCREMENT_LINE_NUM() ; strcpy(yylval.na,fortran_text); return TOK_CHAR_CUT; } |
---|
| 317 | <includestate>((\')[^']*(\'))+ {Add_Include_1(fortran_text);} |
---|
| 318 | <includestate>[ \t]* {} |
---|
| 319 | <includestate>\n { |
---|
| 320 | if (inmoduledeclare == 0 ) |
---|
| 321 | { |
---|
| 322 | pos_end=setposcur(); |
---|
| 323 | RemoveWordSET_0(fortran_out,pos_curinclude,pos_end-pos_curinclude); |
---|
| 324 | } |
---|
| 325 | out_of_donottreat(); |
---|
| 326 | } |
---|
| 327 | ((\')[^']*(\'))+ { strcpy(yylval.na,fortran_text);return TOK_CHAR_CONSTANT; } |
---|
| 328 | ((\")[^"]*(\"))+ { strcpy(yylval.na,fortran_text);return TOK_CHAR_MESSAGE; } |
---|
| 329 | {BEG_INTERFACE} { BEGIN(donottreat_interface); } |
---|
| 330 | <donottreat_interface>{END_INTERFACE} { out_of_donottreat(); return '\n'; } |
---|
| 331 | <donottreat_interface>.*\n {INCREMENT_LINE_NUM() ; } |
---|
| 332 | <fortran77style>{NAME}{NEXTLINEF77}[a-zA-Z0-9\_]+ {strcpy(yylval.na,fortran_text); removenewline(yylval.na); |
---|
| 333 | return TOK_NAME; } |
---|
[5596] | 334 | {NAME} { strcpy(yylval.na,fortran_text); return TOK_NAME; } |
---|
[13027] | 335 | {INTEGER}\.[0-9]+ {strcpy(yylval.na,fortran_text); return TOK_CSTREAL; } |
---|
[5596] | 336 | ({INTEGER}\.[0-9]*)/[^"and."|"false."|"true."|"eq."|"or."|"gt."|"ge."|"lt."|"le."|"not."|"ne."] { // REAL1 |
---|
| 337 | strcpy(yylval.na,fortran_text); return TOK_CSTREAL; } |
---|
| 338 | (({INTEGER}\.[0-9]+|[0-9]*\.{INTEGER}){EXPONENT}?)|{INTEGER}(\.)?{EXPONENT} { // REAL2 |
---|
| 339 | strcpy(yylval.na,fortran_text); return TOK_CSTREAL; } |
---|
[13027] | 340 | {INTEGER} { strcpy(yylval.na,fortran_text); |
---|
| 341 | if (lastwasendofstmt == 0) |
---|
| 342 | return TOK_CSTINT; |
---|
| 343 | else |
---|
| 344 | if (testandextractfromlist(&List_Do_labels,fortran_text) == 1) |
---|
| 345 | { |
---|
| 346 | removefromlist(&List_Do_labels,yylval.na); |
---|
| 347 | return TOK_LABEL_DJVIEW; |
---|
| 348 | } |
---|
| 349 | else |
---|
| 350 | { |
---|
| 351 | return TOK_LABEL; |
---|
| 352 | } |
---|
| 353 | } |
---|
[5596] | 354 | \$ {} |
---|
| 355 | \. {} |
---|
[13027] | 356 | \(/([ \t]*[\+\-]?[a-zA-Z0-9]+[\.]*[0-9]*(\_({INTEGER}|{NAME}))?[ \t]*\,[ \t]*[\+\-]?[a-zA-Z0-9]+[\.]*[0-9]*(\_({INTEGER}|{NAME}))?[ \t]*\)) { |
---|
| 357 | in_complex_literal = -1; |
---|
| 358 | return (int) *fortran_text; |
---|
| 359 | } |
---|
| 360 | \(|\)|:|\[|\]|\+|\-|\*|\_ { strcpy(yylval.na,fortran_text); return (int) *fortran_text; } |
---|
[5596] | 361 | \% { strcpy(yylval.na,fortran_text); return (int) *fortran_text; } |
---|
[13027] | 362 | \; { lastwasendofstmt=1; token_since_endofstmt = 0; return TOK_SEMICOLON; } |
---|
| 363 | \, { if (in_complex_literal==-1) {return TOK_COMMACOMPLEX; in_complex_literal=0;} else; return (int) *fortran_text; } |
---|
[5596] | 364 | \= { return (int) *fortran_text; } |
---|
| 365 | \< { return (int) *fortran_text; } |
---|
| 366 | \> { return (int) *fortran_text; } |
---|
[13027] | 367 | \n { INCREMENT_LINE_NUM() ; lastwasendofstmt=1; token_since_endofstmt = 0; increment_nbtokens = 0; return '\n'; } |
---|
| 368 | [ \t]+ {increment_nbtokens = 0;} |
---|
| 369 | <fortran77style>{LABEL}[ \t]*format[ \t]*\((.|{NEXTLINEF90}|{NEXTLINEF77})*\) { |
---|
| 370 | return TOK_LABEL_FORMAT; } |
---|
| 371 | <fortran90style>^[ \t]*{INTEGER}[ \t]*format[ \t]*\((.|{NEXTLINEF90})*\) {return TOK_LABEL_FORMAT; } |
---|
[5596] | 372 | {NEXTLINEF90} { INCREMENT_LINE_NUM() ; newlinef90=1; } |
---|
[13027] | 373 | <fortran77style>{NEXTLINEF77} { INCREMENT_LINE_NUM() ;} |
---|
[5596] | 374 | |
---|
[13027] | 375 | {BEG_DNT} {INCREMENT_LINE_NUM() ; BEGIN(donottreat); } |
---|
| 376 | <donottreat>{END_DNT} {out_of_donottreat(); return '\n'; } |
---|
| 377 | <donottreat>.*\n {INCREMENT_LINE_NUM() ; } |
---|
| 378 | <fortran77style>{COMM_F77} {INCREMENT_LINE_NUM() ; increment_nbtokens = 0;} |
---|
| 379 | {COMM_F90_1} {INCREMENT_LINE_NUM() ; increment_nbtokens = 0;} |
---|
| 380 | {COMM_F90_2} {increment_nbtokens = 0;} |
---|
| 381 | <<EOF>> {endoffile = 1; yyterminate();} |
---|
[5596] | 382 | %% |
---|
| 383 | |
---|
| 384 | void out_of_donottreat ( void ) |
---|
| 385 | { |
---|
| 386 | BEGIN(INITIAL); |
---|
| 387 | if (infixed) BEGIN(fortran77style) ; |
---|
| 388 | if (infree) BEGIN(fortran90style) ; |
---|
| 389 | INCREMENT_LINE_NUM() ; |
---|
| 390 | } |
---|