diff options
Diffstat (limited to 'tools/regexpTestLib.tcl')
| -rw-r--r-- | tools/regexpTestLib.tcl | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/tools/regexpTestLib.tcl b/tools/regexpTestLib.tcl index 71dc909..86f2a3e 100644 --- a/tools/regexpTestLib.tcl +++ b/tools/regexpTestLib.tcl @@ -4,7 +4,7 @@ # spencer2regexp.tcl, which are programs written to convert Henry # Spencer's test suite to tcl test files. # -# Copyright © 1996 Sun Microsystems, Inc. +# Copyright (c) 1996 by Sun Microsystems, Inc. proc readInputFile {} { global inFileName @@ -17,13 +17,13 @@ proc readInputFile {} { set len [string length $line] - if {($len > 0) && ([string index $line [expr {$len - 1}]] == "\\")} { + if {($len > 0) && ([string index $line [expr $len - 1]] == "\\")} { if {[info exists lineArray(c$i)] == 0} { set lineArray(c$i) 1 } else { incr lineArray(c$i) } - set line [string range $line 0 [expr {$len - 2}]] + set line [string range $line 0 [expr $len - 2]] append lineArray($i) $line continue } @@ -42,8 +42,8 @@ proc readInputFile {} { # # strings with embedded @'s are truncated -# unpreceded @'s are replaced by {} -# +# unpreceeded @'s are replaced by {} +# proc removeAts {ls} { set len [llength $ls] set newLs {} @@ -94,7 +94,7 @@ proc writeOutputFile {numLines fcn} { global outFileName global lineArray - # open output file and write file header info to it. + # open output file and write file header info to it. set fileId [open $outFileName w] @@ -105,7 +105,7 @@ proc writeOutputFile {numLines fcn} { puts $fileId "# errors. No output means no errors were found. Setting VERBOSE to" puts $fileId "# -1 will run tests that are known to fail." puts $fileId "#" - puts $fileId "# Copyright © 1998 Sun Microsystems, Inc." + puts $fileId "# Copyright (c) 1998 Sun Microsystems, Inc." puts $fileId "#" puts $fileId "# See the file \"license.terms\" for information on usage and redistribution" puts $fileId "# of this file, and for a DISCLAIMER OF ALL WARRANTIES." @@ -133,7 +133,7 @@ proc writeOutputFile {numLines fcn} { puts $fileId $currentLine incr srcLineNum $lineArray(c$lineNum) incr lineNum - continue + continue } set len [llength $currentLine] @@ -144,7 +144,7 @@ proc writeOutputFile {numLines fcn} { puts $fileId "\n" incr srcLineNum $lineArray(c$lineNum) incr lineNum - continue + continue } if {($len < 3)} { puts "warning: test is too short --\n\t$currentLine" @@ -192,7 +192,7 @@ proc convertTestLine {currentLine len lineNum srcLineNum} { # if and \r substitutions are made, do not wrap re, flags, # str, and result in braces - set noBraces [regsub -all {R} $currentLine {\\\x0D} currentLine] + set noBraces [regsub -all {R} $currentLine {\\\u000D} currentLine] regsub -all {T} $currentLine {\\t} currentLine regsub -all {V} $currentLine {\\v} currentLine if {[regexp {=} $flags] == 1} { @@ -204,26 +204,26 @@ proc convertTestLine {currentLine len lineNum srcLineNum} { # find the test result - set numVars [expr {$len - 3}] + set numVars [expr $len - 3] set vars {} set vals {} set result 0 set v 0 - + if {[regsub {\*} "$flags" "" newFlags] == 1} { # an error is expected - + if {[string compare $str "EMPTY"] == 0} { # empty regexp is not an error # skip this test - + return "\# skipping the empty-re test from line $srcLineNum\n" } set flags $newFlags set result "\{1 \{[convertErrCode $str]\}\}" } elseif {$numVars > 0} { # at least 1 match is made - + if {[regexp {s} $flags] == 1} { set result "\{0 1\}" } else { @@ -240,7 +240,7 @@ proc convertTestLine {currentLine len lineNum srcLineNum} { } } else { # no match is made - + set result "\{0 0\}" } @@ -248,16 +248,16 @@ proc convertTestLine {currentLine len lineNum srcLineNum} { set cmd [prepareCmd $flags $re $str $vars $noBraces] if {$cmd == -1} { - return "\# skipping test with metasyntax from line $srcLineNum\n" + return "\# skipping test with metasyntax from line $srcLineNum\n" } set test "test regexp-1.$srcLineNum \{converted from line $srcLineNum\} \{\n" append test "\tcatch {unset var}\n" - append test "\tlist \[catch \{\n" - append test "\t\tset match \[$cmd\]\n" - append test "\t\tlist \$match $vals\n" - append test "\t\} msg\] \$msg\n" - append test "\} $result\n" + append test "\tlist \[catch \{ \n" + append test "\t\tset match \[$cmd\] \n" + append test "\t\tlist \$match $vals \n" + append test "\t\} msg\] \$msg \n" + append test "\} $result \n" return $test } |
