Skip to content

Source

SourceInfo dataclass

SourceInfo(
    lineno: int,
    col_offset: int,
    end_lineno: int | None,
    end_col_offset: int | None,
    file: str | None = None,
    lineno_begin: int = 0,
    col_indent: int = 0,
)

offset

offset(lineno_begin: int = 0, col_indent: int = 0)

Offset the source info by the given offsets.

Parameters:

Name Type Description Default
lineno_offset int

The line number offset.

required
col_offset int

The column offset.

required
Source code in src/kirin/source.py
31
32
33
34
35
36
37
38
39
def offset(self, lineno_begin: int = 0, col_indent: int = 0):
    """Offset the source info by the given offsets.

    Args:
        lineno_offset (int): The line number offset.
        col_offset (int): The column offset.
    """
    self.lineno_begin = lineno_begin
    self.col_indent = col_indent