Whole file
terryyin/lizard
The author described this change as “fix the elseif statement for fortran”. It counts as a record because the check below fails on the code as it stood at 00e10094f and passes on ff1928bd9, with nothing else changed between the two runs.
Projectterryyin/lizard
Fix saved2024-10-31
Sharing licenceMIT · LICENSE.txt
Change size+4 −3
What the code was meant to do, written into the code itself as a save note
fix the elseif statement for fortran
The change
| 35 | 35 | _until_end = r'(?:\\\n|[^\n])*' | |
| 36 | 36 | return CodeReader.generate_tokens( | |
| 37 | 37 | source_code, | |
| 38 | - | r'(?i)' + | |
| 39 | - | r'|\/\/' + | |
| 38 | + | r'(?i)' | |
| 39 | + | r'\/\/' + | |
| 40 | 40 | r'|\#' + _until_end + | |
| 41 | 41 | r'|\!' + _until_end + | |
| 42 | - | r'|^C' + _until_end + | |
| 43 | 42 | r'|^\*' + _until_end + | |
| 44 | 43 | r'|\.OR\.' + | |
| 45 | 44 | r'|\.AND\.' + | |
| ⋯ | |||
| 124 | 123 | self.context.add_bare_nesting() | |
| 125 | 124 | elif token_upper.replace(' ', '') == 'ELSEIF': | |
| 126 | 125 | self.context.pop_nesting() | |
| 126 | + | if token_upper == 'ELSEIF': | |
| 127 | + | self.context.add_condition() | |
| 127 | 128 | self._state = self._if | |
| 128 | 129 | elif token_upper == 'END' or self._ends.match(token): | |
| 129 | 130 | self.context.pop_nesting() | |
The check that tells the two apart
fail→pass·test/test_languages/testFortran.py::TestFortran::test_case_insensitive_tokens
Check file test/test_languages/testFortran.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 it00e10094f57b65b538855a717a2412201cc18a97
Broken version dated2024-10-08
Modulelizard_languages.fortran
Units changedFortranReader, FortranStates
Fingerprintd0c977c89fd10608
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)