Source code for zyntex.code_generation.premade.source_code_printer
from ...parsing.source_code import SourceCode
from .default_printer import IDefaultPrintable
[docs]
class SourceCodePrinter(IDefaultPrintable):
"""Printer for Zig source code."""
[docs]
def print(self, target: SourceCode) -> str:
return f"{self._dispatcher.configuration.line_ending}".join(
self._dispatcher.print(content) for content in target.content
)
[docs]
@staticmethod
def target_type() -> type[SourceCode]:
return SourceCode