diff 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
line wrap: on
line diff
--- a/src/parse.y	Mon Feb 23 12:25:45 2009 -0500
+++ b/src/parse.y	Mon Feb 23 12:29:10 2009 -0500
@@ -2296,6 +2296,17 @@
       int l = if_tok->line ();
       int c = if_tok->column ();
 
+      if (list && ! list->empty ())
+	{
+	  tree_if_clause *elt = list->front ();
+
+	  if (elt)
+	    {
+	      elt->line (l);
+	      elt->column (c);
+	    }
+	}
+
       retval = new tree_if_command (list, lc, tc, l, c);
     }
 
@@ -2332,6 +2343,17 @@
       int l = switch_tok->line ();
       int c = switch_tok->column ();
 
+      if (list && ! list->empty ())
+	{
+	  tree_switch_case *elt = list->front ();
+
+	  if (elt)
+	    {
+	      elt->line (l);
+	      elt->column (c);
+	    }
+	}
+
       retval = new tree_switch_command (expr, list, lc, tc, l, c);
     }