# tokens

URL: /kida/api/parser/tokens/
Section: parser
Description: Token navigation utilities for Kida parser.

Provides mixin for token stream navigation and basic parsing operations.

Uses inline TYPE_CHECKING declarations for host attributes.
See: plan/rfc-mixin-protocol-typing.md

---

> For a complete page index, fetch /kida/llms.txt.

Open LLM text
(/kida/api/parser/tokens/index.txt)

Share with AI

Ask Claude
(https://claude.ai/new?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fparser%2Ftokens%2Findex.txt)

Ask ChatGPT
(https://chatgpt.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fparser%2Ftokens%2Findex.txt)

Ask Gemini
(https://gemini.google.com/app?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fparser%2Ftokens%2Findex.txt)

Ask Copilot
(https://copilot.microsoft.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fparser%2Ftokens%2Findex.txt)

Module

#
`parser.tokens`

Token navigation utilities for Kida parser.

Provides mixin for token stream navigation and basic parsing operations.

Uses inline TYPE_CHECKING declarations for host attributes.
See: plan/rfc-mixin-protocol-typing.md

1Class

## Classes

`TokenNavigationMixin`

6

▼

Mixin providing token stream navigation methods.

Host attributes accessed via inline TYPE_CHECKING…

Mixin providing token stream navigation methods.

Host attributes accessed via inline TYPE_CHECKING declarations.

#### Methods

Internal Methods
6

▼

`_current`

0

`Token`

▼

Get current token.

property

`def _current(self) -> Token`

##### Returns

`Token`

`_peek`

1

`Token`

▼

Peek at token at offset from current position.

`def _peek(self, offset: int = 0) -> Token`

##### Parameters

Name
Type
Description

`offset`
`—`

Default:`0`

##### Returns

`Token`

`_advance`

0

`Token`

▼

Advance to next token and return current.

`def _advance(self) -> Token`

##### Returns

`Token`

`_expect`

1

`Token`

▼

Expect current token to be of given type.

`def _expect(self, token_type: TokenType) -> Token`

##### Parameters

Name
Type
Description

`token_type`
`—`

##### Returns

`Token`

`_match`

1

`bool`

▼

Check if current token matches any of the types.

`def _match(self, *types: TokenType) -> bool`

##### Parameters

Name
Type
Description

`*types`
`—`

##### Returns

`bool`

`_error`

4

`ParseError`

▼

Create a ParseError with source context and block stack info.

`def _error(self, message: str, token: Token | None = None, suggestion: str | None = None, code: ErrorCode | None = None) -> ParseError`

##### Parameters

Name
Type
Description

`message`
`—`

`token`
`—`

Default:`None`

`suggestion`
`—`

Default:`None`

`code`
`—`

Default:`None`

##### Returns

`ParseError`
