lexi.c (f9287a9d85e47b4ac0c2ed7891d0b9d472f36243) lexi.c (9522d0b0d2c9418330de71422a6b4688cb000de6)
1/*-
2 * SPDX-License-Identifier: BSD-4-Clause
3 *
4 * Copyright (c) 1985 Sun Microsystems, Inc.
5 * Copyright (c) 1980, 1993
6 * The Regents of the University of California. All rights reserved.
7 * All rights reserved.
8 *

--- 353 unchanged lines hidden (view full) ---

362 return (funcname);
363 not_proc:;
364 }
365 /*
366 * The following hack attempts to guess whether or not the current
367 * token is in fact a declaration keyword -- one that has been
368 * typedefd
369 */
1/*-
2 * SPDX-License-Identifier: BSD-4-Clause
3 *
4 * Copyright (c) 1985 Sun Microsystems, Inc.
5 * Copyright (c) 1980, 1993
6 * The Regents of the University of California. All rights reserved.
7 * All rights reserved.
8 *

--- 353 unchanged lines hidden (view full) ---

362 return (funcname);
363 not_proc:;
364 }
365 /*
366 * The following hack attempts to guess whether or not the current
367 * token is in fact a declaration keyword -- one that has been
368 * typedefd
369 */
370 if (((*buf_ptr == '*' && buf_ptr[1] != '=') || isalpha(*buf_ptr) || *buf_ptr == '_')
371 && !state->p_l_follow
372 && !state->block_init
373 && (state->last_token == rparen || state->last_token == semicolon ||
374 state->last_token == decl ||
375 state->last_token == lbrace || state->last_token == rbrace)) {
370 else if (!state->p_l_follow && !state->block_init &&
371 !state->in_stmt &&
372 ((*buf_ptr == '*' && buf_ptr[1] != '=') ||
373 isalpha((unsigned char)*buf_ptr)) &&
374 (state->last_token == semicolon || state->last_token == lbrace ||
375 state->last_token == rbrace)) {
376 state->keyword = 4; /* a type name */
377 state->last_u_d = true;
378 return decl;
379 }
380 if (state->last_token == decl) /* if this is a declared variable,
381 * then following sign is unary */
382 state->last_u_d = true; /* will make "int a -1" work */
383 return (ident); /* the ident is not in the list */

--- 191 unchanged lines hidden (view full) ---

575 fill_buffer();
576 }
577 if (*buf_ptr == '=')
578 *e_token++ = *buf_ptr++;
579 code = (state->last_u_d ? unary_op : binary_op);
580 unary_delim = true;
581 break;
582
376 state->keyword = 4; /* a type name */
377 state->last_u_d = true;
378 return decl;
379 }
380 if (state->last_token == decl) /* if this is a declared variable,
381 * then following sign is unary */
382 state->last_u_d = true; /* will make "int a -1" work */
383 return (ident); /* the ident is not in the list */

--- 191 unchanged lines hidden (view full) ---

575 fill_buffer();
576 }
577 if (*buf_ptr == '=')
578 *e_token++ = *buf_ptr++;
579 code = (state->last_u_d ? unary_op : binary_op);
580 unary_delim = true;
581 break;
582
583 case '*':
584 unary_delim = true;
585 if (!state->last_u_d) {
586 if (*buf_ptr == '=')
587 *e_token++ = *buf_ptr++;
588 code = binary_op;
589 break;
590 }
591 while (*buf_ptr == '*' || isspace((unsigned char)*buf_ptr)) {
592 if (*buf_ptr == '*')
593 *e_token++ = *buf_ptr;
594 if (++buf_ptr >= buf_end)
595 fill_buffer();
596 }
597 if (ps.in_decl) {
598 char *tp = buf_ptr;
599
600 while (isalpha((unsigned char)*tp) ||
601 isspace((unsigned char)*tp)) {
602 if (++tp >= buf_end)
603 fill_buffer();
604 }
605 if (*tp == '(')
606 ps.procname[0] = ' ';
607 }
608 code = unary_op;
609 break;
610
583 default:
584 if (token[0] == '/' && *buf_ptr == '*') {
585 /* it is start of comment */
586 *e_token++ = '*';
587
588 if (++buf_ptr >= buf_end)
589 fill_buffer();
590

--- 69 unchanged lines hidden ---
611 default:
612 if (token[0] == '/' && *buf_ptr == '*') {
613 /* it is start of comment */
614 *e_token++ = '*';
615
616 if (++buf_ptr >= buf_end)
617 fill_buffer();
618

--- 69 unchanged lines hidden ---