File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,17 @@ comment ::= '//' character-that-isnt-a-newline*
58
58
| '/*' any-unicode-character* '*/'
59
59
```
60
60
61
+ There is a special type of comment called ` documentation comment ` . A
62
+ ` doc-comment ` is either a line comment preceded with ` /// ` whichends at the next
63
+ newline (` \n ` ) character or it's a block comment which starts with ` /** ` and ends
64
+ with ` */ ` . Note that block comments are allowed to be nested and their delimiters
65
+ must be balanced
66
+
67
+ ``` wit
68
+ doc-comment ::= '///' character-that-isnt-a-newline*
69
+ | '/**' any-unicode-character* '*/'
70
+ ```
71
+
61
72
### Operators
62
73
63
74
There are some common operators in the lexical structure of ` wit ` used for
Original file line number Diff line number Diff line change @@ -514,13 +514,13 @@ impl Resolver {
514
514
}
515
515
let mut docs = String :: new ( ) ;
516
516
for doc in doc. docs . iter ( ) {
517
- if let Some ( doc) = doc. strip_prefix ( "//" ) {
517
+ // Comments which are not doc-comments are silently ignored
518
+ if let Some ( doc) = doc. strip_prefix ( "///" ) {
518
519
docs. push_str ( doc. trim_start_matches ( '/' ) . trim ( ) ) ;
519
520
docs. push ( '\n' ) ;
520
- } else {
521
- assert ! ( doc. starts_with( "/*" ) ) ;
521
+ } else if let Some ( doc) = doc. strip_prefix ( "/**" ) {
522
522
assert ! ( doc. ends_with( "*/" ) ) ;
523
- for line in doc[ 2 ..doc. len ( ) - 2 ] . lines ( ) {
523
+ for line in doc[ ..doc. len ( ) - 2 ] . lines ( ) {
524
524
docs. push_str ( line) ;
525
525
docs. push ( '\n' ) ;
526
526
}
You can’t perform that action at this time.
0 commit comments