X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/c66bde989c72461b5ca17917a47f91441a3f3347..d3acad8d49c680092bcc259f9ae0af4e1ec53847:/usr/src/usr.bin/ctags/yacc.c diff --git a/usr/src/usr.bin/ctags/yacc.c b/usr/src/usr.bin/ctags/yacc.c index c8910ba42d..b7d73e4675 100644 --- a/usr/src/usr.bin/ctags/yacc.c +++ b/usr/src/usr.bin/ctags/yacc.c @@ -6,26 +6,32 @@ */ #ifndef lint -static char sccsid[] = "@(#)yacc.c 8.1 (Berkeley) %G%"; +static char sccsid[] = "@(#)yacc.c 8.2 (Berkeley) %G%"; #endif /* not lint */ +#include +#include #include #include + #include "ctags.h" /* * y_entries: * find the yacc tags and put them in. */ +void y_entries() { - register int c; - register char *sp; - register bool in_rule; + int c; + char *sp; + bool in_rule; char tok[MAXTOKEN]; - while (GETC(!=,EOF)) - switch ((char)c) { + in_rule = NO; + + while (GETC(!=, EOF)) + switch (c) { case '\n': SETLINE; /* FALLTHROUGH */ @@ -35,7 +41,7 @@ y_entries() case '\t': break; case '{': - if (skip_key((int)'}')) + if (skip_key('}')) in_rule = NO; break; case '\'': @@ -44,42 +50,41 @@ y_entries() in_rule = NO; break; case '%': - if (GETC(==,'%')) + if (GETC(==, '%')) return; - (void)ungetc(c,inf); + (void)ungetc(c, inf); break; case '/': - if (GETC(==,'*')) + if (GETC(==, '*')) skip_comment(); else - (void)ungetc(c,inf); + (void)ungetc(c, inf); break; case '|': case ';': in_rule = NO; break; default: - if (in_rule || !isalpha(c) && c != (int)'.' - && c != (int)'_') + if (in_rule || !isalpha(c) && c != '.' && c != '_') break; sp = tok; *sp++ = c; - while (GETC(!=,EOF) && (intoken(c) || c == (int)'.')) + while (GETC(!=, EOF) && (intoken(c) || c == '.')) *sp++ = c; *sp = EOS; getline(); /* may change before ':' */ while (iswhite(c)) { - if (c == (int)'\n') + if (c == '\n') SETLINE; - if (GETC(==,EOF)) + if (GETC(==, EOF)) return; } - if (c == (int)':') { - pfnote(tok,lineno); + if (c == ':') { + pfnote(tok, lineno); in_rule = YES; } else - (void)ungetc(c,inf); + (void)ungetc(c, inf); } } @@ -87,10 +92,11 @@ y_entries() * toss_yysec -- * throw away lines up to the next "\n%%\n" */ +void toss_yysec() { - register int c, /* read character */ - state; + int c; /* read character */ + int state; /* * state == 0 : waiting @@ -99,20 +105,21 @@ toss_yysec() * state == 3 : recieved second % */ lineftell = ftell(inf); - for (state = 0;GETC(!=,EOF);) - switch ((char)c) { - case '\n': - ++lineno; - lineftell = ftell(inf); - if (state == 3) /* done! */ - return; - state = 1; /* start over */ - break; - case '%': - if (state) /* if 1 or 2 */ - ++state; /* goto 3 */ - break; - default: - state = 0; /* reset */ + for (state = 0; GETC(!=, EOF);) + switch (c) { + case '\n': + ++lineno; + lineftell = ftell(inf); + if (state == 3) /* done! */ + return; + state = 1; /* start over */ + break; + case '%': + if (state) /* if 1 or 2 */ + ++state; /* goto 3 */ + break; + default: + state = 0; /* reset */ + break; } }