Skip to content

C++ domain: Trips over complex constant with unknown escape sequence #6462

@t-b

Description

@t-b

Using latest breathe and sphinx and applying the following patch in breathe

$git diff .
diff --git a/examples/doxygen/example.cpp b/examples/doxygen/example.cpp
index 15aee3f..c9ac551 100644
--- a/examples/doxygen/example.cpp
+++ b/examples/doxygen/example.cpp
@@ -17,3 +17,7 @@ void Test5::example() {}
  * This is an example of how to use the Test5 class.
  * More details about this example.
  */
+
+#include <string>
+
+std::string RES_FORMAT_STR = "\\[1\\K(%d, %d, %d)\\{\"%%s\", FloatWithMinSigDigits(%s[%d], numMinSignDigits = 2)}\\]1\K(0, 0, 0)"; ///< some comment

I get

/home/firma/devel/breathe/documentation/source/doxygen.rst:64: WARNING: Invalid definition: Expected end of definition. [error at 50]
  std::string RES_FORMAT_STR = "\[1\K(%d, %d, %d)\{"%%s", FloatWithMinSigDigits(%s[%d], numMinSignDigits = 2)}\]1K(0, 0, 0)"

but the code is valid C++

$git diff .
diff --git a/examples/doxygen/example.cpp b/examples/doxygen/example.cpp
index 15aee3f..c9ac551 100644
--- a/examples/doxygen/example.cpp
+++ b/examples/doxygen/example.cpp
@@ -17,3 +17,7 @@ void Test5::example() {}
  * This is an example of how to use the Test5 class.
  * More details about this example.
  */
+
+#include <string>
+
+std::string RES_FORMAT_STR = "\\[1\\K(%d, %d, %d)\\{\"%%s\", FloatWithMinSigDigits(%s[%d], numMinSignDigits = 2)}\\]1\K(0, 0, 0)"; ///< some comment

Looking at the result

grafik

it seems that sphinx is removing some backslashes and then get's tripped.

The output from sphinx 1.8.3 can be viewed here.

Environment info

  • OS: Linux
  • Python version: 3.6.7
  • Sphinx version: 2.1.0
  • Sphinx extensions: breathe

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions