Index: Singular/grammar.y
===================================================================
--- Singular/grammar.y	(revision 0e184696d061294efc7e95f66a996a5d96f19738)
+++ Singular/grammar.y	(revision 922e4dd1a44f03aeaf603667dae8c7b4adeab1bd)
@@ -3,4 +3,7 @@
 ****************************************/
 /* $Log: not supported by cvs2svn $
+ * Revision 1.1.1.1  1997/03/19  13:18:55  obachman
+ * Imported Singular sources
+ *
 */
 
@@ -255,6 +258,4 @@
 %token <i> SYSVAR
 
-%type <i>    intexpr
-
 %type <name> extendedid
 %type <lv>   rlist ordering OrderingList orderelem
@@ -468,298 +469,8 @@
             $2.CleanUp();
           }
-        | intexpr
+        | INT_CONST
           {
             memset(&$$,0,sizeof($$));
-            $$.rtyp  = INT_CMD;
-            $$.data = (void *)$1;
-          }
-        | SYSVAR
-          {
-            memset(&$$,0,sizeof($$));
-            $$.rtyp = $1;
-            $$.data = $$.Data();
-          }
-        | stringexpr
-          {
-            memset(&$$,0,sizeof($$));
-            $$.rtyp  = STRING_CMD;
-            $$.data = $1;
-          }
-        ;
-
-exprlist:
-        expr ',' exprlist
-          {
-            leftv v = &$1;
-            while (v->next!=NULL)
-            {
-              v=v->next;
-            }
-            v->next = (leftv)Alloc(sizeof(sleftv));
-            memcpy(v->next,&($3),sizeof(sleftv));
-            $$ = $1;
-          }
-        | expr
-          {
-            $$ = $1;
-          }
-        | '(' expr ',' exprlist ')'
-          {
-            leftv v = &$2;
-            while (v->next!=NULL)
-            {
-              v=v->next;
-            }
-            v->next = (leftv)Alloc(sizeof(sleftv));
-            memcpy(v->next,&($4),sizeof(sleftv));
-            $$ = $2;
-          }
-        ;
-
-expr:   expr_arithmetic
-          {
-            /*if ($1.typ == eunknown) YYERROR;*/
-            $$ = $1;
-          }
-        | elemexpr        { $$ = $1; }
-        | '(' expr ')'    { $$ = $2; }
-        | expr '[' expr ',' expr ']'
-          {
-            if(iiExprArith3(&$$,'[',&$1,&$3,&$5)) YYERROR;
-          }
-        | expr '[' expr ']'
-          {
-            if(iiExprArith2(&$$,&$1,'[',&$3)) YYERROR;
-          }
-        | ROOT_DECL '(' expr ')'
-          {
-            if(iiExprArith1(&$$,&$3,$1)) YYERROR;
-          }
-        | ROOT_DECL_LIST '(' exprlist ')'
-          {
-            if(iiExprArithM(&$$,&$3,$1)) YYERROR;
-          }
-        | ROOT_DECL_LIST '(' ')'
-          {
-            if(iiExprArithM(&$$,NULL,$1)) YYERROR;
-          }
-        | RING_DECL '(' expr ')'
-          {
-            if(iiExprArith1(&$$,&$3,$1)) YYERROR;
-          }
-        | currring_lists '(' exprlist ')'
-          {
-            if(iiExprArithM(&$$,&$3,$1)) YYERROR;
-          }
-        | currring_lists '(' ')'
-          {
-            if(iiExprArithM(&$$,NULL,$1)) YYERROR;
-          }
-        | CMD_1 '(' expr ')'
-          {
-            if(iiExprArith1(&$$,&$3,$1)) YYERROR;
-          }
-        | CMD_2 '(' expr ',' expr ')'
-          {
-            if(iiExprArith2(&$$,&$3,$1,&$5,TRUE)) YYERROR;
-          }
-        | CMD_3 '(' expr ',' expr ',' expr ')'
-          {
-            if(iiExprArith3(&$$,$1,&$3,&$5,&$7)) YYERROR;
-          }
-        | CMD_M '(' ')'
-          {
-            if(iiExprArithM(&$$,NULL,$1)) YYERROR;
-          }
-        | CMD_23 '(' expr ',' expr ')'
-          {
-            if(iiExprArith2(&$$,&$3,$1,&$5,TRUE)) YYERROR;
-          }
-        | CMD_23 '(' expr ',' expr ',' expr ')'
-          {
-            if(iiExprArith3(&$$,$1,&$3,&$5,&$7)) YYERROR;
-          }
-        | CMD_12 '(' expr ')'
-          {
-            if(iiExprArith1(&$$,&$3,$1)) YYERROR;
-          }
-        | CMD_12 '(' expr ',' expr ')'
-          {
-            if(iiExprArith2(&$$,&$3,$1,&$5,TRUE)) YYERROR;
-          }
-        | CMD_123 '(' expr ')'
-          {
-            if(iiExprArith1(&$$,&$3,$1)) YYERROR;
-          }
-        | CMD_123 '(' expr ',' expr ')'
-          {
-            if(iiExprArith2(&$$,&$3,$1,&$5,TRUE)) YYERROR;
-          }
-        | CMD_123 '(' expr ',' expr ',' expr ')'
-          {
-            if(iiExprArith3(&$$,$1,&$3,&$5,&$7)) YYERROR;
-          }
-        | MATRIX_CMD '(' expr ',' expr ',' expr ')'
-          {
-            if(iiExprArith3(&$$,MATRIX_CMD,&$3,&$5,&$7)) YYERROR;
-          }
-        | MATRIX_CMD '(' expr ')'
-          {
-            if(iiExprArith1(&$$,&$3,MATRIX_CMD)) YYERROR;
-          }
-        | INTMAT_CMD '(' expr ')'
-          {
-            if(iiExprArith1(&$$,&$3,INTMAT_CMD)) YYERROR;
-          }
-        | CMD_M '(' exprlist ')'
-          {
-            if(iiExprArithM(&$$,&$3,$1)) YYERROR;
-          }
-        | quote_start expr quote_end
-          {
-            $$=$2;
-          }
-        | quote_start expr '=' expr quote_end
-          {
-            #ifdef SIQ
-            siq++;
-            if (siq>0)
-            { if (iiExprArith2(&$$,&$2,'=',&$4)) YYERROR; }
-            else
-            #endif
-            {
-              memset(&$$,0,sizeof($$));
-              $$.rtyp=NONE;
-              if (iiAssign(&$2,&$4)) YYERROR;
-            }
-            #ifdef SIQ
-            siq--;
-            #endif
-          }
-        | EVAL  '('
-          {
-            #ifdef SIQ
-            siq--;
-            #endif
-          }
-          expr ')'
-          {
-            #ifdef SIQ
-            if (siq<=0) $4.Eval();
-            #endif
-            $$=$4;
-            #ifdef SIQ
-            siq++;
-            #endif
-          }
-          ;
-
-quote_start:    QUOTE  '('
-          {
-            #ifdef SIQ
-            siq++;
-            #endif
-          }
-          ;
-
-quote_end: ')'
-          {
-            #ifdef SIQ
-            siq--;
-            #endif
-          }
-          ;
-
-expr_arithmetic:
-          expr  PLUSPLUS     %prec PLUSPLUS
-          {
-            if(iiExprArith1(&$$,&$1,PLUSPLUS)) YYERROR;
-          }
-        | expr  MINUSMINUS   %prec MINUSMINUS
-          {
-            if(iiExprArith1(&$$,&$1,MINUSMINUS)) YYERROR;
-          }
-        | expr  '+' expr
-          {
-            if(iiExprArith2(&$$,&$1,'+',&$3)) YYERROR;
-          }
-        | expr  '-' expr
-          {
-            if(iiExprArith2(&$$,&$1,'-',&$3)) YYERROR;
-          }
-        | expr  '*' expr
-          {
-            if(iiExprArith2(&$$,&$1,'*',&$3)) YYERROR;
-          }
-        | expr  '/' expr
-          {
-            if(iiExprArith2(&$$,&$1,'/',&$3)) YYERROR;
-          }
-        | expr  '^' expr
-          {
-            if(iiExprArith2(&$$,&$1,'^',&$3)) YYERROR;
-          }
-        | expr  '%' expr
-          {
-            if(iiExprArith2(&$$,&$1,'%',&$3)) YYERROR;
-          }
-        | expr  '>' expr
-          {
-            if(iiExprArith2(&$$,&$1,'>',&$3)) YYERROR;
-          }
-        | expr  '<' expr
-          {
-            if(iiExprArith2(&$$,&$1,'<',&$3)) YYERROR;
-          }
-        | expr  '&' expr
-          {
-            if(iiExprArith2(&$$,&$1,'&',&$3)) YYERROR;
-          }
-        | expr  '|' expr
-          {
-            if(iiExprArith2(&$$,&$1,'|',&$3)) YYERROR;
-          }
-        | expr  NOTEQUAL expr
-          {
-            if(iiExprArith2(&$$,&$1,NOTEQUAL,&$3)) YYERROR;
-          }
-        | expr  EQUAL_EQUAL expr
-          {
-            if(iiExprArith2(&$$,&$1,EQUAL_EQUAL,&$3)) YYERROR;
-          }
-        | expr  GE  expr
-          {
-            if(iiExprArith2(&$$,&$1,GE,&$3)) YYERROR;
-          }
-        | expr  LE expr
-          {
-            if(iiExprArith2(&$$,&$1,LE,&$3)) YYERROR;
-          }
-        | expr DOTDOT expr
-          {
-            if(iiExprArith2(&$$,&$1,DOTDOT,&$3)) YYERROR;
-          }
-        | NOT '(' expr ')'
-          {
-            memset(&$$,0,sizeof($$));
-            int i; TESTSETINT($3,i);
-            $$.rtyp  = INT_CMD;
-            $$.data = (void *)(i == 0 ? 1 : 0);
-          }
-        | '-' expr %prec UMINUS
-          {
-            if(iiExprArith1(&$$,&$2,'-')) YYERROR;
-          }
-        ;
-
-left_value:
-        declare_ip_variable cmdeq  { $$ = $1; }
-        | exprlist '=' { $$ = $1; }
-        ;
-
-intexpr:
-        INT_CONST
-          {
-            $$ = atoi($1);
+            int i = atoi($1);
 
             /* check: out of range input */
@@ -768,6 +479,6 @@
             {
               char tmp[100];
-              sprintf(tmp,"%d",$$);
-              if (strcmp(tmp,$1))
+              sprintf(tmp,"%d",i);
+              if (strcmp(tmp,$1)!=0)
               {
                 Werror("`%s` greater than %d(max. integer representation)"
@@ -778,6 +489,291 @@
             /*remember not to FreeL($1)
             *because it is a part of the scanner buffer*/
-          }
-        ;
+            $$.rtyp  = INT_CMD;
+            $$.data = (void *)i;
+          }
+        | SYSVAR
+          {
+            memset(&$$,0,sizeof($$));
+            $$.rtyp = $1;
+            $$.data = $$.Data();
+          }
+        | stringexpr
+          {
+            memset(&$$,0,sizeof($$));
+            $$.rtyp  = STRING_CMD;
+            $$.data = $1;
+          }
+        ;
+
+exprlist:
+        expr ',' exprlist
+          {
+            leftv v = &$1;
+            while (v->next!=NULL)
+            {
+              v=v->next;
+            }
+            v->next = (leftv)Alloc(sizeof(sleftv));
+            memcpy(v->next,&($3),sizeof(sleftv));
+            $$ = $1;
+          }
+        | expr
+          {
+            $$ = $1;
+          }
+        | '(' expr ',' exprlist ')'
+          {
+            leftv v = &$2;
+            while (v->next!=NULL)
+            {
+              v=v->next;
+            }
+            v->next = (leftv)Alloc(sizeof(sleftv));
+            memcpy(v->next,&($4),sizeof(sleftv));
+            $$ = $2;
+          }
+        ;
+
+expr:   expr_arithmetic
+          {
+            /*if ($1.typ == eunknown) YYERROR;*/
+            $$ = $1;
+          }
+        | elemexpr        { $$ = $1; }
+        | '(' expr ')'    { $$ = $2; }
+        | expr '[' expr ',' expr ']'
+          {
+            if(iiExprArith3(&$$,'[',&$1,&$3,&$5)) YYERROR;
+          }
+        | expr '[' expr ']'
+          {
+            if(iiExprArith2(&$$,&$1,'[',&$3)) YYERROR;
+          }
+        | ROOT_DECL '(' expr ')'
+          {
+            if(iiExprArith1(&$$,&$3,$1)) YYERROR;
+          }
+        | ROOT_DECL_LIST '(' exprlist ')'
+          {
+            if(iiExprArithM(&$$,&$3,$1)) YYERROR;
+          }
+        | ROOT_DECL_LIST '(' ')'
+          {
+            if(iiExprArithM(&$$,NULL,$1)) YYERROR;
+          }
+        | RING_DECL '(' expr ')'
+          {
+            if(iiExprArith1(&$$,&$3,$1)) YYERROR;
+          }
+        | currring_lists '(' exprlist ')'
+          {
+            if(iiExprArithM(&$$,&$3,$1)) YYERROR;
+          }
+        | currring_lists '(' ')'
+          {
+            if(iiExprArithM(&$$,NULL,$1)) YYERROR;
+          }
+        | CMD_1 '(' expr ')'
+          {
+            if(iiExprArith1(&$$,&$3,$1)) YYERROR;
+          }
+        | CMD_2 '(' expr ',' expr ')'
+          {
+            if(iiExprArith2(&$$,&$3,$1,&$5,TRUE)) YYERROR;
+          }
+        | CMD_3 '(' expr ',' expr ',' expr ')'
+          {
+            if(iiExprArith3(&$$,$1,&$3,&$5,&$7)) YYERROR;
+          }
+        | CMD_M '(' ')'
+          {
+            if(iiExprArithM(&$$,NULL,$1)) YYERROR;
+          }
+        | CMD_23 '(' expr ',' expr ')'
+          {
+            if(iiExprArith2(&$$,&$3,$1,&$5,TRUE)) YYERROR;
+          }
+        | CMD_23 '(' expr ',' expr ',' expr ')'
+          {
+            if(iiExprArith3(&$$,$1,&$3,&$5,&$7)) YYERROR;
+          }
+        | CMD_12 '(' expr ')'
+          {
+            if(iiExprArith1(&$$,&$3,$1)) YYERROR;
+          }
+        | CMD_12 '(' expr ',' expr ')'
+          {
+            if(iiExprArith2(&$$,&$3,$1,&$5,TRUE)) YYERROR;
+          }
+        | CMD_123 '(' expr ')'
+          {
+            if(iiExprArith1(&$$,&$3,$1)) YYERROR;
+          }
+        | CMD_123 '(' expr ',' expr ')'
+          {
+            if(iiExprArith2(&$$,&$3,$1,&$5,TRUE)) YYERROR;
+          }
+        | CMD_123 '(' expr ',' expr ',' expr ')'
+          {
+            if(iiExprArith3(&$$,$1,&$3,&$5,&$7)) YYERROR;
+          }
+        | MATRIX_CMD '(' expr ',' expr ',' expr ')'
+          {
+            if(iiExprArith3(&$$,MATRIX_CMD,&$3,&$5,&$7)) YYERROR;
+          }
+        | MATRIX_CMD '(' expr ')'
+          {
+            if(iiExprArith1(&$$,&$3,MATRIX_CMD)) YYERROR;
+          }
+        | INTMAT_CMD '(' expr ')'
+          {
+            if(iiExprArith1(&$$,&$3,INTMAT_CMD)) YYERROR;
+          }
+        | CMD_M '(' exprlist ')'
+          {
+            if(iiExprArithM(&$$,&$3,$1)) YYERROR;
+          }
+        | quote_start expr quote_end
+          {
+            $$=$2;
+          }
+        | quote_start expr '=' expr quote_end
+          {
+            #ifdef SIQ
+            siq++;
+            if (siq>0)
+            { if (iiExprArith2(&$$,&$2,'=',&$4)) YYERROR; }
+            else
+            #endif
+            {
+              memset(&$$,0,sizeof($$));
+              $$.rtyp=NONE;
+              if (iiAssign(&$2,&$4)) YYERROR;
+            }
+            #ifdef SIQ
+            siq--;
+            #endif
+          }
+        | EVAL  '('
+          {
+            #ifdef SIQ
+            siq--;
+            #endif
+          }
+          expr ')'
+          {
+            #ifdef SIQ
+            if (siq<=0) $4.Eval();
+            #endif
+            $$=$4;
+            #ifdef SIQ
+            siq++;
+            #endif
+          }
+          ;
+
+quote_start:    QUOTE  '('
+          {
+            #ifdef SIQ
+            siq++;
+            #endif
+          }
+          ;
+
+quote_end: ')'
+          {
+            #ifdef SIQ
+            siq--;
+            #endif
+          }
+          ;
+
+expr_arithmetic:
+          expr  PLUSPLUS     %prec PLUSPLUS
+          {
+            if(iiExprArith1(&$$,&$1,PLUSPLUS)) YYERROR;
+          }
+        | expr  MINUSMINUS   %prec MINUSMINUS
+          {
+            if(iiExprArith1(&$$,&$1,MINUSMINUS)) YYERROR;
+          }
+        | expr  '+' expr
+          {
+            if(iiExprArith2(&$$,&$1,'+',&$3)) YYERROR;
+          }
+        | expr  '-' expr
+          {
+            if(iiExprArith2(&$$,&$1,'-',&$3)) YYERROR;
+          }
+        | expr  '*' expr
+          {
+            if(iiExprArith2(&$$,&$1,'*',&$3)) YYERROR;
+          }
+        | expr  '/' expr
+          {
+            if(iiExprArith2(&$$,&$1,'/',&$3)) YYERROR;
+          }
+        | expr  '^' expr
+          {
+            if(iiExprArith2(&$$,&$1,'^',&$3)) YYERROR;
+          }
+        | expr  '%' expr
+          {
+            if(iiExprArith2(&$$,&$1,'%',&$3)) YYERROR;
+          }
+        | expr  '>' expr
+          {
+            if(iiExprArith2(&$$,&$1,'>',&$3)) YYERROR;
+          }
+        | expr  '<' expr
+          {
+            if(iiExprArith2(&$$,&$1,'<',&$3)) YYERROR;
+          }
+        | expr  '&' expr
+          {
+            if(iiExprArith2(&$$,&$1,'&',&$3)) YYERROR;
+          }
+        | expr  '|' expr
+          {
+            if(iiExprArith2(&$$,&$1,'|',&$3)) YYERROR;
+          }
+        | expr  NOTEQUAL expr
+          {
+            if(iiExprArith2(&$$,&$1,NOTEQUAL,&$3)) YYERROR;
+          }
+        | expr  EQUAL_EQUAL expr
+          {
+            if(iiExprArith2(&$$,&$1,EQUAL_EQUAL,&$3)) YYERROR;
+          }
+        | expr  GE  expr
+          {
+            if(iiExprArith2(&$$,&$1,GE,&$3)) YYERROR;
+          }
+        | expr  LE expr
+          {
+            if(iiExprArith2(&$$,&$1,LE,&$3)) YYERROR;
+          }
+        | expr DOTDOT expr
+          {
+            if(iiExprArith2(&$$,&$1,DOTDOT,&$3)) YYERROR;
+          }
+        | NOT '(' expr ')'
+          {
+            memset(&$$,0,sizeof($$));
+            int i; TESTSETINT($3,i);
+            $$.rtyp  = INT_CMD;
+            $$.data = (void *)(i == 0 ? 1 : 0);
+          }
+        | '-' expr %prec UMINUS
+          {
+            if(iiExprArith1(&$$,&$2,'-')) YYERROR;
+          }
+        ;
+
+left_value:
+        declare_ip_variable cmdeq  { $$ = $1; }
+        | exprlist '=' { $$ = $1; }
+        ;
+
 
 extendedid:
