comparison src/parse.y @ 8842:be7b30a24938

line/column info for switch and if statements
author John W. Eaton <jwe@octave.org>
date Mon, 23 Feb 2009 12:29:10 -0500
parents 8463d1a2e544
children 8ed42c679af5
comparison
equal deleted inserted replaced
8841:c74389115610 8842:be7b30a24938
2294 octave_comment_list *tc = octave_comment_buffer::get_comment (); 2294 octave_comment_list *tc = octave_comment_buffer::get_comment ();
2295 2295
2296 int l = if_tok->line (); 2296 int l = if_tok->line ();
2297 int c = if_tok->column (); 2297 int c = if_tok->column ();
2298 2298
2299 if (list && ! list->empty ())
2300 {
2301 tree_if_clause *elt = list->front ();
2302
2303 if (elt)
2304 {
2305 elt->line (l);
2306 elt->column (c);
2307 }
2308 }
2309
2299 retval = new tree_if_command (list, lc, tc, l, c); 2310 retval = new tree_if_command (list, lc, tc, l, c);
2300 } 2311 }
2301 2312
2302 return retval; 2313 return retval;
2303 } 2314 }
2329 { 2340 {
2330 octave_comment_list *tc = octave_comment_buffer::get_comment (); 2341 octave_comment_list *tc = octave_comment_buffer::get_comment ();
2331 2342
2332 int l = switch_tok->line (); 2343 int l = switch_tok->line ();
2333 int c = switch_tok->column (); 2344 int c = switch_tok->column ();
2345
2346 if (list && ! list->empty ())
2347 {
2348 tree_switch_case *elt = list->front ();
2349
2350 if (elt)
2351 {
2352 elt->line (l);
2353 elt->column (c);
2354 }
2355 }
2334 2356
2335 retval = new tree_switch_command (expr, list, lc, tc, l, c); 2357 retval = new tree_switch_command (expr, list, lc, tc, l, c);
2336 } 2358 }
2337 2359
2338 return retval; 2360 return retval;