mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-19 11:23:46 +00:00
Discussion of these changes can be found on the Mercury developers
mailing list archives from June 2018.
COPYING.LIB:
Add a special linking exception to the LGPL.
*:
Update references to COPYING.LIB.
Clean up some minor errors that have accumulated in copyright
messages.
77 lines
1.6 KiB
Awk
Executable File
77 lines
1.6 KiB
Awk
Executable File
#! /usr/bin/gawk -f
|
|
#
|
|
# Copyright (C) 2002 The University of Melbourne
|
|
# Copyright (C) 2018 The Mercury team.
|
|
# This file is distributed under the terms specified in COPYING.LIB.
|
|
|
|
# This is a gawk program that attempts to mirror what test_regex does
|
|
# for global search and replace. It scans the files test_regex.in
|
|
# and test_regex.exp and tests for differences between the results
|
|
# obtained by gawk and those obtained by regex. It exits with a non-zero
|
|
# return code if any differences are detected.
|
|
|
|
BEGIN {
|
|
IN = "test_regex.in"
|
|
EXP = "test_regex.exp"
|
|
regex = ""
|
|
|
|
while(getline lineIN < IN) {
|
|
|
|
if(lineIN ~ "set_regex") {
|
|
regexp = strip(lineIN)
|
|
}
|
|
else if(lineIN ~ "try_match") {
|
|
|
|
string = strip(lineIN)
|
|
gawk = string
|
|
gsub(regexp, "<&>", gawk)
|
|
|
|
while(getline lineEXP < EXP) {
|
|
|
|
if(lineEXP ~ "change_all") {
|
|
regex = strip(lineEXP)
|
|
if(regex != gawk) {
|
|
print "pattern \"" regexp "\""
|
|
print "string \"" string "\""
|
|
print "regex \"" regex "\""
|
|
print "gawk \"" gawk "\""
|
|
print ""
|
|
|
|
failed = 1
|
|
}
|
|
|
|
break
|
|
}
|
|
else if(lineEXP ~ "^all matches *: \\[\\]$") {
|
|
if(gawk != string) {
|
|
print "pattern \"" regexp "\""
|
|
print "string \"" string "\""
|
|
print "regex finds no match"
|
|
print "gawk \"" gawk "\""
|
|
print ""
|
|
|
|
failed = 1
|
|
}
|
|
|
|
while(getline lineEXP < EXP) {
|
|
if(lineEXP ~ "") { break }
|
|
}
|
|
|
|
break
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
exit failed
|
|
}
|
|
|
|
# Remove the outermost level of quotation from a string.
|
|
#
|
|
function strip(l) {
|
|
sub(/^[^\"]*\"/, "", l)
|
|
sub(/\"[^\"]*$/, "", l)
|
|
gsub(/\\\\/, "\\", l)
|
|
return l
|
|
}
|