MCPcopy Create free account
hub / github.com/Schildkroet/Candle2 / removeComment

Method removeComment

src/parser/gcodepreprocessorutils.cpp:41–53  ·  view source on GitHub ↗

* Removes any comments within parentheses or beginning with a semi-colon. */

Source from the content-addressed store, hash-verified

39* Removes any comments within parentheses or beginning with a semi-colon.
40*/
41QString GcodePreprocessorUtils::removeComment(QString command)
42{
43 static QRegExp rx1("\\(+[^\\(]*\\)+");
44 static QRegExp rx2(";.*");
45
46 // Remove any comments within ( parentheses ) using regex "\([^\(]*\)"
47 if (command.contains('(')) command.remove(rx1);
48
49 // Remove any comment beginning with ';' using regex ";.*"
50 if (command.contains(';')) command.remove(rx2);
51
52 return command.trimmed();
53}
54
55/**
56* Searches for a comment in the input string and returns the first match.

Callers

nothing calls this directly

Calls 1

containsMethod · 0.80

Tested by

no test coverage detected