Support preprocessing __LINE__

This commit is contained in:
Wilson Snyder
2023-09-17 19:49:38 -04:00
parent ab13548018
commit b68f101e81
5 changed files with 41 additions and 17 deletions
+4 -1
View File
@@ -221,7 +221,10 @@ void FileLine::lineDirective(const char* textp, int& enterExitRef) {
bool fail = false;
const char* const ln = textp;
while (*textp && !std::isspace(*textp)) ++textp;
if (std::isdigit(*ln)) {
if (0 == strncmp(ln, "`__LINE__", strlen("`__LINE__"))) {
// Special case - see docs - don't change other than accounting for `line itself
lineno(lineno() + 1);
} if (std::isdigit(*ln)) {
lineno(std::atoi(ln));
} else {
fail = true;