// BNF notation: // <> Defined element // = is defined as // | Exclusive OR // {} Group, one element is required // [] Optional, can be omitted // ... Previous element(s) may be repeated // Message elements // [:]
[[[]]...] // Agrument types // Signed integer value // Floating point value // Floating point value with exponent // Mixed format, any of , , // Mixed format, any of , MIN, MAX or DEF // Signed or unsigned integer in binary format // 0|1|ON|OFF // Quoted with single (') or double quotes (") // Non-zero digit character 1-9 // Digit character 0-9 // Character with hex equivalent 00-FF (0-255 decimal) // {#[...][...]|#0[...]} // Mnemonics // CH channel specifier, is 1 through 4 // CURSOR cursor selector, is 1 or 2 const nr1 = `[+-]?\d+` const nr2 = `[+-]?(?:\d+\.?\d*|\d*\.\d+)` const nr3 = `${nr2}(?:[eE]${nr2})?` const NR1 = new RegExp(`(${nr1})`) const NR2 = new RegExp(`(${nr2})`) const NR3 = new RegExp(`(${nr3})`) const nfr = `${nr1}|${nr2}|${nr3}` const nfrp = `${nfr}|MIN|MAX|DEF` const Nfr = new RegExp(`(${nfr})`) const Nfrp = new RegExp(`(${nfrp})`) const bool = `0|1|ON|OFF` const Bool = new RegExp(`(${bool})`) const qString = `(?:["'])(?:(?:\\{2})*|(?:.*?[^\\](?:\\{2})*))\1` const QString = new RegExp(`(${qString})`) const dig = `\d` const nzdig = `[1-9]` const dchar = `[\\x00-\\xFF]` const Dig = new RegExp(`(${dig})`) const ZNDig = new RegExp(`(${nzdig})`) const DChar = new RegExp(`(${dchar})`) const block = `#${nzdig}(?:${dig})+(?:${dchar})*|#0(?:${dchar})*` const Block = new RegExp(`(${block})`) const header = `v` const Header = new RegExp(`(${header})`)