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.
convert.lex in trunk/AGRIF/LIB – NEMO

source: trunk/AGRIF/LIB/convert.lex @ 396

Last change on this file since 396 was 396, checked in by opalod, 18 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
RevLine 
[396]1/******************************************************************************/
2/*                                                                            */
3/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
4/*                                                                            */
5/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
6/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
7/*                                                                            */
8/*     This program is free software; you can redistribute it and/or modify   */
9/*    it                                                                      */
10/*                                                                            */
11/*    This program is distributed in the hope that it will be useful,         */
12/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
13/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
14/*    GNU General Public License for more details.                            */
15/*                                                                            */
16/******************************************************************************/
17%s character
18%{
19#include <math.h>
20#include <stdlib.h>
21#include <string.h>
22int line_num=1;
23extern FILE * yyin;
24#define MAX_INCLUDE_DEPTH 30
25YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
26%}
27
28COMMENT "%" 
29SEPARATEUR "::"
30NIMPORTEQUOI .
31COMMENTAIRES1 {COMMENT}{NIMPORTEQUOI}*{COMMENT}
32PROBTYPE "1D"|"2D"|"3D"
33USEITEM "FIXED_GRIDS"|"ONLY_FIXED_GRIDS"|"DEBUG"
34NAME [a-zA-Z\_][a-zA-Z0-9\_]*
35DIGIT [0-9]+
36NUM {DIGIT}
37NEXTLINE \n+[ \t]+"$"|\n+[ \t]+"&"
38FILENAME {NAME}"."{NAME}
39%%
40regridding  return TOK_REGRIDDING; /* period of regridding                    */
41coeffrefx   return TOK_COEFFRAFX;  /* space refinement in the x direction     */
42coeffrefy   return TOK_COEFFRAFY;  /* space refinement in the y direction     */
43coeffrefz   return TOK_COEFFRAFZ;  /* space refinement in the z direction     */
44coeffreftx  return TOK_COEFFRAFTX; /* time refinement in the x direction      */
45coeffrefty  return TOK_COEFFRAFTY; /* time refinement in the y direction      */
46coeffreftz  return TOK_COEFFRAFTZ; /* time refinement in the z direction      */
47parammodule return TOK_MODULEMAIN; /* name of the module                      */
48efficiency  return TOK_EFFICIENCY; /* efficiency for the adaptive refinement  */
49rafmax      return TOK_RAFMAX;     /* minimum size in all directions          */
50rafmaxx     return TOK_RAFMAXX;    /* minimum size in x direction             */
51rafmaxy     return TOK_RAFMAXY;    /* minimum size in y direction             */
52rafmaxz     return TOK_RAFMAXZ;    /* minimum size in z direction             */
53notgriddep  return TOK_NOTGRIDDEP; /* variable which are not grid dependent   */
54use         return TOK_USE;
55minwidth    return TOK_MINWIDTH;   /* minimum width of rectangles for the     */
56                                   /*    adaptive refinement                  */
57{COMMENTAIRES1}    {}
58{SEPARATEUR}        return TOK_SEP;
59{FILENAME}         {strcpy(yylval.na,yytext); return TOK_FILENAME;}
60{USEITEM}          {strcpy(yylval.na,yytext); return TOK_USEITEM;}
61{PROBTYPE}         {strcpy(yylval.na,yytext); return TOK_PROBTYPE;}
62                                   /* dimension of the problem                */
63{NAME}             {strcpy(yylval.na,yytext); return TOK_NAME;}
64{NUM}              {yylval.ival=atoi(yytext); return TOK_NUM;}
65;|\,|\(|\)|:|\[|\] {return (int) *yytext;}
66\n                 {line_num++;return (int) *yytext;}
67[ \t]+ ;
68%%
69
70
71int yywrap()
72{
73}
74
75
76yyerror(char *s)
77{
78if (!strcasecmp(curfile,mainfile))
79{
80   printf("Dans convert %s line %d, fichier %s\n",s,line_num,curfile);
81}
82else
83{
84   printf("Dans convert %s line %d, fichier %s\n",s,line_num,curfile);
85}
86exit(0);
87}
Note: See TracBrowser for help on using the repository browser.