orchestrata_ultimate.refactor.ctok
Reference › orchestrata_ultimate › refactor › ctok › init
The facade of ctok-parser, the C tokenizer and lossless token layer of the SPEC-110 codemod engine. It re-exports the public names of tokenizer, token_stream, node_index, edit_buffer and lossless_module. The codemod workspace, server, passes, review modules and the scripts.codemod script import from here.
At a glance
Class diagram
No classes; see Functions.
Dependency diagram
API
No public API: the module defines no classes, functions or constants.
Source
"""ctok-parser: FT-safe C tokenizer + token-array lossless CST layer (SPEC-110).
Replaces LibCST's Rust parser for the SPEC-110 codemod engine
(``plans/contracts/ctok-parser.contract.json``, REQ-110-120 through
REQ-110-127). ``CTokenizer.tokenize`` drives a C extension (``scripts/_ctok/``)
that itself drives CPython's own battle-tested lexer, returning a
``TokenStream`` whose ``reconstruct()`` is byte-identical to the input source
by construction. ``LosslessModule`` marries that token array to an ``ast``
overlay via ``NodeIndex`` (P2): byte-identical ``.code`` (bytes), rename
targets locatable without libcst, and ``EditBuffer`` span-splice edits guarded
by the Black-derived ``verify_edit`` AST-equivalence check.
"""
from orchestrata_ultimate.refactor.ctok.edit_buffer import (
EditBuffer,
EditSafetyError,
stringify_ast,
verify_edit,
)
from orchestrata_ultimate.refactor.ctok.lossless_module import LosslessModule
from orchestrata_ultimate.refactor.ctok.node_index import NodeIndex, NodeSpanError
from orchestrata_ultimate.refactor.ctok.token_stream import TokenStream
from orchestrata_ultimate.refactor.ctok.tokenizer import CTokenizer, Token, TokenKind
__all__ = [
"CTokenizer",
"EditBuffer",
"EditSafetyError",
"LosslessModule",
"NodeIndex",
"NodeSpanError",
"Token",
"TokenKind",
"TokenStream",
"stringify_ast",
"verify_edit",
]