stage1_2/iec_bison.yy
changeset 415 5c115720149c
parent 382 ac6dfec701c9
child 417 d48f53715f77
equal deleted inserted replaced
414:b6a522b762c9 415:5c115720149c
   248  * declaring the typedef struct yyltype__local here would result in a 
   248  * declaring the typedef struct yyltype__local here would result in a 
   249  * compilation error when compiling iec.cc, as this struct would be
   249  * compilation error when compiling iec.cc, as this struct would be
   250  * declared twice.
   250  * declared twice.
   251  * We therefore use the #if !defined YYLTYPE ...
   251  * We therefore use the #if !defined YYLTYPE ...
   252  * to make sure only the first declaration is parsed by the C++ compiler.
   252  * to make sure only the first declaration is parsed by the C++ compiler.
   253  *
       
   254  * At first glance it seems that what we really should do is delcare the
       
   255  * YYLTYPE directly as an anonymous struct, thus:
       
   256  * #define YYLTYPE struct{ ...}
       
   257  * however, this also results in compilation errors.
       
   258  *
       
   259  * I (Mario) think this is kind of a hack. If you know how to
       
   260  * do this re-declaration of YYLTYPE properly, please let me know!
       
   261  */
   253  */
   262 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
   254 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
   263   typedef struct {
   255 typedef struct YYLTYPE {
   264     int         first_line;
   256     int         first_line;
   265     int         first_column;
   257     int         first_column;
   266     const char *first_file;
   258     const char *first_file;
   267     long int    first_order;
   259     long int    first_order;
   268     int         last_line;
   260     int         last_line;
   269     int         last_column;
   261     int         last_column;
   270     const char *last_file;
   262     const char *last_file;
   271     long int    last_order;
   263     long int    last_order;
   272   } yyltype__local;
   264 } YYLTYPE;
   273   #define YYLTYPE yyltype__local
   265 #define YYLTYPE_IS_DECLARED 1
       
   266 #define YYLTYPE_IS_TRIVIAL 1
   274 #endif
   267 #endif
       
   268 
   275 }
   269 }
   276 
   270 
   277 
   271 
   278 
   272 
   279 %union {
   273 %union {