equal
deleted
inserted
replaced
302 in |
302 in |
303 (($$ \"h\") -- ($$ \"e\") >> double) (explode \"hello\") |
303 (($$ \"h\") -- ($$ \"e\") >> double) (explode \"hello\") |
304 end" |
304 end" |
305 "((\"hh\", \"ee\"), [\"l\", \"l\", \"o\"])"} |
305 "((\"hh\", \"ee\"), [\"l\", \"l\", \"o\"])"} |
306 |
306 |
307 doubles the two parsed input strings. |
307 doubles the two parsed input strings. Or |
|
308 |
|
309 @{ML_response [display] |
|
310 "let |
|
311 val p = Scan.repeat (Scan.one Symbol.not_eof) >> implode |
|
312 val input = (explode \"foo bar foo\") |
|
313 in |
|
314 Scan.finite Symbol.stopper p input |
|
315 end" |
|
316 "(\"foo bar foo\",[])"} |
|
317 |
|
318 where the single strings in the parsed output are transformed |
|
319 back into one string. |
308 |
320 |
309 \begin{exercise}\label{ex:scancmts} |
321 \begin{exercise}\label{ex:scancmts} |
310 Write a parser that parses an input string so that any comment enclosed |
322 Write a parser that parses an input string so that any comment enclosed |
311 inside @{text "(*\<dots>*)"} is replaced by a the same comment but enclosed inside |
323 inside @{text "(*\<dots>*)"} is replaced by a the same comment but enclosed inside |
312 @{text "(**\<dots>**)"} in the output string. To enclose a string, you can use the |
324 @{text "(**\<dots>**)"} in the output string. To enclose a string, you can use the |