ml_switcheroo.compiler.frontends.sass.tokens ============================================ .. py:module:: ml_switcheroo.compiler.frontends.sass.tokens .. autoapi-nested-parse:: SASS Tokenizer Definition. Provides a Regex-based Lexer (`SassLexer`) that decomposes raw NVIDIA SASS assembly strings into a stream of typed `Token` objects. Classes ------- .. autoapisummary:: ml_switcheroo.compiler.frontends.sass.tokens.TokenType ml_switcheroo.compiler.frontends.sass.tokens.Token ml_switcheroo.compiler.frontends.sass.tokens.SassLexer Module Contents --------------- .. py:class:: TokenType(*args, **kwds) Bases: :py:obj:`enum.Enum` Enumeration of valid SASS token types. .. py:attribute:: LABEL_DEF .. py:attribute:: DIRECTIVE .. py:attribute:: COMMENT .. py:attribute:: SEMICOLON .. py:attribute:: COMMA .. py:attribute:: PREDICATE .. py:attribute:: REGISTER .. py:attribute:: MEMORY .. py:attribute:: IMMEDIATE .. py:attribute:: IDENTIFIER .. py:class:: Token Represents a lexical unit. .. attribute:: kind The type of token. :type: TokenType .. attribute:: value The raw string content. :type: str .. attribute:: line Line number in source (1-based). :type: int .. attribute:: column Column number in source (1-based). :type: int .. py:attribute:: kind :type: TokenType .. py:attribute:: value :type: str .. py:attribute:: line :type: int .. py:attribute:: column :type: int .. py:class:: SassLexer Regex-based Lexer for NVIDIA SASS assembly. .. py:attribute:: PATTERNS :type: List[Tuple[TokenType, str]] .. py:attribute:: regex_pairs .. py:method:: tokenize(text: str) -> Generator[Token, None, None] Tokenizes the input string. :param text: Raw SASS source code. :type text: str :Yields: *Token* -- Token objects. :raises ValueError: If an unrecognized character sequence is encountered.