From: kaashoek Date: Thu, 7 Jan 1988 15:52:52 +0000 (+0000) Subject: Comments added X-Git-Tag: release-5-5~3670 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=a92a93bc54c9e7f3fc71c4fb82bc689fc4059ce0;p=ack.git Comments added --- diff --git a/util/ceg/as_parser/conversion.c b/util/ceg/as_parser/conversion.c index 7b9dfc6e0..5f2b45168 100644 --- a/util/ceg/as_parser/conversion.c +++ b/util/ceg/as_parser/conversion.c @@ -1,3 +1,8 @@ +/* This file contains functions to handle %d, %$, %dist constructs in the + * as_table. + */ + + pr_text_with_conversions( str) char *str; { @@ -15,6 +20,9 @@ char *str; char *next_conversion( str) char *str; + +/* Look for a %-sign, but not in a comment or string! */ + { char *match(); @@ -29,18 +37,24 @@ char *str; return( *str == '%' ? str : (char *)0); } + char *match( c, str) char c, *str; + +/* Look for charcter 'c', but watch out for things like \n */ + { while ( *str && ( *str != c || *(str-1) == '\\')) str++; return( *str ? str : str-1); } + char *match_bracket( str) char *str; /* find ')', but look at nesting '('-')' pairs, return position of ')'. + * Skip strings and comments. */ { int depth; @@ -75,7 +89,7 @@ char *pr_conversion( str) char *str; /* str points to '%'-sign, returns pointer to first character AFTER the - * conversion + * conversion. %$ will result in a call of eval(), %d will call dist(). */ { char *start, *ptr, *match_bracket(), *find();