You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sonar-scanner can't parse a specific regular expression that is defined in a raw string. When using capturing groups with round brackets () inside the regular expression, the closing bracket of a capturing group can not be placed just in front of the very last closing bracket of the raw string.
Run sonar-scanner with this file as inclusion (e.g. sonar-scanner -Dsonar.inclusion=test.cpp).
Expected behavior
Line with defined regular expression in raw string should be parsed without syntax error.
Actual behavior
Expression can't be parsed. Sonar-scanner resolves in error:
C++ skip parser error
C++ Parser can't read code. Declaration is skipped.
Known workarounds
Avoid closing bracket immediately before the very last closing bracket that is used to finish the raw string. You could e.g. use a dollar sign before the very last closing bracket:
constexprauto rgxStr = R"(([A-Z\d])$)";
LOG file
10:27:42.924 DEBUG: finished preprocessing '/opt/wsp/project/test.cpp'
10:27:42.935 DEBUG: [/opt/wsp/project/test.cpp:2]: syntax error: const auto rgxStr = R "(([A-Z\d]\d{4}))"
Description
Sonar-scanner can't parse a specific regular expression that is defined in a raw string. When using capturing groups with round brackets
()
inside the regular expression, the closing bracket of a capturing group can not be placed just in front of the very last closing bracket of the raw string.Steps to reproduce the problem
Create c++ file with regular expression:
Run sonar-scanner with this file as inclusion (e.g. sonar-scanner -Dsonar.inclusion=test.cpp).
Expected behavior
Line with defined regular expression in raw string should be parsed without syntax error.
Actual behavior
Expression can't be parsed. Sonar-scanner resolves in error:
C++ skip parser error
C++ Parser can't read code. Declaration is skipped.
Known workarounds
Avoid closing bracket immediately before the very last closing bracket that is used to finish the raw string. You could e.g. use a dollar sign before the very last closing bracket:
LOG file
10:27:42.924 DEBUG: finished preprocessing '/opt/wsp/project/test.cpp'
10:27:42.935 DEBUG: [/opt/wsp/project/test.cpp:2]: syntax error: const auto rgxStr = R "(([A-Z\d]\d{4}))"
Related information
cxx plugin version: 1.2.0
SonarQube version: 7.2.1 (14109)
The text was updated successfully, but these errors were encountered: