6.13.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.

Start python section to interscript/frames/inputf.py[8 /40 ] Next Prev Last
   295: #line 367 "input_frame.ipk"
   296:   def begin(self):
   297:     ho = self.head_offset
   298:     self.select(None)
   299:     inpt = input_frame(
   300:       self.pass_frame,
   301:       self.source,
   302:       [],
   303:       self.current_weaver,
   304:       self.userdict.copy(),
   305:       self.depth)
   306:     inpt.head_offset = ho
   307:     inpt.set_warning_character(python=self.python_warn)
   308:     inpt.file_pass()
   309: 
   310:   def end(self):
   311:     self.select(None)
   312:     raise eoi
   313: 
End python section to interscript/frames/inputf.py[8]


6.13.10.2.3.1. Begin/end test