Deleted Added
full compact
lexi.c (93440) lexi.c (98771)
1/*
2 * Copyright (c) 1985 Sun Microsystems, Inc.
3 * Copyright (c) 1980, 1993
4 * The Regents of the University of California. All rights reserved.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36#if 0
37#ifndef lint
38static char sccsid[] = "@(#)lexi.c 8.1 (Berkeley) 6/6/93";
39static const char rcsid[] =
1/*
2 * Copyright (c) 1985 Sun Microsystems, Inc.
3 * Copyright (c) 1980, 1993
4 * The Regents of the University of California. All rights reserved.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36#if 0
37#ifndef lint
38static char sccsid[] = "@(#)lexi.c 8.1 (Berkeley) 6/6/93";
39static const char rcsid[] =
40 "$FreeBSD: head/usr.bin/indent/lexi.c 93440 2002-03-30 17:10:20Z dwmalone $";
40 "$FreeBSD: head/usr.bin/indent/lexi.c 98771 2002-06-24 17:40:27Z jmallett $";
41#endif /* not lint */
42#endif
43
44/*
45 * Here we have the token scanner for indent. It scans off one token and puts
46 * it in the global variable "token". It returns a code, indicating the type
47 * of token scanned.
48 */

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

148 /* Scan an alphanumeric token */
149 if (chartype[(int)*buf_ptr] == alphanum || (buf_ptr[0] == '.' && isdigit(buf_ptr[1]))) {
150 /*
151 * we have a character or number
152 */
153 const char *j; /* used for searching thru list of
154 *
155 * reserved words */
41#endif /* not lint */
42#endif
43
44/*
45 * Here we have the token scanner for indent. It scans off one token and puts
46 * it in the global variable "token". It returns a code, indicating the type
47 * of token scanned.
48 */

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

148 /* Scan an alphanumeric token */
149 if (chartype[(int)*buf_ptr] == alphanum || (buf_ptr[0] == '.' && isdigit(buf_ptr[1]))) {
150 /*
151 * we have a character or number
152 */
153 const char *j; /* used for searching thru list of
154 *
155 * reserved words */
156 register struct templ *p;
156 struct templ *p;
157
158 if (isdigit(*buf_ptr) || (buf_ptr[0] == '.' && isdigit(buf_ptr[1]))) {
159 int seendot = 0,
160 seenexp = 0,
161 seensfx = 0;
162 if (*buf_ptr == '0' &&
163 (buf_ptr[1] == 'x' || buf_ptr[1] == 'X')) {
164 *e_token++ = *buf_ptr++;

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

310 case 7:
311 ps.sizeof_keyword = true;
312 default: /* all others are treated like any other
313 * identifier */
314 return (ident);
315 } /* end of switch */
316 } /* end of if (found_it) */
317 if (*buf_ptr == '(' && ps.tos <= 1 && ps.ind_level == 0) {
157
158 if (isdigit(*buf_ptr) || (buf_ptr[0] == '.' && isdigit(buf_ptr[1]))) {
159 int seendot = 0,
160 seenexp = 0,
161 seensfx = 0;
162 if (*buf_ptr == '0' &&
163 (buf_ptr[1] == 'x' || buf_ptr[1] == 'X')) {
164 *e_token++ = *buf_ptr++;

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

310 case 7:
311 ps.sizeof_keyword = true;
312 default: /* all others are treated like any other
313 * identifier */
314 return (ident);
315 } /* end of switch */
316 } /* end of if (found_it) */
317 if (*buf_ptr == '(' && ps.tos <= 1 && ps.ind_level == 0) {
318 register char *tp = buf_ptr;
318 char *tp = buf_ptr;
319 while (tp < buf_end)
320 if (*tp++ == ')' && (*tp == ';' || *tp == ','))
321 goto not_proc;
322 strncpy(ps.procname, token, sizeof ps.procname - 1);
323 ps.in_parameter_declaration = 1;
324 rparen_count = 1;
325 not_proc:;
326 }

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

583}
584
585/*
586 * Add the given keyword to the keyword table, using val as the keyword type
587 */
588void
589addkey(char *key, int val)
590{
319 while (tp < buf_end)
320 if (*tp++ == ')' && (*tp == ';' || *tp == ','))
321 goto not_proc;
322 strncpy(ps.procname, token, sizeof ps.procname - 1);
323 ps.in_parameter_declaration = 1;
324 rparen_count = 1;
325 not_proc:;
326 }

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

583}
584
585/*
586 * Add the given keyword to the keyword table, using val as the keyword type
587 */
588void
589addkey(char *key, int val)
590{
591 register struct templ *p = specials;
591 struct templ *p = specials;
592 while (p->rwd)
593 if (p->rwd[0] == key[0] && strcmp(p->rwd, key) == 0)
594 return;
595 else
596 p++;
597 if (p >= specials + sizeof specials / sizeof specials[0])
598 return; /* For now, table overflows are silently
599 * ignored */
600 p->rwd = key;
601 p->rwcode = val;
602 p[1].rwd = 0;
603 p[1].rwcode = 0;
604}
592 while (p->rwd)
593 if (p->rwd[0] == key[0] && strcmp(p->rwd, key) == 0)
594 return;
595 else
596 p++;
597 if (p >= specials + sizeof specials / sizeof specials[0])
598 return; /* For now, table overflows are silently
599 * ignored */
600 p->rwd = key;
601 p->rwcode = val;
602 p[1].rwd = 0;
603 p[1].rwcode = 0;
604}