One function
CLikeNestingStackStates in terryyin/lizard
The author described this change as “fix https://github.com/terryyin/lizard/issues/178”. It counts as a record because the check below fails on the code as it stood at fe6cafa6f and passes on 7c294306c, with nothing else changed between the two runs.
Projectterryyin/lizard
Fix saved2017-08-22
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
| 82 | 82 | self.__structure_brace_stack.append(False) | |
| 83 | 83 | ||
| 84 | 84 | elif token == '}': | |
| 85 | - | if self.__structure_brace_stack and self.__structure_brace_stack[-1]: | |
| 85 | + | while self.__structure_brace_stack and self.__structure_brace_stack[-1]: | |
| 86 | 86 | self.__pop_structures() | |
| 87 | 87 | self.__pop_structures() | |
| 88 | 88 | elif (token == ";" and self.__structure_brace_stack and |
The check that tells the two apart
fail→pass·test/test_languages/testCAndCPP.py::Test_Preprocessing::test_body_with_macro_call_after_if_and_no_semicolon_before_the_closing_br2
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 itfe6cafa6feec1f1d2787ce609da29af51c5c1c2a
Broken version dated2017-08-21
Modulelizard_languages.clike
Units changedCLikeNestingStackStates
Fingerprint5f6d8a76d99f2243
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
- 2026-08-08fix(java): do not report control structures as methods
- 2026-07-02HalsteadClassifier
- 2026-07-02fix(csv): emit columns for extensions with multiple FUNCTION_INFO fields
- 2026-06-15fix(golike): register generic functions with [...] type params
- 2026-06-15fix(java): enhance parsing of generic and qualified type names in anonymous classes
- 2026-06-11fix(script): stop a '#' comment continuing past a trailing backslash (#317)