Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
t-b opened this issue Jun 8, 2019 · 3 comments
Closed

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

t-b opened this issue Jun 8, 2019 · 3 comments
Assignees

Comments

@t-b
Copy link

t-b commented Jun 8, 2019

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
@jakobandersen
Copy link
Contributor

It looks like this is problem in all domains:

.. cpp:var:: std::string s = "foo\\bar"
.. py:data:: s = "foo\\bar"

See PR #6473.

@t-b
Copy link
Author

t-b commented Jun 12, 2019

@jakobandersen Thanks! Quite interesting that I'm the first one to observe that.

@t-b
Copy link
Author

t-b commented Aug 27, 2019

@jakobandersen Is there a workaround available or do I just have to live with it?

jakobandersen added a commit to jakobandersen/sphinx that referenced this issue Oct 6, 2019
Adds several ways to reinstate the old behaviour.

Fixes sphinx-doc#6462
jakobandersen added a commit to jakobandersen/sphinx that referenced this issue Jan 25, 2020
Adds several ways to reinstate the old behaviour.

Fixes sphinx-doc#6462
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants