summaryrefslogtreecommitdiffstats
path: root/usr.bin/indent/lexi.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2000-12-09 09:45:09 +0000
committerobrien <obrien@FreeBSD.org>2000-12-09 09:45:09 +0000
commitae466e022e32b4b72435351b39db7c596626315c (patch)
tree1b668963aef728cdd7b1a89fc512e215658ac433 /usr.bin/indent/lexi.c
parentb010dd915757f9b97f10d341fcb18ec6bacd1e56 (diff)
downloadFreeBSD-src-ae466e022e32b4b72435351b39db7c596626315c.zip
FreeBSD-src-ae466e022e32b4b72435351b39db7c596626315c.tar.gz
"Implement -[n]fcb (formatting of block comments) and attempt to implement
no-space=after-sizeof (not optional) and no-space-after 'struct foo *' (not optional). Without these, indent unKNFizes even more perfectly KNF code." Submitted by: bde
Diffstat (limited to 'usr.bin/indent/lexi.c')
-rw-r--r--usr.bin/indent/lexi.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/usr.bin/indent/lexi.c b/usr.bin/indent/lexi.c
index 7a0929f..2db3e0a 100644
--- a/usr.bin/indent/lexi.c
+++ b/usr.bin/indent/lexi.c
@@ -35,6 +35,7 @@
#ifndef lint
static char sccsid[] = "@(#)lexi.c 8.1 (Berkeley) 6/6/93";
+static char rcsid[] = "@(#)$FreeBSD$";
#endif /* not lint */
/*
@@ -58,7 +59,7 @@ struct templ {
int rwcode;
};
-struct templ specials[100] =
+struct templ specials[1000] =
{
"switch", 1,
"case", 2,
@@ -88,6 +89,8 @@ struct templ specials[100] =
"else", 6,
"do", 6,
"sizeof", 7,
+ "const", 9,
+ "volatile", 9,
0, 0
};
@@ -257,18 +260,27 @@ lexi()
return (casestmt);
case 3: /* a "struct" */
- if (ps.p_l_follow)
- break; /* inside parens: cast */
+ /*
+ * Next time around, we may want to know that we have had a
+ * 'struct'
+ */
l_struct = true;
/*
- * Next time around, we will want to know that we have had a
- * 'struct'
+ * Fall through to test for a cast, function prototype or
+ * sizeof().
*/
case 4: /* one of the declaration keywords */
if (ps.p_l_follow) {
ps.cast_mask |= 1 << ps.p_l_follow;
- break; /* inside parens: cast */
+
+ /*
+ * Forget that we saw `struct' if we're in a sizeof().
+ */
+ if (ps.sizeof_mask)
+ l_struct = false;
+
+ break; /* inside parens: cast, prototype or sizeof() */
}
last_code = decl;
return (decl);
OpenPOWER on IntegriCloud