Skip to content

Commit aa3885a

Browse files
committed
/*** is not NatSpec
1 parent 5343164 commit aa3885a

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

crates/solidity-v2/inputs/language/src/definition.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,8 @@ language_v2_macros::compile!(Language(
440440
// https://stackoverflow.com/a/36328890
441441
scanner = Sequence([
442442
Atom("/**"),
443-
Optional(Sequence([Not(['/', '*']), ZeroOrMore(Not(['*']))])),
443+
Not(['/', '*']),
444+
ZeroOrMore(Not(['*'])),
444445
OneOrMore(Atom("*")),
445446
ZeroOrMore(Sequence([
446447
Not(['/', '*']),

crates/solidity-v2/outputs/cargo/parser/src/lexer/contexts.generated.rs

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/solidity-v2/outputs/cargo/parser/src/lexer/tests/trivia.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ fn single_line_nat_spec_comment() {
2222

2323
#[test]
2424
fn multi_line_comment() {
25+
// Three stars is not a NatSpec comment
26+
test("/*** */", &[(L::MultiLineComment, 0..7)]);
27+
// This could be an empty NatSpec comment, but makes no difference and no sense to support
28+
test("/***/", &[(L::MultiLineComment, 0..5)]);
2529
test("/**/", &[(L::MultiLineComment, 0..4)]);
2630
test("/* */", &[(L::MultiLineComment, 0..5)]);
2731
test("/* **/", &[(L::MultiLineComment, 0..6)]);
@@ -46,21 +50,18 @@ fn multi_line_comment() {
4650

4751
#[test]
4852
fn multi_line_nat_spec_comment() {
49-
test("/***/", &[(L::MultiLineNatSpecComment, 0..5)]);
5053
test("/** */", &[(L::MultiLineNatSpecComment, 0..6)]);
5154
test("/** */", &[(L::MultiLineNatSpecComment, 0..6)]);
52-
test("/*** */", &[(L::MultiLineNatSpecComment, 0..7)]);
53-
test("/****/", &[(L::MultiLineNatSpecComment, 0..6)]);
5455
test("/** * */", &[(L::MultiLineNatSpecComment, 0..8)]);
5556
test("/** / */", &[(L::MultiLineNatSpecComment, 0..8)]);
5657
test("/** foo */", &[(L::MultiLineNatSpecComment, 0..10)]);
5758

5859
test(
59-
"/***/ /***/",
60+
"/** a */ /** b */",
6061
&[
61-
(L::MultiLineNatSpecComment, 0..5),
62-
(L::Whitespace, 5..6),
63-
(L::MultiLineNatSpecComment, 6..11),
62+
(L::MultiLineNatSpecComment, 0..8),
63+
(L::Whitespace, 8..9),
64+
(L::MultiLineNatSpecComment, 9..17),
6465
],
6566
);
6667

0 commit comments

Comments
 (0)