diff src/lex.l @ 947:570f55edf65f

[project @ 1994-11-22 17:12:12 by jwe]
author jwe
date Tue, 22 Nov 1994 17:12:12 +0000
parents c4827d0fe063
children b228d6cd59a1
line wrap: on
line diff
--- a/src/lex.l	Mon Nov 21 22:08:36 1994 +0000
+++ b/src/lex.l	Tue Nov 22 17:12:12 1994 +0000
@@ -164,6 +164,8 @@
 			    }
 		        }
 
+<TEXT_FCN>{S}*		{ current_input_column += yyleng; }
+
 <HELP_FCN>[^ \t\n]*{S}*	    |
 <TEXT_FCN>[^ \t\n\;\,]*{S}* {
 			      static char *tok = 0;
@@ -220,8 +222,6 @@
 			  return TEXT;
 			}
 
-<TEXT_FCN>{S}*		{ current_input_column += yyleng; }
-
 <STRING>{QSTR}*[\n\']	{
 			  if (braceflag)
 			    BEGIN MATRIX;
@@ -296,8 +296,12 @@
 // different for the expression on the left hand side of the equals
 // operator.
 
-			  in_brace_or_paren.pop ();
-			  braceflag--;
+			  if (! in_brace_or_paren.empty ())
+			    {
+			      in_brace_or_paren.pop ();
+			      braceflag--;
+			    }
+
 			  if (braceflag == 0)
 			    {
 			      if (! defining_func)
@@ -312,8 +316,12 @@
 			}
 
 <MATRIX>{SN}*\]{S}*/=	{
-			  in_brace_or_paren.pop ();
-			  braceflag--;
+			  if (! in_brace_or_paren.empty ())
+			    {
+			      in_brace_or_paren.pop ();
+			      braceflag--;
+			    }
+
 			  if (braceflag == 0)
 			    {
 			      BEGIN 0;
@@ -336,8 +344,12 @@
 // It's a pain in the ass to decide whether to insert a comma after
 // seeing a ']' character...
 
-			  in_brace_or_paren.pop ();
-			  braceflag--;
+			  if (! in_brace_or_paren.empty ())
+			    {
+			      in_brace_or_paren.pop ();
+			      braceflag--;
+			    }
+
 			  if (braceflag == 0)
 			    {
 			      if (! defining_func)
@@ -358,9 +370,12 @@
 			      unput (c1);
 			      int other_op = match_any (c1, ",;\n]");
 
-			      if (! (postfix_un_op || bin_op || other_op)
-				     && in_brace_or_paren.top ()
-				     && convert_spaces_to_comma)
+			      if (! (postfix_un_op
+				     || bin_op
+				     || other_op
+				     || in_brace_or_paren.empty ())
+				  && in_brace_or_paren.top ()
+				  && convert_spaces_to_comma)
 				{
 				  unput (',');
 				  return ']';
@@ -385,7 +400,9 @@
 			      int postfix_un_op
 				= next_token_is_postfix_unary_op (1, yytext);
 
-			      if (! (postfix_un_op || bin_op)
+			      if (! (postfix_un_op
+				     || bin_op
+				     || in_brace_or_paren.empty ())
 				  && in_brace_or_paren.top ()
 				  && convert_spaces_to_comma)
 				TOK_RETURN (',');