General-purpose Modbus point-table linter: catches duplicate register names, out-of-range and overlapping addresses, oversized address gaps and conflicting JSONB field mappings.
# name address type access unit jsonb
coil_temp 40001 float32 R degC jsonb->coil_temp
conveyor 40003 bool RW jsonb->conveyor_run
tank_level 40004 uint16 R mm jsonb->tank_levellet dev = @modbus_lint.parse_device(text)?
let issues = @modbus_lint.lint(dev)
println(@modbus_lint.render(issues))let s = @modbus_lint.device_to_json_string(dev) // Device -> pretty JSON
let back = @modbus_lint.parse_device_json(s)? // JSON -> Device
println(@modbus_lint.render_summary(dev, issues)) // errors/warnings + coverage
let sorted = @modbus_lint.sort_by_address(dev) // tools.sort_by_addressmoon run cmd/main # built-in demo
moon run cmd/main -- "a 40001 int16 R" # lint given register line
moon run cmd/main -- --format summary --demo
moon run cmd/main -- --json-in "$(cat points.json)"
moon run cmd/main -- --gap 32 --show "coil_temp 40001 int16 R degC"pub struct AreaStats {
area : Int
registers : Int
words : Int
free_words : Int
utilization_permille : Int
bytes : Int
}pub enum ByteOrder {
BigEndian
LittleEndian
}pub struct Register {
name : String
address : Int
rtype : RegisterType
access : Access
unit : String
jsonb : String
line : Int
}pub enum RegisterType {
TBit
TInt16
TUInt16
TInt32
TUInt32
TFloat32
TFloat64
}pub enum WordOrder {
HighWordLowAddress
LowWordLowAddress
}fn area_is_bit(area : Int) -> Boolfn area_is_input(area : Int) -> Boolfn decode_coil(word : Int) -> Boolfn decode_int16(word : Int) -> Intfn decode_uint16(word : Int) -> Intfn encode_coil(value : Bool) -> Intfn encode_int16(v : Int) -> Intfn encode_uint16(v : Int) -> Intfn float32_from_words(hi : Int, lo : Int) -> Doublefn float32_words(v : Double) -> (Int, Int)fn float64_from_words(w0 : Int, w1 : Int, w2 : Int, w3 : Int) -> Doublefn float64_words(v : Double) -> (Int, Int, Int, Int)fn int32_fold(hi : Int, lo : Int) -> Intfn int32_parts(v : Int) -> (Int, Int)fn is_jsonb_prefixed(s : String) -> Boolfn jsonb_depth(s : String) -> Intfn jsonb_is_unset(s : String) -> Boolfn jsonb_leaf(s : String) -> Stringfn pad(s : String) -> Stringfn pad_num(n : Int) -> StringInstall
Download zipGeneral-purpose Modbus point-table linter: catches duplicate register names, out-of-range and overlapping addresses, oversized address gaps and conflicting JSONB field mappings.