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 Gerber files #3744
Conversation
/cc @pchaigno This marks the third and final chapter in my trilogy of distraction, having started with looking up misclassified PostScript repositories, then noticing our definition of KiCad was off, and then discovering a plain-text format that was not only unhighlighted, but also entirely unacknowledged by Linguist.
|
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.
Going to sleep now, I thinkNah, fuck that.
Don't you live in Australia? Aren't people waking up right now?
Gerber Image: | ||
type: data | ||
aliases: | ||
- rs-274x |
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.
Seriously? Who are the crazy people who made this?
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.
Yeah? Try reading the actual format spec. It doubles as both a drug-trip and a lesson in how not to typeset a document. Page 40 pretty much king-punched the designer in me.
I think page 46 sums up the format's insanity best, though...
@carlosgonzalez Pilla esto. Número de pagina 46 == "jajajaja";
Also, I lost your e-mail address, else I would've e-mailed you this confusing crap at some fucked-up hour of the morning like I usually do.
lib/linguist/languages.yml
Outdated
- ".gts" | ||
interpreters: | ||
- ".gerbv" | ||
- ".gerbview" |
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.
Are the dots here on purpose or is that a mistake?
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.
Whoops. Hang on, will fix this and that thing below me.
@@ -0,0 +1,1775 @@ | |||
G04 #@! TF.FileFunction,Copper,L2,Bot,Signal* |
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.
Could we reduce the size of these files? It looks like it's mostly the same pattern over and over, but samples.json
is still gonna have one entry per token...
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.
Done! =) And yep, it's almost 7am. Who cares, sleep is for people with jobs. :p
This is it. This is the moment that nobody's been waiting for. The anxiously awaited addition of GERBER support for GitHub!
What's Gerber, you ask? Well, if you haven't figured out from the name that it's the de facto standard for PCB imaging formats, then I don't know what else to tell you. In all seriousness, the format has been standardised since at least 1998, and with more file extension schizophrenia than Markdown AND Roff together.
I wouldn't have expected such a format to have a widespread presence on GitHub, and... well, I was wrong:
.gbr
: ~37,727 results / 2,953 sampled results.gbl
: ~14,608 / 2,862 sampled results.gbo
: ~12,124 / 2,847 sampled results.gbp
: ~4,773 / 2,599 sampled results.gbs
: ~21,498 / 2,889 sampled results.gko
: ~2,656 / 2,237 sampled results.gtl
: ~14,481 / 2,856 sampled results.gto
: ~13,105 / 2,860 sampled results.gtp
: ~10,268 / 2,836 sampled results.gts
: ~14,775 / 2,891 sampled results.gpb
: ~1,433.gpt
: ~3,960You see now why I already hate this format.
Despite the ridiculous number of extensions, there's thankfully very little conflict with existing file formats. Most of the clashes are with binary files, which Linguist would skip anyway. You can see the sorted result of each filetype search in the aforementioned sample links.
Origin of samples
I was lucky to find samples released under a license, let alone a permissive one. Most repos I encountered were unlicensed altogether, so I'm glad I found these:
986-Studio/FelinaePurr
: BSD-3-Clausegatechipdl/GameOfLight
: MIT/Expatakhenakh/nanoAPRS
: MIT/ExpatagustinBassi/juegoSimon
: BSD-2-Clause