convert.lex 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. %s character
  38. %{
  39. #include <math.h>
  40. #include <stdlib.h>
  41. #include <string.h>
  42. #define YY_NO_INPUT
  43. %}
  44. SEPARATEUR "::"
  45. COMMENTS "%".*"%"
  46. PROBTYPE "1D"|"2D"|"3D"
  47. USEITEM "FIXED_GRIDS"|"ONLY_FIXED_GRIDS"|"F77"
  48. NAME [a-zA-Z\_][a-zA-Z0-9\_]*
  49. INTEGER [0-9]+
  50. NEXTLINE \n+[ \t]+"$"|\n+[ \t]+"&"
  51. %%
  52. parammodule { return TOK_MODULEMAIN; } /* name of the module */
  53. notgriddep { return TOK_NOTGRIDDEP; } /* variable which are not grid dependent */
  54. use { return TOK_USE; }
  55. {COMMENTS} { }
  56. {SEPARATEUR} { return TOK_SEP; }
  57. KIND { return TOK_KIND; }
  58. \= { return TOK_EQUAL; }
  59. {USEITEM} { strcpy(yylval.na,yytext); return TOK_USEITEM; }
  60. {PROBTYPE} { strcpy(yylval.na,yytext); return TOK_PROBTYPE; } /* dimension of the problem */
  61. {NAME} { strcpy(yylval.na,yytext); return TOK_NAME; }
  62. {INTEGER} { strcpy(yylval.na,yytext); return TOK_CSTINT; }
  63. ;|\,|\(|\)|:|\[|\] { return (int) *yytext; }
  64. \n { line_num++; return (int) *yytext; }
  65. [ \t]+ ;
  66. %%