Skip to documentation
SLOP

tiny.smt.smtlib.parse.state

Reference tiny.smt smtlib parse state

Defined in smtlib.parse.

The state one reading of an SMT-LIB text carries from call to call.

API (3)

Actions

Public operations.

Types and contracts

Public types and contracts.

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

Source

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

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

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

zig
//! The state one reading of an SMT-LIB text carries from call to call. A term can name any constant//! or function declared earlier in the script, so the reader keeps the declared names while it//! reads. The state (`Parser`) holds the text, the position in it, and two hash maps from declared//! names to constants and to functions.const std = @import("std");const smt = @import("../../root.zig");const term = smt.term;/// The state of one reading: the `Context` the terms go into, the text, the position in it, and the/// constants and functions declared so far. Code that reads a script with the reader's parts builds/// one, as `parseScript` does. It borrows the `Context` and the text, and its hash maps allocate/// with the `Context`'s allocator. The hash-map keys are slices of the text, so the text has to/// outlive the state.pub const Parser = struct {    ctx: *term.Context,    source: []const u8,    pos: usize = 0,    symbols: std.StringHashMap(term.Term),    functions: std.StringHashMap(term.Function),    /// Returns a state over `ctx` and `source` at position 0 with no declared names. Code calls it    /// once before reading. It allocates nothing.    pub fn init(ctx: *term.Context, source: []const u8) Parser {        return .{            .ctx = ctx,            .source = source,            .symbols = std.StringHashMap(term.Term).init(ctx.allocator),            .functions = std.StringHashMap(term.Function).init(ctx.allocator),        };    }    /// Frees the two hash maps. Code calls it once when done reading. The terms and the `Script`    /// the reading built stay valid.    pub fn deinit(self: *Parser) void {        self.functions.deinit();        self.symbols.deinit();    }};

Audit

Definitions4
Public names7
Members5
Version26.7.0
Revisiondaab053ee433