Skip to content

Commit

Permalink
Improve Lispify-ing comments
Browse files Browse the repository at this point in the history
+ don't remove '*' chars in the middle of comments
+ Remove spurious whitespace at the beginning of each line, but
  conserve indentation after that
  • Loading branch information
sdilts committed Mar 19, 2020
1 parent 9bd1fa9 commit 8c9e1fe
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cl_bindgen/processfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@
# the pip version of clang doesn't have the comment functions,
# so define _output_comment accordingly
if hasattr(clang.Cursor, 'raw_comment'):
import re

doc_decorator_re = re.compile("^\s*[*/]* ?",flags=re.MULTILINE)

def _lispify_comment(comment):
comment = comment.replace('"', '\\"')
return comment.replace('*','').replace('/','').strip()
return re.sub(doc_decorator_re, '', comment).strip()

def _output_comment(cursor, output, before='', after=''):
comment = cursor.raw_comment
Expand Down

0 comments on commit 8c9e1fe

Please sign in to comment.