Skip to content

base

nodes.base contains definition of node class.

SourceInfo

Bases: ModelType

Source information for the node.

line

line() -> int

Get the line number of the start location within the string; the first line is line 1, newlines start new rows.

column

column() -> int

Get the column number of the start location within the string; the first column is column 1, newlines reset the column number to 1.

end_line

end_line() -> int

Get the line number of the end location within the string; the first line is line 1, newlines start new rows.

end_column

end_column() -> int

Get the column number of the end location within the string; the first column is column 1, newlines reset the column number to 1.

end_location

end_location() -> int

Get the end location of the source.

Node

Bases: ModelType

Base class for all nodes.

visit abstractmethod

visit(visitor: AstVisitor) -> Self

Handle visitor call.

get_visitor_callback_function abstractmethod

get_visitor_callback_function(
    visitor: AstVisitor,
) -> Callable[[Self], Self]

Get callback function for the node.

__len__

__len__() -> int

Get the length of token in source code.