knit_script.knit_script_interpreter.ks_element module
Module containing the KS_Element Super Class.
This module provides the KS_Element base class, which serves as the foundation for all parser elements in the KnitScript language. It provides common functionality for accessing parser node information, location data, and line number information that is essential for error reporting and debugging.
- class KS_Element(parser_node)[source]
Bases:
object
Superclass of all parser elements in KS.
The KS_Element class provides the base functionality for all elements created during knit script parsing. It maintains a reference to the parser node that created the element and provides convenient access to location information for error reporting and debugging purposes.
This base class ensures that all knit script language elements have consistent access to their source location information, which is essential for providing meaningful error messages and debugging information to users.
- parser_node
The parser node that created this element.
- Type:
LRStackNode
- Parameters:
parser_node (
LRStackNode
)
- __init__(parser_node)[source]
Initialize the KS element with parser node information.
- Parameters:
parser_node (LRStackNode) – The parser node that created this element, containing location and context information.
- property location: Location
Get the location of this symbol in KnitScript file.
- Returns:
The location of this symbol in the source file, including file name, line number, and position information.
- Return type:
Location