tiny.termtex.ast
Defined in tiny.termtex.
API (26)
Actions
Public operations.
Types and contracts
Public types and contracts.
AccentAccentMarkAnnotationAnnotationKindDelimitedDelimiterDelimiterShapeExprFractionFractionStyleGridGridAlignmentGridFenceGridRowLimitPolicyOperatorRadicalScriptsSpace
Source
Source: lib/termtex/src/ast.zig
zig
const std = @import("std");pub const Expr = union(enum) { row: []const *Expr, text: []const u8, operator: Operator, space: Space, fraction: Fraction, sqrt: Radical, scripts: Scripts, accent: Accent, grid: Grid, annotation: Annotation, delimited: Delimited,};pub const Space = struct { numerator: i32, denominator: u32,};pub const LimitPolicy = enum { auto, limits, nolimits,};pub const Operator = struct { body: *Expr, limit_policy: LimitPolicy = .auto,};pub const FractionStyle = enum { text, display,};pub const Fraction = struct { numerator: *Expr, denominator: *Expr, style: FractionStyle = .text,};pub const Radical = struct { index: ?*Expr = null, body: *Expr,};pub const Scripts = struct { base: *Expr, sub: ?*Expr = null, sup: ?*Expr = null,};pub const AccentMark = enum { bar, hat, vec, dot, underline, tilde, check, breve, ddot, acute, grave, ring, overleft, overleftright,};pub const Accent = struct { mark: AccentMark, body: *Expr,};pub const AnnotationKind = enum { plain, overbrace, underbrace, boxed,};pub const Annotation = struct { base: *Expr, over: ?*Expr = null, under: ?*Expr = null, kind: AnnotationKind = .plain,};pub const Delimited = struct { left: Delimiter, body: *Expr, right: Delimiter,};pub const Delimiter = union(enum) { none, shape: DelimiterShape, text: []const u8,};pub const DelimiterShape = enum { left_paren, right_paren, left_bracket, right_bracket, left_brace, right_brace, bar, double_bar, left_angle, right_angle, left_double_angle, right_double_angle, left_double_bracket, right_double_bracket, left_floor, right_floor, left_ceil, right_ceil,};pub const GridFence = enum { none, paren, bracket, brace, bar, double_bar, left_brace,};pub const GridAlignment = enum { center, left,};pub const Grid = struct { rows: []const GridRow, fence: GridFence = .none, alignment: GridAlignment = .center,};pub const GridRow = struct { cells: []const *Expr,};pub fn empty(arena: std.mem.Allocator) std.mem.Allocator.Error!*Expr { return text(arena, "");}pub fn text(arena: std.mem.Allocator, value: []const u8) std.mem.Allocator.Error!*Expr { const owned = try arena.dupe(u8, value); return node(arena, .{ .text = owned });}pub fn operator(arena: std.mem.Allocator, body: *Expr, limit_policy: LimitPolicy) std.mem.Allocator.Error!*Expr { return node(arena, .{ .operator = .{ .body = body, .limit_policy = limit_policy, } });}pub fn space(arena: std.mem.Allocator, value: Space) std.mem.Allocator.Error!*Expr { return node(arena, .{ .space = value });}pub fn row(arena: std.mem.Allocator, items: []const *Expr) std.mem.Allocator.Error!*Expr { if (items.len == 0) return empty(arena); if (items.len == 1) return items[0]; const owned = try arena.dupe(*Expr, items); return node(arena, .{ .row = owned });}pub fn node(arena: std.mem.Allocator, expr: Expr) std.mem.Allocator.Error!*Expr { const out = try arena.create(Expr); out.* = expr; return out;}pub fn textValue(expr: *const Expr) ?[]const u8 { return switch (expr.*) { .text => |value| value, .operator => |value| textValue(value.body), else => null, };}Source: lib/termtex/src/root.zig:10
zig
pub const ast = @import("ast.zig");Complete caller list for ast.empty
11 direct callers.
tiny.termtex.ast.row[function] atlib/termtex/src/ast.zig:169lib.termtex.src.parse.Parser.attachScript[method] — private source atlib/termtex/src/parse.zig:123in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.commandExpr[method] — private source atlib/termtex/src/parse.zig:244in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.ignoreArgument[method] — private source atlib/termtex/src/parse.zig:657in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.ignoreDeclaration[method] — private source atlib/termtex/src/parse.zig:674in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.ignoreRawArgument[method] — private source atlib/termtex/src/parse.zig:662in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.ignoreSpacingCommand[method] — private source atlib/termtex/src/parse.zig:667in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.makeHSpace[method] — private source atlib/termtex/src/parse.zig:638in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.parseArgument[method] — private source atlib/termtex/src/parse.zig:170in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.parseAtom[method] — private source atlib/termtex/src/parse.zig:187in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.parseDelimiterText[method] — private source atlib/termtex/src/parse.zig:970in nearest public ownertiny.termtex.parse
Complete caller list for ast.node
17 direct callers.
tiny.termtex.alphabet.apply[function] atlib/termtex/src/alphabet.zig:34lib.termtex.src.alphabet.mapText[function] — private source atlib/termtex/src/alphabet.zig:92in nearest public ownertiny.termtex.alphabettiny.termtex.ast.operator[function] atlib/termtex/src/ast.zig:158tiny.termtex.ast.row[function] atlib/termtex/src/ast.zig:169tiny.termtex.ast.space[function] atlib/termtex/src/ast.zig:165tiny.termtex.ast.text[function] atlib/termtex/src/ast.zig:153lib.termtex.src.parse.Parser.attachScript[method] — private source atlib/termtex/src/parse.zig:123in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.fraction[method] — private source atlib/termtex/src/parse.zig:533in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.makeAccent[method] — private source atlib/termtex/src/parse.zig:575in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.makeAnnotation[method] — private source atlib/termtex/src/parse.zig:583in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.makeDelimited[method] — private source atlib/termtex/src/parse.zig:646in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.makeOverUnder[method] — private source atlib/termtex/src/parse.zig:591in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.makeSqrt[method] — private source atlib/termtex/src/parse.zig:566in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.makeXArrow[method] — private source atlib/termtex/src/parse.zig:440in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.oneCellGrid[method] — private source atlib/termtex/src/parse.zig:541in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.parseGridBody[method] — private source atlib/termtex/src/parse.zig:712in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.stack[method] — private source atlib/termtex/src/parse.zig:552in nearest public ownertiny.termtex.parse
Complete caller list for ast.text
15 direct callers.
lib.termtex.src.alphabet.test_alphabet_maps_common_mathematical_alphabets[function] — test source atlib/termtex/src/alphabet.zig:408in nearest public ownertiny.termtex.alphabetlib.termtex.src.alphabet.test_alphabet_maps_script_exceptions_and_bold_Greek[function] — test source atlib/termtex/src/alphabet.zig:438in nearest public ownertiny.termtex.alphabetlib.termtex.src.alphabet.test_alphabet_maps_unicode_math_aliases[function] — test source atlib/termtex/src/alphabet.zig:418in nearest public ownertiny.termtex.alphabettiny.termtex.ast.empty[function] atlib/termtex/src/ast.zig:149lib.termtex.src.parse.Parser.commandExpr[method] — private source atlib/termtex/src/parse.zig:244in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.makeArgumentText[method] — private source atlib/termtex/src/parse.zig:490in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.makeInferenceRule[method] — private source atlib/termtex/src/parse.zig:450in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.makeNot[method] — private source atlib/termtex/src/parse.zig:627in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.makeReference[method] — private source atlib/termtex/src/parse.zig:515in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.makeXArrow[method] — private source atlib/termtex/src/parse.zig:440in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.parseAtom[method] — private source atlib/termtex/src/parse.zig:187in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.parseCommand[method] — private source atlib/termtex/src/parse.zig:223in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.parseDelimiterText[method] — private source atlib/termtex/src/parse.zig:970in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.parseRawGroupText[method] — private source atlib/termtex/src/parse.zig:684in nearest public ownertiny.termtex.parselib.termtex.src.parse.Parser.parseTextRun[method] — private source atlib/termtex/src/parse.zig:208in nearest public ownertiny.termtex.parse
Audit
| Definitions | 26 |
|---|---|
| Public names | 26 |
| Members | 78 |
| Version | 26.7.0 |
| Revision | daab053ee433 |