diff src/parse.y @ 478:90964309100b

[project @ 1994-06-28 16:39:41 by jwe]
author jwe
date Tue, 28 Jun 1994 16:39:41 +0000
parents de9de43ad21f
children 680426c10c5e
line wrap: on
line diff
--- a/src/parse.y
+++ b/src/parse.y
@@ -371,13 +371,25 @@
 
 plot_command	: PLOT plot_command1
 		  {
-		    tree_subplot_list *tmp = $2->reverse ();
-		    $$ = new tree_plot_command (tmp, $1->pttype ());
-		    plotting = 0;
-		    past_plot_range = 0;
-		    in_plot_range = 0;
-		    in_plot_using = 0;
-		    in_plot_style = 0;
+		    tree_subplot_list *tmp = (tree_subplot_list *) NULL;
+		    if ($2 != (tree_subplot_list *) NULL)
+		      tmp = $2->reverse ();
+
+		    if (tmp == (tree_subplot_list *) NULL
+			&& $1->pttype () != token::replot)
+		      {
+			yyerror ("must have something to plot");
+			ABORT_PARSE;
+		      }
+		    else
+		      {
+			$$ = new tree_plot_command (tmp, $1->pttype ());
+			plotting = 0;
+			past_plot_range = 0;
+			in_plot_range = 0;
+			in_plot_using = 0;
+			in_plot_style = 0;
+		      }
 		  }
 		| PLOT ranges plot_command1
 		  {
@@ -419,7 +431,9 @@
 		  { $$ = new tree_plot_range (); }
 		;
 
-plot_command1	: plot_command2
+plot_command1	: // empty
+		  { $$ = (tree_subplot_list *) NULL; }
+		| plot_command2
 		  { $$ = $1; }
 		| plot_command1 ',' plot_command2
 		  { $$ = $1->chain ($3); }