1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- // 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
- // [:]<Header>[<Space><Argument>[<Comma>[<Space>]<Argument>]...]
- // Agrument types
- // <NR1> Signed integer value
- // <NR2> Floating point value
- // <NR3> Floating point value with exponent
- // <Nrf> Mixed format, any of <NR1>, <NR2>, <NR3>
- // <Nrf+> Mixed format, any of <Nrf>, MIN, MAX or DEF
- // <bin> Signed or unsigned integer in binary format
- // <Bool> 0|1|ON|OFF
- // <QString> Quoted with single (') or double quotes (")
- // <NZDig> Non-zero digit character 1-9
- // <Dig> Digit character 0-9
- // <DChar> Character with hex equivalent 00-FF (0-255 decimal)
- // <Block> {#<NZDig><Dig>[<Dig>...][<DChar>...]|#0[<DChar>...]<terminator>}
- // Mnemonics
- // CH<x> channel specifier, <x> is 1 through 4
- // CURSOR<x> cursor selector, <x> 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})`)
|