Whole file

David-Wobrock/sqlvalidator

The author described this change as Fix #34 -- Handle parsing a function with a single comma string. It counts as a record because the check below fails on the code as it stood at c8c95c0de and passes on d7e8b6c46, with nothing else changed between the two runs.

Fix saved2021-12-22
Sharing licenceMIT · LICENSE
Change size+4 0

What the code was meant to do, written into the code itself as a save note

Fix #34 -- Handle parsing a function with a single comma string

The change

510510 expression_tokens = []
511511 count_parenthesis = 0
512512 count_square_brackets = 0
513+ in_string = False
513514 while next_token is not None:
514515 expression_tokens.append(next_token)
515516 if next_token == "(":
520521 count_square_brackets += 1
521522 elif next_token == "]":
522523 count_square_brackets -= 1
524+ elif next_token in String.QUOTES:
525+ in_string = not in_string
523526
524527 next_token = next(tokens, None)
525528 if next_token is None or (
526529 next_token == ","
527530 and count_parenthesis == 0
528531 and count_square_brackets == 0
532+ and in_string is False
529533 ):
530534 expression, _ = ExpressionParser.parse(
531535 iter(expression_tokens), can_be_type=can_be_type

The check that tells the two apart

failpass·tests/unit/test_lexer.py::test_function_with_single_comma_string_param

Check file tests/unit/test_lexer.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before itc8c95c0debdc7aedc10702f88c4a9c21319082c8
Broken version dated2021-11-15
Modulesqlvalidator.grammar.lexer
Units changedExpressionListParser
Fingerprinte7a90c50bbbf8905
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in David-Wobrock/sqlvalidator