#zpl #zebra #table #parser

zpl_toolchain_spec_tables

Parser tables and command spec data structures for the ZPL toolchain

10 releases (5 breaking)

Uses new Rust 2024

new 0.6.0 Feb 21, 2026
0.5.0 Feb 16, 2026
0.4.0 Feb 15, 2026
0.3.0 Feb 14, 2026
0.1.4 Feb 9, 2026

#2343 in Parser implementations


Used in 3 crates (2 directly)

MIT/Apache

47KB
784 lines

zpl_toolchain_spec_tables

Defines shared data structures for generated tables consumed by parser/validator.

Part of the zpl-toolchain project.

Key types

  • ParserTables { schema_version, format_version, commands, opcode_trie }
  • CommandEntry { codes, arity, field_data, raw_payload, opens_field, closes_field, hex_escape_modifier, field_number, serialization, requires_field, signature, args, constraints, effects, plane, scope, ... }
  • Signature { params, joiner, spacing_policy, allow_empty_trailing }
  • Arg { name, key, type, unit, range, optional, presence, default, default_from, profile_constraint, range_when, rounding_policy, rounding_policy_when, resource, enum, min_length, max_length }
  • Constraint { kind: ConstraintKind, expr, message, severity: Option<ConstraintSeverity> }
  • Effects { sets: Vec<String> }
  • ProfileConstraint { field, op: ComparisonOp }

Enums

  • ConstraintKind: Order, Requires, Incompatible, EmptyData, Range, Note, Custom
    • ConstraintKind::ALL is the single source of truth for the set of valid kinds; the JSONC schema mirrors this list and a spec-compiler test validates they stay in sync.
  • ConstraintSeverity: Error, Warn, Info
  • ComparisonOp: Lte, Gte, Lt, Gt, Eq
  • RoundingMode: ToMultiple
  • Plane: Format, Device, Host, Config
  • CommandScope: Label, Session, Global
  • CommandCategory: Format, Control, Status, Config
  • Stability: Stable, Deprecated, Undocumented

Additional Types

  • FieldDataRules { charset, length, parity } — barcode field data validation rules
  • SplitRule { font_len, orientation_len } — spec-driven ^A font+orientation splitting
  • Composite { prefix, args } — composite command expansion (e.g., ^XG)

Notes

  • TABLE_FORMAT_VERSION is currently 0.4.0.
  • Legacy args_spec was removed in format 0.3.0; use args (and ArgUnion).
  • Signature spacing now uses spacing_policy (forbid/require/allow) in format 0.4.0.
  • Structural role flags (opens_field, closes_field, etc.) drive the validator's field-tracking state machine.
  • Conditional rules are evaluated by the validator using simple predicates.

Dependencies

~0.5–1.4MB
~30K SLoC