source: git/Singular/grammar.y @ 0e1846

spielwiese
Last change on this file since 0e1846 was 0e1846, checked in by Olaf Bachmann <obachman@…>, 27 years ago
This commit was generated by cvs2svn to compensate for changes in r59, which included commits to RCS files with non-trunk default branches. git-svn-id: file:///usr/local/Singular/svn/trunk@60 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 40.5 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/* $Log: not supported by cvs2svn $
5*/
6
7/*
8* ABSTRACT: SINGULAR shell grammatik
9*/
10%{
11
12#include <stdio.h>
13#include <stddef.h>
14#include <stdlib.h>
15#include <stdarg.h>
16#include <string.h>
17#include <limits.h>
18
19#include "mod2.h"
20#include "tok.h"
21#include "stype.h"
22#include "ipid.h"
23#include "intvec.h"
24#include "febase.h"
25#include "matpol.h"
26#include "ring.h"
27#include "kstd1.h"
28#include "mmemory.h"
29#include "subexpr.h"
30#include "ipshell.h"
31#include "ipconv.h"
32#include "ideals.h"
33#include "numbers.h"
34#include "polys.h"
35#include "weight.h"
36#include "stairc.h"
37#include "timer.h"
38#include "cntrlc.h"
39#include "maps.h"
40#include "syz.h"
41#include "lists.h"
42
43
44extern int   yylineno;
45extern FILE* yyin;
46
47char       my_yylinebuf[YY_READ_BUF_SIZE];
48char *     currid;
49BOOLEAN    noringvars=FALSE;
50BOOLEAN    expected_parms;
51int        cmdtok;
52int        inerror = 0;
53
54#define TESTSETINT(a,i)                                \
55   if ((a).Typ() != INT_CMD)                           \
56   {                                                   \
57     WerrorS("no int expression");                     \
58     YYERROR;                                          \
59   }                                                   \
60   (i) = (int)(a).Data();
61
62#define MYYERROR(a) { WerrorS(a); YYERROR; }
63
64void yyerror(char * fmt)
65{
66  int oldInError=inerror;
67
68  inerror = 1;
69  BOOLEAN old_errorreported=errorreported;
70  errorreported = TRUE;
71  if (currid!=NULL)
72  {
73    killid(currid,&idroot);
74    currid = NULL;
75  }
76  if(!oldInError)
77  {
78    Werror( "error occurred in %s line %d: `%s`"
79           ,VoiceName(), yylineno-1, my_yylinebuf);
80    if (cmdtok!=0)
81    {
82      char *s=Tok2Cmdname(cmdtok);
83      if (expected_parms)
84      {
85        Werror("expected %s-expression. type \'help %s;\'",s,s);
86      }
87      else
88      {
89        Werror("wrong type declaration. type \'help %s;\'",s);
90      }
91    }
92    if (!old_errorreported && (lastreserved!=NULL))
93    {
94      Werror("last reserved name was `%s`",lastreserved);
95    }
96  }
97  else
98    inerror=oldInError;
99  if ((voice>0)&&(myynest>0))
100  {
101    Werror("leaving %s",VoiceName());
102    exitBuffer(BT_proc);
103  }
104}
105
106#ifndef alloca
107#define alloca malloc
108#endif
109
110%}
111
112/* %expect 22 */
113%pure_parser
114
115/* special symbols */
116%token DOTDOT
117%token EQUAL_EQUAL
118%token GE
119%token LE
120/*%token MINUSEQUAL*/
121%token MINUSMINUS
122%token NOT
123%token NOTEQUAL
124/*%token PLUSEQUAL*/
125%token PLUSPLUS
126
127/* types, part 1 (ring indep.)*/
128%token <i> DRING_CMD
129%token <i> INTMAT_CMD
130%token <i> PROC_CMD
131%token <i> RING_CMD
132
133/* valid when ring defined ! */
134%token <i> BEGIN_RING
135/* types, part 2 */
136%token <i> IDEAL_CMD
137%token <i> MAP_CMD
138%token <i> MATRIX_CMD
139%token <i> MODUL_CMD
140%token <i> NUMBER_CMD
141%token <i> POLY_CMD
142%token <i> VECTOR_CMD
143/* end types */
144
145/* ring dependent cmd:*/
146%token <i> BAREISS_CMD
147%token <i> BETTI_CMD
148%token <i> COEFFS_CMD
149%token <i> COEF_CMD
150%token <i> CONTRACT_CMD
151%token <i> DEGREE_CMD
152%token <i> DEG_CMD
153%token <i> DET_CMD
154%token <i> DIFF_CMD
155%token <i> DIM_CMD
156%token <i> ELIMINATION_CMD
157%token <i> E_CMD
158%token <i> FETCH_CMD
159%token <i> FREEMODULE_CMD
160%token <i> KEEPRING_CMD
161%token <i> HILBERT_CMD
162%token <i> HOMOG_CMD
163%token <i> IMAP_CMD
164%token <i> INDEPSET_CMD
165%token <i> INTERRED_CMD
166%token <i> INTERSECT_CMD
167%token <i> JACOB_CMD
168%token <i> JET_CMD
169%token <i> KBASE_CMD
170%token <i> KOSZUL_CMD
171%token <i> LEADCOEF_CMD
172%token <i> LEADEXP_CMD
173%token <i> LEAD_CMD
174%token <i> LIFTSTD_CMD
175%token <i> LIFT_CMD
176%token <i> MAXID_CMD
177%token <i> MINBASE_CMD
178%token <i> MINOR_CMD
179%token <i> MINRES_CMD
180%token <i> MODULO_CMD
181%token <i> MRES_CMD
182%token <i> MULTIPLICITY_CMD
183%token <i> ORD_CMD
184%token <i> PAR_CMD
185%token <i> PARDEG_CMD
186%token <i> PREIMAGE_CMD
187%token <i> QUOTIENT_CMD
188%token <i> QHWEIGHT_CMD
189%token <i> REDUCE_CMD
190%token <i> REGULARITY_CMD
191%token <i> RES_CMD
192%token <i> SIMPLIFY_CMD
193%token <i> SORTVEC_CMD
194%token <i> SRES_CMD
195%token <i> STD_CMD
196%token <i> SUBST_CMD
197%token <i> SYZYGY_CMD
198%token <i> VAR_CMD
199%token <i> VDIM_CMD
200%token <i> WEDGE_CMD
201%token <i> WEIGHT_CMD
202
203/*system variables in ring block*/
204%token <i> VALTVARS
205%token <i> VMAXDEG
206%token <i> VMAXMULT
207%token <i> VNOETHER
208%token <i> VMINPOLY
209
210%token <i> END_RING
211/* end of ring definitions */
212
213%token <i> CMD_1
214%token <i> CMD_2
215%token <i> CMD_3
216%token <i> CMD_12
217%token <i> CMD_23
218%token <i> CMD_123
219%token <i> CMD_M
220%token <i> ROOT_DECL
221        /* put variables of this type into the idroot list */
222%token <i> ROOT_DECL_LIST
223        /* put variables of this type into the idroot list */
224%token <i> RING_DECL
225        /* put variables of this type into the currRing list */
226%token <i> EXAMPLE_CMD
227%token <i> EXECUTE_CMD
228%token <i> EXPORT_CMD
229%token <i> HELP_CMD
230%token <i> KILL_CMD
231%token <i> LIB_CMD
232%token <i> LISTVAR_CMD
233%token <i> SETRING_CMD
234%token <i> TYPE_CMD
235
236%token <name> STRINGTOK BLOCKTOK INT_CONST
237%token <name> UNKNOWN_IDENT RINGVAR PROC_DEF
238
239/* control */
240%token <i> BREAK_CMD
241%token <i> CONTINUE_CMD
242%token <i> ELSE_CMD
243%token <i> EVAL
244%token <i> QUOTE
245%token <i> EXIT_CMD
246%token <i> FOR_CMD
247%token <i> IF_CMD
248%token <i> SYS_BREAK
249%token <i> WHILE_CMD
250%token <i> RETURN
251%token <i> END_PROC
252%token <i> PARAMETER
253
254/* system variables */
255%token <i> SYSVAR
256
257%type <i>    intexpr
258
259%type <name> extendedid
260%type <lv>   rlist ordering OrderingList orderelem
261%type <name> stringexpr
262%type <lv>   expr elemexpr exprlist expr_arithmetic
263%type <lv>   declare_ip_variable left_value
264%type <i>    ordername
265%type <i>    cmdeq
266%type <i>    currring_lists
267%type <i>    setrings
268%type <i>    ringcmd1
269
270%type <i>    '=' '<' '>' '+' '-'
271%type <i>    '*' '/' '[' ']' '.' '^' ',' ';'
272
273
274/*%nonassoc '=' PLUSEQUAL DOTDOT*/
275%nonassoc '=' DOTDOT
276%left '|' '&'
277%left EQUAL_EQUAL NOTEQUAL
278%left '<' '>' GE LE
279%left '+' '-'
280%left '*' '/' '%'
281%left UMINUS
282%left  '^'
283%left '[' ']'
284%left '(' ')'
285%left PLUSPLUS
286%left MINUSMINUS
287
288%%
289lines:
290        /**/
291        | lines pprompt
292          {
293            if (timerv
294            #ifdef SIC
295            && (!sic)
296            #endif
297            )
298            {
299              writeTime("used time:");
300              startTimer();
301            }
302            prompt_char = '>';
303            currid = NULL;
304            if (errorreported)
305            {
306              yyerror("");
307            }
308            if (inerror==2) PrintLn();
309            errorreported = inerror = cmdtok = 0;
310            lastreserved=NULL;
311            expected_parms=FALSE;
312            noringvars = FALSE;
313            test_int();
314          }
315        ;
316
317pprompt:
318        flowctrl                       /* if, while, for etc */
319        | command ';'                  /* commands returning no value */
320          {ifswitch[voice]=0;}
321        | assign  ';'                  /* general assignment */
322          {ifswitch[voice]=0;}
323        | parametercmd ';'             /* proc parameter assignments */
324          {yylineno--;ifswitch[voice]=0;}
325        | declare_ip_variable ';'      /* default initialization */
326          { $1.CleanUp(); ifswitch[voice]=0;}
327        | filecmd
328          {ifswitch[voice]=0;}
329        | returncmd
330          {
331            #ifdef SIC
332            if (!sic)
333            #endif
334            YYACCEPT;
335          }
336        | EXIT_CMD
337          {
338            ifswitch[voice]=0;
339            Print("exit found\n");
340            YYACCEPT;
341          }
342        | SYS_BREAK
343          {
344            #ifdef SIC
345            if (sic)
346              emStoreOp(SYS_BREAK,0);
347            else
348            #endif
349            {
350              ifswitch[voice]=0;
351              iiDebug();
352            }
353          }
354        | ';'                    /* ignore empty statements */
355          {ifswitch[voice]=0;}
356        | error ';'
357          {
358            #ifdef SIQ
359            siq=0;
360            #endif
361            ifswitch[voice]=0;
362            if (inerror&&($1.i<UMINUS) && ($1.i>' '))
363            {
364              // 1: yyerror called
365              // 2: scanner put actual string
366              // 3: error rule put token+\n
367              inerror=3;
368              Print(" error at token `%s`\n",iiTwoOps($1.i));
369            }
370            if (!errorreported) WerrorS("...parse error");
371            yyerror("");
372            yyerrok;
373            #ifdef SIC
374            if (sic) YYABORT;
375            #endif
376            if (myynest>0)
377            {
378              //WerrorS("leaving yyparse");
379              YYABORT;
380            }
381            else if (voice>0)
382            {
383              //WerrorS("leaving voice");
384              exitBuffer(BT_break);
385            }
386            errorreported = FALSE;
387            lastreserved=NULL;
388          }
389        ;
390
391flowctrl: ifcmd
392          | whilecmd
393          | forcmd
394          | proccmd
395            {ifswitch[voice]=0;}
396        ;
397
398command: executecmd | helpcmd | killcmd | exportcmd | listcmd
399         | ringcmd | scriptcmd | setringcmd | typecmd
400         ;
401
402assign: left_value exprlist
403          {
404            if(iiAssign(&$1,&$2)) YYERROR;
405          }
406        ;
407
408elemexpr:
409        RINGVAR
410          {
411            #ifdef SIC
412            if (!sic)
413            #endif
414              if (currRing==NULL) MYYERROR("no ring active");
415            syMake(&$$,$1);
416          }
417        | extendedid
418          {
419            syMake(&$$,$1);
420          }
421        | elemexpr '('  ')'
422          {
423            if(iiExprArith1(&$$,&$1,'(')) YYERROR;
424          }
425        | elemexpr '(' exprlist ')'
426          {
427            $1.next=(leftv)Alloc(sizeof(sleftv));
428            memcpy($1.next,&$3,sizeof(sleftv));
429            if(iiExprArithM(&$$,&$1,'(')) YYERROR;
430          }
431        | elemexpr '.' extendedid
432          {
433            idhdl r=idroot;
434            if ($1.Typ()!=PACKAGE_CMD) MYYERROR("<package>.<id> expected");
435            idroot=IDPACKAGE((idhdl)$1.data)->idroot;
436            syMake(&$$,$3);
437            idroot=r;
438          }
439        | '[' exprlist ']'
440          {
441            if (currRingHdl==NULL) MYYERROR("no ring active");
442            int j = 0;
443            memset(&$$,0,sizeof(sleftv));
444            $$.rtyp=VECTOR_CMD;
445            leftv v = &$2;
446            while (v!=NULL)
447            {
448              poly p = pOne();
449              pSetCompP(p,++j);
450              int k = (int)(v->Data());
451              if (k!=0)
452              {
453                if (v->Typ() == INT_CMD)
454                {
455                  $$.data = (void *)pAdd((poly)$$.data,pMult(p,pISet(k)));
456                }
457                else if (v->Typ() == POLY_CMD)
458                {
459                  $$.data = (void *)pAdd((poly)$$.data,pMult(p, (poly)(v->CopyD())) );
460                }
461                else
462                  MYYERROR("expected '[poly,...'");
463              }
464              else
465                pDelete1(&p);
466              v=v->next;
467            }
468            $2.CleanUp();
469          }
470        | intexpr
471          {
472            memset(&$$,0,sizeof($$));
473            $$.rtyp  = INT_CMD;
474            $$.data = (void *)$1;
475          }
476        | SYSVAR
477          {
478            memset(&$$,0,sizeof($$));
479            $$.rtyp = $1;
480            $$.data = $$.Data();
481          }
482        | stringexpr
483          {
484            memset(&$$,0,sizeof($$));
485            $$.rtyp  = STRING_CMD;
486            $$.data = $1;
487          }
488        ;
489
490exprlist:
491        expr ',' exprlist
492          {
493            leftv v = &$1;
494            while (v->next!=NULL)
495            {
496              v=v->next;
497            }
498            v->next = (leftv)Alloc(sizeof(sleftv));
499            memcpy(v->next,&($3),sizeof(sleftv));
500            $$ = $1;
501          }
502        | expr
503          {
504            $$ = $1;
505          }
506        | '(' expr ',' exprlist ')'
507          {
508            leftv v = &$2;
509            while (v->next!=NULL)
510            {
511              v=v->next;
512            }
513            v->next = (leftv)Alloc(sizeof(sleftv));
514            memcpy(v->next,&($4),sizeof(sleftv));
515            $$ = $2;
516          }
517        ;
518
519expr:   expr_arithmetic
520          {
521            /*if ($1.typ == eunknown) YYERROR;*/
522            $$ = $1;
523          }
524        | elemexpr        { $$ = $1; }
525        | '(' expr ')'    { $$ = $2; }
526        | expr '[' expr ',' expr ']'
527          {
528            if(iiExprArith3(&$$,'[',&$1,&$3,&$5)) YYERROR;
529          }
530        | expr '[' expr ']'
531          {
532            if(iiExprArith2(&$$,&$1,'[',&$3)) YYERROR;
533          }
534        | ROOT_DECL '(' expr ')'
535          {
536            if(iiExprArith1(&$$,&$3,$1)) YYERROR;
537          }
538        | ROOT_DECL_LIST '(' exprlist ')'
539          {
540            if(iiExprArithM(&$$,&$3,$1)) YYERROR;
541          }
542        | ROOT_DECL_LIST '(' ')'
543          {
544            if(iiExprArithM(&$$,NULL,$1)) YYERROR;
545          }
546        | RING_DECL '(' expr ')'
547          {
548            if(iiExprArith1(&$$,&$3,$1)) YYERROR;
549          }
550        | currring_lists '(' exprlist ')'
551          {
552            if(iiExprArithM(&$$,&$3,$1)) YYERROR;
553          }
554        | currring_lists '(' ')'
555          {
556            if(iiExprArithM(&$$,NULL,$1)) YYERROR;
557          }
558        | CMD_1 '(' expr ')'
559          {
560            if(iiExprArith1(&$$,&$3,$1)) YYERROR;
561          }
562        | CMD_2 '(' expr ',' expr ')'
563          {
564            if(iiExprArith2(&$$,&$3,$1,&$5,TRUE)) YYERROR;
565          }
566        | CMD_3 '(' expr ',' expr ',' expr ')'
567          {
568            if(iiExprArith3(&$$,$1,&$3,&$5,&$7)) YYERROR;
569          }
570        | CMD_M '(' ')'
571          {
572            if(iiExprArithM(&$$,NULL,$1)) YYERROR;
573          }
574        | CMD_23 '(' expr ',' expr ')'
575          {
576            if(iiExprArith2(&$$,&$3,$1,&$5,TRUE)) YYERROR;
577          }
578        | CMD_23 '(' expr ',' expr ',' expr ')'
579          {
580            if(iiExprArith3(&$$,$1,&$3,&$5,&$7)) YYERROR;
581          }
582        | CMD_12 '(' expr ')'
583          {
584            if(iiExprArith1(&$$,&$3,$1)) YYERROR;
585          }
586        | CMD_12 '(' expr ',' expr ')'
587          {
588            if(iiExprArith2(&$$,&$3,$1,&$5,TRUE)) YYERROR;
589          }
590        | CMD_123 '(' expr ')'
591          {
592            if(iiExprArith1(&$$,&$3,$1)) YYERROR;
593          }
594        | CMD_123 '(' expr ',' expr ')'
595          {
596            if(iiExprArith2(&$$,&$3,$1,&$5,TRUE)) YYERROR;
597          }
598        | CMD_123 '(' expr ',' expr ',' expr ')'
599          {
600            if(iiExprArith3(&$$,$1,&$3,&$5,&$7)) YYERROR;
601          }
602        | MATRIX_CMD '(' expr ',' expr ',' expr ')'
603          {
604            if(iiExprArith3(&$$,MATRIX_CMD,&$3,&$5,&$7)) YYERROR;
605          }
606        | MATRIX_CMD '(' expr ')'
607          {
608            if(iiExprArith1(&$$,&$3,MATRIX_CMD)) YYERROR;
609          }
610        | INTMAT_CMD '(' expr ')'
611          {
612            if(iiExprArith1(&$$,&$3,INTMAT_CMD)) YYERROR;
613          }
614        | CMD_M '(' exprlist ')'
615          {
616            if(iiExprArithM(&$$,&$3,$1)) YYERROR;
617          }
618        | quote_start expr quote_end
619          {
620            $$=$2;
621          }
622        | quote_start expr '=' expr quote_end
623          {
624            #ifdef SIQ
625            siq++;
626            if (siq>0)
627            { if (iiExprArith2(&$$,&$2,'=',&$4)) YYERROR; }
628            else
629            #endif
630            {
631              memset(&$$,0,sizeof($$));
632              $$.rtyp=NONE;
633              if (iiAssign(&$2,&$4)) YYERROR;
634            }
635            #ifdef SIQ
636            siq--;
637            #endif
638          }
639        | EVAL  '('
640          {
641            #ifdef SIQ
642            siq--;
643            #endif
644          }
645          expr ')'
646          {
647            #ifdef SIQ
648            if (siq<=0) $4.Eval();
649            #endif
650            $$=$4;
651            #ifdef SIQ
652            siq++;
653            #endif
654          }
655          ;
656
657quote_start:    QUOTE  '('
658          {
659            #ifdef SIQ
660            siq++;
661            #endif
662          }
663          ;
664
665quote_end: ')'
666          {
667            #ifdef SIQ
668            siq--;
669            #endif
670          }
671          ;
672
673expr_arithmetic:
674          expr  PLUSPLUS     %prec PLUSPLUS
675          {
676            if(iiExprArith1(&$$,&$1,PLUSPLUS)) YYERROR;
677          }
678        | expr  MINUSMINUS   %prec MINUSMINUS
679          {
680            if(iiExprArith1(&$$,&$1,MINUSMINUS)) YYERROR;
681          }
682        | expr  '+' expr
683          {
684            if(iiExprArith2(&$$,&$1,'+',&$3)) YYERROR;
685          }
686        | expr  '-' expr
687          {
688            if(iiExprArith2(&$$,&$1,'-',&$3)) YYERROR;
689          }
690        | expr  '*' expr
691          {
692            if(iiExprArith2(&$$,&$1,'*',&$3)) YYERROR;
693          }
694        | expr  '/' expr
695          {
696            if(iiExprArith2(&$$,&$1,'/',&$3)) YYERROR;
697          }
698        | expr  '^' expr
699          {
700            if(iiExprArith2(&$$,&$1,'^',&$3)) YYERROR;
701          }
702        | expr  '%' expr
703          {
704            if(iiExprArith2(&$$,&$1,'%',&$3)) YYERROR;
705          }
706        | expr  '>' expr
707          {
708            if(iiExprArith2(&$$,&$1,'>',&$3)) YYERROR;
709          }
710        | expr  '<' expr
711          {
712            if(iiExprArith2(&$$,&$1,'<',&$3)) YYERROR;
713          }
714        | expr  '&' expr
715          {
716            if(iiExprArith2(&$$,&$1,'&',&$3)) YYERROR;
717          }
718        | expr  '|' expr
719          {
720            if(iiExprArith2(&$$,&$1,'|',&$3)) YYERROR;
721          }
722        | expr  NOTEQUAL expr
723          {
724            if(iiExprArith2(&$$,&$1,NOTEQUAL,&$3)) YYERROR;
725          }
726        | expr  EQUAL_EQUAL expr
727          {
728            if(iiExprArith2(&$$,&$1,EQUAL_EQUAL,&$3)) YYERROR;
729          }
730        | expr  GE  expr
731          {
732            if(iiExprArith2(&$$,&$1,GE,&$3)) YYERROR;
733          }
734        | expr  LE expr
735          {
736            if(iiExprArith2(&$$,&$1,LE,&$3)) YYERROR;
737          }
738        | expr DOTDOT expr
739          {
740            if(iiExprArith2(&$$,&$1,DOTDOT,&$3)) YYERROR;
741          }
742        | NOT '(' expr ')'
743          {
744            memset(&$$,0,sizeof($$));
745            int i; TESTSETINT($3,i);
746            $$.rtyp  = INT_CMD;
747            $$.data = (void *)(i == 0 ? 1 : 0);
748          }
749        | '-' expr %prec UMINUS
750          {
751            if(iiExprArith1(&$$,&$2,'-')) YYERROR;
752          }
753        ;
754
755left_value:
756        declare_ip_variable cmdeq  { $$ = $1; }
757        | exprlist '=' { $$ = $1; }
758        ;
759
760intexpr:
761        INT_CONST
762          {
763            $$ = atoi($1);
764
765            /* check: out of range input */
766            int l = strlen($1)+2;
767            if (l >= MAX_INT_LEN)
768            {
769              char tmp[100];
770              sprintf(tmp,"%d",$$);
771              if (strcmp(tmp,$1))
772              {
773                Werror("`%s` greater than %d(max. integer representation)"
774                       ,$1,INT_MAX);
775                YYERROR;
776              }
777            }
778            /*remember not to FreeL($1)
779            *because it is a part of the scanner buffer*/
780          }
781        ;
782
783extendedid:
784        UNKNOWN_IDENT
785        | '`' expr '`'
786          {
787            if ($2.Typ()!=STRING_CMD)
788            {
789              MYYERROR("string expression expected");
790            }
791            $$ = (char *)$2.CopyD();
792            $2.CleanUp();
793          }
794        ;
795
796currring_lists:
797        IDEAL_CMD | MODUL_CMD
798        /* put variables into the current ring */
799        ;
800
801declare_ip_variable:
802        ROOT_DECL elemexpr
803          {
804            if (iiDeclCommand(&$$,&$2,myynest,$1,&idroot)) YYERROR;
805          }
806        | ROOT_DECL_LIST elemexpr
807          {
808            if (iiDeclCommand(&$$,&$2,myynest,$1,&idroot)) YYERROR;
809          }
810        | RING_DECL elemexpr
811          {
812            #ifdef SIC
813            if ((sic) && (currRing==NULL))
814            {
815              if (iiDeclCommand(&$$,&$2,myynest,$1,NULL)) YYERROR;
816            }
817            else
818            #endif
819            {
820              if (iiDeclCommand(&$$,&$2,myynest,$1,&(currRing->idroot))) YYERROR;
821            }
822          }
823        | currring_lists elemexpr
824          {
825            #ifdef SIC
826            if ((sic) && (currRing==NULL))
827            {
828              if (iiDeclCommand(&$$,&$2,myynest,$1,NULL)) YYERROR;
829            }
830            else
831            #endif
832            {
833              if (iiDeclCommand(&$$,&$2,myynest,$1,&(currRing->idroot))) YYERROR;
834            }
835          }
836        | MATRIX_CMD elemexpr '[' expr ']' '[' expr ']'
837          {
838            if (iiDeclCommand(&$$,&$2,myynest,$1,&(currRing->idroot))) YYERROR;
839            #ifdef SIC
840            if (sic)
841            {
842            }
843            else
844            #endif
845            {
846              int r; TESTSETINT($4,r);
847              int c; TESTSETINT($7,c);
848              if (r < 1)
849                MYYERROR("rows must be greater than 0");
850              if (c < 0)
851                MYYERROR("cols must be greater than -1");
852              leftv v=&$$;
853              //while (v->next!=NULL) { v=v->next; }
854              idhdl h=(idhdl)v->data;
855              idDelete(&IDIDEAL(h));
856              IDMATRIX(h) = mpNew(r,c);
857              if (IDMATRIX(h)==NULL) YYERROR;
858            }
859          }
860        | MATRIX_CMD elemexpr
861          {
862            if (iiDeclCommand(&$$,&$2,myynest,$1,&(currRing->idroot))) YYERROR;
863          }
864        | INTMAT_CMD elemexpr '[' expr ']' '[' expr ']'
865          {
866            if (iiDeclCommand(&$$,&$2,myynest,$1,&idroot)) YYERROR;
867            #ifdef SIC
868            if (sic)
869            {
870            }
871            else
872            #endif
873            {
874              int r; TESTSETINT($4,r);
875              int c; TESTSETINT($7,c);
876              if (r < 1)
877                MYYERROR("rows must be greater than 0");
878              if (c < 0)
879                MYYERROR("cols must be greater than -1");
880              leftv v=&$$;
881              //while (v->next!=NULL) { v=v->next; }
882              idhdl h=(idhdl)v->data;
883              delete IDINTVEC(h);
884              IDINTVEC(h) = new intvec(r,c,0);
885              if (IDINTVEC(h)==NULL) YYERROR;
886            }
887          }
888        | INTMAT_CMD elemexpr
889          {
890            if (iiDeclCommand(&$$,&$2,myynest,$1,&idroot)) YYERROR;
891            leftv v=&$$;
892            idhdl h;
893            do
894            {
895               h=(idhdl)v->data;
896               delete IDINTVEC(h);
897               IDINTVEC(h) = new intvec(1,1,0);
898               v=v->next;
899            } while (v!=NULL);
900          }
901        | declare_ip_variable ',' elemexpr
902          {
903            int t=$1.Typ();
904            sleftv r;
905            memset(&r,0,sizeof(sleftv));
906            if ((BEGIN_RING<t) && (t<END_RING))
907            {
908              if (iiDeclCommand(&r,&$3,myynest,t,&(currRing->idroot))) YYERROR;
909            }
910            else
911            {
912              if (iiDeclCommand(&r,&$3,myynest,t,&idroot)) YYERROR;
913            }
914            leftv v=&$1;
915            while (v->next!=NULL) v=v->next;
916            v->next=(leftv)Alloc(sizeof(sleftv));
917            memcpy(v->next,&r,sizeof(sleftv));
918            $$=$1;
919          }
920        ;
921
922stringexpr:
923        STRINGTOK
924        | LIB_CMD
925          {
926            idhdl h = ggetid( "LIB" );
927            if (h==NULL) YYERROR;
928            $$ = mstrdup(IDSTRING(h));
929          }
930        ;
931
932rlist:
933        expr
934        | '(' expr ',' exprlist ')'
935          {
936            leftv v = &$2;
937            while (v->next!=NULL)
938            {
939              v=v->next;
940            }
941            v->next = (leftv)Alloc(sizeof(sleftv));
942            memcpy(v->next,&($4),sizeof(sleftv));
943            $$ = $2;
944          }
945        ;
946
947ordername:
948        UNKNOWN_IDENT
949        {
950          if (!($$=rOrderName($1)))
951            YYERROR;
952        }
953        ;
954
955orderelem:
956        ordername
957          {
958            memset(&$$,0,sizeof($$));
959            intvec *iv = new intvec(2);
960            (*iv)[0] = 1;
961            (*iv)[1] = $1;
962            $$.rtyp = INTVEC_CMD;
963            $$.data = (void *)iv;
964          }
965        | ordername '(' exprlist ')'
966          {
967            memset(&$$,0,sizeof($$));
968            leftv sl = &$3;
969            int slLength;
970            {
971              slLength =  exprlist_length(sl);
972              int l = 2 +  slLength;
973              intvec *iv = new intvec(l);
974              (*iv)[0] = slLength;
975              (*iv)[1] = $1;
976
977              int i = 2;
978              while ((i<l) && (sl!=NULL))
979              {
980                if (sl->Typ() == INT_CMD)
981                {
982                  (*iv)[i++] = (int)(sl->Data());
983                }
984                else if ((sl->Typ() == INTVEC_CMD)
985                ||(sl->Typ() == INTMAT_CMD))
986                {
987                  intvec *ivv = (intvec *)(sl->Data());
988                  int ll = 0,l = ivv->length();
989                  for (; l>0; l--)
990                  {
991                    (*iv)[i++] = (*ivv)[ll++];
992                  }
993                }
994                else
995                {
996                  delete iv;
997                  $3.CleanUp();
998                  MYYERROR("wrong type in ordering");
999                }
1000                sl = sl->next;
1001              }
1002              $$.rtyp = INTVEC_CMD;
1003              $$.data = (void *)iv;
1004            }
1005            $3.CleanUp();
1006          }
1007        ;
1008
1009OrderingList:
1010        orderelem
1011        |  orderelem ',' OrderingList
1012          {
1013            $$ = $1;
1014            $$.next = (sleftv *)Alloc(sizeof(sleftv));
1015            memcpy($$.next,&$3,sizeof(sleftv));
1016          }
1017        ;
1018
1019ordering:
1020        orderelem
1021        | '(' OrderingList ')'
1022          {
1023            $$ = $2;
1024          }
1025        ;
1026
1027cmdeq:  '='
1028          {
1029            expected_parms = TRUE;
1030          }
1031        ;
1032
1033
1034/* --------------------------------------------------------------------*/
1035/* section of pure commands                                            */
1036/* --------------------------------------------------------------------*/
1037
1038executecmd:
1039        EXECUTE_CMD expr
1040          {
1041            #ifdef SIC
1042            if (sic) MYYERROR("execute not supported");
1043            #endif
1044            if ($2.Typ() == STRING_CMD)
1045            {
1046              char * s = (char *)AllocL(strlen((char *)$2.Data()) + 4);
1047              strcpy( s, (char *)$2.Data());
1048              strcat( s, "\n;\n");
1049              $2.CleanUp();
1050              newBuffer(s,BT_execute);
1051            }
1052            else
1053            {
1054              MYYERROR("string expected");
1055            }
1056          }
1057        ;
1058
1059filecmd:
1060        '<' stringexpr ';'
1061          { if (iiPStart(NULL,$2,NULL)) YYERROR; }
1062        ;
1063
1064helpcmd:
1065        HELP_CMD STRINGTOK
1066          {
1067            singular_help($2,FALSE);
1068            FreeL((ADDRESS)$2);
1069          }
1070        | HELP_CMD
1071          {
1072#ifdef buildin_help
1073            char *s=(char *)Alloc(10);
1074            strcpy(s,"index");
1075            singular_help(s,FALSE);
1076            Free((ADDRESS)s,10);
1077#else
1078            system("info singular");
1079#endif
1080          }
1081        | EXAMPLE_CMD STRINGTOK
1082          {
1083            singular_help($2,TRUE);
1084            FreeL((ADDRESS)$2);
1085            if (inerror) YYERROR;
1086          }
1087        ;
1088
1089exportcmd:
1090        EXPORT_CMD exprlist
1091        {
1092          if (iiExport(&$2,0)) YYERROR;
1093        }
1094        | EXPORT_CMD exprlist extendedid expr
1095        {
1096          if ((strcmp($3,"to")!=0) ||
1097          (($4.Typ()!=PACKAGE_CMD) && ($4.Typ()!=INT_CMD)))
1098            MYYERROR("export <id> to <package|int>");
1099          FreeL((ADDRESS)$3);
1100          if ($4.Typ()==INT_CMD)
1101          {
1102            if (iiExport(&$2,((int)$4.Data())-1)) YYERROR;
1103          }
1104          else
1105          {
1106            if (iiExport(&$2,0,IDPACKAGE((idhdl)$4.data)->idroot))
1107              YYERROR;
1108          }
1109        }
1110        ;
1111
1112killcmd:
1113        KILL_CMD kill_any_identifier {;}
1114        ;
1115
1116kill_any_identifier:
1117        elemexpr
1118          {
1119            leftv v=&$1;
1120            do
1121            {
1122              if (v->rtyp!=IDHDL)
1123              {
1124                if (v->name!=NULL) Werror("`%s` is undefined in kill",v->name);
1125                else               WerrorS("kill what ?");
1126              }
1127              else
1128              {
1129                killhdl((idhdl)v->data);
1130              }
1131              v=v->next;
1132            } while (v!=NULL);
1133            $1.CleanUp();
1134          }
1135        | kill_any_identifier ',' elemexpr
1136          {
1137            if ($3.rtyp!=IDHDL)
1138            {
1139              if ($3.name!=NULL) Werror("`%s` is undefined",$3.name);
1140              else               WerrorS("kill what ?");
1141            }
1142            else
1143            {
1144              killhdl((idhdl)$3.data);
1145            }
1146            $3.CleanUp();
1147          }
1148        ;
1149
1150listcmd:
1151        LISTVAR_CMD '(' ROOT_DECL ')'
1152          {
1153            list_cmd($3,NULL,"// ",TRUE);
1154          }
1155        | LISTVAR_CMD '(' ROOT_DECL_LIST ')'
1156          {
1157            list_cmd($3,NULL,"// ",TRUE);
1158          }
1159        | LISTVAR_CMD '(' RING_DECL ')'
1160          {
1161            if ($3==QRING_CMD) $3=RING_CMD;
1162            list_cmd($3,NULL,"// ",TRUE);
1163          }
1164        | LISTVAR_CMD '(' currring_lists ')'
1165          {
1166            list_cmd($3,NULL,"// ",TRUE);
1167          }
1168        | LISTVAR_CMD '(' RING_CMD ')'
1169          {
1170            #ifdef SIC
1171            if (sic) MYYERROR("not implemented yet");
1172            #endif
1173            list_cmd(RING_CMD,NULL,"// ",TRUE);
1174          }
1175        | LISTVAR_CMD '(' MATRIX_CMD ')'
1176          {
1177            #ifdef SIC
1178            if (sic) MYYERROR("not implemented yet");
1179            #endif
1180            list_cmd(MATRIX_CMD,NULL,"// ",TRUE);
1181           }
1182        | LISTVAR_CMD '(' INTMAT_CMD ')'
1183          {
1184            #ifdef SIC
1185            if (sic) MYYERROR("not implemented yet");
1186            #endif
1187            list_cmd(INTMAT_CMD,NULL,"// ",TRUE);
1188          }
1189        | LISTVAR_CMD '(' PROC_CMD ')'
1190          {
1191            #ifdef SIC
1192            if (sic) MYYERROR("not implemented yet");
1193            #endif
1194            list_cmd(PROC_CMD,NULL,"// ",TRUE);
1195          }
1196        | LISTVAR_CMD '(' elemexpr ')'
1197          {
1198            #ifdef SIC
1199            if (sic) MYYERROR("not implemented yet");
1200            #endif
1201            list_cmd(0,$3.Name(),"// ",TRUE);
1202            $3.CleanUp();
1203          }
1204        | LISTVAR_CMD '(' ')'
1205          {
1206            #ifdef SIC
1207            if (sic) MYYERROR("not implemented yet");
1208            #endif
1209            list_cmd(-1,NULL,"// ",TRUE);
1210          }
1211        ;
1212
1213ringcmd1:
1214       RING_CMD { noringvars = TRUE; }
1215       ;
1216
1217ringcmd:
1218        ringcmd1
1219          elemexpr cmdeq
1220          rlist     ','      /* description of coeffs */
1221          rlist     ','      /* var names */
1222          ordering           /* list of (multiplier ordering (weight(s))) */
1223          {
1224            #ifdef SIC
1225            if (sic)
1226            {
1227            }
1228            #endif
1229            //noringvars = FALSE;
1230            if(!rInit($2.name,        /* ringname */
1231                     &$4,            /* characteristik and list of parameters*/
1232                     &$6,            /* names of ringvariables */
1233                     &$8,            /* ordering */
1234                     FALSE))         /* is not a dring */
1235            {
1236              MYYERROR("cannot make ring");
1237            }
1238            $4.CleanUp();
1239            $6.CleanUp();
1240            $8.CleanUp();
1241          }
1242        | ringcmd1 elemexpr
1243          {
1244            //noringvars = FALSE;
1245            if (!inerror) rDefault($2.name);
1246          }
1247        | DRING_CMD { noringvars = TRUE; }
1248          elemexpr cmdeq
1249          rlist     ','       /* description of coeffs */
1250          rlist     ','       /* var names */
1251          ordering           /* list of (multiplier ordering (weight(s))) */
1252          {
1253            #ifdef DRING
1254            idhdl h;
1255            //noringvars = FALSE;
1256            if(!(h=rInit($3.name,    /* ringname */
1257                     &$5,            /* characteristik and list of parameters*/
1258                     &$7,            /* names of ringvariables */
1259                     &$9,            /* ordering */
1260                     TRUE)))         /* is a dring */
1261            {
1262              YYERROR;
1263            }
1264            setFlag(h,FLAG_DRING);
1265            rDSet();
1266            $5.CleanUp();
1267            $7.CleanUp();
1268            $9.CleanUp();
1269            #endif
1270          }
1271        ;
1272
1273scriptcmd:
1274         LIB_CMD stringexpr
1275          {
1276            if (iiLibCmd($2)) YYERROR;
1277          }
1278        ;
1279
1280setrings:  SETRING_CMD | KEEPRING_CMD ;
1281
1282setringcmd:
1283        setrings expr
1284          {
1285            if (($1==KEEPRING_CMD) && (myynest==0))
1286               MYYERROR("only inside a proc allowed");
1287            const char * n=$2.Name();
1288            if ((($2.Typ()==RING_CMD)||($2.Typ()==QRING_CMD))
1289            && ($2.rtyp==IDHDL))
1290            {
1291              idhdl h=(idhdl)$2.data;
1292              if ($2.e!=NULL) h=rFindHdl((ring)$2.Data(),NULL);
1293              if ($1==KEEPRING_CMD)
1294              {
1295                if (h!=NULL)
1296                {
1297                  if (IDLEV(h)!=0)
1298                  {
1299                    if (iiExport(&$2,myynest-1)) YYERROR;
1300                    //if (TEST_OPT_KEEPVARS)
1301                    //{
1302                      idhdl p=IDRING(h)->idroot;
1303                      int prevlev=myynest-1;
1304                      while (p!=NULL)
1305                      {
1306                        if (IDLEV(p)==myynest) IDLEV(p)=prevlev;
1307                        p=IDNEXT(p);
1308                      }
1309                    //}
1310                  }
1311                  iiLocalRing[myynest-1]=IDRING(h);
1312                }
1313                else
1314                {
1315                  Werror("%s is no identifier",n);
1316                  $2.CleanUp();
1317                  YYERROR;
1318                }
1319              }
1320              if (h!=NULL) rSetHdl(h,TRUE);
1321              else
1322              {
1323                Werror("cannot find the name of the basering %s",n);
1324                $2.CleanUp();
1325                YYERROR;
1326              }
1327              $2.CleanUp();
1328            }
1329            else
1330            {
1331              Werror("%s is no name of a ring/qring",n);
1332              $2.CleanUp();
1333              YYERROR;
1334            }
1335          }
1336        ;
1337
1338typecmd:
1339        TYPE_CMD expr
1340          {
1341            if ($2.rtyp!=IDHDL) MYYERROR("identifier expected");
1342            #ifdef SIC
1343            if (sic)
1344            {
1345            }
1346            else
1347            #endif
1348            {
1349              idhdl h = (idhdl)$2.data;
1350              type_cmd(h);
1351            }
1352          }
1353        | exprlist
1354          {
1355            //Print("typ is %d, rtyp:%d\n",$1.Typ(),$1.rtyp);
1356            #ifdef SIQ
1357            if ($1.rtyp!=COMMAND)
1358            {
1359            #endif
1360              if ($1.Typ()==UNKNOWN)
1361              {
1362                if ($1.name!=NULL)
1363                {
1364                  Werror("`%s` is undefined",$1.name);
1365                  FreeL((ADDRESS)$1.name);
1366                }
1367                YYERROR;
1368              }
1369            #ifdef SIQ
1370            }
1371            #endif
1372            $1.Print(&sLastPrinted);
1373            $1.CleanUp();
1374          }
1375        ;
1376
1377/* --------------------------------------------------------------------*/
1378/* section of flow control                                             */
1379/* --------------------------------------------------------------------*/
1380
1381ifcmd: IF_CMD '(' expr ')' BLOCKTOK
1382          {
1383            #ifdef SIC
1384            if (sic)
1385            {
1386              //egPrint(IF_CMD,1,"if, 1\n");
1387              //egPrint(&$3);
1388              newBuffer( $5, BT_if);
1389            }
1390            else
1391            #endif
1392            {
1393              int i; TESTSETINT($3,i);
1394              if (i!=0)
1395              {
1396                newBuffer( $5, BT_if);
1397                //printf("if:new level %d\n",voice);
1398              }
1399              else
1400              {
1401                FreeL((ADDRESS)$5);
1402                ifswitch[voice]=1;
1403                //printf("if:(0):set ifsw=1 in voice %d\n",voice);
1404              }
1405            }
1406          }
1407        | ELSE_CMD BLOCKTOK
1408          {
1409            #ifdef SIC
1410            if (sic)
1411            {
1412            //egPrint(ELSE_CMD,0,"op: else, 0\n");
1413            newBuffer( $2, BT_else);
1414            }
1415            else
1416            #endif
1417            {
1418              if (ifswitch[voice]==1)
1419              {
1420                ifswitch[voice]=0;
1421                newBuffer( $2, BT_else);
1422              }
1423              else
1424              {
1425                if (ifswitch[voice]!=2)
1426                {
1427                  char *s=$2+strlen($2)-1;
1428                  while ((*s=='\0')||(*s=='\n')) s--;
1429                  s[1]='\0';
1430                  Warn("`else` without `if` in level %d",myynest);
1431                }
1432                FreeL((ADDRESS)$2);
1433              }
1434              ifswitch[voice]=0;
1435            }
1436          }
1437        | IF_CMD '(' expr ')' BREAK_CMD
1438          {
1439            #ifdef SIC
1440            if (sic)
1441            {
1442              //egPrint(IFBREAK,1,"ifbreak, 1\n");
1443              //egPrint(&$3);
1444            }
1445            else
1446            #endif
1447            {
1448              int i; TESTSETINT($3,i);
1449              if (i)
1450              {
1451                if (exitBuffer(BT_break)) YYERROR;
1452              }
1453              ifswitch[voice]=0;
1454            }
1455          }
1456        | BREAK_CMD
1457          {
1458            #ifdef SIC
1459            if (sic)
1460            {
1461            }
1462            else
1463            #endif
1464            {
1465              if (exitBuffer(BT_break)) YYERROR;
1466              ifswitch[voice]=0;
1467            }
1468          }
1469        | CONTINUE_CMD
1470          {
1471            #ifdef SIC
1472            if (sic)
1473            {
1474            }
1475            else
1476            #endif
1477            {
1478              contBuffer(BT_break);
1479              ifswitch[voice]=0;
1480            }
1481          }
1482      ;
1483
1484whilecmd:
1485        WHILE_CMD STRINGTOK BLOCKTOK
1486          {
1487            /* -> if(!$2) break; $3; continue;*/
1488            char * s = (char *)AllocL( strlen($2) + strlen($3) + 36);
1489            sprintf(s,"whileif (!(%s)) break;\n%scontinue;\n " ,$2,$3);
1490            newBuffer(s,BT_break);
1491            FreeL((ADDRESS)$2);
1492            FreeL((ADDRESS)$3);
1493          }
1494        ;
1495
1496forcmd:
1497        FOR_CMD STRINGTOK STRINGTOK STRINGTOK BLOCKTOK
1498          {
1499            /* $2 */
1500            /* if (!$3) break; $5; $4; continue; */
1501            char * s = (char *)AllocL( strlen($3)+strlen($4)+strlen($5)+36);
1502            sprintf(s,"forif (!(%s)) break;\n%s%s;\ncontinue;\n "
1503                   ,$3,$5,$4);
1504            FreeL((ADDRESS)$3);
1505            FreeL((ADDRESS)$4);
1506            FreeL((ADDRESS)$5);
1507            newBuffer(s,BT_break);
1508            s = (char *)AllocL( strlen($2) + 3);
1509            sprintf(s,"%s;\n",$2);
1510            FreeL((ADDRESS)$2);
1511            newBuffer(s,BT_if);
1512          }
1513        ;
1514
1515proccmd:
1516        PROC_CMD extendedid BLOCKTOK
1517          {
1518            #ifdef SIC
1519            if (sic)
1520            {
1521              FreeL((ADDRESS)$2);
1522              FreeL((ADDRESS)$3);
1523              MYYERROR("not implemented");
1524            }
1525            #endif
1526            idhdl h = enterid($2,myynest,PROC_CMD,&idroot,FALSE);
1527            if (h==NULL) {FreeL((ADDRESS)$3); YYERROR;}
1528            IDSTRING(h) = (char *)AllocL(strlen($3)+31);
1529            sprintf(IDSTRING(h),"parameter list #;\n%s;return();\n\n",$3);
1530            FreeL((ADDRESS)$3);
1531          }
1532        | PROC_CMD extendedid '=' expr ';'
1533          {
1534            #ifdef SIC
1535            if (sic)
1536            {
1537              $4.CleanUp();
1538              FreeL((ADDRESS)$2);
1539              MYYERROR("not implemented");
1540            }
1541            #endif
1542            if ($4.Typ()!=STRING_CMD)
1543              MYYERROR("string expression expected");
1544            idhdl h = enterid($2,myynest,PROC_CMD,&idroot,FALSE);
1545            if (h==NULL) YYERROR;
1546            IDSTRING(h) = (char *)$4.CopyD();
1547            $4.CleanUp();
1548          }
1549        | PROC_DEF STRINGTOK BLOCKTOK
1550          {
1551            idhdl h = enterid($1,myynest,PROC_CMD,&idroot,FALSE);
1552            if (h==NULL)
1553            {
1554              FreeL((ADDRESS)$2);
1555              FreeL((ADDRESS)$3);
1556              YYERROR;
1557            }
1558            char *args=iiProcArgs($2,FALSE);
1559            FreeL((ADDRESS)$2);
1560            IDSTRING(h) = (char *)AllocL(strlen($3)+strlen(args)+14);
1561            sprintf(IDSTRING(h),"%s\n%s;RETURN();\n\n",args,$3);
1562            FreeL((ADDRESS)args);
1563            FreeL((ADDRESS)$3);
1564            //Print(">>%s<<\n",IDSTRING(h));
1565          }
1566        ;
1567
1568parametercmd:
1569        PARAMETER declare_ip_variable
1570          {
1571            //Print("par:%s, %d\n",$2.Name(),$2.Typ());
1572            yylineno--;
1573            #ifdef SIC
1574            if (sic)
1575            {
1576              //egParameter(&$2);
1577            }
1578            else
1579            #endif
1580            {
1581              if (iiParameter(&$2)) YYERROR;
1582            }
1583          }
1584        | PARAMETER expr
1585          {
1586            //Print("par:%s, %d\n",$2.Name(),$2.Typ());
1587            sleftv tmp_expr;
1588            #ifdef SIC
1589            if (sic)
1590            {
1591              if (iiDeclCommand(&tmp_expr,&$2,myynest,DEF_CMD,&idroot))
1592                YYERROR;
1593              //egParameter(&$2);
1594            }
1595            else
1596            #endif
1597            {
1598              if ((iiDeclCommand(&tmp_expr,&$2,myynest,DEF_CMD,&idroot))
1599              || (iiParameter(&tmp_expr)))
1600                YYERROR;
1601            }
1602          }
1603        ;
1604
1605returncmd:
1606        RETURN '(' exprlist ')'
1607          {
1608            iiRETURNEXPR[myynest].Copy(&$3);
1609            $3.CleanUp();
1610            if (exitBuffer(BT_proc)) YYERROR;
1611          }
1612        | RETURN '(' ')'
1613          {
1614            iiRETURNEXPR[myynest].Init();
1615            iiRETURNEXPR[myynest].rtyp=NONE;
1616            if (exitBuffer(BT_proc)&&($1!=END_PROC)) YYERROR;
1617            if ($1==END_PROC) YYACCEPT;
1618          }
1619        ;
Note: See TracBrowser for help on using the repository browser.