The NsiqCppStyle parser incorrectly identifies the starting and ending LBRACE/RBRACE tokens for a FUNCTION_BLOCK when one of the initialization variables uses an LBRACE/RBRACE pair.
Example of the Problem
Here is a minimal snippet of C++ code showing the problem:
Notice that the class initialization list includes _UTP{}, which uses list (or brace) initialization to initialize it to all default values. We'll see that NsiqCppStyle gets confused about the LRACE/RBRACE of the list initialization.
Running this snippet file through trace-callbacks:
cd <nsiqcppstyle root folder>
/usr/bin/python3.11 trace-callbacks.py ~/junk/test_class.min.cpp > ~/junk/test_class.min.cpp.log
results in the following (you can find the entire output attached to this comment):
Although the parser correctly recognizes "test_class::test_class" as a FunctionName, its context shows it believes the function's LBRACE and RBRACE are on line 4, column 9 (LBRACE) and 10 (RBRACE). This is, of course, incorrect: the correct function LBRACE/RBRACE are lines 6 and 8, respectively.
The NsiqCppStyle parser incorrectly identifies the starting and ending LBRACE/RBRACE tokens for a FUNCTION_BLOCK when one of the initialization variables uses an LBRACE/RBRACE pair.
Example of the Problem
Here is a minimal snippet of C++ code showing the problem:
Notice that the class initialization list includes
_UTP{}
, which uses list (or brace) initialization to initialize it to all default values. We'll see that NsiqCppStyle gets confused about the LRACE/RBRACE of the list initialization.Running this snippet file through trace-callbacks:
results in the following (you can find the entire output attached to this comment):
Although the parser correctly recognizes "test_class::test_class" as a FunctionName, its context shows it believes the function's LBRACE and RBRACE are on line 4, column 9 (LBRACE) and 10 (RBRACE). This is, of course, incorrect: the correct function LBRACE/RBRACE are lines 6 and 8, respectively.
The parser continues to get things wrong:
In the end, the parser interprets "_videoEnabled" to be a function name with LBRACE/RBRACE tokens on lines 6 and 8:
Expectations
The parser should handle brace initializations correctly, accurately identifying the opening and closing braces of the function.