@@ -172,6 +172,8 @@ static size_t pic2_size;
172172static unsigned int inside_bracket = 0 ;
173173static char err_msg[COB_MINI_BUFF];
174174
175+ struct cb_text_list *cb_include_file_list_directive = NULL ;
176+
175177/* Function declarations */
176178static void read_literal (const char , const enum cb_literal_type);
177179static int scan_x (const char *, const char *);
@@ -189,6 +191,7 @@ static void copy_two_words_in_quotes (char ** const, char ** const);
189191static void add_synonym (const int , const int );
190192static void make_synonym (void );
191193static void clear_constants (void );
194+ static struct cb_text_list *scan_list_add (struct cb_text_list *, const char *);
192195
193196%}
194197
@@ -217,7 +220,7 @@ AREA_A "#AREA_A"\n
217220 cobc_in_area_a = 0 ;
218221%}
219222
220- <* >^ [ ] ? " #CALLFH" . * \n {
223+ <* >^ " #CALLFH" . * \n {
221224 if (current_program) {
222225 const char *p1;
223226 char *p2;
@@ -240,37 +243,37 @@ AREA_A "#AREA_A"\n
240243}
241244
242245
243- <* >^ [ ] ? " #DEFLIT" . * \n {
246+ <* >^ " #DEFLIT" . * \n {
244247 scan_define_options (yytext);
245248}
246249
247- <* >^ [ ] ? " #ADDRSV" . * \n {
250+ <* >^ " #ADDRSV" . * \n {
248251 char *word;
249252
250253 copy_word_in_quotes (&word);
251254 add_reserved_word_now (word, NULL );
252255 cobc_free (word);
253256}
254257
255- <* >^ [ ] ? " #ADDSYN-STD" . * \n {
258+ <* >^ " #ADDSYN-STD" . * \n {
256259 add_synonym (1 , 0 );
257260}
258- <* >^ [ ] ? " #ADDSYN" . * \n {
261+ <* >^ " #ADDSYN" . * \n {
259262 add_synonym (0 , 0 );
260263}
261264
262- <* >^ [ ] ? " #MAKESYN" . * \n {
265+ <* >^ " #MAKESYN" . * \n {
263266 make_synonym ();
264267 }
265268
266- <* >^ [ ] ? " #OVERRIDE-STD" . * \n {
269+ <* >^ " #OVERRIDE-STD" . * \n {
267270 add_synonym (1 , 1 );
268271}
269- <* >^ [ ] ? " #OVERRIDE" . * \n {
272+ <* >^ " #OVERRIDE" . * \n {
270273 add_synonym (0 , 1 );
271274}
272275
273- <* >^ [ ] ? " #REMOVE-STD" . * \n {
276+ <* >^ " #REMOVE-STD" . * \n {
274277 char *word;
275278
276279 copy_word_in_quotes (&word);
@@ -283,27 +286,27 @@ AREA_A "#AREA_A"\n
283286 cobc_free (word);
284287}
285288
286- <* >^ [ ] ? " #REMOVE" . * \n {
289+ <* >^ " #REMOVE" . * \n {
287290 char *word;
288291
289292 copy_word_in_quotes (&word);
290293 remove_reserved_word_now (word);
291294 cobc_free (word);
292295}
293296
294- <* >^ [ ] ? " #REFMOD_ZERO " [0 -9 ]\n {
297+ <* >^ " #REFMOD_ZERO " [0 -9 ]\n {
295298 cb_ref_mod_zero_length = (yytext[13 ] - ' 0' );
296299}
297300
298- <* >^ [ ] ? " #ODOSLIDE " [0 -1 ]\n {
301+ <* >^ " #ODOSLIDE " [0 -1 ]\n {
299302 cb_odoslide = (yytext[10 ] - ' 0' );
300303}
301304
302- <* >^ [ ] ? " #ASSIGN " [0 -9 ]\n {
305+ <* >^ " #ASSIGN " [0 -9 ]\n {
303306 cb_assign_type_default = (enum cb_assign_type)(yytext[8 ] - ' 0' );
304307}
305308
306- <* >^ [ ] ? " #TURN" . * \n {
309+ <* >^ " #TURN" . * \n {
307310 struct cb_turn_list *l;
308311
309312 for (l = cb_turn_list; l && l->line != -1 ; l = l->next );
@@ -312,14 +315,21 @@ AREA_A "#AREA_A"\n
312315 }
313316}
314317
315- <* >^ [ ] ? " #AREACHECK" \n {
318+ <* >^ " #AREACHECK" \n {
316319 cobc_areacheck = 1 ;
317320}
318321
319- <* >^ [ ] ? " #NOAREACHECK" \n {
322+ <* >^ " #NOAREACHECK" \n {
320323 cobc_areacheck = 0 ;
321324}
322325
326+ <* >^ " #INCLUDE" . * / \n {
327+ cb_include_file_list_directive = scan_list_add (
328+ cb_include_file_list_directive,
329+ yytext + 9
330+ );
331+ }
332+
323333<* >^ {AREA_A }[ ]* / " ." {
324334 count_lines (yytext + 9 ); /* skip "\n#area_a\n" */
325335 if (cobc_in_procedure && cobc_areacheck) {
@@ -2580,6 +2590,22 @@ clear_constants (void)
25802590 top_78_ptr = NULL ;
25812591}
25822592
2593+ static struct cb_text_list *
2594+ scan_list_add (struct cb_text_list *list, const char *text)
2595+ {
2596+ struct cb_text_list *p;
2597+
2598+ p = cobc_parse_malloc (sizeof (struct cb_text_list ));
2599+ p->text = cobc_parse_strdup (text);
2600+ if (!list) {
2601+ p->last = p;
2602+ return p;
2603+ }
2604+ list->last ->next = p;
2605+ list->last = p;
2606+ return list;
2607+ }
2608+
25832609/* Global functions */
25842610
25852611void
0 commit comments