-
Notifications
You must be signed in to change notification settings - Fork 441
Add Children
section to SyntaxCollection
nodes
#1902
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
Add Children
section to SyntaxCollection
nodes
#1902
Conversation
try! StructDeclSyntax( | ||
""" | ||
\(raw: node.documentation) | ||
public struct \(raw: node.kind.syntaxType): SyntaxCollection, SyntaxHashable | ||
\(raw: node.documentation.isEmpty ? "" : "///") | ||
\(raw: node.grammar) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really cool changes! 💙
Maybe it would be beneficial to use removedEmptyLines(string:)
to prevent adding empty lines? It could look this:
let docComment = removedEmptyLines(
string: """
\(node.documentation)
\(node.documentation.isEmpty ? "" : "///")
\(node.grammar)
"""
)
try! StructDeclSyntax(
"""
\(raw: docComment)
public struct \(node.kind.syntaxType): SyntaxCollection, SyntaxHashable
"""
) {
(...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good idea 👍🏽
grammar = "``\(onlyElement.syntaxType)``*" | ||
} else { | ||
grammar = "(\(elementChoices.map { "``\($0.syntaxType)``" }.joined(separator: " | "))) `*`" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could make them a little more consistent here, ie. either
"``foo``*" and "(``foo`` | ``bar``)*"
or
"``foo`` `*`" and "(``foo`` | ``bar``) `*`"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this.
0857b48
to
070b908
Compare
070b908
to
9a5ff8d
Compare
@swift-ci Please test |
This simplifies the navigation of the syntax tree hierarchy in the generated documentation.
Also remove a bunch of empty lines from the generated files.