-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for TF command (FileAttribute) from GerberX2 #5
base: master
Are you sure you want to change the base?
Conversation
This is completely untested right now, but I'm interested to see if either of you have any comments on the work so far before I go any further with it. |
457e3dd
to
606a2d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good and clean great work, I only have question about using the TH
constructor for "NPTH"
attributes which I think should change, and then maybe we can add a round trip test to see that we can parse what we print, that is if we have a print for the gerber commands.
parseVia :: MonadFail m => Field -> m Via | ||
parseVia field = case field of | ||
"PTH" -> pure TH | ||
"NPTH" -> pure TH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why don't we have a distinct constructor for non plated through hole, I feel we are loosing vital information here, also you won't be able to print what you parse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I see we don't have a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All seems good to me! Just one suggestion - and I also agree with Handre's comment.
(bytes, "") | ByteString.length bytes == 16 -> pure (MD5 bytes) | ||
_ -> fail "Bad .MD5: must consist of exactly 32 hexadecimal digits" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You aren't actually checking both conditions of this error, which I think might lead to confusion later. I suggest we either do check that the digits are hexadecimal, or just drop this from the error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am checking the condition. If they weren't hexadecimal digits then decode
(from base16-bytestring
) would fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or at least wouldn't return 16 bytes of data with nothing leftover.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry, I missed the call to decode. Great!
I wouldn't ignore this comment, it's a fundamental architectural choice of the parser to try and faithfully parse the input into a data structure as close as possible to the input. |
No description provided.