Skip to content

CHeaderParser hangs forever if a line has both "{" and "}" #219

@colbychaskell

Description

@colbychaskell

Describe the bug
The CHeaderParser script will hang forever searching for command parameters if a line has both a "{" and a "}". This includes commented lines since there is nothing in the script to ignore comment lines.

To Reproduce

  1. Add a comment such as /* {TEST_PARSER} */ to a header file
  2. Add that header file to CHeaderParser-hdr-paths.txt

Expected behavior
For one, the parser should ignore structs that are commented out so this line could be ignored entirely, but otherwise it should be adding that line to the list of command structs and continuing

Code snips
From CHeaderParser.py:
`
while inside_struct:
# Check for the end of the structure
# We will still want to know what line this is
if '}' in file_lines[line_num]:
# Clear the flag, we found the end.
inside_struct = False

    # Add line number to list, even if it has a '}'
    lines_of_struct.append(line_num)

    # Now that we know the struct is over, add list of lines
    # to the sets of command structures
    list_cmd_structs.append(lines_of_struct)
    line_num += 1
    break

System observed on:

  • OS: Ubuntu 20.0.4
  • Versions: v3.3.0-rc4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions