-
Notifications
You must be signed in to change notification settings - Fork 145
[WIP] Retain comments in AST #3509
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
base: master
Are you sure you want to change the base?
Conversation
|
hey @bartolomej , we recently restructured the cadence repo and as part of that, moved all the subdirectories under Let me know if you run into any issues/conflicts, I can help with resolving those. |
# Conflicts: # ast/comments.go # ast/identifier.go # ast/transaction_declaration_test.go # old_parser/comment.go # old_parser/expression_test.go # parser/comment.go # parser/expression_test.go # parser/lexer/lexer.go # parser/parser.go # parser/statement.go # tools/maprange/go.sum # tools/storage-explorer/go.mod # tools/storage-explorer/go.sum
# Conflicts: # parser/comment.go # parser/declaration.go # parser/expression.go # parser/function.go # parser/lexer/state.go # parser/parser.go # parser/statement.go # parser/transaction.go # parser/type.go # sema/check_composite_declaration.go
Description
POC for preserving comments in Cadence AST. This should enable us to make a fully working, pretty printer for Cadence.
This is a follow-up to my discussion in Discord some time ago: https://discord.com/channels/613813861610684416/1108479699732152503/1240749220357607475
Closes #308
Design
I decided to start tracking comments in the form of leading/trailing comment structs attached to lexer tokens and AST nodes as discussed in #308 (comment).
I believe this approach (instead of the old one where comments were tracked as AST nodes) could simplify comment parsing logic, as the lexer already computes which tokens are associated with which comments + it removes the need to skip comments when parsing.
Notes
TODO(preserve-comments)in codeDefinition of Done
TODOs
Description
masterbranchFiles changedin the Github PR explorer