6.10.10.2.3. begin/end blocks

6.10.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]
   206: #line 289 "input_frame.ipk"
   207:   def begin(self):
   208:     ho = self.head_offset
   209:     self.select(None)
   210:     inpt = input_frame(
   211:       self.pass_frame,
   212:       self.source,
   213:       [],
   214:       self.weaver,
   215:       self.userdict.copy(),
   216:       self.depth)
   217:     inpt.head_offset = ho
   218:     inpt.set_warning_character(python=self.python_warn)
   219:     inpt.file_pass()
   220: 
   221:   def end(self):
   222:     self.select(None)
   223:     raise eoi
   224: 
End python section to interscript/frames/inputf.py[8]


6.10.10.2.3.1. Begin/end test