114 |
114 |
115 |
115 |
116 /* Macros used to pass the line and column locations when |
116 /* Macros used to pass the line and column locations when |
117 * creating a new object for the abstract syntax tree. |
117 * creating a new object for the abstract syntax tree. |
118 */ |
118 */ |
119 #define locloc(foo) foo.first_line, foo.first_column, foo.first_file, foo.last_line, foo.last_column, foo.last_file |
119 #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 |
120 #define locf(foo) foo.first_line, foo.first_column, foo.first_file |
120 #define locf(foo) foo.first_line, foo.first_column, foo.first_file, foo.first_order |
121 #define locl(foo) foo.last_line, foo.last_column, foo.last_file |
121 #define locl(foo) foo.last_line, foo.last_column, foo.last_file, foo.last_order |
122 |
122 |
123 /* Redefine the default action to take for each rule, so that the filenames are correctly processed... */ |
123 /* Redefine the default action to take for each rule, so that the filenames are correctly processed... */ |
124 # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
124 # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
125 do \ |
125 do \ |
126 if (N) \ |
126 if (N) \ |
127 { \ |
127 { \ |
128 (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \ |
128 (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \ |
129 (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \ |
129 (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \ |
130 (Current).first_file = YYRHSLOC(Rhs, 1).first_file; \ |
130 (Current).first_file = YYRHSLOC(Rhs, 1).first_file; \ |
|
131 (Current).first_order = YYRHSLOC(Rhs, 1).first_order; \ |
131 (Current).last_line = YYRHSLOC(Rhs, N).last_line; \ |
132 (Current).last_line = YYRHSLOC(Rhs, N).last_line; \ |
132 (Current).last_column = YYRHSLOC(Rhs, N).last_column; \ |
133 (Current).last_column = YYRHSLOC(Rhs, N).last_column; \ |
133 (Current).last_file = YYRHSLOC(Rhs, 1).last_file; \ |
134 (Current).last_file = YYRHSLOC(Rhs, 1).last_file; \ |
|
135 (Current).last_order = YYRHSLOC(Rhs, 1).last_order; \ |
134 } \ |
136 } \ |
135 else \ |
137 else \ |
136 { \ |
138 { \ |
137 (Current).first_line = (Current).last_line = \ |
139 (Current).first_line = (Current).last_line = \ |
138 YYRHSLOC(Rhs, 0).last_line; \ |
140 YYRHSLOC(Rhs, 0).last_line; \ |
139 (Current).first_column = (Current).last_column = \ |
141 (Current).first_column = (Current).last_column = \ |
140 YYRHSLOC(Rhs, 0).last_column; \ |
142 YYRHSLOC(Rhs, 0).last_column; \ |
141 (Current).first_file = (Current).last_file = \ |
143 (Current).first_file = (Current).last_file = \ |
142 YYRHSLOC(Rhs, 0).last_file; \ |
144 YYRHSLOC(Rhs, 0).last_file; \ |
|
145 (Current).first_order = (Current).last_order = \ |
|
146 YYRHSLOC(Rhs, 0).last_order; \ |
143 } \ |
147 } \ |
144 while (0) |
148 while (0) |
145 |
149 |
146 |
150 |
147 /* A macro for printing out internal parser errors... */ |
151 /* A macro for printing out internal parser errors... */ |
7890 |
7898 |
7891 |
7899 |
7892 void print_err_msg(int first_line, |
7900 void print_err_msg(int first_line, |
7893 int first_column, |
7901 int first_column, |
7894 const char *first_filename, |
7902 const char *first_filename, |
|
7903 long int first_order, |
7895 int last_line, |
7904 int last_line, |
7896 int last_column, |
7905 int last_column, |
7897 const char *last_filename, |
7906 const char *last_filename, |
|
7907 long int last_order, |
7898 const char *additional_error_msg) { |
7908 const char *additional_error_msg) { |
7899 |
7909 |
7900 const char *unknown_file = "<unknown_file>"; |
7910 const char *unknown_file = "<unknown_file>"; |
7901 if (first_filename == NULL) first_filename = unknown_file; |
7911 if (first_filename == NULL) first_filename = unknown_file; |
7902 if ( last_filename == NULL) last_filename = unknown_file; |
7912 if ( last_filename == NULL) last_filename = unknown_file; |
7998 |
8008 |
7999 res = new identifier_c(strdup(name), |
8009 res = new identifier_c(strdup(name), |
8000 il_operator->first_line, |
8010 il_operator->first_line, |
8001 il_operator->first_column, |
8011 il_operator->first_column, |
8002 il_operator->first_file, |
8012 il_operator->first_file, |
|
8013 il_operator->first_order, |
8003 il_operator->last_line, |
8014 il_operator->last_line, |
8004 il_operator->last_column, |
8015 il_operator->last_column, |
8005 il_operator->last_file |
8016 il_operator->last_file, |
|
8017 il_operator->last_order |
8006 ); |
8018 ); |
8007 free(il_operator); |
8019 free(il_operator); |
8008 return res; |
8020 return res; |
8009 } |
8021 } |
8010 |
8022 |