planetarypy / pvl

Python implementation of PVL (Parameter Value Language)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Store and write labels

percurnicus opened this issue · comments

The decoder should be able to parse and store the comments and the encoder should be able to write them as well.

I have implemented this in a private fork and just need to transfer it over here. However, I want to take this time to make sure I am doing it the best way possible. Here are some notes on how I have it implemented or will implement in this project.

  • Comments exist in a Comment object that holds the text of the comment, the type (whether to use the # or /* to start the comment), and whether or not the comment exists inline with the key.

  • Comments are associated with the keys. Currently, I associate the comment with the key that directly precedes it. However, most comments are directed at the key-value pair that comes directly after it and I plan to make this the correspondence (I did it the other way because it made parsing the comments easier).

  • The PVLModule (as well as PVLObject and PVLGroup) object has a new comments attribute that holds the comments. There is a mutable mapping Comments object to hold the comments. I plan for this to directly mirror the label object, matching all the keys and the values will be the Comment object.

  • I am trying to decide if users should interact with the comments by only accessing the comments attribute or if there should be higher level methods on the label object to interact with the comments. I'm leaning towards making users use the comments attribute but not decided yet.

This Issue is almost two years old. Closing for inactivity.