root/trunk/thune/scripts/c_string.t

Revision 541, 0.5 kB (checked in by krobillard, 6 months ago)

Fixes for date! on windows.
Fixed c_string.t to handle last line with no newline.

Line 
1; Convert Urlan data to C string.
2
3[str | a b]
4[
5    str copy {"} {\"} replace.all head
6    /*
7    str copy
8    [some [
9        to '"' :a skip to '"' :b ('{' :a/1 '}' :b/1) skip
10    ]]
11    parse head
12    */
13]
14func :replace-quotes  ; (str -- str)
15
16args [
17    load to-string
18    next dup tail prev remove drop   ; Remove first & last bracket
19    trim.in
20        dup eol push
21    ;dup first eol eq? ift next
22    [some[
23        :tok to eol tok: skip
24            (tok tail? iff ({  "} prin tok replace-quotes prin {\n"} print))
25    ]]
26    parse drop
27]
28each
Note: See TracBrowser for help on using the browser.