Translation unit

class verigen.TranslationUnit(matcher: verigen.Matcher, src, dest, **kwargs)

This class represents translation engine invoked for single input file.

Parameters:
  • matcher (verigen.Matcher) – language matcher object
  • src (tuple(IOBase, str)) – input stream and corresponding name for diagnostics
  • dest (tuple(IOBase, str)) – output stream and corresponding name for diagnostics
STATE_GENERATED = 2

GENERATED state means that translation unit is passing through previously generated code. This state occurs when in-place translation is done multiple times

STATE_SCRIPT = 1

SCRIPT state means that current line is collected into script bucket and executed as soon as last script in the current block is detected.

STATE_VERBATIM = 0

VERBATIM state means that current line is copied as is to the output stream

issue_msg(level, *args, **kwargs)

Issue diagnostics message

Parameters:
  • level (int) – severity level
  • args (list) – additional parameters passed to diag()
  • line_no (str, keyword, optional) – line number coordinate; if not specified currently translated line number is used
translate()

Process through translation of entire content in the input stream.