write todo check section us file comment end file hint us second map compar us kei param filenam file param indent current indent param output lost section lost section written write filenam indent output lost section file reader file reader filenam buffer reader fr buffer reader todo us platform charact encod specifi encod produc predict result file writer fw file writer filenam line line fr read line line section id sect id line section id content ari section id content fw write line line separ fw write content read end section discard gener content end section id line fr read line line eof except reach end file look end section id section id end section id sect id line end section id defin log lp log granular type statement lp log local nest statement end section id equal section id log error mismatch section id section id end section id end section id endif ari remov section id fw write line line fr read line line fw write line separ ari output lost section fw write lost code follow line separ set map entri ari entri set iter itr map entri iter itr map entri entri map entri itr fw write indent section entri kei begin line separ fw write entri valu fw write indent section entri kei end line separ fw write fr close fw close io except defin log lp log granular type statement log error error endif 