aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bindgen/gen_d.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/bindgen/gen_d.py b/bindgen/gen_d.py
index b02cf0a8..634a4347 100644
--- a/bindgen/gen_d.py
+++ b/bindgen/gen_d.py
@@ -247,12 +247,14 @@ def format_comment(comment, indent="", multiline=False):
if not comment:
return
comment = comment.strip()
+ # Escape nested comment delimiters to ensure valid D code
+ comment = comment.replace('/++', '/+ /').replace('+/', '/ +/')
if multiline:
- lines = textwrap.wrap(comment, width=80, subsequent_indent=indent + " * ")
+ lines = textwrap.wrap(comment, width=80, subsequent_indent=indent)
l(f"{indent}/++")
for line in lines:
- l(f"{indent} * {line}")
- l(f"{indent} +/")
+ l(f"{indent}+ {line}")
+ l(f"{indent}+/")
else:
for line in comment.split('\n'):
l(f"{indent}/// {line.strip()}")