smartinspectpython.sitokenfactory

Module: sitokenfactory.py

Revision History

Date Version Description
2023/05/30 3.0.0.0 Initial Version.

@static_init
@export
class SITokenFactory:

Creates instances of Token subclasses.

This class has only one public method called GetToken, which is capable of creating Token objects depending on the given argument.

Threadsafety:

This class is not guaranteed to be thread-safe.

SITokenFactory()

Initializes a new instance of the class.

@classmethod
def static_init(cls) -> None:

Initializes a new instance of the class.

@staticmethod
def CreateLiteral(value: str) -> smartinspectpython.sitoken.SIToken:

Creates a LiteralToken instance.

Arguments:
  • value (str): The value to assign to the literal token.
Returns:

A LiteralToken object with the value assigned.

@staticmethod
def GetToken(value: str) -> smartinspectpython.sitoken.SIToken:

Creates instance of Token subclasses.

Arguments:
  • value (str): The original string representation of the token.
Returns:

An appropriate Token object for the given string representation of a token.

This method analyzes and parses the supplied representation of a token and creates an appropriate Token object. For example, if the value argument is set to "%session%", a Token object is created and returned which is responsible for expanding the %session% variable. For a list of available tokens and a detailed description, please have a look at the SIPatternParser class, especially the SIPatternParser.Pattern property.

@staticmethod
def ParseWidth(value: str) -> int:

Parses the specified value for it's width.

Arguments:
  • value (str): The value to obtain the width of.
Returns:

The width of the value.