Beispiel #1
0
 protected override void Visit(SendExpressionChunk chunk)
 {
     _source.WriteLine("try:");
     _source.Indent++;
     _source.Write("OutputWriteAdapter(").Write(chunk.Code).WriteLine(")");
     _source.Indent--;
     _source.WriteLine("except:");
     _source.Indent++;
     if (chunk.SilentNulls)
     {
         _source.WriteLine("pass");
     }
     else
     {
         _source.Write("OutputWriteAdapter(\"${").Write(EscapeStringContents(chunk.Code)).WriteLine("}\")");
     }
     _source.Indent--;
 }
        protected override void Visit(SendExpressionChunk chunk)
        {
            //_source.Write("output_write_adapter ").WriteLine(chunk.Code);
            //TODO: handle exception

            _source.WriteLine("begin");
            _source.Indent++;
            _source.Write("output_write_adapter(").Write(chunk.Code).WriteLine(")");
            _source.Indent--;
            _source.WriteLine("rescue");
            if (!chunk.SilentNulls)
            {
                _source.Indent++;
                _source.Write("output_write_adapter \"${").Write(EscapeStringContents(chunk.Code)).WriteLine(" => \"+$!+\"}\"");
                _source.Indent--;
            }
            _source.WriteLine("end");
        }