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

Added support for {..} and (*..*) comments and attaching them nodes #185

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

neslib
Copy link

@neslib neslib commented Aug 25, 2016

Currently, DelphiAST only extracts "//..." style comments. This branch adds support for "{..}" and "(..)" comments as well. This only required changes to SimpleParser.Lexer.pas.

In addition, I added support for attaching the last preceding comments to TSyntaxNodes, through the new TSyntaxNode.LastPrecedingCommentNode property.

Support for this is disabled by default, since not everyone may be interested in comments. To attach the comments to their nodes, I added TPasSyntaxTreeBuilder.AttachCommentNodes.

There have been discussions about where to place comment nodes in the tree. The approach I took here was not the place comments nodes in the tree, but to associate each comment with the node that succeeds it. This is the same convention that is used in the Delphi RTL/VCL/FMX source code: the documentation for a declaration is written in a comment preceding the declaration itself.

If there are more comments preceding a node, then only the last comment is attached.

@EMBBlaster
Copy link

Related to #39

@sglienke
Copy link
Contributor

sglienke commented Aug 5, 2022

Support for multiline comments has been implemented in 25eb2ac - so this can be closed imo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants