equal
deleted
inserted
replaced
182 /* Macro that is executed for every action. |
182 /* Macro that is executed for every action. |
183 * We use it to pass the location of the token |
183 * We use it to pass the location of the token |
184 * back to the bison parser... |
184 * back to the bison parser... |
185 */ |
185 */ |
186 #define YY_USER_ACTION {\ |
186 #define YY_USER_ACTION {\ |
187 yylloc.first_line = current_tracking->lineNumber;\ |
187 yylloc.first_line = current_tracking->lineNumber;\ |
188 yylloc.first_column = current_tracking->currentTokenStart;\ |
188 yylloc.first_column = current_tracking->currentTokenStart;\ |
189 yylloc.last_line = current_tracking->lineNumber;\ |
189 yylloc.first_file = current_filename;\ |
190 yylloc.last_column = current_tracking->currentChar - 1;\ |
190 yylloc.last_line = current_tracking->lineNumber;\ |
191 current_tracking->currentTokenStart = current_tracking->currentChar;\ |
191 yylloc.last_column = current_tracking->currentChar - 1;\ |
|
192 yylloc.last_file = current_filename;\ |
|
193 current_tracking->currentTokenStart = current_tracking->currentChar;\ |
192 } |
194 } |
193 |
195 |
194 |
196 |
195 /* Since this lexical parser we defined only works in ASCII based |
197 /* Since this lexical parser we defined only works in ASCII based |
196 * systems, we might as well make sure it is being compiled on |
198 * systems, we might as well make sure it is being compiled on |
856 /* removing constness of char *. This is safe actually, |
858 /* removing constness of char *. This is safe actually, |
857 * since the only real const char * that is stored on the stack is |
859 * since the only real const char * that is stored on the stack is |
858 * the first one (i.e. the one that gets stored in include_stack[0], |
860 * the first one (i.e. the one that gets stored in include_stack[0], |
859 * which is never free'd! |
861 * which is never free'd! |
860 */ |
862 */ |
861 free((char *)current_filename); |
863 /* NOTE: We do __NOT__ free the malloc()'d memory since |
|
864 * pointers to this filename will be kept by many objects |
|
865 * in the abstract syntax tree. |
|
866 * This will later be used to provide correct error |
|
867 * messages during semantic analysis (stage 3) |
|
868 */ |
|
869 /* free((char *)current_filename); */ |
862 current_filename = include_stack[include_stack_ptr].filename; |
870 current_filename = include_stack[include_stack_ptr].filename; |
863 yy_push_state(include_end); |
871 yy_push_state(include_end); |
864 } |
872 } |
865 } |
873 } |
866 |
874 |