@@ -93,7 +93,7 @@ def _append_literal_char(acc: str, current_char: str | None) -> tuple[str, str |
9393 self .index += 1
9494 else :
9595 # Ok this is not a doubled quote, check if this is an empty string or not
96- i = self .skip_whitespaces_at (idx = 1 , move_main_index = False )
96+ i = self .scroll_whitespaces (idx = 1 )
9797 next_c = self .get_char_at (i )
9898 if next_c in STRING_DELIMITERS + ["{" , "[" ]:
9999 # something fishy is going on here
@@ -143,7 +143,7 @@ def _append_literal_char(acc: str, current_char: str | None) -> tuple[str, str |
143143 ):
144144 rstring_delimiter_missing = True
145145 # check if this is a case in which the closing comma is NOT missing instead
146- self .skip_whitespaces_at ()
146+ self .skip_whitespaces ()
147147 if self .get_char_at (1 ) == "\\ " :
148148 # Ok this is a quoted string, skip
149149 rstring_delimiter_missing = False
@@ -153,7 +153,7 @@ def _append_literal_char(acc: str, current_char: str | None) -> tuple[str, str |
153153 i += 1
154154 # found a delimiter, now we need to check that is followed strictly by a comma or brace
155155 # or the string ended
156- i = self .skip_whitespaces_at (idx = i , move_main_index = False )
156+ i = self .scroll_whitespaces (idx = i )
157157 next_c = self .get_char_at (i )
158158 if not next_c or next_c in ["," , "}" ]:
159159 rstring_delimiter_missing = False
@@ -168,7 +168,7 @@ def _append_literal_char(acc: str, current_char: str | None) -> tuple[str, str |
168168 else :
169169 # But again, this could just be something a bit stupid like "lorem, "ipsum" sic"
170170 # Check if we find a : afterwards (skipping space)
171- i = self .skip_whitespaces_at (idx = i + 1 , move_main_index = False )
171+ i = self .scroll_whitespaces (idx = i + 1 )
172172 next_c = self .get_char_at (i )
173173 if next_c and next_c != ":" :
174174 rstring_delimiter_missing = False
@@ -183,7 +183,7 @@ def _append_literal_char(acc: str, current_char: str | None) -> tuple[str, str |
183183 break
184184 else :
185185 # skip any whitespace first
186- i = self .skip_whitespaces_at (idx = 1 , move_main_index = False )
186+ i = self .scroll_whitespaces (idx = 1 )
187187 # We couldn't find any rstring_delimeter before the end of the string
188188 # check if this is the last string of an object and therefore we can keep going
189189 # make an exception if this is the last char before the closing brace
@@ -220,7 +220,7 @@ def _append_literal_char(acc: str, current_char: str | None) -> tuple[str, str |
220220 if self .context .current == ContextValues .OBJECT_VALUE and char == "}" :
221221 # We found the end of an object while parsing a value
222222 # Check if the object is really over, to avoid doubling the closing brace
223- i = self .skip_whitespaces_at (idx = 1 , move_main_index = False )
223+ i = self .scroll_whitespaces (idx = 1 )
224224 next_c = self .get_char_at (i )
225225 if next_c == "`" and self .get_char_at (i + 1 ) == "`" and self .get_char_at (i + 2 ) == "`" :
226226 # This could be a special case in which the LLM added code fences after the object
@@ -286,7 +286,7 @@ def _append_literal_char(acc: str, current_char: str | None) -> tuple[str, str |
286286 # found a second delimiter
287287 i += 1
288288 # Skip spaces
289- i = self .skip_whitespaces_at (idx = i , move_main_index = False )
289+ i = self .scroll_whitespaces (idx = i )
290290 if self .get_char_at (i ) in ["," , "}" ]:
291291 # Ok then this is a missing right quote
292292 self .log (
@@ -319,7 +319,7 @@ def _append_literal_char(acc: str, current_char: str | None) -> tuple[str, str |
319319 # We found a quote, now let's make sure there's a ":" following
320320 i += 1
321321 # found a delimiter, now we need to check that is followed strictly by a comma or brace
322- i = self .skip_whitespaces_at (idx = i , move_main_index = False )
322+ i = self .scroll_whitespaces (idx = i )
323323 if self .get_char_at (i ) == ":" :
324324 # Reset the cursor
325325 self .index -= 1
@@ -365,7 +365,7 @@ def _append_literal_char(acc: str, current_char: str | None) -> tuple[str, str |
365365 next_c = self .get_char_at (i )
366366 # Ok now I found a delimiter, let's skip whitespaces and see if next we find a } or a ,
367367 i += 1
368- i = self .skip_whitespaces_at (idx = i , move_main_index = False )
368+ i = self .scroll_whitespaces (idx = i )
369369 next_c = self .get_char_at (i )
370370 if next_c in ["}" , "," ]:
371371 self .log (
@@ -378,15 +378,15 @@ def _append_literal_char(acc: str, current_char: str | None) -> tuple[str, str |
378378 if all (str (self .get_char_at (j )).isspace () for j in range (1 , i ) if self .get_char_at (j )):
379379 break
380380 if self .context .current == ContextValues .OBJECT_VALUE :
381- i = self .skip_whitespaces_at (idx = i + 1 , move_main_index = False )
381+ i = self .scroll_whitespaces (idx = i + 1 )
382382 if self .get_char_at (i ) == "," :
383383 # So we found a comma, this could be a case of a single quote like "va"lue",
384384 # Search if it's followed by another key, starting with the first delimeter
385385 i = self .skip_to_character (character = lstring_delimiter , idx = i + 1 )
386386 i += 1
387387 i = self .skip_to_character (character = rstring_delimiter , idx = i + 1 )
388388 i += 1
389- i = self .skip_whitespaces_at (idx = i , move_main_index = False )
389+ i = self .scroll_whitespaces (idx = i )
390390 next_c = self .get_char_at (i )
391391 if next_c == ":" :
392392 self .log (
@@ -449,7 +449,7 @@ def _append_literal_char(acc: str, current_char: str | None) -> tuple[str, str |
449449 self .log (
450450 "While parsing a string, handling an extreme corner case in which the LLM added a comment instead of valid string, invalidate the string and return an empty value" ,
451451 )
452- self .skip_whitespaces_at ()
452+ self .skip_whitespaces ()
453453 if self .get_char_at () not in [":" , "," ]:
454454 return ""
455455
0 commit comments