stage1_2/iec_bison.yy
changeset 822 a7d9e0b8636b
parent 811 970c582885bf
child 870 9c6c588fd708
equal deleted inserted replaced
821:fa4569bf1538 822:a7d9e0b8636b
    94 
    94 
    95 /* file with declaration of absyntax classes... */
    95 /* file with declaration of absyntax classes... */
    96 #include "../absyntax/absyntax.hh"
    96 #include "../absyntax/absyntax.hh"
    97 
    97 
    98 /* file with declaration of token constants. Generated by bison! */
    98 /* file with declaration of token constants. Generated by bison! */
    99 #include "iec_bison.h"
    99 #include "iec_bison.hh"
   100 
   100 
   101 /* The interface through which bison and flex interact. */
   101 /* The interface through which bison and flex interact. */
   102 #include "stage1_2_priv.hh"
   102 #include "stage1_2_priv.hh"
   103 #include "create_enumtype_conversion_functions.hh"
   103 #include "create_enumtype_conversion_functions.hh"
   104 
   104 
   167 
   167 
   168 /*************************/
   168 /*************************/
   169 /* global variables...   */
   169 /* global variables...   */
   170 /*************************/
   170 /*************************/
   171 /* NOTE: For some strange reason bison ver 2.3 is including these declarations
   171 /* NOTE: For some strange reason bison ver 2.3 is including these declarations
   172  *       in the iec_bison.h file, which is in turn included by flex.
   172  *       in the iec_bison.hh file, which is in turn included by flex.
   173  *       We cannot therefore define any variables over here, but merely declare 
   173  *       We cannot therefore define any variables over here, but merely declare 
   174  *       their existance (otherwise we get errors when linking the code, since we
   174  *       their existance (otherwise we get errors when linking the code, since we
   175  *       would get a new variable defined each time iec_bison.h is included!).
   175  *       would get a new variable defined each time iec_bison.hh is included!).
   176  *       Even though the variables are declared 'extern' over here, they will in
   176  *       Even though the variables are declared 'extern' over here, they will in
   177  *       fact be defined towards the end of this same file (i.e. in the prologue)
   177  *       fact be defined towards the end of this same file (i.e. in the prologue)
   178  */
   178  */
   179 
   179 
   180 
   180 
   248 
   248 
   249 
   249 
   250 /* The following definitions need to be inside a '%code requires' 
   250 /* The following definitions need to be inside a '%code requires' 
   251  * so that they are also included in the header files. If this were not the case,
   251  * so that they are also included in the header files. If this were not the case,
   252  * YYLTYPE would be delcared as something in the iec.cc file, and another thing
   252  * YYLTYPE would be delcared as something in the iec.cc file, and another thing
   253  * (actually the default value of YYLTYPE) in the iec_bison.h heder file.
   253  * (actually the default value of YYLTYPE) in the iec_bison.hh heder file.
   254  */
   254  */
   255 %code requires {
   255 %code requires {
   256 /* define a new data type to store the locations, so we can also store
   256 /* define a new data type to store the locations, so we can also store
   257  * the filename in which the token is expressed.
   257  * the filename in which the token is expressed.
   258  */
   258  */
   259 /* NOTE: since this code will be placed in the iec_bison.h header file,
   259 /* NOTE: since this code will be placed in the iec_bison.hh header file,
   260  * as well as the iec.cc file that also includes the iec_bison.h header file,
   260  * as well as the iec.cc file that also includes the iec_bison.hh header file,
   261  * declaring the typedef struct yyltype__local here would result in a 
   261  * declaring the typedef struct yyltype__local here would result in a 
   262  * compilation error when compiling iec.cc, as this struct would be
   262  * compilation error when compiling iec.cc, as this struct would be
   263  * declared twice.
   263  * declared twice.
   264  * We therefore use the #if !defined YYLTYPE ...
   264  * We therefore use the #if !defined YYLTYPE ...
   265  * to make sure only the first declaration is parsed by the C++ compiler.
   265  * to make sure only the first declaration is parsed by the C++ compiler.