I haven't found a straightforward and reliable specification or source listing exactly which optional characters are allowed before line numbers. Unfortunately, I currently don't have the time to dive deeper into ISO specs.
But I think that this a good minimal change that resolves some issues and hopefully doesn't cause others.
Changes
The current G-CODE syntax is too loose on the "line number" instruction matching.
Example:
Rendered as:
NFIG
is not a line number instruction or symbol. My proposed fix is to strictly match the letter N, followed by one or more digits.This does not resolve all issues, such as matching
N\d+
that is NOT at the start of the line:Rendered as
I haven't found a straightforward and reliable specification or source listing exactly which optional characters are allowed before line numbers. Unfortunately, I currently don't have the time to dive deeper into ISO specs.
But I think that this a good minimal change that resolves some issues and hopefully doesn't cause others.
Checklist
CHANGES.md