%{
/*
 *   Copyright (C) 1988-2006 Lucent Technologies Inc. and others.
 *   All Rights Reserved.
 */

/*	cscope - interactive C symbol cross-reference
 *
 *	C symbol scanner
 */

/* #include "global.h" -- prepended to lex.yy.c by make */

/* the line counting has been moved from character reading for speed */
/* comments are discarded */
static	int	comment();
static 	int	sourceinput();	/* Can't use input() - generated by flex */
static	int	noncommentinput();
static	int	msdosgetc();
#define YY_INPUT(buf,result,max_size) \
	{ \
		int c = sourceinput(); \
		result = (c == LEXEOF) ? YY_NULL : (buf[0] = c, 1); \
	}

/* not a preprocessor line (allow Ingres(TM) "## char var;" lines) */
#define	notpp()	(ppdefine == NO && (*yytext != '#' || yytext[1] == '#'))

#define	IFLEVELINC	5	/* #if nesting level size increment */

/* keyword text for fast testing of keywords in the scanner */
extern	char	externtext[];
extern	char	typedeftext[];
extern	char	classtext[];

int	cfirst;	/* buffer index for first char of symbol */
int	clast;	/* buffer index for last char of symbol */
int	clineno;/* symbol line number */
int	cmyylineno = 1;

static	BOOL	arraydimension;		/* inside array dimension declaration */
static	BOOL	bplisting;		/* breakpoint listing */
static	int	braces;			/* unmatched left brace count */
static	int	cesudeftoken;		/* class/enum/struct/union definition */
static	int	classbraces;		/* class brace count */
static	BOOL	classdef;		/* c++ class definition */
static	BOOL	elseelif;		/* #else or #elif found */
static	BOOL	esudef;			/* enum/struct/union definition */
static	int	esubraces;		/* outermost enum/struct/union brace count */
static	BOOL	externdec;		/* extern declaration */
static	BOOL	fcndef;			/* function definition */
static	BOOL	globalscope;		/* file global scope (outside functions) */
static	int	iflevel;		/* #if nesting level */
static	BOOL	initializer;		/* data initializer */
static	int	initializerbraces;	/* data initializer outer brace count */
static	BOOL	lex;			/* lex file */
static	BOOL	localdef;		/* function/block local definition */
static	int	miflevel = IFLEVELINC;	/* maximum #if nesting level */
static	int	*maxifbraces;		/* maximum brace count within #if */
static	int	*preifbraces;		/* brace count before #if */
static	int	parens;			/* unmatched left parenthesis count */
static	BOOL	ppdefine;		/* preprocessor define statement */
static	BOOL	psuedoelif;		/* psuedo-#elif */
static	BOOL	oldtype;		/* next identifier is an old type */
static	BOOL	rules;			/* lex/yacc rules */
static	BOOL	structfield;		/* structure field declaration */
static	BOOL	template;		/* function template */
static	int	templateparens;		/* function template outer parentheses count */
static	BOOL	typedefdef;		/* typedef name definition */
static	BOOL	typedefname;		/* typedef name use */
static	int	token;			/* token found */

static	void	multicharconstant();
%}
identifier	[a-zA-Z_][a-zA-Z_0-9]*
number		\.?[0-9][.0-9a-fA-FlLuUxX]*
%x C
%s BP
%a 12000
%o 18000
%p 5000
%%
%\{		{	/* lex/yacc C declarations/definitions */
			globalscope = YES;
			goto more;
			/* NOTREACHED */
		}
%\}		{
			globalscope = NO;
			goto more;
			/* NOTREACHED */
		}
^%%		{	/* lex/yacc rules delimiter */
			braces = 0;
			if (rules == NO) {
				rules = YES;
				
				/* simulate a yylex() or yyparse() definition */
				(void) strcat(yytext, " /* ");
				cfirst = strlen(yytext);
				if (lex == YES) {
					(void) strcat(yytext, "yylex");
				}
				else {	/* yacc: yyparse implicitly calls yylex */
					char *s = " yylex()";
					char *cp = s + strlen(s);
					while (--cp >= s) {
						unput(*cp);
					}
					(void) strcat(yytext, "yyparse");
				}
				clast = strlen(yytext);
				(void) strcat(yytext, " */");
				yyleng = strlen(yytext);
				yymore();
				return(FCNDEF);
			}
			else {
				rules = NO;
				globalscope = YES;
				clast = cfirst;
				yymore();
				return(FCNEND);
			}
			/* NOTREACHED */
		}
\{		{	/* count unmatched left braces for fcn def detection */
			++braces;
			if (classdef == YES && fcndef == NO && classbraces == braces-1) {
				classbraces++;
			}
			/* mark an untagged class/enum/struct/union so its beginning
			   can be found */
			if (cesudeftoken) {
				clast = cfirst;
				csavesymbol(cesudeftoken);
				cesudeftoken = '\0';
			}
			/* if not in an enum/struct/union declaration */
			if (esudef == NO) {
				externdec = NO;
			}
			goto more;
			/* NOTREACHED */
		}
\#[ \t]*endif/.*[\n\r][ \t\n\r]*#[ \t]*if	{
			/* attempt to correct erroneous brace count caused by:
			 * 
			 * #if ...
			 * 	... {
			 * #endif
			 * #if ...
			 * 	... {
			 * #endif
			 */
			/* the current #if must not have an #else or #elif */
			if (elseelif == YES) {
				goto endif;
			}
			psuedoelif = YES;
			goto more;
			/* NOTREACHED */
		}
\#[ \t]*ifn?(def)?	{ /* #if, #ifdef or #ifndef */
			elseelif = NO;
			if (psuedoelif == YES) {
				psuedoelif = NO;
				goto elif;
			}
			/* make sure there is room for the current brace count */
			if (iflevel == miflevel) {
				miflevel += IFLEVELINC;
				maxifbraces = (int *) myrealloc((char *)
				    maxifbraces, miflevel * sizeof(int));
				preifbraces = (int *) myrealloc((char *)
				    preifbraces, miflevel * sizeof(int));
			}
			/* push the current brace count */
			preifbraces[iflevel] = braces;
			maxifbraces[iflevel++] = 0;
			goto more;
			/* NOTREACHED */
		}
\#[ \t]*el(se|if)	{ /* #elif or #else */
			elseelif = YES;
		elif:
			if (iflevel > 0) {
				
				/* save the maximum brace count for this #if */
				if (braces > maxifbraces[iflevel - 1]) {
					maxifbraces[iflevel - 1] = braces;
				}
				/* restore the brace count to before the #if */
				braces = preifbraces[iflevel - 1];
			}
			goto more;
			/* NOTREACHED */
		}
\#[ \t]*endif	{	/* #endif */
		endif:
			if (iflevel > 0) {
				
				/* get the maximum brace count for this #if */
				if (braces < maxifbraces[--iflevel]) {
					braces = maxifbraces[iflevel];
				}
			}
			goto more;
			/* NOTREACHED */
		}
\}		{
			/* could be the last enum member initializer */
			if (braces == initializerbraces) {
				initializerbraces = -1;
				initializer = NO;
			}
			if (--braces <= 0) {
		endstate:
				braces = 0;
			}
			/* if the end of a class */
			if (classdef == YES && braces == classbraces-1) {
				if (classbraces > 0) classbraces--;
				if (classbraces == 0) classdef = NO;
				globalscope = YES;
				clast = cfirst;
				yymore();
				return(FCNEND);
			}
			/* if the end of an outermost enum/struct/union definition */
			if (esudef == YES && braces == esubraces) {
				esudef = NO;
				esubraces = -1;
				clast = cfirst;
				yymore();
				return(ESUEND);
			}
			/* if the end of a function */
			if ((braces == 0 || braces == classbraces && classdef == YES) &&
			    fcndef == YES) {
				fcndef = NO;
				if (classdef == NO) {
					globalscope = YES;
				}
				clast = cfirst;
				yymore();
				return(FCNEND);
			}
			goto more;
			/* NOTREACHED */
		}
\(		{	/* count unmatched left parentheses for function templates */
			++parens;
			goto more;
			/* NOTREACHED */
		}
\)		{
			if (--parens <= 0) {
				parens = 0;
			}
			/* if the end of a function template */
			if (parens == templateparens) {
				templateparens = -1;
				template = NO;
			}
			goto more;
			/* NOTREACHED */
		}
=		{	/* if a global definition initializer */
			if ((globalscope == YES || localdef == YES) && notpp()) {
				initializerbraces = braces;
				initializer = YES;
			}
			goto more;
			/* NOTREACHED */
		}
:		{	/* if a structure field */
			/* note: a pr header has a colon in the date */
			if (esudef == YES && notpp()) {
				structfield = YES;
			}
			goto more;
			/* NOTREACHED */
		}
\,		{
			if (braces == initializerbraces) {
				initializerbraces = -1;
				initializer = NO;
			}
			structfield = NO;
			goto more;
			/* NOTREACHED */
		}
"##"		|	/* start of Ingres(TM) code line */
;		{
			/* if not in an enum/struct/union declaration */
			if (esudef == NO) {
				externdec = NO;
				typedefdef = NO;
				localdef = NO;
			}
			structfield = NO;
			initializer = NO;
			oldtype = NO;
			goto more;
			/* NOTREACHED */
		}
\#[ \t]*define[ \t]+{identifier}	{
				
			/* preprocessor macro or constant definition */
			ppdefine = YES;
			token = DEFINE;
			if (compress == YES) {
				yytext[0] = '\7';	/* compress the keyword */
			}
		findident:
			cfirst = yyleng - 1;
			while (isalnum(yytext[cfirst]) || yytext[cfirst] == '_') {
				--cfirst;
			}
			++cfirst;
			goto iflongline;
			/* NOTREACHED */
		}
<C>class[ \t]+{identifier}[ \t\n\ra-zA-Z0-9_():]*\{	{	/* class definition */
			classdef = YES;
			cesudeftoken = 'c';
			REJECT;
			/* NOTREACHED */
		}
operator[ \ta-zA-Z_*/%^&|~!,=<>\[\]()+-]+[ \t\n\ra-zA-Z0-9_():]*\{	{
			/* operator overload definition */
			fcndef = YES;
			token = FCNDEF;
			globalscope = NO;
			goto iflongline;
			/* NOTREACHED */
		}
(enum|struct|union)/([ \t\n\r]+{identifier})?[ \t\n\r]*\{	{ /* enum/struct/union definition */
			esudef = YES;
			if (esubraces < 0) {	/* if outermost enum/struct/union */
				esubraces = braces;
			}
			cesudeftoken = *(yytext + cfirst);
			goto iflongline;
			/* NOTREACHED */
		}
<BP>{identifier}/[ \t\n\r]*\([ \t\n\ra-zA-Z0-9_*&\[\]=,.]*\)[ \t\n\r()\[\]0-9]*[:a-zA-Z_#{]	{
			goto iffcndef;
			/* NOTREACHED */
		}
{identifier}/[ \t\n\r]*\([ \t\n\ra-zA-Z0-9_*&[\]=,.]*\)[ \t\n\r()]*[:a-zA-Z_#{]	{
		iffcndef:	
			/* warning: "if (...)" must not overflow yytext, so the content
			   of function argument definitions is restricted, in particular
			   parentheses are not allowed */

			/* if a function definition */
			/* note: "#define a (b) {" and "#if defined(a)\n#" are not */
			if (braces == 0 && notpp() && rules == NO ||
			    braces == classbraces && classdef == YES) {
				fcndef = YES;
				token = FCNDEF;
				globalscope = NO;
				goto iflongline;
			}
			goto iffcncall;
			/* NOTREACHED */
		}
{identifier}/[ \t]*\(	{
			/* if a function call */
		iffcncall:
			if ((fcndef == YES || ppdefine == YES || rules == YES) &&
			    externdec == NO && (localdef == NO || initializer == YES)) {
				token = FCNCALL;
				goto iflongline;
			}
			if (template == NO && typedefdef == NO) {
				templateparens = parens;
				template = YES;
			}
			token = IDENT;
			goto iflongline;
			/* NOTREACHED */
		}
(\+\+|--)[ \t]*{identifier}	{	/* prefix increment or decrement */
			token = ASSIGNMENT;
			goto findident;
			/* NOTREACHED */
		}
{identifier}/[ \t]*(\+\+|--)	{	/* postfix increment or decrement */
			token = ASSIGNMENT;
			goto iflongline;
			/* NOTREACHED */
		}
\*[ \t]*{identifier}/[ \t]*[^a-zA-Z0-9_(+-][^+-]	{ /* indirect assignment or dcl */
			while (!isalnum(yytext[cfirst]) && yytext[cfirst] != '_') {
				++cfirst;
			}
			goto ident;
			/* NOTREACHED */
		}
{identifier}/[ \t\n\r]*(=[^=]|[-+*/%&^|]=|<<=|>>=)	{ /* assignment */
			if ((fcndef == YES || ppdefine == YES || rules == YES) &&
			    localdef == NO) {
				token = ASSIGNMENT;
				goto iflongline;
			}
			goto ident;
			/* NOTREACHED */
		}
{identifier}/[* \t\n\r]+[a-zA-Z0-9_]	{	/* possible typedef name use */
			if (notpp() && esudef == NO && fcndef == YES && 
			   typedefdef == NO && parens == 0) {
				char	c, *s = yytext + cfirst - 1;
				
				while (--s >= yytext && (c = *s) != ';' && c != '{') {
					if (!isspace(c) && !isalpha(c)) {
						goto nottypedefname;
					}
				}
				typedefname = YES;
			}
		nottypedefname:
			token = IDENT;	/* skip the global/parameter/local tests */
			goto iflongline;
			/* NOTREACHED */
		}
{identifier}	{
			struct	keystruct *p;
			char	*s;

		ident:	token = IDENT;
			if (notpp() && externdec == NO && arraydimension == NO
			    && initializer == NO) {
				
				/* if a class definition */
				if (classdef == YES && braces == 0) {
					token = CLASSDEF;
				}
				/* if an enum/struct/union member definition */
				else if (esudef == YES) {
					if (structfield == NO) {
						token = MEMBERDEF;
					}
				}
				/* if a typedef name */
				else if (typedefdef == YES && oldtype == NO) {
					token = TYPEDEF;
				}
				/* if a global definition */
				else if (globalscope == YES && template == NO
				    && oldtype == NO) {
					token = GLOBALDEF;
				}
				/* if a function parameter definition */
				else if (fcndef == YES && braces == classbraces && parens > 0) {
					token = PARAMETER;
				}
				/* if a local definition */
				else if (localdef == YES) {
					token = LOCALDEF;
				}
			}
		iflongline:
			/* if a long line */
			if (yyleng > STMTMAX) {
				int	c;
				
				/* skip to the end of the line */
				warning("line too long");
				while ((c = input()) != EOF) {
					if (c == '\n') {
						unput(c);
						break;
					}
				}
			}
			/* truncate a long symbol */
			if (yyleng - cfirst > PATLEN) {
				warning("symbol too long");
				yyleng = cfirst + PATLEN;
				yytext[yyleng] = '\0';
			}
			/* if a keyword */
			yymore();
			if ((p = lookup(yytext + cfirst)) != NULL) {
				cfirst = yyleng;
				s = p->text;
				
				/* if an extern declaration */
				if (s == externtext) {
					externdec = YES;
				}
				/* if a class definition */
				else if (s == classtext) {
					classdef = YES;
					cesudeftoken = 'c';
				}
				/* if a typedef name definition */
				else if (s == typedeftext) {
					typedefdef = YES;
					oldtype = YES;
				}
				/* if a local definition */
				else if (p->type == DECL && fcndef == YES &&
				    typedefdef == NO && parens == 0) {
					localdef = YES;
				}
				/* keyword doesn't start a function template */
				else if (templateparens == parens && template == YES) {
					templateparens = -1;
					template = NO;
				}
				else {	/* next identifier after typedef was a keyword */
					oldtype = NO;
				}
				/* keyword can't be in a local definition */
				localdef = NO;
				typedefname = NO;
			}
			else {	/* identifier */
				clast = yyleng;
				
				/* if an enum/struct/union keyword preceded this ident. */
				if ((classdef == YES || esudef == YES) && cesudeftoken) {
					token = cesudeftoken;
					cesudeftoken = '\0';
				}
				else {
					oldtype = NO;
				}
				/* if a local definition using a typedef name */
				if (typedefname == YES) {
					localdef = YES;
				}
				typedefname = NO;
				return(token);
			}
		}
\[		{	/* array dimension (don't worry about subscripts) */
			arraydimension = YES;
			goto more;
			/* NOTREACHED */
		}
\]		{
			arraydimension = NO;
			goto more;
			/* NOTREACHED */
		}
\\\n		{	/* preprocessor statement is continued on next line */
			goto eol;
			/* NOTREACHED */
		}
\n		{	/* end of the line */
			if (ppdefine == YES) {	/* end of a #define */
				ppdefine = NO;
				yyless(yyleng - 1);	/* rescan \n */
				clast = cfirst;
				yymore();
				return(DEFINEEND);
			}
			/* skip the first 8 columns of a breakpoint listing line */
			/* and skip the file path in the page header */
			if (bplisting == YES) {
				int	c, i;

				switch (input()) {	/* tab and EOF just fall through */
				case ' ':	/* breakpoint number line */
				case '[':
					for (i = 1; i < 8 && (c = input()) != EOF; ++i)
						;
					/* eat up white space */
					while ((c = input()) != EOF) {
						if (c != ' ' && c != '\t' &&
						    c != '\f' && c != '\b') {
							unput(c);
							break;
						}
					}
					break;
				case '.':	/* header line */
				case '/':
					/* skip to the end of the line */
					while ((c = input()) != EOF) {
						if (c == '\n') {
							unput(c);
							break;
						}
					}
					break;
				case '\n':	/* empty line */
					unput('\n');
					break;
				case '\t':	/* tab */
					/* eat up white space */
					while ((c = input()) != EOF) {
						if (c != ' ' && c != '\t' &&
						    c != '\f' && c != '\b') {
							unput(c);
							break;
						}
					}
					break;
				}
			}
		eol:
			++cmyylineno;
			cfirst = 0;
			clast = 0;
			if (symbols > 0) {
				return(NEWLINE);
			}
			clineno = cmyylineno;
		}
\'		{	/* character constant */
			multicharconstant('\'');
			goto more;
			/* NOTREACHED */
		}
\"		{	/* string constant */
			multicharconstant('"');
			goto more;
			/* NOTREACHED */
		}
^[ \t\f\b]+	{	/* don't save leading white space */
		}
\#[# \t]*include[ \t]*["<][^"> \t\n\r]+	{ /* #include or Ingres ##include */
			char	*s;
			
			s = strpbrk(yytext, "\"<");
			incfile(s + 1, *s);
			cfirst = s - yytext;
			clast = yyleng;
			if (compress == YES) {
				yytext[0] = '\1';	/* compress the keyword */
			}
			/* avoid multicharconstant call triggered by trailing
			   ", which puts a trailing comment in the database */
			if (*s == '"') {
				int	c;

				while ((c = input()) != EOF) {
					if (c == '"') {
						yytext[yyleng] = '"';
						yytext[++yyleng] = '\0';
						break;
					}
					/* the trailing '"' may be missing */
					if (c == '\n') {
						unput('\n');
						break;
					}
				}
			}
			yymore();
			return(INCLUDE);
			/* NOTREACHED */
		}
\#[ \t]*{identifier}	|	/* preprocessor keyword */
{number}	|	/* number */
.		{	/* punctuation and operators */
		more:	cfirst = yyleng;
			yymore();
		}
%%

void
cinitscanner(srcfile)
char	*srcfile;
{
	char	*s;
	
	if (maxifbraces == NULL) {
		maxifbraces = (int *) mymalloc(miflevel * sizeof(int));
		preifbraces = (int *) mymalloc(miflevel * sizeof(int));
	}
	cfirst = 0;		/* buffer index for first char of symbol */
	clast = 0;		/* buffer index for last char of symbol */
	clineno = 1;		/* symbol line number */
	cmyylineno = 1;		/* input line number */
	arraydimension = NO;	/* inside array dimension declaration */
	bplisting = NO;		/* breakpoint listing */
	braces = 0;		/* unmatched left brace count */
	cesudeftoken = '\0';	/* class/enum/struct/union definition */
	classbraces = 0;	/* class brace count */
	classdef = NO;		/* c++ class definition */
	elseelif = NO;		/* #else or #elif found */
	esudef = NO;		/* enum/struct/union definition */
	esubraces = -1;		/* outermost enum/struct/union brace count */
	externdec = NO;		/* extern declaration */
	fcndef = NO;		/* function definition */
	globalscope = YES;	/* file global scope (outside functions) */
	iflevel = 0;		/* #if nesting level */
	initializer = NO;	/* data initializer */
	initializerbraces = -1;	/* data initializer outer brace count */
	lex = NO;		/* lex file */
	localdef = NO;		/* function/block local definition */
	parens = 0;		/* unmatched left parenthesis count */
	ppdefine = NO;		/* preprocessor define statement */
	psuedoelif = NO;	/* psuedo-#elif */
	oldtype = NO;		/* next identifier is an old type */
	rules = NO;		/* lex/yacc rules */
	structfield = NO;	/* structure field declaration */
	template = NO;		/* function template */
	templateparens = -1;	/* function template outer parentheses count */
	typedefdef = NO;	/* typedef name definition */
	typedefname = NO;	/* typedef name use */
	BEGIN 0;

	/* if this is not a C file */
	if ((s = strrchr(srcfile, '.')) != NULL) {
		switch (*++s) {	/* this switch saves time on C files */
		case 'b':
			if (strcmp(s, "bp") == 0) {	/* breakpoint listing */
				bplisting = YES;
				BEGIN BP;
			}
			break;
		case 'l':
			if (strcmp(s, "l") == 0) {	/* lex */
				lex = YES;
				globalscope = NO;
			}

			break;
		case 'y':
			if (strcmp(s, "y") == 0) {	/* yacc */
				globalscope = NO;
			}
			break;
		}
	}
}

/* getc that ignores comments and RETURN characters */

static int
sourceinput()
{
	register int c;

	if ((c = getc(yyin)) == '/') {
		c = comment();
	}
	if (c == EOF) {
		c = 0;
	}
/* #ifdef __BORLANDC__*/
	if (c == '\r') {
		c = msdosgetc(yyin);
	}
/* #endif*/
	return(c);
}

/* getc that ignores RETURN characters */

static int
noncommentinput()
{
	register int c;

	c = getc(yyin);
	if (c == EOF) {
		c = 0;
	}
/* #ifdef __BORLANDC__*/
	if (c == '\r') {
		c = msdosgetc(yyin);
	}
/* #endif*/
	return(c);
}

static int
comment()
{
	register int	c, lastc;

	do {
		if ((c = getc(yyin)) == '*') {	/* C comment */
			lastc = '\0';
			while ((c = getc(yyin)) != EOF &&
			    (c != '/' || lastc != '*')) { /* fewer '/'s */
				if (c == '\n') {
					++cmyylineno;
				}
				lastc = c;
			}

			if(feof(yyin)) {	/* unterminated comment at end of file */
				c = '\n';
				(void) ungetc(c,yyin);
				break;
			}

			/* return a blank for Reiser cpp token concatenation */
			if ((c = getc(yyin)) == '_' || isalnum(c)) {
				(void) ungetc(c, yyin);
				c = ' ';
				break;
			}
		}
		else if (c == '/') {		/* C++ comment */
			while ((c = getc(yyin)) != EOF && c != '\n') {
				;
			}
			break;
		}
		else {	/* not a comment */
			(void) ungetc(c, yyin);
			c = '/';
			break;
		}
		
	/* there may be an immediately following comment */
	} while (c == '/');
/* #ifdef __BORLANDC__*/
	if (c == '\r') {
		c = msdosgetc(yyin);
		if (c == '/') {
			c = comment();	/* recurse */
		}
	}
/* #endif*/
	return(c);
}

static void
multicharconstant(terminator)
register char	terminator;
{
	register char	c;

	/* scan until the terminator is found */
	while ((c = yytext[yyleng++] = noncommentinput()) != terminator) {
		switch (c) {
		case '\\':	/* escape character */
			if ((yytext[yyleng++] = noncommentinput()) == '\n') {
				++cmyylineno;
			}
			break;
		case '\t':	/* tab character */
		
			/* if not a lex program, continue */
			if (lex == NO) {
				break;
			}
			/* fall through */
			
		case '\n':	/* illegal character */
			
			/* assume the terminator is missing, so put
			   this character back */
			unput(c);
			yytext[--yyleng] = '\0';
			/* fall through */
			
		case EOF:	/* end of file */
			return;
			
		default:
			/* change a control character to a blank */
			if (!isprint(c)) {
				yytext[yyleng - 1] = ' ';
			}
		}
		/* if this token will overflow the line buffer */
		/* note: '\\' may cause yyleng to be > STMTMAX */
		if (yyleng >= STMTMAX) {
			
			/* truncate the token */
			while ((c = noncommentinput()) != EOF) {
				if (c == terminator) {
					unput(c);
					break;
				}
				else if (c == '\n') {
					++cmyylineno;
				}
			}
		}
	}
	yytext[yyleng] = '\0';
}
#ifdef __BORLANDC__

/* getc for MS-DOS that ignores RETURN characters */

static int
msdosgetc(FILE *inputfile)
#else

/* getc for MS-DOS that ignores RETURN characters */

static int
msdosgetc(inputfile)
FILE *inputfile;
#endif
{
	int	c;

	while ((c = getc(inputfile)) == '\r') {
		;
	}
	if (c == EOF) {
		c = 0;
	}
	return(c);
}
/* #endif*/

cyywrap()
{
	return(1);
}
