tiny.python.source
Defined in tiny.python.
The first stage of the package turns the text of a Python program into a list of tokens.
API (7)
Actions
Public operations.
tokenize: Reads the source text and returns its tokens as aStream.
Types and contracts
Public types and contracts.
Span: A byte range of the source text: the offset of its first byte and the offset one past its last byte.Stream: The token list thattokenizereturns, for the caller to pass toparse.Tag: The kind of a token.Token: One token: its kind and its byte range in the source text.
Namespaces
Public namespaces.
lexer: The lexer reads the text of a Python program once, from start to end, and turns it into a list of tokens that ends with an end-of-input token.token: A token is one name, number, string, keyword or symbol of a program's text.
Source
Source: lib/python/src/root.zig:88
zig
pub const source = @import("source/root.zig");Source: lib/python/src/source/root.zig
zig
//! The first stage of the package turns the text of a Python program into a list of tokens. Each//! token records its kind and the byte range it covers in the text. The parser needs the program as//! a sequence of names, numbers, strings, keywords and symbols, with the start and end of every//! indented block marked.//!//! One file, `token`, defines the token and its kinds. The other file, `lexer`, produces the list//! through one function, `tokenize`. The namespace re-exports `Token`, `Tag` and `Span` from//! `token`, and `Stream` and `tokenize` from `lexer`. The package's `execute` calls `tokenize`//! before anything else.pub const token = @import("token.zig");pub const lexer = @import("lexer.zig");pub const Token = token.Token;pub const Tag = token.Tag;pub const Span = token.Span;pub const Stream = lexer.Stream;pub const tokenize = lexer.tokenize;Audit
| Definitions | 1 |
|---|---|
| Public names | 1 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |