diff options
author | David Crocker <dcrocker@eschertech.com> | 2020-12-29 11:27:39 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2020-12-29 11:27:39 +0300 |
commit | d97b3d498166feddf1ef73896253f2d9cb655dfd (patch) | |
tree | 25c0850e3df570b8d097303f45d6e9d7d85a9806 /src/GCodes/GCodeBuffer/StringParser.cpp | |
parent | 44f3b93ddec110ecde6d5b5f8c32cdd8f4cfea22 (diff) |
Increased maximum axes to 15, reduced default extruders to 0
Diffstat (limited to 'src/GCodes/GCodeBuffer/StringParser.cpp')
-rw-r--r-- | src/GCodes/GCodeBuffer/StringParser.cpp | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/src/GCodes/GCodeBuffer/StringParser.cpp b/src/GCodes/GCodeBuffer/StringParser.cpp index ea395077..82536daa 100644 --- a/src/GCodes/GCodeBuffer/StringParser.cpp +++ b/src/GCodes/GCodeBuffer/StringParser.cpp @@ -905,6 +905,13 @@ bool StringParser::IsLastCommand() const noexcept bool StringParser::Seen(char c) noexcept { bool inQuotes = false; + bool escaped = false; + bool wantLowerCase = (c >= 'a'); + if (wantLowerCase) + { + c = toupper(c); + } + unsigned int inBrackets = 0; for (readPointer = parameterStart; (unsigned int)readPointer < commandEnd; ++readPointer) { @@ -915,18 +922,30 @@ bool StringParser::Seen(char c) noexcept } else if (!inQuotes) { - if (inBrackets == 0 && toupper(b) == c && (c != 'E' || (unsigned int)readPointer == parameterStart || !isdigit(gb.buffer[readPointer - 1]))) - { - ++readPointer; - return true; - } - if (b == '{') + if (b == '\'' && !escaped) { - ++inBrackets; + escaped = true; } - else if (b == '}' && inBrackets != 0) + else { - --inBrackets; + if ( inBrackets == 0 + && toupper(b) == c + && escaped == wantLowerCase + && (c != 'E' || (unsigned int)readPointer == parameterStart || !isdigit(gb.buffer[readPointer - 1])) + ) + { + ++readPointer; + return true; + } + escaped = false; + if (b == '{') + { + ++inBrackets; + } + else if (b == '}' && inBrackets != 0) + { + --inBrackets; + } } } } |