22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
}
if {[info exists ::minirivet::_outputVariable]} {
append $::minirivet::_outputVariable $string
}
return
}
proc ::minirivet::parseStringToCode {string} {
set code ""
while {$string ne ""} {
set endIndex [string first "<?" $string]
if {$endIndex == -1} {
set endIndex [expr {[string length $string] + 1}]
}
append code [list ::minirivet::_emitOutput [string range $string 0 $endIndex-1]] "; "
set string [string range $string $endIndex end]
set endIndex [string first "?>" $string]
if {$endIndex == -1} {
set endIndex [expr {[string length $string] + 1}]
}
set work [string range $string 0 2]
if {$work eq "<?="} {
set startIndex 3
append code "::minirivet::_emitOutput [string trim [string range $string 3 $endIndex-1]]; "
} else {
append code [string range $string 2 $endIndex-1] "\n"
}
set string [string range $string $endIndex+2 end]
|
|
>
>
>
>
|
|
|
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
}
if {[info exists ::minirivet::_outputVariable]} {
append $::minirivet::_outputVariable $string
}
return
}
proc ::minirivet::parseStringToCode {string {outputCommand ""}} {
if {$outputCommand eq ""} {
set outputCommand [list ::minirivet::_emitOutput]
}
set code ""
while {$string ne ""} {
set endIndex [string first "<?" $string]
if {$endIndex == -1} {
set endIndex [expr {[string length $string] + 1}]
}
append code [list {*}$outputCommand [string range $string 0 $endIndex-1]] "; "
set string [string range $string $endIndex end]
set endIndex [string first "?>" $string]
if {$endIndex == -1} {
set endIndex [expr {[string length $string] + 1}]
}
set work [string range $string 0 2]
if {$work eq "<?="} {
set startIndex 3
append code "$outputCommand [string trim [string range $string 3 $endIndex-1]]; "
} else {
append code [string range $string 2 $endIndex-1] "\n"
}
set string [string range $string $endIndex+2 end]
|