]> granicus.if.org Git - re2c/commitdiff
run_tests.sh: tried to clarify regexp that splits options from filename.
authorUlya Trofimovich <skvadrik@gmail.com>
Thu, 15 Oct 2015 13:54:17 +0000 (14:54 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Thu, 15 Oct 2015 13:54:17 +0000 (14:54 +0100)
Note: should keep to POSIX, so no '+' or '?' is allowed.

re2c/run_tests.sh.in

index 5fb131da96af7599df9ba0b7e626c16ef9f6234b..b0740451c63abd8ea7eb178dec5fe29a2013366f 100644 (file)
@@ -115,7 +115,15 @@ run_pack() {
                fi
                local outc="${outx%.re}.c"
 
-               local switches=`basename "$x" | sed -e 's/^[^.]*\.\(.*\)\.re$/-\1/g' -e 's/^[^-].*//g' -e 's/\([^ ]\)--/\1 --/g' -e 's/(\([^)]*\))/ \1/g' -e 's/- //g'`
+               # filename (dot short* (long arg?)*)? ext
+               # must keep to POSIX standard: no syntactic sugar like +,?, etc.
+               # if you change this regexp, try it with 'sed --posix'
+               local switches=`basename "$x" | LC_ALL=C sed \
+                       -e 's/^[^.]*\.re$//g' \
+                       -e 's/^[^.]*\.\(.*\)\.re$/\1/g' \
+                       -e 's/^\([^-]\)/-\1/' \
+                       -e 's/--\([^ (-]*\)/ --\1/g' \
+                       -e 's/(\([^)]*\))/ \1/g'`
                local switches="$switches -o $outc"
                # enable warnings globally
                local switches="$switches -W"