Parse N[0-9]+[ ]* differently (PR #2263)
More general solution to skip N[0-9]+[ ]* in the parser as in #2218
This commit is contained in:
parent
d8e2f5d333
commit
ff6081be3a
1 changed files with 4 additions and 3 deletions
|
@ -5254,12 +5254,13 @@ void process_next_command() {
|
||||||
|
|
||||||
// Sanitize the current command:
|
// Sanitize the current command:
|
||||||
// - Skip leading spaces
|
// - Skip leading spaces
|
||||||
// - Bypass N...
|
// - Bypass N[0-9][0-9]*[ ]*
|
||||||
// - Overwrite * with nul to mark the end
|
// - Overwrite * with nul to mark the end
|
||||||
while (*current_command == ' ') ++current_command;
|
while (*current_command == ' ') ++current_command;
|
||||||
if (*current_command == 'N' && current_command[1] >= '0' && current_command[1] <= '9') {
|
if (*current_command == 'N' && current_command[1] >= '0' && current_command[1] <= '9') {
|
||||||
while (*current_command != ' ' && *current_command != 'G' && *current_command != 'M' && *current_command != 'T') ++current_command;
|
current_command += 2; // skip N[0-9]
|
||||||
while (*current_command == ' ') ++current_command;
|
while (*current_command >= '0' && *current_command <= '9') ++current_command; // skip [0-9]*
|
||||||
|
while (*current_command == ' ') ++current_command; // skip [ ]*
|
||||||
}
|
}
|
||||||
char *starpos = strchr(current_command, '*'); // * should always be the last parameter
|
char *starpos = strchr(current_command, '*'); // * should always be the last parameter
|
||||||
if (starpos) *starpos = '\0';
|
if (starpos) *starpos = '\0';
|
||||||
|
|
Loading…
Reference in a new issue