Skip to content

Commit eeb0702

Browse files
committed
Revert "Merge pull request #99 from resolritter/doc_comments"
This reverts commit 67d304c, reversing changes made to 5993f53.
1 parent 67d304c commit eeb0702

File tree

6 files changed

+49321
-48402
lines changed

6 files changed

+49321
-48402
lines changed

corpus/source_files.txt

-30
Original file line numberDiff line numberDiff line change
@@ -55,36 +55,6 @@ Line comments
5555
(source_file
5656
(line_comment))
5757

58-
============================================
59-
Doc comments
60-
============================================
61-
62-
/// Doc
63-
/// Comment
64-
// / Now a line comment (note the space separating the third slash)
65-
66-
/// Doc
67-
/// Comment
68-
//// Four slashes makes the line a normal comment
69-
/// Doc comment got interrupted by the line above
70-
71-
//! Inner doc comment line 1
72-
//! Inner doc comment line 2
73-
/// This is different doc comment since the line starts differently
74-
//! Back to inner doc comment
75-
76-
----
77-
78-
(source_file
79-
(doc_comment)
80-
(line_comment)
81-
(doc_comment)
82-
(line_comment)
83-
(doc_comment)
84-
(doc_comment)
85-
(doc_comment)
86-
(doc_comment))
87-
8858
=====================================
8959
Greek letters in identifiers
9060
=====================================

grammar.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,13 @@ const primitive_types = numeric_types.concat(['bool', 'str', 'char'])
3838
module.exports = grammar({
3939
name: 'rust',
4040

41-
extras: $ => [/\s/, $.line_comment, $.block_comment, $.doc_comment],
41+
extras: $ => [/\s/, $.line_comment, $.block_comment],
4242

4343
externals: $ => [
4444
$._string_content,
4545
$.raw_string_literal,
4646
$.float_literal,
4747
$.block_comment,
48-
$.line_comment,
49-
$.doc_comment
5048
],
5149

5250
supertypes: $ => [
@@ -1428,6 +1426,15 @@ module.exports = grammar({
14281426

14291427
boolean_literal: $ => choice('true', 'false'),
14301428

1429+
comment: $ => choice(
1430+
$.line_comment,
1431+
$.block_comment
1432+
),
1433+
1434+
line_comment: $ => token(seq(
1435+
'//', /.*/
1436+
)),
1437+
14311438
_path: $ => choice(
14321439
$.self,
14331440
alias(choice(...primitive_types), $.identifier),

src/grammar.json

+29-12
Original file line numberDiff line numberDiff line change
@@ -8173,6 +8173,35 @@
81738173
}
81748174
]
81758175
},
8176+
"comment": {
8177+
"type": "CHOICE",
8178+
"members": [
8179+
{
8180+
"type": "SYMBOL",
8181+
"name": "line_comment"
8182+
},
8183+
{
8184+
"type": "SYMBOL",
8185+
"name": "block_comment"
8186+
}
8187+
]
8188+
},
8189+
"line_comment": {
8190+
"type": "TOKEN",
8191+
"content": {
8192+
"type": "SEQ",
8193+
"members": [
8194+
{
8195+
"type": "STRING",
8196+
"value": "//"
8197+
},
8198+
{
8199+
"type": "PATTERN",
8200+
"value": ".*"
8201+
}
8202+
]
8203+
}
8204+
},
81768205
"_path": {
81778206
"type": "CHOICE",
81788207
"members": [
@@ -8353,10 +8382,6 @@
83538382
{
83548383
"type": "SYMBOL",
83558384
"name": "block_comment"
8356-
},
8357-
{
8358-
"type": "SYMBOL",
8359-
"name": "doc_comment"
83608385
}
83618386
],
83628387
"conflicts": [
@@ -8402,14 +8427,6 @@
84028427
{
84038428
"type": "SYMBOL",
84048429
"name": "block_comment"
8405-
},
8406-
{
8407-
"type": "SYMBOL",
8408-
"name": "line_comment"
8409-
},
8410-
{
8411-
"type": "SYMBOL",
8412-
"name": "doc_comment"
84138430
}
84148431
],
84158432
"inline": [

src/node-types.json

-4
Original file line numberDiff line numberDiff line change
@@ -4939,10 +4939,6 @@
49394939
"type": "default",
49404940
"named": false
49414941
},
4942-
{
4943-
"type": "doc_comment",
4944-
"named": true
4945-
},
49464942
{
49474943
"type": "dyn",
49484944
"named": false

0 commit comments

Comments
 (0)