Open tatarize opened 4 years ago
Just reworked things so your file works. I probably need to do some more work on the parsing logic though, it seems that HPGL allows a lot more flexibility including omitting semicolons and using spaces instead of commas.
I tried to use this as a quick helpful example but it failed to parse the hpgl I threw at it:
https://github.com/bblanchon/HpglViewer/blob/master/Hpgl/Examples/GL-C-F.plt
Throws an error. First, feeding it the filename directly it loads it with flags
rb
which returns read as bytes.Exception: Unknown HPGL command (b'IN')
So opening the file to start without the
b
flag.p = parse_hpgl(open(filename, 'r'))
It throws a different error:
Exception: Unknown HPGL command (94)
It fails at the line:
PU-6580,5096;
It assumes PU can't have operands and is always followed by PA or similar.
K40Nano/K40Tools#5
I whipped up a pretty reasonable regex parser, though I'm missing a couple things like
INPU;
as a command.