-
Notifications
You must be signed in to change notification settings - Fork 0
Comments and whitespace
A sip file is line oriented and space sensitive. The parser runs with arpeggio's whitespace skipping turned off, because newlines separate instances and spaces separate values, so the grammar has to account for whitespace explicitly:
EOL = SP* COMMENT? '\n' // end of line
COMMENT = '//' r'.*'
SP = " "
A comment starts with // and runs to the end of the line. Since EOL allows a comment, one can go on a line
of its own or trail any line of content, including a -- separator:
scenario : Three Bank1
--
// The three banks serving Pigsley Central
Bank
Name | Passenger load time // seconds
--
L { [Lower Floors] [4.0] } // the default bank
--
Comments are dropped entirely and never appear in the parser result.
EOL* and EOL+ appear in enough places that blank lines are permitted before the scenario line, after any
-- separator, and between the rows of an instance block. Use them to space a long population out; they carry
no meaning.
Most of the file is spacing exact, and these are the places that trip people up:
-
scenario :— one space each side of the colon -
|between column names — one space each side - single space or underscore between the words of a name, never two
-
R1>Bankin a reference column — no spaces around the> -
> IDLEin an initial state — one space before the>and one after
The one relaxed spot is inside the braces of a row, where SP* and SP+ let you pad values as much as you like
to line the columns up. See Instance grammar.
Indentation is never used. Every line of a sip file starts in column one.
There is no tab anywhere in the grammar, so a tab is a parse error wherever it appears, including between the values of a row. Align with spaces.
The parser appends a newline to the text it reads, which simplifies the grammar rules and means a file whose last
line has no trailing newline still parses. What the file does need is the final -- closing its last instance
block. See Population grammar.
Copyright 2025-2026 © Leon Starr under MIT Open Source License