js_tools.anubis
680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* Created by PyramIDE.
* User: フランスのトトロ
* Date: 18/04/2015
* Time: 23:21
* © Calexium
*/
define List(Word8)
make_js_string
(
List(Word8) current,
List(Word8) so_far
)
=
if current is
{
[ ] then reverse(so_far),
[h . t] then
make_js_string(t,
if h = '\'' then
[h . ['\\' . so_far]]
else
[h . so_far]
)
}.
/**
* Convert a string into certified javascript string (I hope)
*/
public define String
make_js_string
(
String str
)
=
implode(make_js_string(explode(str), [])).