@@ -14,22 +14,19 @@ import 'package:meta/meta.dart';
14
14
import 'package:path/path.dart' as p show Context;
15
15
16
16
final _templatePattern = RegExp (
17
- r'[ ]*{@template\s+(.+?)}([\s\S]+?){@endtemplate}[ ]*(\n?)' ,
18
- multiLine: true );
17
+ r'[ ]*\{@template\s+([^\s}].*?)\}([^]+?)\{@endtemplate\}[ ]*(\n?)' );
19
18
final _htmlPattern = RegExp (
20
- r'[ ]*{@inject-html\s*}([\s\S]+?){@end-inject-html}[ ]*\n?' ,
21
- multiLine: true );
19
+ r'[ ]*\{@inject-html\s*\}([^]+?)\{@end-inject-html\}[ ]*\n?' );
22
20
23
21
/// Matches all tool directives (even some invalid ones). This is so
24
22
/// we can give good error messages if the directive is malformed, instead of
25
23
/// just silently emitting it as-is.
26
24
final _basicToolPattern = RegExp (
27
- r'[ ]*{@tool\s+([^}]+)}\n?([\s\S]+?)\n?{@end-tool}[ ]*\n?' ,
28
- multiLine: true );
25
+ r'[ ]*{@tool\s+([^\s}][^}]*)}\n?([^]+?)\n?{@end-tool}[ ]*\n?' );
29
26
30
- final _examplePattern = RegExp (r'{@example\s+([^}]+ )}' );
27
+ final _examplePattern = RegExp (r'{@example\s+([^\s}][^}]* )}' );
31
28
32
- final _macroRegExp = RegExp (r'{@macro\s+([^}]+ )}' );
29
+ final _macroRegExp = RegExp (r'{@macro\s+([^\s}][^}]* )}' );
33
30
34
31
final _htmlInjectRegExp = RegExp (r'<dartdoc-html>([a-f0-9]+)</dartdoc-html>' );
35
32
@@ -169,7 +166,7 @@ mixin DocumentationComment
169
166
'required' ,
170
167
};
171
168
172
- static final _nameBreak = RegExp ('[ \ \ s}]' );
169
+ static final _nameBreak = RegExp (r'[ \s}]' );
173
170
174
171
// TODO(srawlins): Implement more checks; see
175
172
// https://github.com/dart-lang/dartdoc/issues/1814.
@@ -391,7 +388,7 @@ mixin DocumentationComment
391
388
/// Matches all youtube directives (even some invalid ones). This is so
392
389
/// we can give good error messages if the directive is malformed, instead of
393
390
/// just silently emitting it as-is.
394
- static final _basicYouTubePattern = RegExp (r''' {@youtube\s+([^}]+)}'' ' );
391
+ static final _basicYouTubePattern = RegExp (r'{@youtube\s+([^\s}][^}]*)} ' );
395
392
396
393
/// Matches YouTube IDs from supported YouTube URLs.
397
394
static final _validYouTubeUrlPattern =
@@ -476,7 +473,7 @@ mixin DocumentationComment
476
473
/// Matches all animation directives (even some invalid ones). This is so we
477
474
/// can give good error messages if the directive is malformed, instead of
478
475
/// just silently emitting it as-is.
479
- static final _basicAnimationPattern = RegExp (r''' {@animation\s+([^}]+)}'' ' );
476
+ static final _basicAnimationPattern = RegExp (r'{@animation\s+([^\s}][^}]*)} ' );
480
477
481
478
/// Matches valid JavaScript identifiers.
482
479
static final _validIdPattern = RegExp (r'^[a-zA-Z_]\w*$' );
@@ -675,8 +672,8 @@ mixin DocumentationComment
675
672
/// Match group 4 is the unquoted arg, if any.
676
673
static final RegExp _argPattern = RegExp (r'([a-zA-Z\-_0-9]+=)?' // option name
677
674
r'(?:' // Start a new non-capture group for the two possibilities.
678
- r'''(["'])((?:\\{2})*|(?:.*? [^\\](?:\\{2})*) )\2|''' // with quotes.
679
- r'([^ ] +))' ); // without quotes.
675
+ r'''(["'])((?:[^\\\r\n]|\\.)*? )\2|''' // with quotes.
676
+ r'(\S +))' ); // without quotes.
680
677
681
678
/// Helper to process arguments given as a (possibly quoted) string.
682
679
///
0 commit comments