Rename `mut` and `dup` to `destructive` and `nonDestructive`

This commit is contained in:
Elias Batek 2025-02-12 01:07:18 +01:00
parent 51d51e5a98
commit eacf798788
1 changed files with 7 additions and 7 deletions

14
ini.d
View File

@ -311,12 +311,12 @@ private enum LocationState {
} }
private enum OperatingMode { private enum OperatingMode {
mut, nonDestructive,
dup, destructive,
} }
private enum OperatingMode operatingMode(string) = (is(string == char[])) private enum OperatingMode operatingMode(string) = (is(string == char[]))
? OperatingMode.mut : OperatingMode.dup; ? OperatingMode.destructive : OperatingMode.nonDestructive;
/++ /++
Low-level INI parser Low-level INI parser
@ -699,7 +699,7 @@ struct IniParser(
static if (dialect.hasFeature(Dialect.concatSubstrings)) { static if (dialect.hasFeature(Dialect.concatSubstrings)) {
Token lexSubstringsImpl(TokenType tokenType)() { Token lexSubstringsImpl(TokenType tokenType)() {
static if (operatingMode!string == OperatingMode.mut) { static if (operatingMode!string == OperatingMode.destructive) {
auto originalSource = _source; auto originalSource = _source;
} }
@ -709,7 +709,7 @@ struct IniParser(
next._bypassConcatSubstrings = true; next._bypassConcatSubstrings = true;
next.popFront(); next.popFront();
static if (operatingMode!string == OperatingMode.mut) { static if (operatingMode!string == OperatingMode.destructive) {
import arsd.core : isSliceOf; import arsd.core : isSliceOf;
if (!token.data.isSliceOf(originalSource)) { if (!token.data.isSliceOf(originalSource)) {
@ -726,10 +726,10 @@ struct IniParser(
break; break;
} }
static if (operatingMode!string == OperatingMode.dup) { static if (operatingMode!string == OperatingMode.nonDestructive) {
token.data ~= next.front.data; token.data ~= next.front.data;
} }
static if (operatingMode!string == OperatingMode.mut) { static if (operatingMode!string == OperatingMode.destructive) {
foreach (const c; next.front.data) { foreach (const c; next.front.data) {
mutSource[mutOffset] = c; mutSource[mutOffset] = c;
++mutOffset; ++mutOffset;