17c478bd9Sstevel@tonic-gate %{
27c478bd9Sstevel@tonic-gate /*
37c478bd9Sstevel@tonic-gate  * CDDL HEADER START
47c478bd9Sstevel@tonic-gate  *
57c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
67c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
77c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
87c478bd9Sstevel@tonic-gate  * with the License.
97c478bd9Sstevel@tonic-gate  *
107c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
117c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
127c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
137c478bd9Sstevel@tonic-gate  * and limitations under the License.
147c478bd9Sstevel@tonic-gate  *
157c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
167c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
177c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
187c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
197c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
207c478bd9Sstevel@tonic-gate  *
217c478bd9Sstevel@tonic-gate  * CDDL HEADER END
227c478bd9Sstevel@tonic-gate  *
237c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate /*	Copyright (c) 1988 AT&T	*/
287c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate /*
317c478bd9Sstevel@tonic-gate  *	cscope - interactive C symbol cross-reference
327c478bd9Sstevel@tonic-gate  *
337c478bd9Sstevel@tonic-gate  *
347c478bd9Sstevel@tonic-gate  *	C symbol scanner
357c478bd9Sstevel@tonic-gate  */
367c478bd9Sstevel@tonic-gate #ident	"@(#)scanner.l	1.2	93/06/07 SMI"
377c478bd9Sstevel@tonic-gate #include "global.h"
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate /* the line counting has been moved from character reading for speed */
407c478bd9Sstevel@tonic-gate /* comments are discarded */
417c478bd9Sstevel@tonic-gate #undef	input
427c478bd9Sstevel@tonic-gate #define	input() \
437c478bd9Sstevel@tonic-gate 	((yytchar = (yytchar = yysptr > yysbuf ? \
447c478bd9Sstevel@tonic-gate 	    *--yysptr : getc(yyin)) == '/' ? comment() : yytchar) == \
457c478bd9Sstevel@tonic-gate 	    EOF ? 0 : toascii(yytchar))
467c478bd9Sstevel@tonic-gate #define	noncommentinput() \
477c478bd9Sstevel@tonic-gate 	((yytchar = yysptr > yysbuf ? *--yysptr : getc(yyin)) == \
487c478bd9Sstevel@tonic-gate 	    EOF ? 0 : yytchar)
497c478bd9Sstevel@tonic-gate #undef	unput
507c478bd9Sstevel@tonic-gate #define	unput(c) (*yysptr++ = (c))
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate /* not a preprocessor line (allow Ingres(TM) "## char var;" lines) */
537c478bd9Sstevel@tonic-gate #define	notpp()	(ppdefine == NO && (*yytext != '#' || yytext[1] == '#'))
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate #define	IFLEVELINC	5	/* #if nesting level size increment */
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate /* keyword text for fast testing of keywords in the scanner */
587c478bd9Sstevel@tonic-gate extern	char	externtext[];
597c478bd9Sstevel@tonic-gate extern	char	typedeftext[];
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate int	first;	/* buffer index for first char of symbol */
627c478bd9Sstevel@tonic-gate int	last;	/* buffer index for last char of symbol */
637c478bd9Sstevel@tonic-gate int	lineno;	/* symbol line number */
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate static	BOOL	arraydimension;		/* inside array dimension declaration */
667c478bd9Sstevel@tonic-gate static	BOOL	bplisting;		/* breakpoint listing */
677c478bd9Sstevel@tonic-gate static	int	braces;			/* unmatched left brace count */
687c478bd9Sstevel@tonic-gate static	int	cesudeftoken;		/* class/enum/struct/union definition */
697c478bd9Sstevel@tonic-gate static	BOOL	classdef;		/* c++ class definition */
707c478bd9Sstevel@tonic-gate static	BOOL	elseelif;		/* #else or #elif found */
717c478bd9Sstevel@tonic-gate static	BOOL	esudef;			/* enum/struct/union definition */
727c478bd9Sstevel@tonic-gate static	int	esubraces;		/* outermost enum/struct/union */
737c478bd9Sstevel@tonic-gate 					/* brace count */
747c478bd9Sstevel@tonic-gate static	BOOL	externdec;		/* extern declaration */
757c478bd9Sstevel@tonic-gate static	BOOL	fcndef;			/* function definition */
767c478bd9Sstevel@tonic-gate static	BOOL	globalscope;		/* file global scope */
777c478bd9Sstevel@tonic-gate 					/* (outside functions) */
787c478bd9Sstevel@tonic-gate static	int	iflevel;		/* #if nesting level */
797c478bd9Sstevel@tonic-gate static	BOOL	initializer;		/* data initializer */
807c478bd9Sstevel@tonic-gate static	int	initializerbraces;	/* data initializer outer brace count */
817c478bd9Sstevel@tonic-gate static	BOOL	lex;			/* lex file */
827c478bd9Sstevel@tonic-gate static	BOOL	localdef;		/* function/block local definition */
837c478bd9Sstevel@tonic-gate static	int	miflevel = IFLEVELINC;	/* maximum #if nesting level */
847c478bd9Sstevel@tonic-gate static	int	*maxifbraces;		/* maximum brace count within #if */
857c478bd9Sstevel@tonic-gate static	int	*preifbraces;		/* brace count before #if */
867c478bd9Sstevel@tonic-gate static	int	parens;			/* unmatched left parenthesis count */
877c478bd9Sstevel@tonic-gate static	BOOL	ppdefine;		/* preprocessor define statement */
887c478bd9Sstevel@tonic-gate static	BOOL	psuedoelif;		/* psuedo-#elif */
897c478bd9Sstevel@tonic-gate static	BOOL	oldtype;		/* next identifier is an old type */
907c478bd9Sstevel@tonic-gate static	BOOL	rules;			/* lex/yacc rules */
917c478bd9Sstevel@tonic-gate static	BOOL	sdl;			/* SDL file */
927c478bd9Sstevel@tonic-gate static	BOOL	structfield;		/* structure field declaration */
937c478bd9Sstevel@tonic-gate static	BOOL	template;		/* function template */
947c478bd9Sstevel@tonic-gate static	int	templateparens;	/* function template outer parentheses count */
957c478bd9Sstevel@tonic-gate static	BOOL	typedefdef;	/* typedef name definition */
967c478bd9Sstevel@tonic-gate static	BOOL	typedefname;	/* typedef name use */
977c478bd9Sstevel@tonic-gate static	int	token;		/* token found */
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate static	BOOL	asy;			/* assembly file */
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate void multicharconstant(char terminator);
1027c478bd9Sstevel@tonic-gate int do_assembly(int token);
1037c478bd9Sstevel@tonic-gate %}
1047c478bd9Sstevel@tonic-gate identifier	[a-zA-Z_][a-zA-Z_0-9]*
1057c478bd9Sstevel@tonic-gate number		\.?[0-9][.0-9a-fA-FlLuUxX]*
1067c478bd9Sstevel@tonic-gate %start SDL
1077c478bd9Sstevel@tonic-gate %a 6000
1087c478bd9Sstevel@tonic-gate %o 11000
1097c478bd9Sstevel@tonic-gate %p 3000
1107c478bd9Sstevel@tonic-gate %%
1117c478bd9Sstevel@tonic-gate %\{		{	/* lex/yacc C declarations/definitions */
1127c478bd9Sstevel@tonic-gate 			globalscope = YES;
1137c478bd9Sstevel@tonic-gate 			goto more;
1147c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
1157c478bd9Sstevel@tonic-gate 		}
1167c478bd9Sstevel@tonic-gate %\}		{
1177c478bd9Sstevel@tonic-gate 			globalscope = NO;
1187c478bd9Sstevel@tonic-gate 			goto more;
1197c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
1207c478bd9Sstevel@tonic-gate 		}
1217c478bd9Sstevel@tonic-gate ^%%		{	/* lex/yacc rules delimiter */
1227c478bd9Sstevel@tonic-gate 			braces = 0;
1237c478bd9Sstevel@tonic-gate 			if (rules == NO) {
1247c478bd9Sstevel@tonic-gate 				rules = YES;
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate 				/* simulate a yylex() or yyparse() definition */
1277c478bd9Sstevel@tonic-gate 				(void) strcat(yytext, " /* ");
1287c478bd9Sstevel@tonic-gate 				first = strlen(yytext);
1297c478bd9Sstevel@tonic-gate 				if (lex == YES) {
1307c478bd9Sstevel@tonic-gate 					(void) strcat(yytext, "yylex");
1317c478bd9Sstevel@tonic-gate 				} else {
1327c478bd9Sstevel@tonic-gate 					/*
1337c478bd9Sstevel@tonic-gate 					 * yacc: yyparse implicitly calls yylex
1347c478bd9Sstevel@tonic-gate 					 */
1357c478bd9Sstevel@tonic-gate 					char *s = " yylex()";
1367c478bd9Sstevel@tonic-gate 					char *cp = s + strlen(s);
1377c478bd9Sstevel@tonic-gate 					while (--cp >= s) {
1387c478bd9Sstevel@tonic-gate 						unput(*cp);
1397c478bd9Sstevel@tonic-gate 					}
1407c478bd9Sstevel@tonic-gate 					(void) strcat(yytext, "yyparse");
1417c478bd9Sstevel@tonic-gate 				}
1427c478bd9Sstevel@tonic-gate 				last = strlen(yytext);
1437c478bd9Sstevel@tonic-gate 				(void) strcat(yytext, " */");
1447c478bd9Sstevel@tonic-gate 				yyleng = strlen(yytext);
1457c478bd9Sstevel@tonic-gate 				yymore();
1467c478bd9Sstevel@tonic-gate 				return (FCNDEF);
1477c478bd9Sstevel@tonic-gate 			} else {
1487c478bd9Sstevel@tonic-gate 				rules = NO;
1497c478bd9Sstevel@tonic-gate 				globalscope = YES;
1507c478bd9Sstevel@tonic-gate 				last = first;
1517c478bd9Sstevel@tonic-gate 				yymore();
1527c478bd9Sstevel@tonic-gate 				return (FCNEND);
1537c478bd9Sstevel@tonic-gate 			}
1547c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
1557c478bd9Sstevel@tonic-gate 		}
1567c478bd9Sstevel@tonic-gate <SDL>(PROCEDURE|STATE)[ \t]+({identifier}|\*)	{ /* SDL procedure or state */
1577c478bd9Sstevel@tonic-gate 			braces = 1;
1587c478bd9Sstevel@tonic-gate 			fcndef = YES;	/* treat as function definition */
1597c478bd9Sstevel@tonic-gate 			token = FCNDEF;
1607c478bd9Sstevel@tonic-gate 			globalscope = NO;
1617c478bd9Sstevel@tonic-gate 			goto findident;
1627c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
1637c478bd9Sstevel@tonic-gate 		}
1647c478bd9Sstevel@tonic-gate <SDL>(CALL|NEXTSTATE)[ \t]+({identifier}|\*)	{ /* SDL call or nextstate */
1657c478bd9Sstevel@tonic-gate 			token = FCNCALL;
1667c478bd9Sstevel@tonic-gate 			goto findident;	/* treat as function call */
1677c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
1687c478bd9Sstevel@tonic-gate 		}
1697c478bd9Sstevel@tonic-gate <SDL>END(PROCEDURE|STATE)[ \t]+({identifier}|\*)	{
1707c478bd9Sstevel@tonic-gate 			/* end of an SDL procedure or state */
1717c478bd9Sstevel@tonic-gate 			goto endstate;	/* treat as the end of a function */
1727c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
1737c478bd9Sstevel@tonic-gate 		}
1747c478bd9Sstevel@tonic-gate \{		{
1757c478bd9Sstevel@tonic-gate 			/* count unmatched left braces for fcn def detection */
1767c478bd9Sstevel@tonic-gate 			++braces;
1777c478bd9Sstevel@tonic-gate 
1787c478bd9Sstevel@tonic-gate 			/*
1797c478bd9Sstevel@tonic-gate 			 * mark an untagged enum/struct/union so its beginning
1807c478bd9Sstevel@tonic-gate 			 * can be found
1817c478bd9Sstevel@tonic-gate 			 */
1827c478bd9Sstevel@tonic-gate 			if (cesudeftoken) {
1837c478bd9Sstevel@tonic-gate 				last = first;
1847c478bd9Sstevel@tonic-gate 				savesymbol(cesudeftoken);
1857c478bd9Sstevel@tonic-gate 				cesudeftoken = '\0';
1867c478bd9Sstevel@tonic-gate 			}
1877c478bd9Sstevel@tonic-gate 			goto more;
1887c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
1897c478bd9Sstevel@tonic-gate 		}
1907c478bd9Sstevel@tonic-gate \#[ \t]*endif/.*[\n\r][ \t\n\r]*#[ \t]*if	{
1917c478bd9Sstevel@tonic-gate 			/*
1927c478bd9Sstevel@tonic-gate 			 * attempt to correct erroneous brace count caused by:
1937c478bd9Sstevel@tonic-gate 			 *
1947c478bd9Sstevel@tonic-gate 			 * #if ...
1957c478bd9Sstevel@tonic-gate 			 * 	... {
1967c478bd9Sstevel@tonic-gate 			 * #endif
1977c478bd9Sstevel@tonic-gate 			 * #if ...
1987c478bd9Sstevel@tonic-gate 			 * 	... {
1997c478bd9Sstevel@tonic-gate 			 * #endif
2007c478bd9Sstevel@tonic-gate 			 */
2017c478bd9Sstevel@tonic-gate 			/* the current #if must not have an #else or #elif */
2027c478bd9Sstevel@tonic-gate 			if (elseelif == YES) {
2037c478bd9Sstevel@tonic-gate 				goto endif;
2047c478bd9Sstevel@tonic-gate 			}
2057c478bd9Sstevel@tonic-gate 			psuedoelif = YES;
2067c478bd9Sstevel@tonic-gate 			goto more;
2077c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
2087c478bd9Sstevel@tonic-gate 		}
2097c478bd9Sstevel@tonic-gate \#[ \t]*ifn?(def)?	{ /* #if, #ifdef or #ifndef */
2107c478bd9Sstevel@tonic-gate 			elseelif = NO;
2117c478bd9Sstevel@tonic-gate 			if (psuedoelif == YES) {
2127c478bd9Sstevel@tonic-gate 				psuedoelif = NO;
2137c478bd9Sstevel@tonic-gate 				goto elif;
2147c478bd9Sstevel@tonic-gate 			}
2157c478bd9Sstevel@tonic-gate 			/*
2167c478bd9Sstevel@tonic-gate 			 * make sure there is room for the current brace count
2177c478bd9Sstevel@tonic-gate 			 */
2187c478bd9Sstevel@tonic-gate 			if (iflevel == miflevel) {
2197c478bd9Sstevel@tonic-gate 				miflevel += IFLEVELINC;
2207c478bd9Sstevel@tonic-gate 				maxifbraces = myrealloc(maxifbraces,
2217c478bd9Sstevel@tonic-gate 				    miflevel * sizeof (int));
2227c478bd9Sstevel@tonic-gate 				preifbraces = myrealloc(preifbraces,
2237c478bd9Sstevel@tonic-gate 				    miflevel * sizeof (int));
2247c478bd9Sstevel@tonic-gate 			}
2257c478bd9Sstevel@tonic-gate 			/* push the current brace count */
2267c478bd9Sstevel@tonic-gate 			preifbraces[iflevel] = braces;
2277c478bd9Sstevel@tonic-gate 			maxifbraces[iflevel++] = 0;
2287c478bd9Sstevel@tonic-gate 			goto more;
2297c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
2307c478bd9Sstevel@tonic-gate 		}
2317c478bd9Sstevel@tonic-gate \#[ \t]*el(se|if)	{ /* #elif or #else */
2327c478bd9Sstevel@tonic-gate 			elseelif = YES;
2337c478bd9Sstevel@tonic-gate 		elif:
2347c478bd9Sstevel@tonic-gate 			if (iflevel > 0) {
2357c478bd9Sstevel@tonic-gate 
2367c478bd9Sstevel@tonic-gate 				/* save the maximum brace count for this #if */
2377c478bd9Sstevel@tonic-gate 				if (braces > maxifbraces[iflevel]) {
2387c478bd9Sstevel@tonic-gate 					maxifbraces[iflevel - 1] = braces;
2397c478bd9Sstevel@tonic-gate 				}
2407c478bd9Sstevel@tonic-gate 				/* restore the brace count to before the #if */
2417c478bd9Sstevel@tonic-gate 				braces = preifbraces[iflevel - 1];
2427c478bd9Sstevel@tonic-gate 			}
2437c478bd9Sstevel@tonic-gate 			goto more;
2447c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
2457c478bd9Sstevel@tonic-gate 		}
2467c478bd9Sstevel@tonic-gate \#[ \t]*endif	{	/* #endif */
2477c478bd9Sstevel@tonic-gate 		endif:
2487c478bd9Sstevel@tonic-gate 			if (iflevel > 0) {
2497c478bd9Sstevel@tonic-gate 
2507c478bd9Sstevel@tonic-gate 				/* get the maximum brace count for this #if */
2517c478bd9Sstevel@tonic-gate 				if (braces < maxifbraces[--iflevel]) {
2527c478bd9Sstevel@tonic-gate 					braces = maxifbraces[iflevel];
2537c478bd9Sstevel@tonic-gate 				}
2547c478bd9Sstevel@tonic-gate 			}
2557c478bd9Sstevel@tonic-gate 			goto more;
2567c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
2577c478bd9Sstevel@tonic-gate 		}
2587c478bd9Sstevel@tonic-gate \}		{
2597c478bd9Sstevel@tonic-gate 			/* could be the last enum member initializer */
2607c478bd9Sstevel@tonic-gate 			if (braces == initializerbraces) {
2617c478bd9Sstevel@tonic-gate 				initializerbraces = -1;
2627c478bd9Sstevel@tonic-gate 				initializer = NO;
2637c478bd9Sstevel@tonic-gate 			}
2647c478bd9Sstevel@tonic-gate 			if (--braces <= 0) {
2657c478bd9Sstevel@tonic-gate 		endstate:
2667c478bd9Sstevel@tonic-gate 				braces = 0;
2677c478bd9Sstevel@tonic-gate 				classdef = NO;
2687c478bd9Sstevel@tonic-gate 			}
2697c478bd9Sstevel@tonic-gate 			/*
2707c478bd9Sstevel@tonic-gate 			 * if the end of an outermost enum/struct/union
2717c478bd9Sstevel@tonic-gate 			 * definition
2727c478bd9Sstevel@tonic-gate 			 */
2737c478bd9Sstevel@tonic-gate 			if (esudef == YES && braces == esubraces) {
2747c478bd9Sstevel@tonic-gate 				esudef = NO;
2757c478bd9Sstevel@tonic-gate 				esubraces = -1;
2767c478bd9Sstevel@tonic-gate 				last = first;
2777c478bd9Sstevel@tonic-gate 				yymore();
2787c478bd9Sstevel@tonic-gate 				return (ESUEND);
2797c478bd9Sstevel@tonic-gate 			}
2807c478bd9Sstevel@tonic-gate 			/* if the end of a function */
2817c478bd9Sstevel@tonic-gate 			if ((braces == 0 || braces == 1 && classdef == YES) &&
2827c478bd9Sstevel@tonic-gate 			    fcndef == YES) {
2837c478bd9Sstevel@tonic-gate 				fcndef = NO;
2847c478bd9Sstevel@tonic-gate 				globalscope = YES;
2857c478bd9Sstevel@tonic-gate 				last = first;
2867c478bd9Sstevel@tonic-gate 				yymore();
2877c478bd9Sstevel@tonic-gate 				return (FCNEND);
2887c478bd9Sstevel@tonic-gate 			}
2897c478bd9Sstevel@tonic-gate 			goto more;
2907c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
2917c478bd9Sstevel@tonic-gate 		}
2927c478bd9Sstevel@tonic-gate \(		{
2937c478bd9Sstevel@tonic-gate 			/*
2947c478bd9Sstevel@tonic-gate 			 * count unmatched left parentheses for function
2957c478bd9Sstevel@tonic-gate 			 * templates
2967c478bd9Sstevel@tonic-gate 			 */
2977c478bd9Sstevel@tonic-gate 			++parens;
2987c478bd9Sstevel@tonic-gate 			goto more;
2997c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
3007c478bd9Sstevel@tonic-gate 		}
3017c478bd9Sstevel@tonic-gate \)		{
3027c478bd9Sstevel@tonic-gate 			if (--parens <= 0) {
3037c478bd9Sstevel@tonic-gate 				parens = 0;
3047c478bd9Sstevel@tonic-gate 			}
3057c478bd9Sstevel@tonic-gate 			/* if the end of a function template */
3067c478bd9Sstevel@tonic-gate 			if (parens == templateparens) {
3077c478bd9Sstevel@tonic-gate 				templateparens = -1;
3087c478bd9Sstevel@tonic-gate 				template = NO;
3097c478bd9Sstevel@tonic-gate 			}
3107c478bd9Sstevel@tonic-gate 			goto more;
3117c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
3127c478bd9Sstevel@tonic-gate 		}
3137c478bd9Sstevel@tonic-gate =		{	/* if a global definition initializer */
3147c478bd9Sstevel@tonic-gate 			if ((globalscope == YES || localdef == YES) &&
3157c478bd9Sstevel@tonic-gate 			    notpp()) {
3167c478bd9Sstevel@tonic-gate 				initializerbraces = braces;
3177c478bd9Sstevel@tonic-gate 				initializer = YES;
3187c478bd9Sstevel@tonic-gate 			}
3197c478bd9Sstevel@tonic-gate 			goto more;
3207c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
3217c478bd9Sstevel@tonic-gate 		}
3227c478bd9Sstevel@tonic-gate :		{	/* if a structure field */
3237c478bd9Sstevel@tonic-gate 			/* note: a pr header has a colon in the date */
3247c478bd9Sstevel@tonic-gate 			if (esudef == YES && notpp()) {
3257c478bd9Sstevel@tonic-gate 				structfield = YES;
3267c478bd9Sstevel@tonic-gate 			}
3277c478bd9Sstevel@tonic-gate 			goto more;
3287c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
3297c478bd9Sstevel@tonic-gate 		}
3307c478bd9Sstevel@tonic-gate \,		{
3317c478bd9Sstevel@tonic-gate 			if (braces == initializerbraces) {
3327c478bd9Sstevel@tonic-gate 				initializerbraces = -1;
3337c478bd9Sstevel@tonic-gate 				initializer = NO;
3347c478bd9Sstevel@tonic-gate 			}
3357c478bd9Sstevel@tonic-gate 			structfield = NO;
3367c478bd9Sstevel@tonic-gate 			goto more;
3377c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
3387c478bd9Sstevel@tonic-gate 		}
3397c478bd9Sstevel@tonic-gate "##"		|	/* start of Ingres(TM) code line */
3407c478bd9Sstevel@tonic-gate ;		{
3417c478bd9Sstevel@tonic-gate 			/* if not in an enum/struct/union declaration */
3427c478bd9Sstevel@tonic-gate 			if (esudef == NO) {
3437c478bd9Sstevel@tonic-gate 				externdec = NO;
3447c478bd9Sstevel@tonic-gate 				typedefdef = NO;
3457c478bd9Sstevel@tonic-gate 				localdef = NO;
3467c478bd9Sstevel@tonic-gate 			}
3477c478bd9Sstevel@tonic-gate 			structfield = NO;
3487c478bd9Sstevel@tonic-gate 			initializer = NO;
3497c478bd9Sstevel@tonic-gate 			oldtype = NO;
3507c478bd9Sstevel@tonic-gate 			goto more;
3517c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
3527c478bd9Sstevel@tonic-gate 		}
3537c478bd9Sstevel@tonic-gate \#[ \t]*define[ \t]+{identifier}	{
3547c478bd9Sstevel@tonic-gate 
3557c478bd9Sstevel@tonic-gate 			/* preprocessor macro or constant definition */
3567c478bd9Sstevel@tonic-gate 			ppdefine = YES;
3577c478bd9Sstevel@tonic-gate 			token = DEFINE;
3587c478bd9Sstevel@tonic-gate 			if (compress == YES) {
3597c478bd9Sstevel@tonic-gate 				/* compress the keyword */
3607c478bd9Sstevel@tonic-gate 				yytext[0] = '\7';
3617c478bd9Sstevel@tonic-gate 			}
3627c478bd9Sstevel@tonic-gate 		findident:
3637c478bd9Sstevel@tonic-gate 			first = yyleng - 1;
3647c478bd9Sstevel@tonic-gate 			while (isalnum(yytext[first]) || yytext[first] == '_') {
3657c478bd9Sstevel@tonic-gate 				--first;
3667c478bd9Sstevel@tonic-gate 			}
3677c478bd9Sstevel@tonic-gate 			++first;
3687c478bd9Sstevel@tonic-gate 			goto iflongline;
3697c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
3707c478bd9Sstevel@tonic-gate 		}
3717c478bd9Sstevel@tonic-gate class[ \t]+{identifier}[ \t\n\ra-zA-Z0-9_():]*\{	{
3727c478bd9Sstevel@tonic-gate 			/* class definition */
3737c478bd9Sstevel@tonic-gate 			classdef = YES;
3747c478bd9Sstevel@tonic-gate 			cesudeftoken = 'c';
3757c478bd9Sstevel@tonic-gate 			REJECT;
3767c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
3777c478bd9Sstevel@tonic-gate 		}
3787c478bd9Sstevel@tonic-gate (enum|struct|union)/([ \t\n\r]+{identifier})?[ \t\n\r]*\{	{
3797c478bd9Sstevel@tonic-gate 			/* enum/struct/union definition */
3807c478bd9Sstevel@tonic-gate 			esudef = YES;
3817c478bd9Sstevel@tonic-gate 			if (esubraces < 0) {
3827c478bd9Sstevel@tonic-gate 				/* if outermost enum/struct/union */
3837c478bd9Sstevel@tonic-gate 				esubraces = braces;
3847c478bd9Sstevel@tonic-gate 			}
3857c478bd9Sstevel@tonic-gate 			cesudeftoken = *(yytext + first);
3867c478bd9Sstevel@tonic-gate 			goto iflongline;
3877c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
3887c478bd9Sstevel@tonic-gate 		}
3897c478bd9Sstevel@tonic-gate {identifier}/[ \t]*\(([ \t\n\ra-zA-Z0-9_*&[\]=,.]*|\([ \ta-zA-Z0-9_*[\],]*\))*\)[ \t\n\r()]*[:a-zA-Z_#{]	{
3907c478bd9Sstevel@tonic-gate 
3917c478bd9Sstevel@tonic-gate 			/*
3927c478bd9Sstevel@tonic-gate 			 * warning: "if (...)" must not overflow yytext, so
3937c478bd9Sstevel@tonic-gate 			 * the content of function argument definitions is
3947c478bd9Sstevel@tonic-gate 			 * restricted, in particular parentheses are
3957c478bd9Sstevel@tonic-gate 			 * not allowed
3967c478bd9Sstevel@tonic-gate 			 */
3977c478bd9Sstevel@tonic-gate 
3987c478bd9Sstevel@tonic-gate 			if (asy) {
3997c478bd9Sstevel@tonic-gate 				/*
4007c478bd9Sstevel@tonic-gate 				 * In assembly files, if it looks like
4017c478bd9Sstevel@tonic-gate 				 * a definition, pass it down as one and we'll
4027c478bd9Sstevel@tonic-gate 				 * take care of it later.
4037c478bd9Sstevel@tonic-gate 				 */
4047c478bd9Sstevel@tonic-gate 				token = FCNDEF;
4057c478bd9Sstevel@tonic-gate 				goto iflongline;
4067c478bd9Sstevel@tonic-gate 			}
4077c478bd9Sstevel@tonic-gate 
4087c478bd9Sstevel@tonic-gate 			/* if a function definition */
4097c478bd9Sstevel@tonic-gate 			/*
4107c478bd9Sstevel@tonic-gate 			 * note: "#define a (b) {" and "#if defined(a)\n#"
4117c478bd9Sstevel@tonic-gate 			 * are not
4127c478bd9Sstevel@tonic-gate 			 */
4137c478bd9Sstevel@tonic-gate 			if (braces == 0 && notpp() && rules == NO ||
4147c478bd9Sstevel@tonic-gate 			    braces == 1 && classdef == YES) {
4157c478bd9Sstevel@tonic-gate 				fcndef = YES;
4167c478bd9Sstevel@tonic-gate 				token = FCNDEF;
4177c478bd9Sstevel@tonic-gate 				globalscope = NO;
4187c478bd9Sstevel@tonic-gate 				goto iflongline;
4197c478bd9Sstevel@tonic-gate 			}
4207c478bd9Sstevel@tonic-gate 			goto iffcncall;
4217c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
4227c478bd9Sstevel@tonic-gate 		}
4237c478bd9Sstevel@tonic-gate {identifier}/[ \t]*\(	{
4247c478bd9Sstevel@tonic-gate 			if (asy) {
4257c478bd9Sstevel@tonic-gate 				/*
4267c478bd9Sstevel@tonic-gate 				 * Macro calls can get here if they have
4277c478bd9Sstevel@tonic-gate 				 * arguments which contain %'s (i.e.,
4287c478bd9Sstevel@tonic-gate 				 * registers).
4297c478bd9Sstevel@tonic-gate 				 */
4307c478bd9Sstevel@tonic-gate 				token = FCNDEF;
4317c478bd9Sstevel@tonic-gate 				goto iflongline;
4327c478bd9Sstevel@tonic-gate 			}
4337c478bd9Sstevel@tonic-gate 
4347c478bd9Sstevel@tonic-gate 			/* if a function call */
4357c478bd9Sstevel@tonic-gate 		iffcncall:
4367c478bd9Sstevel@tonic-gate 			if ((fcndef == YES || ppdefine == YES ||
4377c478bd9Sstevel@tonic-gate 			    rules == YES) && externdec == NO &&
4387c478bd9Sstevel@tonic-gate 			    (localdef == NO || initializer == YES)) {
4397c478bd9Sstevel@tonic-gate 				token = FCNCALL;
4407c478bd9Sstevel@tonic-gate 				goto iflongline;
4417c478bd9Sstevel@tonic-gate 			}
4427c478bd9Sstevel@tonic-gate 			if (template == NO && typedefdef == NO) {
4437c478bd9Sstevel@tonic-gate 				templateparens = parens;
4447c478bd9Sstevel@tonic-gate 				template = YES;
4457c478bd9Sstevel@tonic-gate 			}
4467c478bd9Sstevel@tonic-gate 			token = IDENT;
4477c478bd9Sstevel@tonic-gate 			goto iflongline;
4487c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
4497c478bd9Sstevel@tonic-gate 		}
4507c478bd9Sstevel@tonic-gate (\+\+|--)[ \t]*{identifier}	{	/* prefix increment or decrement */
4517c478bd9Sstevel@tonic-gate 			token = ASSIGNMENT;
4527c478bd9Sstevel@tonic-gate 			goto findident;
4537c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
4547c478bd9Sstevel@tonic-gate 		}
4557c478bd9Sstevel@tonic-gate {identifier}/[ \t]*(\+\+|--)	{	/* postfix increment or decrement */
4567c478bd9Sstevel@tonic-gate 			token = ASSIGNMENT;
4577c478bd9Sstevel@tonic-gate 			goto iflongline;
4587c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
4597c478bd9Sstevel@tonic-gate 		}
4607c478bd9Sstevel@tonic-gate \*[ \t]*{identifier}/[ \t]*[^a-zA-Z0-9_(+-][^+-]	{
4617c478bd9Sstevel@tonic-gate 			/* indirect assignment or dcl */
4627c478bd9Sstevel@tonic-gate 			while (!isalnum(yytext[first]) &&
4637c478bd9Sstevel@tonic-gate 			    yytext[first] != '_') {
4647c478bd9Sstevel@tonic-gate 				++first;
4657c478bd9Sstevel@tonic-gate 			}
4667c478bd9Sstevel@tonic-gate 			goto ident;
4677c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
4687c478bd9Sstevel@tonic-gate 		}
4697c478bd9Sstevel@tonic-gate {identifier}/[ \t\n\r]*(=[^=]|[-+*/%&^|]=|<<=|>>=)	{ /* assignment */
4707c478bd9Sstevel@tonic-gate 			if ((fcndef == YES || ppdefine == YES ||
4717c478bd9Sstevel@tonic-gate 			    rules == YES) && localdef == NO) {
4727c478bd9Sstevel@tonic-gate 				token = ASSIGNMENT;
4737c478bd9Sstevel@tonic-gate 				goto iflongline;
4747c478bd9Sstevel@tonic-gate 			}
4757c478bd9Sstevel@tonic-gate 			goto ident;
4767c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
4777c478bd9Sstevel@tonic-gate 		}
4787c478bd9Sstevel@tonic-gate {identifier}/[* \t\n\r]+[a-zA-Z0-9_]	{	/* possible typedef name use */
4797c478bd9Sstevel@tonic-gate 			if (notpp() && esudef == NO && fcndef == YES &&
4807c478bd9Sstevel@tonic-gate 			    typedefdef == NO && parens == 0) {
4817c478bd9Sstevel@tonic-gate 				char	c, *s = yytext + first - 1;
4827c478bd9Sstevel@tonic-gate 
4837c478bd9Sstevel@tonic-gate 				while (--s >= yytext && (c = *s) != ';' &&
4847c478bd9Sstevel@tonic-gate 				    c != '{') {
4857c478bd9Sstevel@tonic-gate 					if (!isspace(c) && !isalpha(c)) {
4867c478bd9Sstevel@tonic-gate 						goto nottypedefname;
4877c478bd9Sstevel@tonic-gate 					}
4887c478bd9Sstevel@tonic-gate 				}
4897c478bd9Sstevel@tonic-gate 				typedefname = YES;
4907c478bd9Sstevel@tonic-gate 			}
4917c478bd9Sstevel@tonic-gate 		nottypedefname:
4927c478bd9Sstevel@tonic-gate 			/* skip the global/parameter/local tests */
4937c478bd9Sstevel@tonic-gate 			token = IDENT;
4947c478bd9Sstevel@tonic-gate 			goto iflongline;
4957c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
4967c478bd9Sstevel@tonic-gate 		}
4977c478bd9Sstevel@tonic-gate {identifier}	{
4987c478bd9Sstevel@tonic-gate 			struct	keystruct *p;
4997c478bd9Sstevel@tonic-gate 			char	*s;
5007c478bd9Sstevel@tonic-gate 
5017c478bd9Sstevel@tonic-gate 		ident:	token = IDENT;
5027c478bd9Sstevel@tonic-gate 			if (notpp() && externdec == NO &&
5037c478bd9Sstevel@tonic-gate 			    arraydimension == NO && initializer == NO) {
5047c478bd9Sstevel@tonic-gate 
5057c478bd9Sstevel@tonic-gate 				/* if an enum/struct/union member definition */
5067c478bd9Sstevel@tonic-gate 				if (esudef == YES) {
5077c478bd9Sstevel@tonic-gate 					if (structfield == NO) {
5087c478bd9Sstevel@tonic-gate 						token = MEMBERDEF;
5097c478bd9Sstevel@tonic-gate 					}
5107c478bd9Sstevel@tonic-gate 				} else if (typedefdef == YES && oldtype == NO) {
5117c478bd9Sstevel@tonic-gate 					/* if a typedef name */
5127c478bd9Sstevel@tonic-gate 					token = TYPEDEF;
5137c478bd9Sstevel@tonic-gate 				} else if (globalscope == YES &&
5147c478bd9Sstevel@tonic-gate 				    template == NO && oldtype == NO) {
5157c478bd9Sstevel@tonic-gate 					/* if a global definition */
5167c478bd9Sstevel@tonic-gate 					token = GLOBALDEF;
5177c478bd9Sstevel@tonic-gate 				} else if (fcndef == YES && braces == 0) {
5187c478bd9Sstevel@tonic-gate 					/* if a function parameter definition */
5197c478bd9Sstevel@tonic-gate 					token = PARAMETER;
5207c478bd9Sstevel@tonic-gate 				} else if (localdef == YES) {
5217c478bd9Sstevel@tonic-gate 					/* if a local definition */
5227c478bd9Sstevel@tonic-gate 					token = LOCALDEF;
5237c478bd9Sstevel@tonic-gate 				}
5247c478bd9Sstevel@tonic-gate 			}
5257c478bd9Sstevel@tonic-gate 		iflongline:
5267c478bd9Sstevel@tonic-gate 			/* if a long line */
5277c478bd9Sstevel@tonic-gate 			if (yyleng > STMTMAX) {
5287c478bd9Sstevel@tonic-gate 				int	c;
5297c478bd9Sstevel@tonic-gate 
5307c478bd9Sstevel@tonic-gate 				/* skip to the end of the line */
5317c478bd9Sstevel@tonic-gate 				warning("line too long");
5327c478bd9Sstevel@tonic-gate 				while ((c = input()) != LEXEOF) {
5337c478bd9Sstevel@tonic-gate 					if (c == '\n') {
5347c478bd9Sstevel@tonic-gate 						unput(c);
5357c478bd9Sstevel@tonic-gate 						break;
5367c478bd9Sstevel@tonic-gate 					}
5377c478bd9Sstevel@tonic-gate 				}
5387c478bd9Sstevel@tonic-gate 			}
5397c478bd9Sstevel@tonic-gate 			/* truncate a long symbol */
5407c478bd9Sstevel@tonic-gate 			if (yyleng - first > PATLEN) {
5417c478bd9Sstevel@tonic-gate 				warning("symbol too long");
5427c478bd9Sstevel@tonic-gate 				yyleng = first + PATLEN;
5437c478bd9Sstevel@tonic-gate 				yytext[yyleng] = '\0';
5447c478bd9Sstevel@tonic-gate 			}
5457c478bd9Sstevel@tonic-gate 
5467c478bd9Sstevel@tonic-gate 			yymore();
5477c478bd9Sstevel@tonic-gate 
5487c478bd9Sstevel@tonic-gate 			if (asy) {
5497c478bd9Sstevel@tonic-gate 				int t;
5507c478bd9Sstevel@tonic-gate 
5517c478bd9Sstevel@tonic-gate 				last = yyleng;
5527c478bd9Sstevel@tonic-gate 				t = do_assembly(token);
5537c478bd9Sstevel@tonic-gate 				if (t >= 0) {
5547c478bd9Sstevel@tonic-gate 					token = t;
5557c478bd9Sstevel@tonic-gate 					return (token);
5567c478bd9Sstevel@tonic-gate 				}
5577c478bd9Sstevel@tonic-gate 
5587c478bd9Sstevel@tonic-gate 				goto end;
5597c478bd9Sstevel@tonic-gate 			}
5607c478bd9Sstevel@tonic-gate 
5617c478bd9Sstevel@tonic-gate 			/* if a keyword */
5627c478bd9Sstevel@tonic-gate 			if ((p = lookup(yytext + first)) != NULL) {
5637c478bd9Sstevel@tonic-gate 				first = yyleng;
5647c478bd9Sstevel@tonic-gate 				s = p->text;
5657c478bd9Sstevel@tonic-gate 
5667c478bd9Sstevel@tonic-gate 				/* if an extern declaration */
5677c478bd9Sstevel@tonic-gate 				if (s == externtext) {
5687c478bd9Sstevel@tonic-gate 					externdec = YES;
5697c478bd9Sstevel@tonic-gate 				} else if (s == typedeftext) {
5707c478bd9Sstevel@tonic-gate 					/* if a typedef name definition */
5717c478bd9Sstevel@tonic-gate 					typedefdef = YES;
5727c478bd9Sstevel@tonic-gate 					oldtype = YES;
5737c478bd9Sstevel@tonic-gate 				} else if (p->type == DECL && fcndef == YES &&
5747c478bd9Sstevel@tonic-gate 				    typedefdef == NO && parens == 0) {
5757c478bd9Sstevel@tonic-gate 					/* if a local definition */
5767c478bd9Sstevel@tonic-gate 					localdef = YES;
5777c478bd9Sstevel@tonic-gate 				} else if (templateparens == parens &&
5787c478bd9Sstevel@tonic-gate 				    template == YES) {
5797c478bd9Sstevel@tonic-gate 					/*
5807c478bd9Sstevel@tonic-gate 					 * keyword doesn't start a function
5817c478bd9Sstevel@tonic-gate 					 * template
5827c478bd9Sstevel@tonic-gate 					 */
5837c478bd9Sstevel@tonic-gate 					templateparens = -1;
5847c478bd9Sstevel@tonic-gate 					template = NO;
5857c478bd9Sstevel@tonic-gate 				} else {
5867c478bd9Sstevel@tonic-gate 					/*
5877c478bd9Sstevel@tonic-gate 					 * next identifier after typedef was
5887c478bd9Sstevel@tonic-gate 					 * a keyword
5897c478bd9Sstevel@tonic-gate 					 */
5907c478bd9Sstevel@tonic-gate 					oldtype = NO;
5917c478bd9Sstevel@tonic-gate 				}
5927c478bd9Sstevel@tonic-gate 				typedefname = NO;
5937c478bd9Sstevel@tonic-gate 			} else {	/* identifier */
5947c478bd9Sstevel@tonic-gate 				last = yyleng;
5957c478bd9Sstevel@tonic-gate 
5967c478bd9Sstevel@tonic-gate 				/*
5977c478bd9Sstevel@tonic-gate 				 * if an enum/struct/union keyword preceded
5987c478bd9Sstevel@tonic-gate 				 * this ident.
5997c478bd9Sstevel@tonic-gate 				 */
6007c478bd9Sstevel@tonic-gate 				if (esudef == YES && cesudeftoken) {
6017c478bd9Sstevel@tonic-gate 					token = cesudeftoken;
6027c478bd9Sstevel@tonic-gate 					cesudeftoken = '\0';
6037c478bd9Sstevel@tonic-gate 				} else {
6047c478bd9Sstevel@tonic-gate 					oldtype = NO;
6057c478bd9Sstevel@tonic-gate 				}
6067c478bd9Sstevel@tonic-gate 				/* if a local definition using a typedef name */
6077c478bd9Sstevel@tonic-gate 				if (typedefname == YES) {
6087c478bd9Sstevel@tonic-gate 					localdef = YES;
6097c478bd9Sstevel@tonic-gate 				}
6107c478bd9Sstevel@tonic-gate 				typedefname = NO;
6117c478bd9Sstevel@tonic-gate 				return (token);
6127c478bd9Sstevel@tonic-gate 			}
6137c478bd9Sstevel@tonic-gate 
6147c478bd9Sstevel@tonic-gate 		end:
6157c478bd9Sstevel@tonic-gate 			;
6167c478bd9Sstevel@tonic-gate 		}
6177c478bd9Sstevel@tonic-gate \[		{	/* array dimension (don't worry about subscripts) */
6187c478bd9Sstevel@tonic-gate 			arraydimension = YES;
6197c478bd9Sstevel@tonic-gate 			goto more;
6207c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
6217c478bd9Sstevel@tonic-gate 		}
6227c478bd9Sstevel@tonic-gate \]		{
6237c478bd9Sstevel@tonic-gate 			arraydimension = NO;
6247c478bd9Sstevel@tonic-gate 			goto more;
6257c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
6267c478bd9Sstevel@tonic-gate 		}
6277c478bd9Sstevel@tonic-gate \\\n		{	/* preprocessor statement is continued on next line */
6287c478bd9Sstevel@tonic-gate 			goto eol;
6297c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
6307c478bd9Sstevel@tonic-gate 		}
6317c478bd9Sstevel@tonic-gate \n		{	/* end of the line */
6327c478bd9Sstevel@tonic-gate 			if (ppdefine == YES) {	/* end of a #define */
6337c478bd9Sstevel@tonic-gate 				ppdefine = NO;
6347c478bd9Sstevel@tonic-gate 				(void) yyless(yyleng - 1);	/* rescan \n */
6357c478bd9Sstevel@tonic-gate 				last = first;
6367c478bd9Sstevel@tonic-gate 				yymore();
6377c478bd9Sstevel@tonic-gate 				return (DEFINEEND);
6387c478bd9Sstevel@tonic-gate 			}
6397c478bd9Sstevel@tonic-gate 			/*
6407c478bd9Sstevel@tonic-gate 			 * skip the first 8 columns of a breakpoint listing
6417c478bd9Sstevel@tonic-gate 			 * line and skip the file path in the page header
6427c478bd9Sstevel@tonic-gate 			 */
6437c478bd9Sstevel@tonic-gate 			if (bplisting == YES) {
6447c478bd9Sstevel@tonic-gate 				int	c, i;
6457c478bd9Sstevel@tonic-gate 
6467c478bd9Sstevel@tonic-gate 				switch (input()) {
6477c478bd9Sstevel@tonic-gate 				/* tab and EOF just fall through */
6487c478bd9Sstevel@tonic-gate 				case ' ':	/* breakpoint number line */
6497c478bd9Sstevel@tonic-gate 				case '[':
6507c478bd9Sstevel@tonic-gate 					for (i = 1; i < 8 && input() != LEXEOF;
6517c478bd9Sstevel@tonic-gate 					    ++i) {
6527c478bd9Sstevel@tonic-gate 					    /*EMPTY*/
6537c478bd9Sstevel@tonic-gate 					}
6547c478bd9Sstevel@tonic-gate 					break;
6557c478bd9Sstevel@tonic-gate 				case '.':	/* header line */
6567c478bd9Sstevel@tonic-gate 				case '/':
6577c478bd9Sstevel@tonic-gate 					/* skip to the end of the line */
6587c478bd9Sstevel@tonic-gate 					while ((c = input()) != LEXEOF) {
6597c478bd9Sstevel@tonic-gate 						if (c == '\n') {
6607c478bd9Sstevel@tonic-gate 							unput(c);
6617c478bd9Sstevel@tonic-gate 							break;
6627c478bd9Sstevel@tonic-gate 						}
6637c478bd9Sstevel@tonic-gate 					}
6647c478bd9Sstevel@tonic-gate 					break;
6657c478bd9Sstevel@tonic-gate 				case '\n':	/* empty line */
6667c478bd9Sstevel@tonic-gate 					unput('\n');
6677c478bd9Sstevel@tonic-gate 					break;
6687c478bd9Sstevel@tonic-gate 				}
6697c478bd9Sstevel@tonic-gate 			}
6707c478bd9Sstevel@tonic-gate 		eol:
6717c478bd9Sstevel@tonic-gate 			++yylineno;
6727c478bd9Sstevel@tonic-gate 			first = 0;
6737c478bd9Sstevel@tonic-gate 			last = 0;
6747c478bd9Sstevel@tonic-gate 			if (symbols > 0) {
6757c478bd9Sstevel@tonic-gate 				return (NEWLINE);
6767c478bd9Sstevel@tonic-gate 			}
6777c478bd9Sstevel@tonic-gate 			lineno = yylineno;
6787c478bd9Sstevel@tonic-gate 		}
6797c478bd9Sstevel@tonic-gate \'		{	/* character constant */
6807c478bd9Sstevel@tonic-gate 			if (sdl == NO) {
6817c478bd9Sstevel@tonic-gate 				multicharconstant('\'');
6827c478bd9Sstevel@tonic-gate 			}
6837c478bd9Sstevel@tonic-gate 			goto more;
6847c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
6857c478bd9Sstevel@tonic-gate 		}
6867c478bd9Sstevel@tonic-gate \"		{	/* string constant */
6877c478bd9Sstevel@tonic-gate 			multicharconstant('"');
6887c478bd9Sstevel@tonic-gate 			goto more;
6897c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
6907c478bd9Sstevel@tonic-gate 		}
6917c478bd9Sstevel@tonic-gate ^[ \t\f\b]+	{	/* don't save leading white space */
6927c478bd9Sstevel@tonic-gate 		}
6937c478bd9Sstevel@tonic-gate \#[# \t]*include[ \t]*["<][^"> \t\n\r]+	{ /* #include or Ingres ##include */
6947c478bd9Sstevel@tonic-gate 			char	*s;
6957c478bd9Sstevel@tonic-gate 
6967c478bd9Sstevel@tonic-gate 			s = strpbrk(yytext, "\"<");
6977c478bd9Sstevel@tonic-gate 			incfile(s + 1, *s);
6987c478bd9Sstevel@tonic-gate 			first = s - yytext;
6997c478bd9Sstevel@tonic-gate 			last = yyleng;
7007c478bd9Sstevel@tonic-gate 			if (compress == YES) {
7017c478bd9Sstevel@tonic-gate 				/* compress the keyword */
7027c478bd9Sstevel@tonic-gate 				yytext[0] = '\1';
7037c478bd9Sstevel@tonic-gate 			}
7047c478bd9Sstevel@tonic-gate 			/*
7057c478bd9Sstevel@tonic-gate 			 * avoid multicharconstant call triggered by trailing
7067c478bd9Sstevel@tonic-gate 			 * ", which puts a trailing comment in the database
7077c478bd9Sstevel@tonic-gate 			 */
7087c478bd9Sstevel@tonic-gate 			if (*s == '"') {
7097c478bd9Sstevel@tonic-gate 				int	c;
7107c478bd9Sstevel@tonic-gate 
7117c478bd9Sstevel@tonic-gate 				while ((c = input()) != LEXEOF) {
7127c478bd9Sstevel@tonic-gate 					if (c == '"') {
7137c478bd9Sstevel@tonic-gate 						yytext[yyleng] = '"';
7147c478bd9Sstevel@tonic-gate 						yytext[++yyleng] = '\0';
7157c478bd9Sstevel@tonic-gate 						break;
7167c478bd9Sstevel@tonic-gate 					}
7177c478bd9Sstevel@tonic-gate 					/* the trailing '"' may be missing */
7187c478bd9Sstevel@tonic-gate 					if (c == '\n') {
7197c478bd9Sstevel@tonic-gate 						unput('\n');
7207c478bd9Sstevel@tonic-gate 						break;
7217c478bd9Sstevel@tonic-gate 					}
7227c478bd9Sstevel@tonic-gate 				}
7237c478bd9Sstevel@tonic-gate 			}
7247c478bd9Sstevel@tonic-gate 			yymore();
7257c478bd9Sstevel@tonic-gate 			return (INCLUDE);
7267c478bd9Sstevel@tonic-gate 			/* NOTREACHED */
7277c478bd9Sstevel@tonic-gate 		}
7287c478bd9Sstevel@tonic-gate \#[ \t]*pragma[ \t]+weak[ \t]+{identifier} {
7297c478bd9Sstevel@tonic-gate 			ppdefine = YES;
7307c478bd9Sstevel@tonic-gate 			token = DEFINE;
7317c478bd9Sstevel@tonic-gate 			goto findident;
7327c478bd9Sstevel@tonic-gate 
7337c478bd9Sstevel@tonic-gate 			/*NOTREACHED*/
7347c478bd9Sstevel@tonic-gate 		}
7357c478bd9Sstevel@tonic-gate \#[ \t]*{identifier}	|	/* preprocessor keyword */
7367c478bd9Sstevel@tonic-gate {number}	|	/* number */
7377c478bd9Sstevel@tonic-gate .		{	/* punctuation and operators */
7387c478bd9Sstevel@tonic-gate 		more:	first = yyleng;
7397c478bd9Sstevel@tonic-gate 			yymore();
7407c478bd9Sstevel@tonic-gate 		}
7417c478bd9Sstevel@tonic-gate %%
7427c478bd9Sstevel@tonic-gate 
7437c478bd9Sstevel@tonic-gate void
7447c478bd9Sstevel@tonic-gate initscanner(char *srcfile)
7457c478bd9Sstevel@tonic-gate {
7467c478bd9Sstevel@tonic-gate 	char	*s;
7477c478bd9Sstevel@tonic-gate 
7487c478bd9Sstevel@tonic-gate 	if (maxifbraces == NULL) {
7497c478bd9Sstevel@tonic-gate 		maxifbraces = mymalloc(miflevel * sizeof (int));
7507c478bd9Sstevel@tonic-gate 		preifbraces = mymalloc(miflevel * sizeof (int));
7517c478bd9Sstevel@tonic-gate 	}
7527c478bd9Sstevel@tonic-gate 	first = 0;		/* buffer index for first char of symbol */
7537c478bd9Sstevel@tonic-gate 	last = 0;		/* buffer index for last char of symbol */
7547c478bd9Sstevel@tonic-gate 	lineno = 1;		/* symbol line number */
7557c478bd9Sstevel@tonic-gate 	yylineno = 1;		/* input line number */
7567c478bd9Sstevel@tonic-gate 	arraydimension = NO;	/* inside array dimension declaration */
7577c478bd9Sstevel@tonic-gate 	bplisting = NO;		/* breakpoint listing */
7587c478bd9Sstevel@tonic-gate 	braces = 0;		/* unmatched left brace count */
7597c478bd9Sstevel@tonic-gate 	cesudeftoken = '\0';	/* class/enum/struct/union definition */
7607c478bd9Sstevel@tonic-gate 	classdef = NO;		/* c++ class definition */
7617c478bd9Sstevel@tonic-gate 	elseelif = NO;		/* #else or #elif found */
7627c478bd9Sstevel@tonic-gate 	esudef = NO;		/* enum/struct/union definition */
7637c478bd9Sstevel@tonic-gate 	esubraces = -1;		/* outermost enum/struct/union brace count */
7647c478bd9Sstevel@tonic-gate 	externdec = NO;		/* extern declaration */
7657c478bd9Sstevel@tonic-gate 	fcndef = NO;		/* function definition */
7667c478bd9Sstevel@tonic-gate 	globalscope = YES;	/* file global scope (outside functions) */
7677c478bd9Sstevel@tonic-gate 	iflevel = 0;		/* #if nesting level */
7687c478bd9Sstevel@tonic-gate 	initializer = NO;	/* data initializer */
7697c478bd9Sstevel@tonic-gate 	initializerbraces = -1;	/* data initializer outer brace count */
7707c478bd9Sstevel@tonic-gate 	lex = NO;		/* lex file */
7717c478bd9Sstevel@tonic-gate 	localdef = NO;		/* function/block local definition */
7727c478bd9Sstevel@tonic-gate 	parens = 0;		/* unmatched left parenthesis count */
7737c478bd9Sstevel@tonic-gate 	ppdefine = NO;		/* preprocessor define statement */
7747c478bd9Sstevel@tonic-gate 	psuedoelif = NO;	/* psuedo-#elif */
7757c478bd9Sstevel@tonic-gate 	oldtype = NO;		/* next identifier is an old type */
7767c478bd9Sstevel@tonic-gate 	rules = NO;		/* lex/yacc rules */
7777c478bd9Sstevel@tonic-gate 	sdl = NO;		/* SDL file */
7787c478bd9Sstevel@tonic-gate 	structfield = NO;	/* structure field declaration */
7797c478bd9Sstevel@tonic-gate 	template = NO;		/* function template */
7807c478bd9Sstevel@tonic-gate 	templateparens = -1;	/* function template outer parentheses count */
7817c478bd9Sstevel@tonic-gate 	typedefdef = NO;	/* typedef name definition */
7827c478bd9Sstevel@tonic-gate 	typedefname = NO;	/* typedef name use */
7837c478bd9Sstevel@tonic-gate 	asy = NO;		/* assembly file */
7847c478bd9Sstevel@tonic-gate 	BEGIN 0;
7857c478bd9Sstevel@tonic-gate 
7867c478bd9Sstevel@tonic-gate 	/* if this is not a C file */
7877c478bd9Sstevel@tonic-gate 	if ((s = strrchr(srcfile, '.')) != NULL) {
7887c478bd9Sstevel@tonic-gate 		switch (*++s) {	/* this switch saves time on C files */
7897c478bd9Sstevel@tonic-gate 		case 'b':
7907c478bd9Sstevel@tonic-gate 			if (strcmp(s, "bp") == 0) {	/* breakpoint listing */
7917c478bd9Sstevel@tonic-gate 				bplisting = YES;
7927c478bd9Sstevel@tonic-gate 			}
7937c478bd9Sstevel@tonic-gate 			break;
7947c478bd9Sstevel@tonic-gate 		case 'l':
7957c478bd9Sstevel@tonic-gate 			if (strcmp(s, "l") == 0) {	/* lex */
7967c478bd9Sstevel@tonic-gate 				lex = YES;
7977c478bd9Sstevel@tonic-gate 				globalscope = NO;
7987c478bd9Sstevel@tonic-gate 			}
7997c478bd9Sstevel@tonic-gate 			break;
8007c478bd9Sstevel@tonic-gate 		case 'p':
8017c478bd9Sstevel@tonic-gate 		case 's':
8027c478bd9Sstevel@tonic-gate 			if (strcmp(s, "pr") == 0 ||
8037c478bd9Sstevel@tonic-gate 			    strcmp(s, "sd") == 0) {	/* SDL */
8047c478bd9Sstevel@tonic-gate 				sdl = YES;
8057c478bd9Sstevel@tonic-gate 				BEGIN SDL;
8067c478bd9Sstevel@tonic-gate 			} else if (strcmp(s, "s") == 0) {
8077c478bd9Sstevel@tonic-gate 				asy = YES;
8087c478bd9Sstevel@tonic-gate 			}
8097c478bd9Sstevel@tonic-gate 			break;
8107c478bd9Sstevel@tonic-gate 		case 'y':
8117c478bd9Sstevel@tonic-gate 			if (strcmp(s, "y") == 0) {	/* yacc */
8127c478bd9Sstevel@tonic-gate 				globalscope = NO;
8137c478bd9Sstevel@tonic-gate 			}
8147c478bd9Sstevel@tonic-gate 			break;
8157c478bd9Sstevel@tonic-gate 		}
8167c478bd9Sstevel@tonic-gate 	}
8177c478bd9Sstevel@tonic-gate }
8187c478bd9Sstevel@tonic-gate 
8197c478bd9Sstevel@tonic-gate int
8207c478bd9Sstevel@tonic-gate comment(void)
8217c478bd9Sstevel@tonic-gate {
8227c478bd9Sstevel@tonic-gate 	int	c, lastc;
8237c478bd9Sstevel@tonic-gate 
8247c478bd9Sstevel@tonic-gate 	do {
8257c478bd9Sstevel@tonic-gate 		if ((c = getc(yyin)) == '*') {	/* C comment */
8267c478bd9Sstevel@tonic-gate 			lastc = '\0';
8277c478bd9Sstevel@tonic-gate 			while ((c = getc(yyin)) != EOF &&
8287c478bd9Sstevel@tonic-gate 			    (c != '/' || lastc != '*')) { /* fewer '/'s */
8297c478bd9Sstevel@tonic-gate 				if (c == '\n') {
8307c478bd9Sstevel@tonic-gate 					++yylineno;
8317c478bd9Sstevel@tonic-gate 				}
8327c478bd9Sstevel@tonic-gate 				lastc = c;
8337c478bd9Sstevel@tonic-gate 			}
8347c478bd9Sstevel@tonic-gate 			/* return a blank for Reiser cpp token concatenation */
8357c478bd9Sstevel@tonic-gate 			if ((c = getc(yyin)) == '_' || isalnum(c)) {
8367c478bd9Sstevel@tonic-gate 				(void) ungetc(c, yyin);
8377c478bd9Sstevel@tonic-gate 				c = ' ';
8387c478bd9Sstevel@tonic-gate 				break;
8397c478bd9Sstevel@tonic-gate 			}
8407c478bd9Sstevel@tonic-gate 		} else if (c == '/') {		/* C++ comment */
8417c478bd9Sstevel@tonic-gate 			while ((c = getc(yyin)) != EOF && c != '\n') {
8427c478bd9Sstevel@tonic-gate 				/*EMPTY*/
8437c478bd9Sstevel@tonic-gate 			}
8447c478bd9Sstevel@tonic-gate 			break;
8457c478bd9Sstevel@tonic-gate 		} else {	/* not a comment */
8467c478bd9Sstevel@tonic-gate 			(void) ungetc(c, yyin);
8477c478bd9Sstevel@tonic-gate 			c = '/';
8487c478bd9Sstevel@tonic-gate 			break;
8497c478bd9Sstevel@tonic-gate 		}
8507c478bd9Sstevel@tonic-gate 
8517c478bd9Sstevel@tonic-gate 		/* there may be an immediately following comment */
8527c478bd9Sstevel@tonic-gate 	} while (c == '/');
8537c478bd9Sstevel@tonic-gate 	return (c);
8547c478bd9Sstevel@tonic-gate }
8557c478bd9Sstevel@tonic-gate 
8567c478bd9Sstevel@tonic-gate void
8577c478bd9Sstevel@tonic-gate multicharconstant(char terminator)
8587c478bd9Sstevel@tonic-gate {
8597c478bd9Sstevel@tonic-gate 	char	c;
8607c478bd9Sstevel@tonic-gate 
8617c478bd9Sstevel@tonic-gate 	/* scan until the terminator is found */
8627c478bd9Sstevel@tonic-gate 	while ((c = yytext[yyleng++] = noncommentinput()) != terminator) {
8637c478bd9Sstevel@tonic-gate 		switch (c) {
8647c478bd9Sstevel@tonic-gate 		case '\\':	/* escape character */
8657c478bd9Sstevel@tonic-gate 			if ((yytext[yyleng++] = noncommentinput()) == '\n') {
8667c478bd9Sstevel@tonic-gate 				++yylineno;
8677c478bd9Sstevel@tonic-gate 			}
8687c478bd9Sstevel@tonic-gate 			break;
8697c478bd9Sstevel@tonic-gate 		case '\t':	/* tab character */
8707c478bd9Sstevel@tonic-gate 
8717c478bd9Sstevel@tonic-gate 			/* if not a lex program, continue */
8727c478bd9Sstevel@tonic-gate 			if (lex == NO) {
8737c478bd9Sstevel@tonic-gate 				break;
8747c478bd9Sstevel@tonic-gate 			}
8757c478bd9Sstevel@tonic-gate 			/* FALLTHROUGH */
8767c478bd9Sstevel@tonic-gate 
8777c478bd9Sstevel@tonic-gate 		case '\n':	/* illegal character */
8787c478bd9Sstevel@tonic-gate 
8797c478bd9Sstevel@tonic-gate 			/*
8807c478bd9Sstevel@tonic-gate 			 * assume the terminator is missing, so put
8817c478bd9Sstevel@tonic-gate 			 * this character back
8827c478bd9Sstevel@tonic-gate 			 */
8837c478bd9Sstevel@tonic-gate 			unput(c);
8847c478bd9Sstevel@tonic-gate 			yytext[--yyleng] = '\0';
8857c478bd9Sstevel@tonic-gate 			/* FALLTHROUGH */
8867c478bd9Sstevel@tonic-gate 
8877c478bd9Sstevel@tonic-gate 		case LEXEOF:	/* end of file */
8887c478bd9Sstevel@tonic-gate 			return;
8897c478bd9Sstevel@tonic-gate 
8907c478bd9Sstevel@tonic-gate 		default:
8917c478bd9Sstevel@tonic-gate 			/* change a control character to a blank */
8927c478bd9Sstevel@tonic-gate 			if (!isprint(c)) {
8937c478bd9Sstevel@tonic-gate 				yytext[yyleng - 1] = ' ';
8947c478bd9Sstevel@tonic-gate 			}
8957c478bd9Sstevel@tonic-gate 		}
8967c478bd9Sstevel@tonic-gate 		/* if this token will overflow the line buffer */
8977c478bd9Sstevel@tonic-gate 		/* note: '\\' may cause yyleng to be > STMTMAX */
8987c478bd9Sstevel@tonic-gate 		if (yyleng >= STMTMAX) {
8997c478bd9Sstevel@tonic-gate 
9007c478bd9Sstevel@tonic-gate 			/* truncate the token */
9017c478bd9Sstevel@tonic-gate 			while ((c = noncommentinput()) != LEXEOF) {
9027c478bd9Sstevel@tonic-gate 				if (c == terminator) {
9037c478bd9Sstevel@tonic-gate 					unput(c);
9047c478bd9Sstevel@tonic-gate 					break;
9057c478bd9Sstevel@tonic-gate 				} else if (c == '\n') {
9067c478bd9Sstevel@tonic-gate 					++yylineno;
9077c478bd9Sstevel@tonic-gate 				}
9087c478bd9Sstevel@tonic-gate 			}
9097c478bd9Sstevel@tonic-gate 		}
9107c478bd9Sstevel@tonic-gate 	}
9117c478bd9Sstevel@tonic-gate 	yytext[yyleng] = '\0';
9127c478bd9Sstevel@tonic-gate }
9137c478bd9Sstevel@tonic-gate 
9147c478bd9Sstevel@tonic-gate /*
9157c478bd9Sstevel@tonic-gate  * Returns true if the beginning of str matches ident, and the next character
9167c478bd9Sstevel@tonic-gate  * is not alphanumeric and not an underscore.
9177c478bd9Sstevel@tonic-gate  */
9187c478bd9Sstevel@tonic-gate int
9197c478bd9Sstevel@tonic-gate identcmp(const char *str, const char *ident)
9207c478bd9Sstevel@tonic-gate {
9217c478bd9Sstevel@tonic-gate 	int n = strlen(ident);
9227c478bd9Sstevel@tonic-gate 
9237c478bd9Sstevel@tonic-gate 	return (strncmp(str, ident, n) == 0 && !isalnum(str[n]) &&
9247c478bd9Sstevel@tonic-gate 	    str[n] != '_');
9257c478bd9Sstevel@tonic-gate }
9267c478bd9Sstevel@tonic-gate 
9277c478bd9Sstevel@tonic-gate /*
9287c478bd9Sstevel@tonic-gate  * Here we want to
9297c478bd9Sstevel@tonic-gate  *   - Make *ENTRY*() macro invocations into function definitions
9307c478bd9Sstevel@tonic-gate  *   - Make SET_SIZE() macro calls into function ends
9317c478bd9Sstevel@tonic-gate  *   - Make "call sym" instructions into function calls
9327c478bd9Sstevel@tonic-gate  *   - Eliminate C function definitions (since they are for lint, and we want
9337c478bd9Sstevel@tonic-gate  *     only one definition for each function)
9347c478bd9Sstevel@tonic-gate  */
9357c478bd9Sstevel@tonic-gate int
9367c478bd9Sstevel@tonic-gate do_assembly(int token)
9377c478bd9Sstevel@tonic-gate {
9387c478bd9Sstevel@tonic-gate 	/* Handle C keywords? */
9397c478bd9Sstevel@tonic-gate 
9407c478bd9Sstevel@tonic-gate 	switch (token) {
9417c478bd9Sstevel@tonic-gate 
9427c478bd9Sstevel@tonic-gate 	case FCNDEF:
9437c478bd9Sstevel@tonic-gate 		/*
9447c478bd9Sstevel@tonic-gate 		 * We have a symbol that looks like a C function definition or
9457c478bd9Sstevel@tonic-gate 		 * call.  (Note: That can include assembly instructions with
9467c478bd9Sstevel@tonic-gate 		 * the right parentheses.)  We want to convert assembly macro
9477c478bd9Sstevel@tonic-gate 		 * invocations to function calls, and ignore everything else.
9487c478bd9Sstevel@tonic-gate 		 * Since we technically can't tell the difference, we'll use
9497c478bd9Sstevel@tonic-gate 		 * an all-caps heuristic.
9507c478bd9Sstevel@tonic-gate 		 *
9517c478bd9Sstevel@tonic-gate 		 * ... except for SET_SIZE macros, since they will precede
9527c478bd9Sstevel@tonic-gate 		 * FUNCEND tokens, which will break code in find.c which
9537c478bd9Sstevel@tonic-gate 		 * assumes that FUNCEND tokens occur at the beginning of
9547c478bd9Sstevel@tonic-gate 		 * lines.
9557c478bd9Sstevel@tonic-gate 		 */
9567c478bd9Sstevel@tonic-gate 		if (isupper(yytext[first]) && strcmp(yytext, "SET_SIZE") != 0)
9577c478bd9Sstevel@tonic-gate 			return (FCNCALL);
9587c478bd9Sstevel@tonic-gate 
9597c478bd9Sstevel@tonic-gate 		/* Don't return a token. */
9607c478bd9Sstevel@tonic-gate 		return (-1);
9617c478bd9Sstevel@tonic-gate 
9627c478bd9Sstevel@tonic-gate 	case GLOBALDEF:
9637c478bd9Sstevel@tonic-gate 	case IDENT:
9647c478bd9Sstevel@tonic-gate 		/* Macro arguments come down as global variable definitions. */
9657c478bd9Sstevel@tonic-gate 
9667c478bd9Sstevel@tonic-gate 		if (identcmp(yytext, "ENTRY") ||
9677c478bd9Sstevel@tonic-gate 		    identcmp(yytext, "ENTRY2") ||
9687c478bd9Sstevel@tonic-gate 		    identcmp(yytext, "ENTRY_NP") ||
9697c478bd9Sstevel@tonic-gate 		    identcmp(yytext, "ENTRY_NP2") ||
9707c478bd9Sstevel@tonic-gate 		    identcmp(yytext, "RTENTRY") ||
9717c478bd9Sstevel@tonic-gate 		    identcmp(yytext, "ALTENTRY")) {
9727c478bd9Sstevel@tonic-gate 			/*
9737c478bd9Sstevel@tonic-gate 			 * Identifiers on lines beginning with *ENTRY* macros
9747c478bd9Sstevel@tonic-gate 			 * are actually function definitions.
9757c478bd9Sstevel@tonic-gate 			 */
9767c478bd9Sstevel@tonic-gate 			return (FCNDEF);
9777c478bd9Sstevel@tonic-gate 		}
9787c478bd9Sstevel@tonic-gate 
9797c478bd9Sstevel@tonic-gate 		if (identcmp(yytext, "SET_SIZE")) {
9807c478bd9Sstevel@tonic-gate 			/*
9817c478bd9Sstevel@tonic-gate 			 * Identifiers on lines beginning with SET_SIZE are
9827c478bd9Sstevel@tonic-gate 			 * actually function ends.
9837c478bd9Sstevel@tonic-gate 			 */
9847c478bd9Sstevel@tonic-gate 			return (FCNEND);
9857c478bd9Sstevel@tonic-gate 		}
9867c478bd9Sstevel@tonic-gate 
9877c478bd9Sstevel@tonic-gate 		if (first != 0 && identcmp(yytext, "call")) {
9887c478bd9Sstevel@tonic-gate 			/*
9897c478bd9Sstevel@tonic-gate 			 * Make this a function call.  We exclude first == 0,
9907c478bd9Sstevel@tonic-gate 			 * because that happens when we're looking at "call"
9917c478bd9Sstevel@tonic-gate 			 * itself.  (Then we'd get function calls to "call"
9927c478bd9Sstevel@tonic-gate 			 * everywhere.)
9937c478bd9Sstevel@tonic-gate 			 */
9947c478bd9Sstevel@tonic-gate 			return (FCNCALL);
9957c478bd9Sstevel@tonic-gate 		}
9967c478bd9Sstevel@tonic-gate 
997*92e800cbSToomas Soome 		/* FALLTHROUGH */
998*92e800cbSToomas Soome 
9997c478bd9Sstevel@tonic-gate 	default:
10007c478bd9Sstevel@tonic-gate 		/* Default to normal behavior. */
10017c478bd9Sstevel@tonic-gate 		return (token);
10027c478bd9Sstevel@tonic-gate 	}
10037c478bd9Sstevel@tonic-gate }
1004