Make substitutions work and other minor fixes.

This commit is contained in:
2026-08-30 17:02:34 +01:00
parent 41049b1ab6
commit 49bf5a2e2d
9 changed files with 233 additions and 73 deletions
+6 -5
View File
@@ -132,7 +132,7 @@ void Parser::operation() {
if (delim == '\0')
throw ed_error("regex expected");
advance();
uint64_t j = 0;
uint16_t j = 0;
while (true) {
if (peek(j) == '\0')
throw ed_error("Unterminated regex");
@@ -141,7 +141,7 @@ void Parser::operation() {
else if (peek(j) == '\\')
j += 2;
else if (peek(j) == '[')
while (peek(j) != '\0' && cmd[i] != ']')
while (peek(j) != '\0' && peek(j) != ']')
j++;
else
j++;
@@ -157,15 +157,16 @@ void Parser::operation() {
else if (peek(j) == '\\')
j += 2;
else if (peek(j) == '[')
while (peek(j) != '\0' && cmd[i] != ']')
while (peek(j) != '\0' && peek(j) != ']')
j++;
else
j++;
}
std::string replacement;
std::string replacement(peek_str(j));
if (peek(j) != '\0') {
replacement = peek_str(j);
advance(j + 1);
} else {
advance(j);
}
std::string options;
if (peek() != '\0') {