6.23.10.2.3. begin/end blocks

The @begin() command creates a new scope, by pushing a new input_frame onto the input stack. The @end() command is used to end a @begin() block. An unbalanced @end() command can be used to terminate input from a file before the physical end of file.

Use of begin/end blocks is important to limit the lifetime of various objects. In particular, if a tangler is writing code to a named_file_sink, then the file will not be closed properly until it is destroyed.

Comienzo python section to interscript/frames/inputf.py[8 /41 ] Siguiente Previo Primero Ăšltimo
   308: #line 380 "input_frame.ipk"
   309:   def begin(self):
   310:     ho = self.head_offset
   311:     self.select(None)
   312:     inpt = input_frame(
   313:       self.pass_frame,
   314:       self.source,
   315:       [],
   316:       self.current_weaver,
   317:       self.userdict.copy(),
   318:       self.depth)
   319:     inpt.head_offset = ho
   320:     inpt.set_warning_character(python=self.python_warn)
   321:     inpt.file_pass()
   322: 
   323:   def end(self):
   324:     self.select(None)
   325:     raise eoi
   326: 
End python section to interscript/frames/inputf.py[8]


6.23.10.2.3.1. Begin/end test