[BACK]Return to parser.c CVS log [TXT][DIR] Up to [cvs.netbsd.org] / src / bin / sh

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/bin/sh/parser.c between version 1.64 and 1.65

version 1.64, 2007/01/13 18:58:26 version 1.65, 2007/06/07 20:57:59
Line 151  list(int nlflag)
Line 151  list(int nlflag)
 {  {
         union node *n1, *n2, *n3;          union node *n1, *n2, *n3;
         int tok;          int tok;
           TRACE(("list: entered\n"));
   
         checkkwd = 2;          checkkwd = 2;
         if (nlflag == 0 && tokendlist[peektoken()])          if (nlflag == 0 && tokendlist[peektoken()])
Line 222  andor(void)
Line 223  andor(void)
         union node *n1, *n2, *n3;          union node *n1, *n2, *n3;
         int t;          int t;
   
           TRACE(("andor: entered\n"));
         n1 = pipeline();          n1 = pipeline();
         for (;;) {          for (;;) {
                 if ((t = readtoken()) == TAND) {                  if ((t = readtoken()) == TAND) {
Line 250  pipeline(void)
Line 252  pipeline(void)
         struct nodelist *lp, *prev;          struct nodelist *lp, *prev;
         int negate;          int negate;
   
         negate = 0;  
         TRACE(("pipeline: entered\n"));          TRACE(("pipeline: entered\n"));
         while (readtoken() == TNOT)  
           negate = 0;
           checkkwd = 2;
           while (readtoken() == TNOT) {
                   TRACE(("pipeline: TNOT recognized\n"));
                 negate = !negate;                  negate = !negate;
           }
         tokpushback++;          tokpushback++;
         n1 = command();          n1 = command();
         if (readtoken() == TPIPE) {          if (readtoken() == TPIPE) {
Line 274  pipeline(void)
Line 280  pipeline(void)
         }          }
         tokpushback++;          tokpushback++;
         if (negate) {          if (negate) {
                   TRACE(("negate pipeline\n"));
                 n2 = (union node *)stalloc(sizeof (struct nnot));                  n2 = (union node *)stalloc(sizeof (struct nnot));
                 n2->type = NNOT;                  n2->type = NNOT;
                 n2->nnot.com = n1;                  n2->nnot.com = n1;
Line 293  command(void)
Line 300  command(void)
         union node *redir, **rpp;          union node *redir, **rpp;
         int t, negate = 0;          int t, negate = 0;
   
           TRACE(("command: entered\n"));
   
         checkkwd = 2;          checkkwd = 2;
         redir = NULL;          redir = NULL;
         n1 = NULL;          n1 = NULL;
Line 517  TRACE(("expecting DO got %s %s\n", tokna
Line 526  TRACE(("expecting DO got %s %s\n", tokna
   
 checkneg:  checkneg:
         if (negate) {          if (negate) {
                   TRACE(("negate command\n"));
                 n2 = (union node *)stalloc(sizeof (struct nnot));                  n2 = (union node *)stalloc(sizeof (struct nnot));
                 n2->type = NNOT;                  n2->type = NNOT;
                 n2->nnot.com = n1;                  n2->nnot.com = n1;
Line 550  simplecmd(union node **rpp, union node *
Line 560  simplecmd(union node **rpp, union node *
         orig_rpp = rpp;          orig_rpp = rpp;
   
         while (readtoken() == TNOT) {          while (readtoken() == TNOT) {
                 TRACE(("command: TNOT recognized\n"));                  TRACE(("simplcmd: TNOT recognized\n"));
                 negate = !negate;                  negate = !negate;
         }          }
         tokpushback++;          tokpushback++;
Line 593  simplecmd(union node **rpp, union node *
Line 603  simplecmd(union node **rpp, union node *
   
 checkneg:  checkneg:
         if (negate) {          if (negate) {
                   TRACE(("negate simplecmd\n"));
                 n2 = (union node *)stalloc(sizeof (struct nnot));                  n2 = (union node *)stalloc(sizeof (struct nnot));
                 n2->type = NNOT;                  n2->type = NNOT;
                 n2->nnot.com = n;                  n2->nnot.com = n;
Line 762  readtoken(void)
Line 773  readtoken(void)
 out:  out:
                 checkkwd = (t == TNOT) ? savecheckkwd : 0;                  checkkwd = (t == TNOT) ? savecheckkwd : 0;
         }          }
 #ifdef DEBUG          TRACE(("%stoken %s %s\n", alreadyseen ? "reread " : "", tokname[t], t == TWORD ? wordtext : ""));
         if (!alreadyseen)  
             TRACE(("token %s %s\n", tokname[t], t == TWORD ? wordtext : ""));  
         else  
             TRACE(("reread token %s %s\n", tokname[t], t == TWORD ? wordtext : ""));  
 #endif  
         return (t);          return (t);
 }  }
   

Legend:
Removed from v.1.64  
changed lines
  Added in v.1.65

CVSweb <webmaster@jp.NetBSD.org>