public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Hans-Peter Nilsson <hp@axis.com>
To: <gcc-patches@gcc.gnu.org>
Cc: <mikestump@comcast.net>
Subject: Ping: [PATCH 1/2] testsuite: Provide means to regexp in multiline patterns
Date: Sat, 4 Mar 2023 02:58:25 +0100	[thread overview]
Message-ID: <20230304015825.56CC220420@pchp3.se.axis.com> (raw)
In-Reply-To: <20230224191603.3935F20447@pchp3.se.axis.com> (message from Hans-Peter Nilsson on Fri, 24 Feb 2023 20:16:03 +0100)

Ping...

> From: Hans-Peter Nilsson <hp@axis.com>
> Date: Fri, 24 Feb 2023 20:16:03 +0100
> 
> Ok to commit?
> -- >8 --
> 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 "(", ":re}" to ")" and ":re?}" to ")?".
> ---
>  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 5eccf2bbebc1..f746bc3a618e 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\}" ")"
> +	                      "^" "\\^"
>  	                      "(" "\\("
>  	                      ")" "\\)"
>  	                      "[" "\\["
> -- 
> 2.30.2
> 

  reply	other threads:[~2023-03-04  1:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24 19:16 Hans-Peter Nilsson
2023-03-04  1:58 ` Hans-Peter Nilsson [this message]
2023-03-06 10:05   ` Ping: " Mike Stump
2023-03-07  0:32     ` Hans-Peter Nilsson
2023-03-07 14:34       ` Martin Liška

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230304015825.56CC220420@pchp3.se.axis.com \
    --to=hp@axis.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mikestump@comcast.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).