Mercurial > urweb
comparison src/jscomp.sml @ 569:162d5308e34f
Successfully generated a page element from a signal
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 20 Dec 2008 16:19:26 -0500 |
parents | 55fc747a67dc |
children | 57018f21cd5c |
comparison
equal
deleted
inserted
replaced
568:55fc747a67dc | 569:162d5308e34f |
---|---|
283 let | 283 let |
284 val (e, st) = jsE inner (e, st) | 284 val (e, st) = jsE inner (e, st) |
285 in | 285 in |
286 (strcat [str "document.write(", | 286 (strcat [str "document.write(", |
287 e, | 287 e, |
288 str ")"], st) | 288 str ".v)"], st) |
289 end | 289 end |
290 | 290 |
291 | ESeq (e1, e2) => | 291 | ESeq (e1, e2) => |
292 let | 292 let |
293 val (e1, st) = jsE inner (e1, st) | 293 val (e1, st) = jsE inner (e1, st) |
315 | EJavaScript _ => unsupported "Nested JavaScript" | 315 | EJavaScript _ => unsupported "Nested JavaScript" |
316 | ESignalReturn e => | 316 | ESignalReturn e => |
317 let | 317 let |
318 val (e, st) = jsE inner (e, st) | 318 val (e, st) = jsE inner (e, st) |
319 in | 319 in |
320 (strcat [(*str "sreturn(",*) | 320 (strcat [str "sreturn(", |
321 e(*, | 321 e, |
322 str ")"*)], | 322 str ")"], |
323 st) | 323 st) |
324 end | 324 end |
325 end | 325 end |
326 in | 326 in |
327 jsE | 327 jsE |
367 | 367 |
368 val (ds, st) = ListUtil.foldlMapConcat doDecl | 368 val (ds, st) = ListUtil.foldlMapConcat doDecl |
369 {decls = [], | 369 {decls = [], |
370 script = ""} | 370 script = ""} |
371 file | 371 file |
372 | |
373 val inf = TextIO.openIn (OS.Path.joinDirFile {dir = Config.libJs, file = "urweb.js"}) | |
374 fun lines acc = | |
375 case TextIO.inputLine inf of | |
376 NONE => String.concat (rev acc) | |
377 | SOME line => lines (line :: acc) | |
378 val lines = lines [] | |
372 in | 379 in |
373 ds | 380 TextIO.closeIn inf; |
381 (DJavaScript lines, ErrorMsg.dummySpan) :: ds | |
374 end | 382 end |
375 | 383 |
376 end | 384 end |