home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 172_01 / commen.c < prev    next >
Text File  |  1979-12-31  |  2KB  |  48 lines

  1. /*
  2.   HEADER:              CUG  nnn.nn;
  3.   TITLE:               LEX - A Lexical Analyser Generator
  4.   VERSION:             1.1 for IBM-PC
  5.   DATE:                Jan 30, 1985
  6.   DESCRIPTION:         A Lexical Analyser Generator. From UNIX
  7.   KEYWORDS:            Lexical Analyser Generator YACC C PREP
  8.   SYSTEM:              IBM-PC and Compatiables
  9.   FILENAME:            COMMEN.C
  10.   WARNINGS:            This program is not for the casual user. It will
  11.                        be useful primarily to expert developers.
  12.   CRC:                 N/A
  13.   SEE-ALSO:            YACC and PREP
  14.   AUTHORS:             Charles H. Forsyth
  15.                        Scott Guthery 11100 leafwood lane Austin, TX 78750
  16.                        Andrew M. Ward, Jr.  Houston, Texas (Modifications)
  17.   COMPILERS:           LATTICE C
  18.   REFERENCES:          UNIX Systems Manuals -- Lex Manual on distribution disks
  19. */
  20. /*
  21.  * Bob Denny     28-Aug-82  Remove reference to stdio.h
  22.  * Scott Guthery 20-Nov-83  Adapt for IBM PC & DeSmet C
  23.  */
  24. #include "lex.h"
  25.  
  26. extern int yyline;
  27.  
  28. comment(mat)
  29. char *mat;
  30. {
  31.         int c;
  32.         char *cp;
  33.         int lno;
  34.  
  35.         lno = yyline;
  36.         c = 1;
  37.         for (cp = mat; *cp && c>=0;) {
  38.                 if ((c = lexchar())=='\n')
  39.                         yyline++;
  40.                 if (c!=*cp++)
  41.                         cp = mat;
  42.         }
  43.         if (c < 0) {
  44.                 yyline = lno;
  45.                 lexerror("End of file in comment");
  46.         }
  47. }
  48.