transcribe

Macro transcription utilities.

class macro_polo.transcribe.MacroTransciberSubstitution(name)[source]

A variable substitution in a transcriber.

Parameters:

name (str)

name: str

The name of the variable to substitute.

class macro_polo.transcribe.MacroTranscriber(*args)[source]

Transcribes a macro match to an output token stream.

Parameters:

args (MacroTranscriberItem)

Return type:

Self

transcribe(captures, repitition_path=())[source]

Transcribe the given match to an output token stream.

Parameters:
Return type:

Iterator[Token]

macro_polo.transcribe.MacroTranscriberItem

Union of types that can appear in a MacroTranscriber.

alias of Token | MacroTransciberSubstitution | MacroTranscriberRepeater

class macro_polo.transcribe.MacroTranscriberRepeater(transcriber, sep=None)[source]

A repeated sub-transcriber.

Parameters:
sep: Token | None

An optional separator token.

transcribe(captures, repitition_path=())[source]

Transcribe the given match to an output token stream.

Parameters:
Return type:

Iterator[Token]

transcriber: MacroTranscriber

The transcriber to repeat.

exception macro_polo.transcribe.MacroTranscriptionError[source]

Exception raised for macro transcription errors.