Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(908)

Unified Diff: lib/src/utils.dart

Issue 1491383003: Disallow non-hyphenated-identifier tag names. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/runner/parse_metadata.dart ('k') | test/runner/tag_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/utils.dart
diff --git a/lib/src/utils.dart b/lib/src/utils.dart
index 2ccef97f08de0af83ac924ae0badd8b6d0a9ed79..5f970dea83c48d48e708563dcff8827df498186d 100644
--- a/lib/src/utils.dart
+++ b/lib/src/utils.dart
@@ -60,6 +60,17 @@ final OperatingSystem currentOSGuess = (() {
return OperatingSystem.linux;
})();
+/// A regular expression matching a hyphenated identifier.
+///
+/// This is like a standard Dart identifier, except that it can also contain
+/// hyphens.
+final hyphenatedIdentifier = new RegExp(r"[a-zA-Z_-][a-zA-Z0-9_-]*");
+
+/// Like [hyphenatedIdentifier], but anchored so that it must match the entire
+/// string.
+final anchoredHyphenatedIdentifier =
+ new RegExp("^${hyphenatedIdentifier.pattern}\$");
+
/// A pair of values.
class Pair<E, F> {
E first;
« no previous file with comments | « lib/src/runner/parse_metadata.dart ('k') | test/runner/tag_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698