1: # include "../ingres.h"
   2: # include "../scanner.h"
   3: 
   4: /*
   5: ** COMMENT
   6: ** scans comments (as delimited by the tokens 'Tokens.bgncmnt'
   7: ** and 'Tokens.endcmnt') and removes them from the query text.
   8: */
   9: comment()
  10: {
  11:     register int        i, l;
  12:     register struct optab   *op;
  13:     char            buf[3];
  14: 
  15:     /* find the end_of_comment operator */
  16:     for (op = Optab; op->term; op++)
  17:         if (op->token == Tokens.endcmnt)
  18:             break;
  19:     if (!op->term)
  20:         syserr("no end_of_comment token");
  21: 
  22:     /* scan for the end of the comment */
  23:     l = length(op->term);
  24:     for (i = 0; i < l; i++)     /* set up window on input */
  25:         if ((buf[i] = gtchar()) <= 0)
  26:             /* non-terminated comment */
  27:             yyerror(COMMTERM, 0);
  28:     while (!bequal(buf, op->term, l))
  29:     {
  30:         /* move window on input */
  31:         for (i = 0; i < l-1; i++)
  32:             buf[i] = buf[i+1];
  33:         if ((buf[l-1] = gtchar()) <= 0)
  34:             /* non terminated comment */
  35:             yyerror(COMMTERM, 0);
  36:     }
  37:     return (0);
  38: }

Defined functions

comment defined in line 9; used 1 times
Last modified: 1980-12-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2165
Valid CSS Valid XHTML 1.0 Strict