Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions JsonPreprocessor/CJsonPreprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1635,9 +1635,11 @@ def __isAscii(sInput : str) -> bool:
elif '${' not in sInput and not regex.match(r'^\s*\[\s*import\s*\]\s*$', sInput.lower()):
if not oKeyChecker.keyNameChecker(sInput) and __isAscii(sInput):
errorMsg = oKeyChecker.errorMsg
elif regex.search(r'\[[^\'\[]+\'[^\']+\'\s*\]|\[\s*\'[^\']+\'[^\]]+\]', sInput) or\
regex.search(r'\[[^\d\]]+\d+\]|\[\d+[^\d\]]+\]', sInput):
elif regex.search(r'\[[^\'\[]+\'[^\']+\'\s*\]|\[\s*\'[^\']+\'[^\]]+\]', sInput) or \
regex.search(r'\[[^\d\[\]]+\d+\]|\[\d+[^\d\]]+\]', sInput):
errorMsg = f"Invalid syntax: {sInput}"
if regex.search(r'\[\s*[\-\+]\d+\]', sInput):
errorMsg = f"Slicing is not supported (expression: '{sInput}')."
elif regex.match(r'^\s*\${.+[\]}]*$', sInput):
tmpInput = sInput
while regex.search(r'\[[^\[\]]+\]', tmpInput):
Expand All @@ -1651,6 +1653,8 @@ def __isAscii(sInput : str) -> bool:
errorMsg = f"Invalid key name: {sInput} - This key name must be '{correctKey}'"
elif sInput.count('${') != sInput.count('}') or sInput.count('[') != sInput.count(']'):
errorMsg = f"Invalid key name: {sInput} - The brackets mismatch!!!"
elif regex.match(r'^\s*[^\$]+\${.+$|^\s*\${.+[^}\]]\s*$', sInput):
errorMsg = f"Invalid key name: '{sInput}'."
elif regex.search(r'\${[^}]*}', sInput):
if regex.search(r'\[\s*\]', sInput):
errorMsg = f"Invalid key name: {sInput}. A pair of square brackets is empty!!!"
Expand Down Expand Up @@ -2073,7 +2077,7 @@ def __handleLastElement(sInput : str) -> str:
if i==iItems:
item = __handleLastElement(item)
elif not regex.match(r'^[\s{]*"[^"]*"\s*$', item):
item = regex.sub('(\$.+)\s*$', '"\\1" ', item)
item = regex.sub('^\s*([^\s].+[^\s])\s*$', '"\\1" ', item)
while CNameMangling.STRINGVALUE.value in item:
if "${" in tmpList[0]:
sValue = tmpList.pop(0)
Expand Down
Binary file modified JsonPreprocessor/JsonPreprocessor.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions JsonPreprocessor/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
#
# Version and date of JsonPreprocessor
#
VERSION = "0.9.1"
VERSION_DATE = "22.5.2025"
VERSION = "0.9.2"
VERSION_DATE = "5.6.2025"

4 changes: 4 additions & 0 deletions packagedoc/additional_docs/History.tex
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,8 @@
\historychange{- Enhanced cyclic import detection\newline
- Fixed bugs and updated error messages}

\historyversiondate{0.9.2}{06/2025}
\historychange{- Improved invalid key name detection\newline
- Fixed bugs}

\end{packagehistory}
Loading