Skip to content
Snippets Groups Projects
Commit 82318c57 authored by Hans-Peter Nilsson's avatar Hans-Peter Nilsson Committed by Hans-Peter Nilsson
Browse files

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.
parent dfb14cdd
No related branches found
No related tags found
No related merge requests found
......@@ -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\}" ")"
"^" "\\^"
"(" "\\("
")" "\\)"
"[" "\\["
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment