changeset 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 c74389115610
children b9ce57a309a3
files src/ChangeLog src/parse.y
diffstat 2 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Feb 23 12:25:45 2009 -0500
+++ b/src/ChangeLog	Mon Feb 23 12:29:10 2009 -0500
@@ -1,5 +1,9 @@
 2009-02-23  John W. Eaton  <jwe@octave.org>
 
+	* parse.y (finish_if_command): Also store line and column info for
+	if statement in first element of list.
+	(finish_switch_command): Likewise, for switch.
+
 	* input.cc (last_debugging_command): New static variable.
 	(octave_gets): Set it here.  Don't insert repeated debugging
 	commands in the history list.
--- 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);
     }