G-code parsing: enable ; comments

This commit is contained in:
2023-05-05 11:18:30 +03:00
parent 1fd308a648
commit 0d8bff6fd5
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ grbl::program::program(std::string filename) {
} }
static auto comment_re = std::regex(R"(\(([^)]*)\))"); static auto comment_re = std::regex(R"(\(([^)]*)\))");
static auto gcode_re = std::regex(R"(([a-zA-Z0-9\s.\-]+)\s*(\(([^)]*)\))?)"); static auto gcode_re = std::regex(R"(([a-zA-Z0-9\s.\-]+)\s*(;.*|\(([^)]*)\))?)");
bool grbl::program::load_from_stream(std::istream& in) { bool grbl::program::load_from_stream(std::istream& in) {
instructions.clear(); instructions.clear();
+1 -1
View File
@@ -19,7 +19,7 @@ TEST(grbl_program, load_from_string) {
G94 ( Millimeters per minute feed rate. ) G94 ( Millimeters per minute feed rate. )
G21 ( Units == Millimeters. ) G21 ( Units == Millimeters. )
F600.00000 F600.00000 ; another type of comment
X3.87739 Y78.52820 X3.87739 Y78.52820
)"; )";
pgm.load_from_string(content); pgm.load_from_string(content);
+1 -1
View File
@@ -4,7 +4,7 @@
G94 ( Millimeters per minute feed rate. ) G94 ( Millimeters per minute feed rate. )
G21 ( Units == Millimeters. ) G21 ( Units == Millimeters. )
G90 ( Absolute coordinates. ) G90 ( Absolute coordinates. )
S10000 ( RPM spindle speed. ) S20000 ( RPM spindle speed. )
M3 S24000 M3 S24000
G4 P3 G4 P3