Add block ordering and block comment saving #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Researchers have requested the ability to store multiple blocks with similar names (e.g. multiple
control
blocks as seen in the updatedcone.deck
). There has also been significant interest in storing newline and inline comments from a block. The user experience remains mostly unchanged unless blocks contain comments. The only visible difference is that theloads
function now returns a tuple instead of just the dictionary.Handling of Blocks with the Same Name
Blocks that share the same name but do not have a
name
parameter are now stored as separate entries in an array, rather than being merged into the same dictionary.loads
andload
Function Updatesloads
(and consequentlyload
) functions now return a tuple containing both the deck in dictionary format and ablock_order
list.block_order
maintains the order in which blocks are loaded. It uses the following notation:{block_name}
: For blocks with a unique name.{block_name}:{sub_block}
: For blocks that have the same name and contain aname
field (sub-blocks).{block_name}_{i}
: For blocks with the same name but noname
field, wherei
is a zero-based index.Comment Handling
Comments within blocks are now stored using the following notation:
comment_{i}
wherei
starts at 0.{key}_inline_comment_{i}
wherekey
is the key andi
starts at 0.Testing:
Tests have been updated to reflect the new behaviour.