gcode-rs
gcode-rs copied to clipboard
Add newline to the parsing grammar to resolve some bugs
Summary
By adding newline (\n
) to the grammar, this pull request will:
- Resolve #44
- Resolve #55
- Fix some erroneous tests
- Add some new tests
It may be easier to review by commit than in bulk.
Description
Newlines are special for GCode; they represent the end of the current command and the start of a new one. This commit makes newlines a first-class token, and parses with them under consideration.
How I tested
I added some tests, un-ignored or fixed other tests, and executed cargo test
.
I also ran a bunch of gcode files through the parser as a sanity check. In retrospect, I should have created tests from them, so I may go back and do that if I need to make further changes.
@Michael-F-Bryan I pushed two more commits, one of which fixes #55. I was going to wait until after this pull request was merged to fix #55, but it turns out very much related to the newline handling.
If you prefer these fixes in separate pull requests, just let me know.
Howdy! In case anyone is still out there, I tried using this library and ran into a bug. The library panicked on the gcode generated by DrawingBotV3-Free. Anyways, I am interested to know if this change would fix it. I'm hoping this message will motivate someone to resolve this merge request.
@jpursell if you send me some minimal example code that panics the library, I'll check it out. I'm curious.