Capstone.Vendor.Sourceror.Comments (Capstone v0.33.3)

Copy Markdown View Source

Utilities to merge an un-merge comments and quoted expressions.

Summary

Functions

Does the opposite of merge_comments/2, it extracts the comments from the quoted expression and returns both as a {quoted, comments} tuple.

Merges the comments into the given quoted expression.

Functions

extract_comments(quoted, opts \\ [])

Does the opposite of merge_comments/2, it extracts the comments from the quoted expression and returns both as a {quoted, comments} tuple.

merge_comments(quoted, comments)

@spec merge_comments(Macro.t(), [map()]) :: Macro.t()

Merges the comments into the given quoted expression.

The comments are inserted into the metadata of their closest node. Comments in the same line of before a node are inserted into the :leading_comments field while comments that are right before an end keyword are inserted into the :trailing_comments field.