maint: avoid \] in REs

* cfg.mk (sc_dd_max_sym_length, sc_prohibit_man_see_also_period):
Do not rely on undefined interpretation of \] in regular expressions.
This commit is contained in:
Paul Eggert 2022-06-03 19:25:59 -07:00
parent 0ae619f349
commit 93e099e4c3
3 changed files with 6 additions and 6 deletions

6
cfg.mk
View File

@ -76,8 +76,8 @@ sc_dd_O_FLAGS:
dd_c = $(srcdir)/src/dd.c
sc_dd_max_sym_length:
ifneq ($(wildcard $(dd_c)),)
@len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \
@len=$$( (sed -n '/conversions\[] =$$/,/^};/p' $(dd_c);\
sed -n '/flags\[] =$$/,/^};/p' $(dd_c) ) \
|sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p'| wc -L);\
max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
|tr -d '"' | wc -L); \
@ -496,7 +496,7 @@ sc_ensure_comma_after_id_est:
# a period. Check the first line after each "SEE ALSO" line in man/*.x:
sc_prohibit_man_see_also_period:
@grep -nB1 '\.$$' $$($(VC_LIST_EXCEPT) | grep 'man/.*\.x$$') \
| grep -A1 -e '-\[SEE ALSO\]' | grep '\.$$' && \
| grep -A1 -e '-\[SEE ALSO]' | grep '\.$$' && \
{ echo '$(ME): do not end "SEE ALSO" section with a period' \
1>&2; exit 1; } || :

View File

@ -672,7 +672,7 @@ same_para (int c)
/* Read a line from input file F, given first non-blank character C
after the prefix, and the following indent, and break it into words.
A word is a maximal non-empty string of non-white characters. A word
ending in [.?!]["')\]]* and followed by end-of-line or at least two
ending in [.?!][])"']* and followed by end-of-line or at least two
spaces ends a sentence, as in emacs.
Return the first non-blank character of the next line. */

View File

@ -825,7 +825,7 @@ find_bracketed_repeat (const struct E_string *es, size_t start_idx,
}
/* Return true if the string at ES->s[IDX] matches the regular
expression '\*[0-9]*\]', false otherwise. The string does not
expression '\*[0-9]*]', false otherwise. The string does not
match if any of its characters are escaped. */
ATTRIBUTE_PURE
@ -942,7 +942,7 @@ build_spec_list (const struct E_string *es, struct Spec_list *result)
try_bracketed_repeat:
/* Determine whether this is a bracketed repeat range
matching the RE \[.\*(dec_or_oct_number)?\]. */
matching the RE \[.\*(dec_or_oct_number)?]. */
err = find_bracketed_repeat (es, i + 1, &char_to_repeat,
&repeat_count,
&closing_bracket_idx);