summaryrefslogtreecommitdiffstats
path: root/usr.bin/vgrind/vfontedpr.c
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1996-10-18 14:13:18 +0000
committerjoerg <joerg@FreeBSD.org>1996-10-18 14:13:18 +0000
commite9d8333cac1727cd103717773a1d431522322d3d (patch)
tree8ba07061eb7199f93227492816406dcd0da95945 /usr.bin/vgrind/vfontedpr.c
parent193247f80b8792ef4219660d8739d903d43bbd86 (diff)
downloadFreeBSD-src-e9d8333cac1727cd103717773a1d431522322d3d.zip
FreeBSD-src-e9d8333cac1727cd103717773a1d431522322d3d.tar.gz
Some cleanup:
. correct a typo in regexp.c, . implement a new "nc" (non-comment) feature to describe exceptions from the comment detection; there were problems in Perl with the $# operator that could not be solved by any other means, . prevent blocklevel from becoming negative (due to earlier misdetected sequences), this is probably a workaround for the problem described in PR # bin/1785, . update the Perl description to use the "nc" feature, . update the man page for the "nc" and the undocumented "ab"/"ae" features.
Diffstat (limited to 'usr.bin/vgrind/vfontedpr.c')
-rw-r--r--usr.bin/vgrind/vfontedpr.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/usr.bin/vgrind/vfontedpr.c b/usr.bin/vgrind/vfontedpr.c
index 3be249b..bd153a8 100644
--- a/usr.bin/vgrind/vfontedpr.c
+++ b/usr.bin/vgrind/vfontedpr.c
@@ -117,6 +117,7 @@ char *l_combeg; /* string introducing a comment */
char *l_comend; /* string ending a comment */
char l_escape; /* character used to escape characters */
char *l_keywds[BUFSIZ/2]; /* keyword table address */
+char *l_nocom; /* regexp for non-comments */
char *l_prcbeg; /* regular expr for procedure begin */
char *l_strbeg; /* delimiter for string constant */
char *l_strend; /* delimiter for string constant */
@@ -274,6 +275,8 @@ main(argc, argv)
l_chrbeg = convexp(cp);
cgetustr(defs, "le", &cp);
l_chrend = convexp(cp);
+ cgetustr(defs, "nc", &cp);
+ l_nocom = convexp(cp);
l_escape = '\\';
l_onecase = (cgetcap(defs, "oc", ':') != NULL);
l_toplex = (cgetcap(defs, "tl", ':') != NULL);
@@ -358,6 +361,7 @@ putScp(os)
char *chrptr; /* end of a character const delimiter */
char *blksptr; /* end of a lexical block start */
char *blkeptr; /* end of a lexical block end */
+ char *nocomptr; /* end of a non-comment delimiter */
_start = os; /* remember the start for expmatch */
_escaped = FALSE;
@@ -385,6 +389,17 @@ skip:
acmptr = expmatch (s, l_acmbeg, dummy);
strptr = expmatch (s, l_strbeg, dummy);
chrptr = expmatch (s, l_chrbeg, dummy);
+ nocomptr = expmatch (s, l_nocom, dummy);
+
+ /* start of non-comment? */
+ if (nocomptr != NIL)
+ if ((nocomptr <= comptr || comptr == NIL)
+ && (nocomptr <= acmptr || acmptr == NIL)) {
+ /* continue after non-comment */
+ putKcp (s, nocomptr-1, FALSE);
+ s = nocomptr;
+ continue;
+ }
/* start of a comment? */
if (comptr != NIL)
@@ -445,7 +460,8 @@ skip:
if (blkeptr < blksptr || blksptr == NIL) {
putKcp (s, blkeptr - 1, FALSE);
s = blkeptr;
- blklevel--;
+ if (blklevel > 0 /* sanity */)
+ blklevel--;
if (psptr >= 0 && plstack[psptr] >= blklevel) {
/* end of current procedure */
@@ -619,6 +635,9 @@ putcp(c)
case '\f':
break;
+ case '\r':
+ break;
+
case '{':
ps("\\*(+K{\\*(-K");
break;
OpenPOWER on IntegriCloud