--- a/absyntax/absyntax.cc Thu Apr 14 17:35:25 2011 +0100
+++ b/absyntax/absyntax.cc Thu Apr 14 18:12:59 2011 +0100
@@ -50,22 +50,24 @@
/* The base class of all symbols */
symbol_c::symbol_c(
- int first_line, int first_column, const char *ffile,
- int last_line, int last_column, const char *lfile) {
+ int first_line, int first_column, const char *ffile, long int first_order,
+ int last_line, int last_column, const char *lfile, long int last_order ) {
this->first_file = ffile,
this->first_line = first_line;
this->first_column = first_column;
+ this->first_order = first_order;
this->last_file = lfile,
this->last_line = last_line;
this->last_column = last_column;
+ this->last_order = last_order;
}
token_c::token_c(const char *value,
- int fl, int fc, const char *ffile,
- int ll, int lc, const char *lfile)
- :symbol_c(fl, fc, ffile, ll, lc, lfile) {
+ int fl, int fc, const char *ffile, long int forder,
+ int ll, int lc, const char *lfile, long int lorder)
+ :symbol_c(fl, fc, ffile, forder, ll, lc, lfile, lorder) {
this->value = value;
// printf("New token: %s\n", value);
}
@@ -76,17 +78,17 @@
list_c::list_c(
- int fl, int fc, const char *ffile,
- int ll, int lc, const char *lfile)
- :symbol_c(fl, fc, ffile, ll, lc, lfile) {
+ int fl, int fc, const char *ffile, long int forder,
+ int ll, int lc, const char *lfile, long int lorder)
+ :symbol_c(fl, fc, ffile, forder, ll, lc, lfile, lorder) {
n = 0;
elements = NULL;
}
list_c::list_c(symbol_c *elem,
- int fl, int fc, const char *ffile,
- int ll, int lc, const char *lfile)
- :symbol_c(fl, fc, ffile, ll, lc, lfile) {
+ int fl, int fc, const char *ffile, long int forder,
+ int ll, int lc, const char *lfile, long int lorder)
+ :symbol_c(fl, fc, ffile, forder, ll, lc, lfile, lorder) {
n = 0;
elements = NULL;
add_element(elem);
@@ -128,35 +130,35 @@
#define SYM_LIST(class_name_c) \
class_name_c::class_name_c( \
- int fl, int fc, const char *ffile, \
- int ll, int lc, const char *lfile) \
- :list_c(fl, fc, ffile, ll, lc, lfile) {} \
+ int fl, int fc, const char *ffile, long int forder, \
+ int ll, int lc, const char *lfile, long int lorder) \
+ :list_c(fl, fc, ffile, forder, ll, lc, lfile, lorder) {} \
class_name_c::class_name_c(symbol_c *elem, \
- int fl, int fc, const char *ffile, \
- int ll, int lc, const char *lfile) \
- :list_c(elem, fl, fc, ffile, ll, lc, lfile) {} \
+ int fl, int fc, const char *ffile, long int forder, \
+ int ll, int lc, const char *lfile, long int lorder) \
+ :list_c(elem, fl, fc, ffile, forder, ll, lc, lfile, lorder) {} \
void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
#define SYM_TOKEN(class_name_c) \
class_name_c::class_name_c(const char *value, \
- int fl, int fc, const char *ffile, \
- int ll, int lc, const char *lfile) \
- :token_c(value, fl, fc, ffile, ll, lc, lfile) {} \
+ int fl, int fc, const char *ffile, long int forder, \
+ int ll, int lc, const char *lfile, long int lorder) \
+ :token_c(value, fl, fc, ffile, forder, ll, lc, lfile, lorder) {} \
void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
#define SYM_REF0(class_name_c) \
class_name_c::class_name_c( \
- int fl, int fc, const char *ffile, \
- int ll, int lc, const char *lfile) \
- :symbol_c(fl, fc, ffile, ll, lc, lfile) {} \
+ int fl, int fc, const char *ffile, long int forder, \
+ int ll, int lc, const char *lfile, long int lorder) \
+ :symbol_c(fl, fc, ffile, forder, ll, lc, lfile, lorder) {} \
void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
#define SYM_REF1(class_name_c, ref1) \
class_name_c::class_name_c(symbol_c *ref1, \
- int fl, int fc, const char *ffile, \
- int ll, int lc, const char *lfile) \
- :symbol_c(fl, fc, ffile, ll, lc, lfile) { \
+ int fl, int fc, const char *ffile, long int forder, \
+ int ll, int lc, const char *lfile, long int lorder) \
+ :symbol_c(fl, fc, ffile, forder, ll, lc, lfile, lorder) { \
this->ref1 = ref1; \
} \
void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
@@ -165,9 +167,9 @@
#define SYM_REF2(class_name_c, ref1, ref2) \
class_name_c::class_name_c(symbol_c *ref1, \
symbol_c *ref2, \
- int fl, int fc, const char *ffile, \
- int ll, int lc, const char *lfile) \
- :symbol_c(fl, fc, ffile, ll, lc, lfile) { \
+ int fl, int fc, const char *ffile, long int forder, \
+ int ll, int lc, const char *lfile, long int lorder) \
+ :symbol_c(fl, fc, ffile, forder, ll, lc, lfile, lorder) { \
this->ref1 = ref1; \
this->ref2 = ref2; \
} \
@@ -178,9 +180,9 @@
class_name_c::class_name_c(symbol_c *ref1, \
symbol_c *ref2, \
symbol_c *ref3, \
- int fl, int fc, const char *ffile, \
- int ll, int lc, const char *lfile) \
- :symbol_c(fl, fc, ffile, ll, lc, lfile) { \
+ int fl, int fc, const char *ffile, long int forder, \
+ int ll, int lc, const char *lfile, long int lorder) \
+ :symbol_c(fl, fc, ffile, forder, ll, lc, lfile, lorder) { \
this->ref1 = ref1; \
this->ref2 = ref2; \
this->ref3 = ref3; \
@@ -193,9 +195,9 @@
symbol_c *ref2, \
symbol_c *ref3, \
symbol_c *ref4, \
- int fl, int fc, const char *ffile, \
- int ll, int lc, const char *lfile) \
- :symbol_c(fl, fc, ffile, ll, lc, lfile) { \
+ int fl, int fc, const char *ffile, long int forder, \
+ int ll, int lc, const char *lfile, long int lorder) \
+ :symbol_c(fl, fc, ffile, forder, ll, lc, lfile, lorder) { \
this->ref1 = ref1; \
this->ref2 = ref2; \
this->ref3 = ref3; \
@@ -210,9 +212,9 @@
symbol_c *ref3, \
symbol_c *ref4, \
symbol_c *ref5, \
- int fl, int fc, const char *ffile, \
- int ll, int lc, const char *lfile) \
- :symbol_c(fl, fc, ffile, ll, lc, lfile) { \
+ int fl, int fc, const char *ffile, long int forder, \
+ int ll, int lc, const char *lfile, long int lorder) \
+ :symbol_c(fl, fc, ffile, forder, ll, lc, lfile, lorder) { \
this->ref1 = ref1; \
this->ref2 = ref2; \
this->ref3 = ref3; \
@@ -230,9 +232,9 @@
symbol_c *ref4, \
symbol_c *ref5, \
symbol_c *ref6, \
- int fl, int fc, const char *ffile, \
- int ll, int lc, const char *lfile) \
- :symbol_c(fl, fc, ffile, ll, lc, lfile) { \
+ int fl, int fc, const char *ffile, long int forder, \
+ int ll, int lc, const char *lfile, long int lorder) \
+ :symbol_c(fl, fc, ffile, forder, ll, lc, lfile, lorder) { \
this->ref1 = ref1; \
this->ref2 = ref2; \
this->ref3 = ref3; \
--- a/absyntax/absyntax.hh Thu Apr 14 17:35:25 2011 +0100
+++ b/absyntax/absyntax.hh Thu Apr 14 18:12:59 2011 +0100
@@ -71,14 +71,16 @@
int first_line;
int first_column;
const char *first_file; /* filename referenced by first line/column */
+ long int first_order; /* relative order in which it is read by lexcial analyser */
int last_line;
int last_column;
const char *last_file; /* filename referenced by last line/column */
+ long int last_order; /* relative order in which it is read by lexcial analyser */
public:
/* default constructor */
- symbol_c(int fl = 0, int fc = 0, const char *ffile = NULL /* filename */,
- int ll = 0, int lc = 0, const char *lfile = NULL /* filename */
+ symbol_c(int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, /* order in which it is read by lexcial analyser */
+ int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0 /* order in which it is read by lexcial analyser */
);
/* default destructor */
@@ -96,8 +98,8 @@
public:
token_c(const char *value,
- int fl = 0, int fc = 0, const char *ffile = NULL /* filename */,
- int ll = 0, int lc = 0, const char *lfile = NULL /* filename */
+ int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, /* order in which it is read by lexcial analyser */
+ int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0 /* order in which it is read by lexcial analyser */
);
};
@@ -109,13 +111,13 @@
symbol_c **elements;
public:
- list_c(int fl = 0, int fc = 0, const char *ffile = NULL /* filename */,
- int ll = 0, int lc = 0, const char *lfile = NULL /* filename */
+ list_c(int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, /* order in which it is read by lexcial analyser */
+ int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0 /* order in which it is read by lexcial analyser */
);
list_c(symbol_c *elem,
- int fl = 0, int fc = 0, const char *ffile = NULL /* filename */,
- int ll = 0, int lc = 0, const char *lfile = NULL /* filename */
+ int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, /* order in which it is read by lexcial analyser */
+ int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0 /* order in which it is read by lexcial analyser */
);
/* insert a new element */
virtual void add_element(symbol_c *elem);
@@ -128,11 +130,11 @@
class class_name_c: public list_c { \
public: \
class_name_c( \
- int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, \
- int ll = 0, int lc = 0, const char *lfile = NULL /* filename */); \
+ int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \
+ int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \
class_name_c(symbol_c *elem, \
- int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, \
- int ll = 0, int lc = 0, const char *lfile = NULL /* filename */); \
+ int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \
+ int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \
virtual void *accept(visitor_c &visitor); \
};
@@ -141,8 +143,8 @@
class class_name_c: public token_c { \
public: \
class_name_c(const char *value, \
- int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, \
- int ll = 0, int lc = 0, const char *lfile = NULL /* filename */); \
+ int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \
+ int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \
virtual void *accept(visitor_c &visitor); \
};
@@ -151,8 +153,8 @@
class class_name_c: public symbol_c { \
public: \
class_name_c( \
- int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, \
- int ll = 0, int lc = 0, const char *lfile = NULL /* filename */); \
+ int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \
+ int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \
virtual void *accept(visitor_c &visitor); \
};
@@ -163,8 +165,8 @@
symbol_c *ref1; \
public: \
class_name_c(symbol_c *ref1, \
- int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, \
- int ll = 0, int lc = 0, const char *lfile = NULL /* filename */); \
+ int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \
+ int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \
virtual void *accept(visitor_c &visitor); \
};
@@ -177,8 +179,8 @@
public: \
class_name_c(symbol_c *ref1, \
symbol_c *ref2 = NULL, \
- int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, \
- int ll = 0, int lc = 0, const char *lfile = NULL /* filename */); \
+ int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \
+ int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \
virtual void *accept(visitor_c &visitor); \
};
@@ -193,8 +195,8 @@
class_name_c(symbol_c *ref1, \
symbol_c *ref2, \
symbol_c *ref3, \
- int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, \
- int ll = 0, int lc = 0, const char *lfile = NULL /* filename */); \
+ int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \
+ int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \
virtual void *accept(visitor_c &visitor); \
};
@@ -211,8 +213,8 @@
symbol_c *ref2, \
symbol_c *ref3, \
symbol_c *ref4 = NULL, \
- int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, \
- int ll = 0, int lc = 0, const char *lfile = NULL /* filename */); \
+ int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \
+ int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \
virtual void *accept(visitor_c &visitor); \
};
@@ -231,8 +233,8 @@
symbol_c *ref3, \
symbol_c *ref4, \
symbol_c *ref5, \
- int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, \
- int ll = 0, int lc = 0, const char *lfile = NULL /* filename */); \
+ int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \
+ int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \
virtual void *accept(visitor_c &visitor); \
};
@@ -253,8 +255,8 @@
symbol_c *ref4, \
symbol_c *ref5, \
symbol_c *ref6 = NULL, \
- int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, \
- int ll = 0, int lc = 0, const char *lfile = NULL /* filename */); \
+ int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \
+ int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \
virtual void *accept(visitor_c &visitor); \
};
--- a/stage1_2/iec.y Thu Apr 14 17:35:25 2011 +0100
+++ b/stage1_2/iec.y Thu Apr 14 18:12:59 2011 +0100
@@ -116,9 +116,9 @@
/* Macros used to pass the line and column locations when
* creating a new object for the abstract syntax tree.
*/
-#define locloc(foo) foo.first_line, foo.first_column, foo.first_file, foo.last_line, foo.last_column, foo.last_file
-#define locf(foo) foo.first_line, foo.first_column, foo.first_file
-#define locl(foo) foo.last_line, foo.last_column, foo.last_file
+#define locloc(foo) foo.first_line, foo.first_column, foo.first_file, foo.first_order, foo.last_line, foo.last_column, foo.last_file, foo.last_order
+#define locf(foo) foo.first_line, foo.first_column, foo.first_file, foo.first_order
+#define locl(foo) foo.last_line, foo.last_column, foo.last_file, foo.last_order
/* Redefine the default action to take for each rule, so that the filenames are correctly processed... */
# define YYLLOC_DEFAULT(Current, Rhs, N) \
@@ -128,9 +128,11 @@
(Current).first_line = YYRHSLOC(Rhs, 1).first_line; \
(Current).first_column = YYRHSLOC(Rhs, 1).first_column; \
(Current).first_file = YYRHSLOC(Rhs, 1).first_file; \
+ (Current).first_order = YYRHSLOC(Rhs, 1).first_order; \
(Current).last_line = YYRHSLOC(Rhs, N).last_line; \
(Current).last_column = YYRHSLOC(Rhs, N).last_column; \
(Current).last_file = YYRHSLOC(Rhs, 1).last_file; \
+ (Current).last_order = YYRHSLOC(Rhs, 1).last_order; \
} \
else \
{ \
@@ -140,6 +142,8 @@
YYRHSLOC(Rhs, 0).last_column; \
(Current).first_file = (Current).last_file = \
YYRHSLOC(Rhs, 0).last_file; \
+ (Current).first_order = (Current).last_order = \
+ YYRHSLOC(Rhs, 0).last_order; \
} \
while (0)
@@ -205,9 +209,11 @@
void print_err_msg(int first_line,
int first_column,
const char *first_filename,
+ long int first_order,
int last_line,
int last_column,
const char *last_filename,
+ long int last_order,
const char *additional_error_msg);
%}
@@ -245,12 +251,14 @@
*/
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
typedef struct {
- int first_line;
- int first_column;
+ int first_line;
+ int first_column;
const char *first_file;
- int last_line;
- int last_column;
+ long int first_order;
+ int last_line;
+ int last_column;
const char *last_file;
+ long int last_order;
} yyltype__local;
#define YYLTYPE yyltype__local
#endif
@@ -7892,9 +7900,11 @@
void print_err_msg(int first_line,
int first_column,
const char *first_filename,
+ long int first_order,
int last_line,
int last_column,
const char *last_filename,
+ long int last_order,
const char *additional_error_msg) {
const char *unknown_file = "<unknown_file>";
@@ -8000,9 +8010,11 @@
il_operator->first_line,
il_operator->first_column,
il_operator->first_file,
+ il_operator->first_order,
il_operator->last_line,
il_operator->last_column,
- il_operator->last_file
+ il_operator->last_file,
+ il_operator->last_order
);
free(il_operator);
return res;