Skip to main content

Structs Ids List Format

WORK IN PROGRESS

The Struct Ids List format is a comma delimited string format for storing references to mnemonics. It is used in various Definitions such as the Profile Definition to store which mnemonics should be included in the Export Package.

ExampleThe string:string "format should be parsed as:

  • Comma delimited, whitespace ignored
  • For each item in list:
    • unroll each instance of #[]
    • instance can only contain numeric values or numeric ranges
    • characters before # and after ] should be prefixed and appended to each unrolled item, respectively
  • For each unrolled item:
    • if starts with @, treat as ext_id
    • if starts with a digit
      • if contains -, treat as a numeric range
      • else, treat as single mn_id
    • otherwise treat as name[;subname] (aka mn key)

A numeric range is shorthand syntax for a range of numbers. For example 3-6 should be expanded to 3,4,5,6.

Example:
@#[1,2,3]sci,name;subname,@100sci,@#[1,5-6,13,15-17]raw,15,20-22,#[40,50-52],30,name2"

 * Parses the input string as a comma delimited list.
 * For each item in list:
 *  - unroll each instance of #[] (# is not permitted in mnemonic names, so its safe)
 * 	- instance can only contain numeric values (can't include @ character)
 * For each unrolled item:
 * 	- if starts with @, treat as ext ID
 *  - if starts with a digit
 *  - if contains -, treat as MN ID range (inclusive)
 * 	  else, treat as single MN ID
 *  - otherwise treat as name[;subname]name2

Will be parsed into:

mn_ids: [ 15, 20, 21, 22, 40, 50, 51, 52, 30 ]

ext_ids: [ "1sci", "2sci", "3sci", "100sci", "1raw", "5raw", "6raw", "13raw", "15raw", "16raw", "17raw" ]

mn keys: [ "name;subname", "name2" ]