Annotation For lib/minirivet/minirivet.tcl

Lines of lib/minirivet/minirivet.tcl from check-in f09ab16ca1 that are changed by the sequence of edits moving toward check-in 9b0190676f:

                         1: #! /usr/bin/env tclsh
                         2: 
                         3: namespace eval ::minirivet {}
                         4: 
                         5: proc ::minirivet::parseStringToCode {string} {
f09ab16ca1 2019-05-08    6: 	set fixMap [list]
f09ab16ca1 2019-05-08    7: 	foreach char [list "\{" "\}" "\\"] {
f09ab16ca1 2019-05-08    8: 		lappend fixMap $char "\}; puts -nonewline \"\\$char\"; puts -nonewline \{"
f09ab16ca1 2019-05-08    9: 	}
f09ab16ca1 2019-05-08   10: 
                        11: 	set code ""
                        12: 	while {$string ne ""} {
                        13: 		set endIndex [string first "<?" $string]
                        14: 		if {$endIndex == -1} {
                        15: 			set endIndex [expr {[string length $string] + 1}]
                        16: 		}
                        17: 
f09ab16ca1 2019-05-08   18: 
f09ab16ca1 2019-05-08   19: 		append code "puts -nonewline \{" [string map $fixMap [string range $string 0 $endIndex-1]] "\}; "
                        20: 		set string [string range $string $endIndex end]
                        21: 		set endIndex [string first "?>" $string]
                        22: 		if {$endIndex == -1} {
                        23: 			set endIndex [expr {[string length $string] + 1}]
                        24: 		}
                        25: 
                        26: 		set work [string range $string 0 2]
                        27: 		if {$work eq "<?="} {
                        28: 			set startIndex 3
                        29: 			append code "puts -nonewline [string trim [string range $string 3 $endIndex-1]]; "
                        30: 		} else {
                        31: 			append code [string range $string 2 $endIndex-1] "\n"
                        32: 		}
                        33: 
                        34: 		set string [string range $string $endIndex+2 end]
                        35: 
                        36: 
                        37: 	}
                        38: 
                        39: 	return $code
                        40: }
                        41: 
                        42: proc ::minirivet::parseString {string} {
                        43: 	set code [parseStringToCode $string]
                        44: 	tailcall namespace eval ::request $code
                        45: }
                        46: 
                        47: proc ::minirivet::parse {file} {
                        48: 	set fd [open $file]
                        49: 	set data [read $fd]
                        50: 	close $fd
                        51: 	tailcall parseString $data
                        52: }
                        53: 
                        54: package provide minirivet 1