2 min read

Documentation comments

A technical reference for Slice documentation comments.

Slice comments that start with /// are documentation (doc) comments. Slice doc comments can be attached to all Slice elements except parameter declarations and module declarations.

identifier: LETTER ALPHANUMERIC*;
text: CHARACTER+;
newline: "\n";
// Tag keywords
param_keyword: "@param";
returns_keyword: "@returns";
see_keyword: "@see";
link_keyword: "@link";
// Symbols
left_brace: "{";
right_brace: "}";
colon: ":";
double_colon: "::";
DocComment
: Overview?
| DocComment ParamBlock
| DocComment ReturnsBlock
| DocComment SeeBlock
;
Overview
: MessageLines
;
ParamBlock
: param_keyword identifier Section
;
ReturnsBlock
: returns_keyword identifier? Section
;
SeeBlock
: see_keyword ScopedIdentifier newline
;
InlineLink
: link_keyword ScopedIdentifier
;
Section
: (colon Message?)? newline MessageLines?
;
MessageLines
: (Message? newline)+
;
Message
: MessageComponent+
;
MessageComponent
: text
| left_brace InlineLink right_brace
;
ScopedIdentifier
: double_colon? identifier (double_colon identifier)*
;

Was this page helpful?

CookiesYour privacy
This website uses cookies to analyze traffic and improve your experience.
By clicking "Accept," you consent to the use of these cookies. You can learn more about our cookies policy in our Privacy Policy.