simple-scpi
A lightweight SCPI (Standard Commands for Programmable Instruments) command parser for Rust.
Define your instrument's command set as a table of pattern strings and handler functions, and the library takes care of parsing input lines — including short/long keyword forms, numeric suffixes, optional nodes, and compound commands.
Usage
use ;
let set = from_table.unwrap;
for cmd in set.parse.unwrap
Each handler receives a &Command with parsed params and numeric
suffixes:
See examples/demo.rs for a complete working example.
Pattern syntax
| Syntax | Meaning |
|---|---|
SYSTem |
Mixed-case keyword — uppercase is the required short form, full word is the long form. Matches SYST, SYSTE, SYSTEM (case-insensitive). |
: |
Keyword hierarchy separator. |
# |
Numeric suffix placeholder (defaults to 1 when omitted by the user). |
[...] |
Optional keyword node, e.g. [:LEVel]. |
? |
Query suffix. |
num |
Numeric parameter (integers, floats, scientific notation, #H/#Q/#B literals, optional unit suffix). |
bool |
Boolean parameter (ON/OFF/1/0). |
str |
String parameter (quoted or unquoted). |
Multiple commands on one line are separated by ;.