ether #614(2007/07/12 07:39 GMT) [ OCaml ] Rating0/0=0.00
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
rule proc = parse | "/*" { skip lexbuf } | _ { Lexing.lexeme_char lexbuf 0 } | eof { raise End_of_file } and skip = parse | "*/" { proc lexbuf } | _ { skip lexbuf } | eof { raise End_of_file } { let remove_comment src = let s = Lexing.from_string src in let buf = Buffer.create 256 in try while true do Buffer.add_char buf (proc s) done; "" with End_of_file -> Buffer.contents buf;; print_endline (remove_comment "AAA"); print_endline (remove_comment "AAA/*BBB*/"); print_endline (remove_comment "AAA/*BBB"); print_endline (remove_comment "AAA/*BBB*/CCC"); print_endline (remove_comment "AAA/*BBB/*CCC*/DDD*/EEE"); print_endline (remove_comment "AAA/a//*BB*B**/CCC"); }
Rating0/0=0.00-0+
[ reply ]
ether
#614()
[
OCaml
]
Rating0/0=0.00
Rating0/0=0.00-0+
[ reply ]