# libtmux._internal.log_context._tokenize_tmux_string

- **Module:** libtmux._internal.log_context
- **Package:** libtmux
- **Language:** Python
- **Kind:** function
- **Source:** https://github.com/tmux-python/libtmux/blob/efdbb5637666b166358772ecc737b3807beab21e/src/libtmux/_internal/log_context.py#L441
- **Page:** https://libtmux.org/en/py/latest/reference/libtmux-_internal-log_context-_tokenize_tmux_string/

```
libtmux._internal.log_context._tokenize_tmux_string(
    raw: str,
) -> list[_LexToken] | None
```

Tokenize a tmux command string per ``cmd-parse.y`` with source spans.

Handles ``'...'``, ``"..."``, ``\x`` escapes, ``;`` and ``\n`` statement
separators (with or without surrounding spaces), and ``{`` / ``}`` blocks.
Returns ``None`` on unterminated quotes or trailing backslashes.

## Parameters

- `raw` (`str`)
