Closed judepayne closed 1 month ago
This will require changes to both the d2 compiler and parser. The dot compiler is a TBD.
dictim represents comments as vectors:
[:comment "I am a comment"]
This could be represented in dictim (in an atto-map) as:
{:comment {:attr-that-is-commented-out val}, attr val ...}
{[:comment :attr-that-is-commented-out] val, attr val ...}
Perhaps some other ways.
Need to that about the most natural representation, before committing to adding this since this is a minor use case
Decided to add this to dictim using notation no. 1 above
@krish777 complete See 5724d82 & a85e883 commits. Note that even though attrs may be commented out, they are still validated both during compilation and parsing. This is because attrs in dictim syntax live in a clojure map, which must have keys and values - so no freeform text allowed. i.e. it's a data format whereas d2 is a text format
@krish777 please review this. Not sure this is the right approach. Maybe it's better to parse commented out attrs as
{:comment "style.italic: true"}
i.e. just treat them as strings
@eddielao Per our discussion, Can you please test this one?
Closing
This d2:
cannot be parsed (and throws an error).
When the
'#'
characters is removed, it can be parsed.attrs should be allowed to be commented out since this is valid d2