Institut de Robòtica i Informàtica Industrial
KRD Group

The CuikSuite Project

readparameters.l

Go to the documentation of this file.
00001 %{ 
00002 
00004 #include <stdlib.h> 
00005 #include <string.h>
00006 
00007 #include "defines.h"
00008 #include "readparameters.tab.h"
00009 
00012 int ReadParameterslex(void);
00013 
00014 extern unsigned int RPNline; /*current line number (declared in the YACC module and updated here)*/
00015 
00016 %} 
00017  
00018 %s IN_COMMENT
00019 
00020 EMPTY                           [ \t]+ 
00021 RETURN                          \n
00022 DIGIT                           [0-9] 
00023 LETTER                          [a-zA-Z] 
00024 R_NUMBER                        (({DIGIT}+(\.{DIGIT}+)?)|(\.{DIGIT}+))((E|e)[+-]?{DIGIT}+)? 
00025 I_NUMBER                        {DIGIT}+ 
00026 IDENTIFIER                      {LETTER}({DIGIT}|{LETTER}|"_")* 
00027 COMMENT                         \%[^\n]*
00028 COMMENT2                        \#[^{\n|\{}]* 
00029  
00030 %%
00031 
00032 {COMMENT}                       { }   
00033 {COMMENT2}                      { }  
00034 
00035 <INITIAL>{
00036   "/*"              BEGIN(IN_COMMENT);
00037 }
00038 <IN_COMMENT>{
00039   "*/"      BEGIN(INITIAL);
00040   [^*\n]+   // eat comment in chunks
00041   "*"       // eat the lone star
00042   \n        RPNline++;
00043 }
00044 
00045 {EMPTY}                         { } 
00046 
00047 {RETURN}                        { RPNline++; } 
00048 
00049 TRUE                            { return(_TRUE);}
00050 FALSE                           { return(_FALSE);}
00051 
00052 INF                             { return(_INF);}
00053 
00054 EPSILON                         { return(_EPSILON);}
00055 
00056 RHO                             { return(_RHO);}
00057 
00058 SIGMA                           { return(_SIGMA);}
00059 SMALL_SIGMA                     { return(_SMALL_SIGMA);}
00060 
00061 STATE_PERIOD                    { return(_STATE_PERIOD);}
00062 
00063 DUMMIFY                         { return(_DUMMIFY);}
00064 ERROR_SPLIT                     { return(_ERROR_SPLIT);}
00065 SAFE_SIMPLEX                    { return(_SAFE_SIMPLEX);}
00066 SIMPLIFICATION_LEVEL            { return(_SIMPLIFICATION_LEVEL);}
00067 LR2TM_Q                         { return(_LR2TM_Q);}
00068 LR2TM_S                         { return(_LR2TM_S);}
00069 
00070 {I_NUMBER}                      {
00071                                   char string_tmp[100];
00072                                   
00073                                   memcpy(string_tmp,ReadParameterstext,(unsigned int)ReadParametersleng);
00074                                   string_tmp[ReadParametersleng]=0;
00075                                   ReadParameterslval.int_number=atoi(string_tmp);
00076                                   return(_INTEGER); 
00077                                 } 
00078  
00079 {R_NUMBER}                      { 
00080                                   char string_tmp[100];
00081                                   
00082                                   memcpy(string_tmp,ReadParameterstext,(unsigned int)ReadParametersleng);
00083                                   string_tmp[ReadParametersleng]=0;
00084                                   ReadParameterslval.real_number=atof(string_tmp);
00085                                   
00086                                   return(_REAL);
00087                                 }
00088  
00089 .                               { return(ReadParameterstext[0]); }
00090  
00091 %%
00092 
00101 int ReadParameterswrap()
00102 {
00103   return(1);
00104 }
00105