More changes
This commit is contained in:
+44
-14
@@ -280,30 +280,60 @@ def find_used_string_keys(
|
|||||||
text = f.read_text(encoding="utf-8", errors="replace")
|
text = f.read_text(encoding="utf-8", errors="replace")
|
||||||
except OSError:
|
except OSError:
|
||||||
continue
|
continue
|
||||||
|
in_block_comment = False
|
||||||
for line in text.splitlines():
|
for line in text.splitlines():
|
||||||
quote_char = None
|
quote_char = None
|
||||||
escaped = False
|
escaped = False
|
||||||
comment_index = None
|
processed_line = []
|
||||||
for idx, ch in enumerate(line):
|
idx = 0
|
||||||
|
while idx < len(line):
|
||||||
|
ch = line[idx]
|
||||||
if escaped:
|
if escaped:
|
||||||
escaped = False
|
escaped = False
|
||||||
|
if not in_block_comment:
|
||||||
|
processed_line.append(ch)
|
||||||
|
idx += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if quote_char is None:
|
if quote_char is None:
|
||||||
|
if in_block_comment:
|
||||||
|
if (
|
||||||
|
ch == "*"
|
||||||
|
and idx + 1 < len(line)
|
||||||
|
and line[idx + 1] == "/"
|
||||||
|
):
|
||||||
|
in_block_comment = False
|
||||||
|
idx += 2
|
||||||
|
continue
|
||||||
|
idx += 1
|
||||||
|
continue
|
||||||
if ch in ['"', "'"]:
|
if ch in ['"', "'"]:
|
||||||
quote_char = ch
|
quote_char = ch
|
||||||
|
processed_line.append(ch)
|
||||||
|
idx += 1
|
||||||
continue
|
continue
|
||||||
if ch == "/" and idx + 1 < len(line) and line[idx + 1] == "/":
|
if ch == "/" and idx + 1 < len(line):
|
||||||
comment_index = idx
|
if line[idx + 1] == "/":
|
||||||
break
|
break
|
||||||
else:
|
if line[idx + 1] == "*":
|
||||||
if ch == "\\":
|
in_block_comment = True
|
||||||
escaped = True
|
idx += 2
|
||||||
continue
|
continue
|
||||||
if ch == quote_char:
|
processed_line.append(ch)
|
||||||
quote_char = None
|
idx += 1
|
||||||
continue
|
continue
|
||||||
if comment_index is not None:
|
|
||||||
line = line[:comment_index]
|
if ch == "\\":
|
||||||
|
escaped = True
|
||||||
|
processed_line.append(ch)
|
||||||
|
idx += 1
|
||||||
|
continue
|
||||||
|
if ch == quote_char:
|
||||||
|
quote_char = None
|
||||||
|
processed_line.append(ch)
|
||||||
|
idx += 1
|
||||||
|
|
||||||
|
line = "".join(processed_line)
|
||||||
for m in pattern.finditer(line):
|
for m in pattern.finditer(line):
|
||||||
used.add(m.group(0))
|
used.add(m.group(0))
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -157,7 +157,8 @@ inline const std::vector<SettingInfo> list = {
|
|||||||
KOREADER_STORE.setCredentials(KOREADER_STORE.getUsername(), v);
|
KOREADER_STORE.setCredentials(KOREADER_STORE.getUsername(), v);
|
||||||
KOREADER_STORE.saveToFile();
|
KOREADER_STORE.saveToFile();
|
||||||
},
|
},
|
||||||
"koPassword", StrId::STR_KOREADER_SYNC),
|
"koPassword", StrId::STR_KOREADER_SYNC)
|
||||||
|
.withObfuscated(),
|
||||||
SettingInfo::DynamicString(
|
SettingInfo::DynamicString(
|
||||||
StrId::STR_SYNC_SERVER_URL, [] { return KOREADER_STORE.getServerUrl(); },
|
StrId::STR_SYNC_SERVER_URL, [] { return KOREADER_STORE.getServerUrl(); },
|
||||||
[](const std::string& v) {
|
[](const std::string& v) {
|
||||||
|
|||||||
Reference in New Issue
Block a user