Fix YYLTYPE declaration.
authorManuele Conti <conti.ma@alice.it>
Tue, 27 Sep 2011 00:07:16 +0200
changeset 415 5c115720149c
parent 414 b6a522b762c9
child 416 0c2ef191b22a
Fix YYLTYPE declaration.
stage1_2/iec_bison.yy
stage1_2/iec_flex.ll
--- a/stage1_2/iec_bison.yy	Sun Nov 20 19:36:48 2011 +0000
+++ b/stage1_2/iec_bison.yy	Tue Sep 27 00:07:16 2011 +0200
@@ -250,17 +250,9 @@
  * declared twice.
  * We therefore use the #if !defined YYLTYPE ...
  * to make sure only the first declaration is parsed by the C++ compiler.
- *
- * At first glance it seems that what we really should do is delcare the
- * YYLTYPE directly as an anonymous struct, thus:
- * #define YYLTYPE struct{ ...}
- * however, this also results in compilation errors.
- *
- * I (Mario) think this is kind of a hack. If you know how to
- * do this re-declaration of YYLTYPE properly, please let me know!
  */
 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
-  typedef struct {
+typedef struct YYLTYPE {
     int         first_line;
     int         first_column;
     const char *first_file;
@@ -269,9 +261,11 @@
     int         last_column;
     const char *last_file;
     long int    last_order;
-  } yyltype__local;
-  #define YYLTYPE yyltype__local
+} YYLTYPE;
+#define YYLTYPE_IS_DECLARED 1
+#define YYLTYPE_IS_TRIVIAL 1
 #endif
+
 }
 
 
--- a/stage1_2/iec_flex.ll	Sun Nov 20 19:36:48 2011 +0000
+++ b/stage1_2/iec_flex.ll	Tue Sep 27 00:07:16 2011 +0200
@@ -171,8 +171,9 @@
  * track of the locations, in order to give
  * more meaningful error messages!
  */
-extern YYLTYPE yylloc;
-
+/*
+ *extern YYLTYPE yylloc;
+b*/
 #define YY_INPUT(buf,result,max_size)  {\
     result = GetNextChar(buf, max_size);\
     if (  result <= 0  )\
@@ -208,7 +209,6 @@
 	current_order++;							\
 	}
 
-
 /* Since this lexical parser we defined only works in ASCII based
  * systems, we might as well make sure it is being compiled on
  * one...