gcode-rs icon indicating copy to clipboard operation
gcode-rs copied to clipboard

Add newline to the parsing grammar to resolve some bugs

Open jmbeck15 opened this issue 2 years ago • 3 comments

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.

jmbeck15 avatar Aug 17 '22 13:08 jmbeck15

@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.

jmbeck15 avatar Aug 18 '22 11:08 jmbeck15

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 avatar May 05 '24 12:05 jpursell

@jpursell if you send me some minimal example code that panics the library, I'll check it out. I'm curious.

jmbeck15 avatar May 25 '24 20:05 jmbeck15