public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-6509] testsuite: Provide means to regexp in multiline patterns
@ 2023-03-07  0:12 Hans-Peter Nilsson
  0 siblings, 0 replies; only message in thread
From: Hans-Peter Nilsson @ 2023-03-07  0:12 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:82318c57607ca983742630c9884e5d30920a3ce1

commit r13-6509-g82318c57607ca983742630c9884e5d30920a3ce1
Author: Hans-Peter Nilsson <hp@axis.com>
Date:   Fri Feb 24 20:07:23 2023 +0100

    testsuite: Provide means to regexp in multiline patterns
    
    Those multi-line-patterns are literal.  Sometimes a regexp
    needs to be matched.  This is a start: just three elements
    are supported: "(" ")" and the compound ")?" (and on second
    thought, it can be argued that "(...)" alone is not useful).
    Note that Tcl "string map" is documented to have the desired
    effect: a once-over but no re-recognitions of previously
    replaced mapped elements.  Also, drop a doubled "containing".
    
    testsuite:
            * lib/multiline.exp (_build_multiline_regex): Map
            "{re:" to "(", similarly ")?" from ":re?}" and the
            same without question mark.

Diff:
---
 gcc/testsuite/lib/multiline.exp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/lib/multiline.exp b/gcc/testsuite/lib/multiline.exp
index cfd928f6e28..73621a0bdbd 100644
--- a/gcc/testsuite/lib/multiline.exp
+++ b/gcc/testsuite/lib/multiline.exp
@@ -297,7 +297,7 @@ proc _get_lines { filename first_line last_line } {
 
 # Convert $multiline from a list of strings to a multiline regex
 # We need to support matching arbitrary followup text on each line,
-# to deal with comments containing containing DejaGnu directives.
+# to deal with comments containing DejaGnu directives.
 
 proc _build_multiline_regex { multiline index } {
     verbose "_build_multiline_regex: $multiline $index" 4
@@ -307,7 +307,10 @@ proc _build_multiline_regex { multiline index } {
 	verbose "  line: $line" 4
 
 	# We need to escape "^" and other regexp metacharacters.
-	set line [string map {"^" "\\^"
+	set line [string map {"\{re:" "("
+	                      ":re?\}" ")?"
+	                      ":re\}" ")"
+	                      "^" "\\^"
 	                      "(" "\\("
 	                      ")" "\\)"
 	                      "[" "\\["

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-07  0:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-07  0:12 [gcc r13-6509] testsuite: Provide means to regexp in multiline patterns Hans-Peter Nilsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).