/* * Created by PyramIDE. * User: フランスのトトロ * Date: 18/04/2015 * Time: 23:21 * © Calexium */ read tools/basis.anubis 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] //single quote else if h = '\r' then ['r', '\\' . so_far] //CR else if h = '\n' then ['n', '\\' . so_far] //LF else if h = '\t' then ['t', '\\' . so_far] //tab else if h = 0x08 then ['b', '\\' . so_far] //Backspace 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), [])). public define String to_js_string ( String str ) = "'" + make_js_string(str) + "'". public define String format_js_function_call ( String name, List(String) args ) = name + "(" + concat(args, ",") + ");".