Conversation
aradi
left a comment
There was a problem hiding this comment.
A very nice idea! I agree, that it may become quite handy, if the user can set include options explicitly in Python (or keep include options unevaluated when parsing HSD into Python), and I definitely support the idea.
However, I am unsure, whether it is a good idea to do it via strings. We may end up with "<<< some_file" in the output (python->hsd), which is not a valid HSD include statement. Probably, we should use special objects to represent unresolved includes ("interrupts" as the HSD jargon calls them). So on the Python side we could have
{
some_block: hsd.interrupts.IncludeText("txt_file_name.txt"),
some_other_block: hsd.interrupts.IncludeHsd("hsd_file_name.hsd")
}which, when transforming back to HSD could be turned into
some_block {
<<< "txt_ile_name.txt"
}
some_other_block {
<<+ "hsd_file_name.hsd"
}
Something along those line would be hopefully more robust and less ambiguous.
baeba37 to
33f9542
Compare
|
I have tried to implement the "interrupts" as I understood them. Please let me know if this meets your expectations or if further changes are needed. |
9a02b3f to
785ca36
Compare
|
Since the tests failed due to the new |
This PR adds the possibility to decide whether an external file should be included via
<<<when read by hsd (default) or not (include_file=False). Also, it is now possible to set such imports via Python by adding<<<filenameto the dictionary.It would also be possible (if desired) to add this decision to the import of hsd-files via
<<+.Please let me know if tests should be added.