1
2
3
4
5
6
7
8
9
10
11
12
13
|
#! /usr/bin/env tclsh
namespace eval ::minirivet {}
proc ::minirivet::parseString {string} {
set fixMap [list]
foreach char [list "\{" "\}" "\\"] {
lappend fixMap $char "\}; puts -nonewline \"\\$char\"; puts -nonewline \{"
}
set code ""
while {$string ne ""} {
|
|
<
|
1
2
3
4
5
6
7
8
9
10
11
12
|
#! /usr/bin/env tclsh
namespace eval ::minirivet {}
proc ::minirivet::parseStringToCode {string} {
set fixMap [list]
foreach char [list "\{" "\}" "\\"] {
lappend fixMap $char "\}; puts -nonewline \"\\$char\"; puts -nonewline \{"
}
set code ""
while {$string ne ""} {
|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
}
set string [string range $string $endIndex+2 end]
}
tailcall namespace eval ::request $code
}
proc ::minirivet::parse {file} {
set fd [open $file]
set data [read $fd]
close $fd
tailcall parseString $data
}
package provide minirivet 1
|
>
>
>
>
>
|
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
}
set string [string range $string $endIndex+2 end]
}
return $code
}
proc ::minirivet::parseString {string} {
set code [parseStringToCode $string]
tailcall namespace eval ::request $code
}
proc ::minirivet::parse {file} {
set fd [open $file]
set data [read $fd]
close $fd
tailcall parseString $data
}
package provide minirivet 1
|