One function

CLikeNestingStackStates in terryyin/lizard

The author described this change as fix https://github.com/terryyin/lizard/issues/134. It counts as a record because the check below fails on the code as it stood at c603f7f2c and passes on 524fc21bd, with nothing else changed between the two runs.

Fix saved2016-06-24
Sharing licenceMIT · LICENSE.txt
Change size+1 1

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

Machinery to track nesting levels of tokens. The main indicators of nesting are braces: '{' and '}'. However, the code is complicated due to braceless structures, which are control-flow structures in C-like languages. Moreover, using braces as nesting level indicators leads to a big caveat; C++ initializer lists, uniform initialization, and any other constructs with braces add extra nesting level. Another complication comes from nested classes inside function bodies and control-flow declarations/bodies. The handling of these complex cases is unspecified and can be ignored.

The change

8080 else:
8181 self._state = self.__declare_structure
8282
83- @CodeStateMachine.read_until_then('({;')
83+ @CodeStateMachine.read_until_then(')({;')
8484 def _read_namespace(self, token, saved):
8585 self._state = self._state_global
8686 if token == "{":

The check that tells the two apart

failpass·test/test_languages/testCAndCPP.py::Test_c_cpp_lizard::test_struct_in_param

Check file test/test_languages/testCAndCPP.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 itc603f7f2ce8eb76b57c18eb17ab37c5a26c88d86
Broken version dated2016-06-24
Modulelizard_languages.clike
Units changedCLikeNestingStackStates
Fingerprint782f93a9845050eb
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 terryyin/lizard