Skip to documentation
SLOP

tiny.smt.smtlib.parse.token

Reference tiny.smt smtlib parse token

Defined in smtlib.parse.

Splits SMT-LIB text into parentheses and atoms.

API (6)

Actions

Public operations.

No direct callersNo direct callssmtlib.parsetoken
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Called byCallssmtlib.parse.scriptparsesmtlib.parse.sortparsesmtlib.parse.termparseprivate sourcelib.smt.src.smtlib.parse.termparseIndexedsmtlib.parse.tokenskipSpacesmtlib.parse.tokenatom
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallssmtlib.parse.scriptparsesmtlib.parse.sortlistsmtlib.parse.sortparsesmtlib.parse.termparseprivate sourcelib.smt.src.smtlib.parse.termparseIndexedsmtlib.parse.tokenpeekLeftsmtlib.parse.tokenexpectLeft
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallssmtlib.parse.scriptparsesmtlib.parse.sortlistsmtlib.parse.sortparsesmtlib.parse.termparseprivate sourcelib.smt.src.smtlib.parse.termparseApply+5 moresmtlib.parse.tokenpeekRightsmtlib.parse.tokenexpectRight
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallssmtlib.parse.sortparsesmtlib.parse.termparsesmtlib.parse.tokenexpectLeftsmtlib.parse.tokenskipSpacesmtlib.parse.tokenpeekLeft
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallssmtlib.parse.sortlistprivate sourcelib.smt.src.smtlib.parse.termparseApplyprivate sourcelib.smt.src.smtlib.parse.termparseNarysmtlib.parse.tokenexpectRightsmtlib.parse.tokenskipSpacesmtlib.parse.tokenpeekRight
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callssmtlib.parse.scriptparsesmtlib.parse.tokenatomsmtlib.parse.tokenpeekLeftsmtlib.parse.tokenpeekRightsmtlib.parse.tokenskipSpace
Static calls · unresolved targets: 0 · external targets: 0.

Source: lib/smt/src/smtlib/parse/root.zig:14

zig
pub const token = @import("token.zig");

Source: lib/smt/src/smtlib/parse/token.zig

zig
//! Splits SMT-LIB text into parentheses and atoms. Every step of the reader has to skip whitespace//! and comments and then read one parenthesis or one atom. An atom is every character up to the//! next whitespace or parenthesis, so the reader has no quoted symbols and no string literals.const errors = @import("error.zig");const state = @import("state.zig");const Error = errors.Error;const ParseError = errors.ParseError;const Parser = state.Parser;/// Moves the position past spaces, tabs, carriage returns, newlines and `;` comments, which run to/// the end of their line. The call returns true when a character remains, so the command reader/// learns whether another command follows.pub fn skipSpace(parser: *Parser) bool {    while (parser.pos < parser.source.len) {        switch (parser.source[parser.pos]) {            ' ', '\t', '\r', '\n' => parser.pos += 1,            ';' => {                while (parser.pos < parser.source.len and parser.source[parser.pos] != '\n') parser.pos += 1;            },            else => return true,        }    }    return false;}/// Skips whitespace and comments and returns true when the next character is `(`, so the term and/// sort readers decide between an atom and a list. The call leaves the parenthesis unconsumed.pub fn peekLeft(parser: *Parser) bool {    _ = skipSpace(parser);    return parser.pos < parser.source.len and parser.source[parser.pos] == '(';}/// Skips whitespace and comments and returns true when the next character is `)`, so the list/// readers find the end of an operand list. The call leaves the parenthesis unconsumed.pub fn peekRight(parser: *Parser) bool {    _ = skipSpace(parser);    return parser.pos < parser.source.len and parser.source[parser.pos] == ')';}/// Skips whitespace and comments and consumes a `(` for the readers where a list has to open. The/// call returns `ExpectedList` for any other character or the end of the text.pub fn expectLeft(parser: *Parser) Error!void {    if (!peekLeft(parser)) return ParseError.ExpectedList;    parser.pos += 1;}/// Skips whitespace and comments and consumes a `)` for the readers where a list has to close. The/// call returns `ExpectedRightParen` for any other character or the end of the text.pub fn expectRight(parser: *Parser) Error!void {    if (!peekRight(parser)) return ParseError.ExpectedRightParen;    parser.pos += 1;}/// Skips whitespace and comments and returns the next atom: the characters up to the next/// whitespace or parenthesis. The readers call it for every command name, operator, name and/// number. The atom is a slice of the parser's text. The call returns `ExpectedAtom` at the end of/// the text or at a parenthesis.pub fn atom(parser: *Parser) Error![]const u8 {    _ = skipSpace(parser);    if (parser.pos >= parser.source.len) return ParseError.ExpectedAtom;    if (parser.source[parser.pos] == '(' or parser.source[parser.pos] == ')') return ParseError.ExpectedAtom;    const start = parser.pos;    while (parser.pos < parser.source.len) {        switch (parser.source[parser.pos]) {            ' ', '\t', '\r', '\n', '(', ')' => break,            else => parser.pos += 1,        }    }    return parser.source[start..parser.pos];}

Complete caller list for smtlib.parse.token.expectRight

10 direct callers.

Audit

Definitions7
Public names7
Members0
Version26.7.0
Revisiondaab053ee433