Deprecate 1-indexed string functions

This commit is contained in:
Rangi42
2025-08-05 16:46:09 -04:00
parent 39f0f9edc0
commit 3a0a4b7f90
21 changed files with 55 additions and 174 deletions

View File

@@ -1493,10 +1493,12 @@ relocexpr_no_str:
$$.makeNumber(pos != std::string::npos ? pos : -1);
}
| OP_STRIN LPAREN string COMMA string RPAREN {
warning(WARNING_OBSOLETE, "`STRIN` is deprecated; use 0-indexed `STRFIND` instead");
size_t pos = $3.find($5);
$$.makeNumber(pos != std::string::npos ? pos + 1 : 0);
}
| OP_STRRIN LPAREN string COMMA string RPAREN {
warning(WARNING_OBSOLETE, "`STRRIN` is deprecated; use 0-indexed `STRRFIND` instead");
size_t pos = $3.rfind($5);
$$.makeNumber(pos != std::string::npos ? pos + 1 : 0);
}