Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ namespace gpr {
string cs = parse_line_comment_with_delimiter(";", s);
return chunk(';', ';', cs);
} else {
if (s.i + 1 >= s.s.size()) {
return parse_isolated_word(s);
}
string next_next = *(s.remaining() + 1);

if (!is_num_char(next_next[0])) {
Expand Down
6 changes: 6 additions & 0 deletions test/parser_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ namespace gpr {
REQUIRE(p.get_block(0).get_chunk(4).tp() == CHUNK_TYPE_WORD);
}

TEST_CASE("Parsing block only an isolated word 'P'") {
gcode_program p = parse_gcode("P");

REQUIRE(p.get_block(0).get_chunk(0).tp() == CHUNK_TYPE_WORD);
}

TEST_CASE("Parse blank line") {
gcode_program p =
parse_gcode("G99 G82 R0.1 Z-0.1227 P F15.04\n ");
Expand Down