-
Notifications
You must be signed in to change notification settings - Fork 0
Class population grammar
Each class you want to populate contributes a four part block: the class name, a column header, a --
separator, and then the instance rows closed by another --.
Here is a complete class population from the elevator scenario:
Bank
Name | Passenger load time | Block clear time | Max close attempts | Average cabin speed | Average stop duration
--
L { [Lower Floors] [4.0] [2.0] [25] [7.0] [9.0] }
P { [Penthouse] [4.0] [2.0] [25] [7.0] [9.0] }
F { [Freight] [7.0] [5.0] [25] [5.0] [14.0] }
--
The relevant grammar is:
class_def = class_name class_attrs block_end
class_name = icaps_name EOL
class_attrs = col_name (' | ' col_name)* EOL
col_name = ref_list / icaps_name / '_state'
instance_block = row+ block_end
The class_def term covers the first three lines: the name, the header, and the separator that closes them
off. The instance_block term covers everything after that separator up to and including the next one.
The header is a table header and the rows beneath it are table rows. The correspondence is purely positional — the first value in each row belongs to the first column, and so on. See the Column header and Instance grammar pages for each half.
Note the row+ in instance_block. A class population must contain at least one instance. There is no way to
write an empty block:
Cabin
Shaft | Travel direction | Current floor
--
--
That is a parse error. If a scenario has no instances of some class, leave the class out of the file altogether rather than trying to declare it empty.
The parser has no access to the xcm class model, so it cannot tell whether the class exists, whether the columns you named are really its attributes, or whether you supplied as many values in a row as there are columns in the header. A row with too few or too many values parses cleanly and the mismatch surfaces further downstream. See Parser output for the full list of what is left to the consumer.
Copyright 2025-2026 © Leon Starr under MIT Open Source License